Example #1
0
       //---------------------------------------------------------------------------------------------
       //create a texture image
       //---------------------------------------------------------------------------------------------
       public void textureImage(classimage source_img)
       {
           int x,y,w,h,xx,yy,texture,c;

           w = source_img.width / width;
           if (w<1) w=1;
           h = source_img.height / height;
           if (h<1) h=1;

           for (x=0;x<width;x++)
           {
	           xx = (x*source_img.width)/width;
	           for (y=0;y<height;y++)
	           {
	               yy = (y*source_img.height)/height;
	               texture = source_img.texture(xx-w,yy-h,xx+w,yy+h);
	               for (c=0;c<3;c++) image[x,y,c] = (Byte)texture;
	           }
           }
       }