transform_world problem
Hi
I'm trying to use transform_world to take on world, scale it and translate it and copy it into the output
It seems that just scaling it and copying it works, and just translating it and copying it works, but trying do do both results in some really odd clipping/masking problem. The example code below should scale by a factor of 100 and then translate by 2 pixels in the x direction (unless I've messed up my matrix multiplication, but I don't think I have). As far as I can tell, both the scaling and the translation are working as they should, but in addition the copied image is cropped on the left. The attached images show the results if I use values of xtranslate of 2 and 2.5 pixels. In this case the world that is being copied from contains white noise, and that copied to is just a purple background. The crop amount seems to be (1-xtranslate)*scale, so is 100 for xtranslate of 2 and 150 for xtranslate of 2.5.
Does anyone have any idea of what is going on?
PF_CompositeMode mode;
mode.opacity=255;
mode.opacitySu=32768;
mode.rgb_only=false;
mode.xfer=PF_Xfer_IN_FRONT;
PF_FloatMatrix mat;
double ratio=(double)in_data->downsample_x.num/(double)in_data->downsample_x.den;
double scale=100.0*ratio;
double xtranslate=2.5*ratio;
mat.mat[0][0]=scale;
mat.mat[0][1]=0.0;
mat.mat[0][2]=0.0;
mat.mat[1][0]=0.0;
mat.mat[1][1]=scale;
mat.mat[1][2]=0.0;
mat.mat[2][0]=xtranslate*scale;
mat.mat[2][1]=0.0;
mat.mat[2][2]=scale;
PF_Rect dest;
dest.bottom=in_data->height;
dest.left=0;
dest.right=in_data->width;
dest.top=0;
int quality=PF_Quality_LO;
err=suites.WorldTransformSuite1()->transform_world(NULL,quality,0,PF_Field_FRAME,&ni.pixelworld,&mode,NULL,&mat,1,true,&dest,output);
links to examples
