0
我的代码here工作正常,除了所有的2个图像的非功率翻转y方向。在wxImageLoader文件中有这样的循环,我认为是罪魁祸首:Unflip wxImage loading
for(int y=0; y<newHeight; y++)
{
for(int x=0; x<newWidth; x++)
{
if(x<(*imageWidth) && y<(*imageHeight)){
imageData[(x+y*newWidth)*bytesPerPixel+0]=
bitmapData[(x+(rev_val-y)*(*imageWidth))*old_bytesPerPixel + 0];
imageData[(x+y*newWidth)*bytesPerPixel+1]=
bitmapData[(x+(rev_val-y)*(*imageWidth))*old_bytesPerPixel + 1];
imageData[(x+y*newWidth)*bytesPerPixel+2]=
bitmapData[(x+(rev_val-y)*(*imageWidth))*old_bytesPerPixel + 2];
if(bytesPerPixel==4) imageData[(x+y*newWidth)*bytesPerPixel+3]=
alphaData[ x+(rev_val-y)*(*imageWidth) ];
}
else
{
imageData[(x+y*newWidth)*bytesPerPixel+0] = 0;
imageData[(x+y*newWidth)*bytesPerPixel+1] = 0;
imageData[(x+y*newWidth)*bytesPerPixel+2] = 0;
if(bytesPerPixel==4) imageData[(x+y*newWidth)*bytesPerPixel+3] = 0;
}
}//next
}//next
但我无法弄清楚如何取消翻转图像。
完整代码是在我张贴的问题 – DShook 2009-05-04 04:50:48
OK的链接。我错过了。代码故意翻转图像。但它似乎也为两张图片的功率做了同样的事情。试着用y代替rev_val-y来调试它,看看会发生什么。 – 2009-05-04 06:30:17