0

the code is create CreateImageHeader for two :imageSo and imageDe, then value imagedata by scanline , then rotate by judge angle, then value scanline by imagedata,

I show the main code like what I said as behind,hope someone could give me the suggestion or thinking.

create:

imageSo = CreateImageHeader(bmp->PixelFormat, bmp->Width,bmp->Height);  
imageDe = CreateImageHeader(bmp->PixelFormat, bmp->Width,bmp->Height);  

shift:

bit1=(BYTE*) bmp->ScanLine[hSrc-1];  
bit2=imageSo->imageData;  
for(int i=0;i < hSrc;i++)    
{  
    memcpy(bit2,bit1,cpy);  
    bit1+=wBmp;  
    bit2+=wIpl;  
}  

rotate:

if(param.Angle){  

double xshift=0;  

double yshift=0;  

iiplGetRotateShift(bmp->Width/2,bmp->Height/2,BmpProperty.Angle,&xshift,&yshift);    

iiplRotate(imageSo,imageDe,BmpProperty.Angle,xshift,yshift,IPL_INTER_CUBIC|IPL_SMOOTH_EDGE);  
}  

shift2:

bit1=(BYTE*) bmp->ScanLine[hSrc-1];  
bit2=imageSo->imageData;  
for(int i=0;i < hSrc;i++)   
{  
    memcpy(bit1,bit2,cpy);  
    bit1+=wBmp;  
    bit2+=wIpl;  
}   
fading
  • 1
  • 3

1 Answers1

0

I know the reason now , because after rotated, the canvas was also rotating,so I set the canvas to be a square which was rectangle before.also understand the picture in canvas's position would also help.

here is the website which is introduce the details of canvas rotate. enter link description here

fading
  • 1
  • 3