⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 图形旋转的c语言源程序.htm

📁 大家 看看 多多关注
💻 HTM
📖 第 1 页 / 共 3 页
字号:
                              i,j,k,nval;<BR>int *vx, *vy, *c;<BR>int 
                              colmax,offset,end,midy;<BR>char 
                              **lines=NULL;<BR>char *temp=NULL;</P>
                              <P>offset=-minx+(cmx/2);<BR>end=cmy-1; 
                              midy=cmy/2;<BR>lines=(char 
                              **)malloc(cmy*sizeof(char 
                              *));<BR>for(i=0;i&lt;cmy;i++) lines[i]=(char 
                              *)malloc(sizeof(char)*(maxx-minx+cmx+1));<BR>setactivepage(LOADPAGE);<BR>for(j=-cmy/2;j&lt;cmy/2;j++) 
                              {<BR>for(i=minx-cmx/2;i&lt;(maxx+cmx/2+1);i++) 
                              {<BR>lines[j+midy][i+offset]=getpixel(i,j+miny);<BR>}<BR>}<BR>colmax=getmaxcolor();<BR>for(j=miny;j&lt;maxy;j++) 
                              {<BR>setactivepage(LOADPAGE);<BR>for(i=j+cmy/2,k=minx-cmx/2,nval=maxx+cmx/2;k&lt;nval;k++)<BR>lines[end][k+offset]=getpixel(k,i);<BR>for(i=minx;i&lt;maxx;i++) 
                              {<BR>/* Load &amp; multiply neighbors into matrix 
                              */<BR>setactivepage(LOADPAGE);<BR>vx=vmat; 
                              vy=vmat+1; c=cmat; 
                              nval=0;<BR>for(k=0;k&lt;cmnum;k++) {<BR>if(*c) 
                              nval+= 
                              lines[(*vy)+midy][i+(*vx)+offset]*(*c);<BR>/* 
                              if(*c) nval+= getpixel(i+(*vx),j+(*vy)) * (*c); 
                              */<BR>c++;<BR>vx+=2; vy+=2;<BR>}<BR>/* Cut off 
                              values too high or too low */<BR>if(nval&lt;0) 
                              nval=0;<BR>if(nval&gt;colmax) nval=colmax;<BR>/* 
                              Place new pixel value 
                              */<BR>setactivepage(ENHANCEPAGE);<BR>putpixel(i,j,nval);<BR>}<BR>if(kbhit()) 
                              { getch(); break; }<BR>/* rotate line pointers 
                              */<BR>temp=lines[0];<BR>for(i=1;i&lt;cmy;i++) 
                              lines[i-1]=lines[i];<BR>lines[end]=temp;<BR>}<BR>for(i=0;i&lt;cmy;i++) 
                              {<BR>if(lines[i]!=NULL) 
                              free(lines[i]);<BR>}<BR>if(lines!=NULL) 
                              {<BR>free(lines);<BR>}<BR>return;<BR>}</P>
                              <P>int build_offset_vectors(void)<BR>{<BR>int 
                              *t;<BR>int il,im,jl,jm,i,j;</P>
                              <P>il=-cmx/2; im=cmx+il;<BR>jl=-cmy/2; 
                              jm=cmy+jl;<BR>t=vmat;<BR>for(j=jl;j&lt;jm;j++) 
                              {<BR>for(i=il;i&lt;im;i++) {<BR>*t++=i; 
                              *t++=j;<BR>}<BR>}<BR>}</P>
                              <P>int load_convolution_matrix(char 
                              *fname)<BR>{<BR>/* Layout of matrix file:<BR>#x 
                              #y<BR>x0y0 x1y0 ... xny1<BR>.... .... ... 
                              ....<BR>x0ym x1ym ... xnym<BR>*/<BR>FILE 
                              *mf;<BR>int *t;<BR>int i,j,im,jm;</P>
                              <P>if( (mf=fopen(fname,"rt"))==NULL ) 
                              {<BR>printf("Cannot load matrix 
                              file.\n");<BR>abort();<BR>}<BR>fscanf(mf,"%d%d",&amp;im,&amp;jm);<BR>if( 
                              (im&amp;1)==0 || (jm&amp;1)==0 ) 
                              {<BR>printf("Convolution matrix MUST have a center 
                              point.\n");<BR>abort();<BR>}<BR>if( (cmat=(int 
                              *)calloc(im*jm,sizeof(int)))==NULL ) 
                              {<BR>printf("Unable to calloc convolution 
                              matrix.\n");<BR>abort();<BR>}<BR>if( (vmat=(int 
                              *)calloc(2*im*jm,sizeof(int)))==NULL ) 
                              {<BR>printf("Unable to calloc offset vector 
                              matrix.\n");<BR>abort();<BR>}<BR>cmx=im; cmy=jm; 
                              cmnum=im*jm;<BR>t=cmat;<BR>for(j=0;j&lt;jm;j++) 
                              {<BR>for(i=0;i&lt;im;i++) {<BR>if( 
                              fscanf(mf,"%d",t++)!=1 ) {<BR>printf("Unable to 
                              read 
                              matrix.\n");<BR>abort();<BR>}<BR>}<BR>}<BR>fclose(mf);<BR>build_offset_vectors();<BR>}</P>
                              <P>int load_cut(char *fname)<BR>{<BR>static 
                              unsigned char st[3000];<BR>char 
                              *sp=st,*spend;<BR>int stp=0;<BR>int 
                              width,height;<BR>FILE *fp;<BR>int 
                              x,y,xl,yl;<BR>int i,n,len,d,j;</P>
                              <P>fp=fopen(fname,"rb");<BR>width=getw(fp); 
                              height=getw(fp);<BR>xl=cmx; yl=cmy;<BR>minx=xl; 
                              miny=yl;<BR>maxx=xl+width; 
                              maxy=yl+height;<BR>if(maxy&gt;(getmaxy()-cmy)) 
                              {<BR>maxy=getmaxy()-cmy;<BR>height=maxy-yl;<BR>}<BR>getw(fp);<BR>y=yl-1;<BR>for(sp=st,n=0;n&lt;height;n++) 
                              {<BR>stp=getw(fp);<BR>for(sp=st,spend=st+stp;sp&lt;spend;) 
                              *sp++=getc(fp);<BR>sp=st; spend=sp+stp; x=xl; 
                              y++;<BR>while(sp&lt;spend) {<BR>if(*((unsigned 
                              char *)sp)&gt;0x80) {<BR>len=(*sp++) &amp; 
                              0x7f;<BR>if(!(*sp)) { x+=len; continue; 
                              }<BR>setcolor(*sp++);<BR>moveto(x,y);<BR>linerel(len,0);<BR>x+=len;<BR>continue;<BR>} 
                              else {<BR>len=*sp++;<BR>for(j=0;j&lt;len;j++) 
                              putpixel(x++,y,*sp++);<BR>continue;<BR>}<BR>}<BR>}<BR>fclose(fp);<BR>}</P>
                              <P></P>
                              <P></P>
                              <P></P>
                              <P></P>
                              <P></P>
                              <P></P>
                              <P></P>
                              <P></P>
                              <P align=center><FONT color=#3300cc>资料收集:beck 
                              Copyright 2002 www.vcok.com, All Rights Reserved 
                              </FONT></P>
                              <P></P></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
                  <TABLE align=center bgColor=#d7ebff border=0 
                  borderColorDark=#ffffff cellPadding=0 cellSpacing=0 
                    width=650><TBODY>
                    <TR align=middle bgColor=#3986ef vAlign=center>
                      <TD align=left colSpan=2 height=25 id=notice 
                        vAlign=center>&nbsp;&nbsp;<FONT 
                        color=#ffffff><B>[</B>来源<B>]</B>: 不详 &nbsp;&nbsp;&nbsp; 
                        <B>[</B>编辑<B>]</B>: <FONT color=#ffffff>beck 
                        </FONT>&nbsp;&nbsp;&nbsp;<B>[</B>加入时间<B>]</B>:2002-8-11 
                        </FONT></TD></TR></TBODY></TABLE><BR><BR>
                  <TABLE border=0 width="100%">
                    <TBODY>
                    <TR>
                      <TD>
                        <LI><FONT color=#0772b1>上篇文章</FONT>:<A 
                        href="http://www.vcok.com/class/list.asp?id=218">字符串查找</A> 

                        <LI><FONT color=#0772b1>下篇文章</FONT>:<A 
                        href="http://www.vcok.com/class/list.asp?id=220">精细绘图及动画</A> 
                        </LI></TD>
                      <TD align=right>
                        <SCRIPT language=JavaScript>
var onecount;
onecount=0;
subcat = new Array();
        
subcat[0] = new Array("C语言教程","8","35");
        
subcat[1] = new Array("C技术文章","8","36");
        
subcat[2] = new Array("C试题库","8","37");
        
subcat[3] = new Array("C程序百例","8","38");
        
subcat[4] = new Array("C函数库","8","39");
        
subcat[5] = new Array("数据结构教程","9","40");
        
subcat[6] = new Array("常用算法","9","41");
        
subcat[7] = new Array("在线测试","8","42");
        
subcat[8] = new Array("linux入门级","10","43");
        
onecount=9;

function changelocation(locationid)
    {
    document.myform.Nclassid.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</SCRIPT>

                        <FORM action=ru_query.asp method=post name=myform>文章搜索: 
                        <SELECT name=action size=1> <OPTION selected 
                          value=title>按文章标题搜索</OPTION> <OPTION 
                          value=writer>按文章来源搜索</OPTION> <OPTION 
                          value=content>按文章内容搜索</OPTION> <OPTION 
                          value=Nkey>按照关键词搜索</OPTION></SELECT> <SELECT 
                        name=classid 
                        onchange=changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value) 
                        size=1> <OPTION selected value="">请指定范围</OPTION> 
                          <OPTION value=8>C语言教室</OPTION> <OPTION 
                          value=9>数据结构</OPTION> <OPTION 
                        value=10>Linux初探</OPTION></SELECT> <SELECT 
                          name=Nclassid> <OPTION selected 
                          value="">请指定范围</OPTION> <OPTION value=8>C语言教程</OPTION> 
                          <OPTION value=8>C技术文章</OPTION> <OPTION 
                          value=8>C试题库</OPTION> <OPTION value=8>C程序百例</OPTION> 
                          <OPTION value=8>C函数库</OPTION> <OPTION 
                          value=9>数据结构教程</OPTION> <OPTION value=9>常用算法</OPTION> 
                          <OPTION value=8>在线测试</OPTION> <OPTION 
                          value=10>linux入门级</OPTION></SELECT> <INPUT maxLength=50 
                        name=keyword size=10 value=输入关键字> <INPUT name=Submit type=submit value=搜索> 
                    </FORM></TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD bgColor=#e6e6e6 width="50%">□- C技术文章热点文章</TD>
                <TD bgColor=#e6e6e6 width="50%">□- 相关文章</TD></TR>
              <TR>
                <TD bgColor=#ffffff vAlign=top width="50%">1.<A 
                  href="http://www.vcok.com/class/list.asp?id=213" target=_top 
                  title=Tc2.0编写俄罗斯方块游戏> Tc2.0编写俄罗斯方块游戏 </A>[阅读:<FONT 
                  color=red>10938</FONT>]<BR>2.<A 
                  href="http://www.vcok.com/class/list.asp?id=331" target=_top 
                  title=查找算法演示:二分法> 查找算法演示:二分法 </A>[阅读:<FONT 
                  color=red>10256</FONT>]<BR>3.<A 
                  href="http://www.vcok.com/class/list.asp?id=326" target=_top 
                  title=以前常用的攻击软件源代码> 以前常用的攻击软件源代码 </A>[阅读:<FONT 
                  color=red>10045</FONT>]<BR>4.<A 
                  href="http://www.vcok.com/class/list.asp?id=327" target=_top 
                  title=设计彩色框的C源程序> 设计彩色框的C源程序 </A>[阅读:<FONT 
                  color=red>9488</FONT>]<BR>5.<A 
                  href="http://www.vcok.com/class/list.asp?id=330" target=_top 
                  title=排序算法演示:冒泡法> 排序算法演示:冒泡法 </A>[阅读:<FONT 
                  color=red>8143</FONT>]<BR></TD>
                <TD bgColor=#ffffff vAlign=top width="50%"><A 
                  href="http://www.vcok.com/class/list.asp?id=219">图形旋转的C语言源程序</A><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <DIV></DIV>
      <TABLE bgColor=#ffffff border=0 width=778>
        <TBODY>
        <TR bgColor=#ffffff>
          <TD colSpan=3></TD></TR>
        <TR vAlign=baseline>
          <TD colSpan=3>
            <HR noShade SIZE=1>
          </TD></TR>
        <TR>
          <TD width="7%">&nbsp;</TD>
          <TD width="87%">
            <DIV align=center>唯C世界|<FONT 
            face="Arial, Helvetica, sans-serif">http://wWw.VcOk.Com</FONT>   <FONT 
            face="Arial, Helvetica, sans-serif">Ver 1.00 Design By <FONT 
            face="Verdana, Arial, Helvetica, sans-serif"><B><FONT 
            color=#ff0000><A href="http://www.vcok.com/"><FONT 
            color=#ff0009>VcOk.com</FONT></A></FONT></B></FONT></FONT></FONT></DIV></TD>
          <TD width="6%">&nbsp;</TD></TR>
        <TR>
          <TD width="7%">&nbsp;</TD>
          <TD width="87%">
            <DIV align=center><FONT 
            face="Arial, Helvetica, sans-serif">CopyRight <FONT 
            color=#ff0000>&copy;</FONT> .:.:.:2002-2008 AT Tie Ling Liaoning 
            China:.:.:.</FONT></DIV></TD>
          <TD width="6%">&nbsp;</TD></TR>
        <TR>
          <TD width="7%">&nbsp;</TD>
          <TD align=middle 
            width="87%">&nbsp;&nbsp;&nbsp;&nbsp;辽宁省铁岭师范高等专科学校计算机中心 
            &nbsp;&nbsp;&nbsp;&nbsp;</TD></TR></TBODY></TABLE>
      <TABLE bgColor=#b5b6b5 cellSpacing=1 height=30 width=778>
        <TBODY>
        <TR>
          <TD align=middle bgColor=#ffffff>在此感谢 <A 
            href="http://www.kingxp.com/">广东省中联科技网络有限公司</A> 为我公司提供空间。/ 合作伙伴:<A 
            href="http://www.11k.net/">中国站长资讯网</A></TD></TR></TBODY></TABLE></TR></TBODY></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -