procedure Rotate(Bmp,Dst:TFastRGB;cx,cy:Integer;Angle:Extended);
var
cAngle,
sAngle:  Double;
xDiff,
yDiff,
xpr,ypr,
ix,iy,
px,py,
x,y:      Integer;
Tmp:      PFColor;{what means?}
begin
  Angle:=-Angle*Pi/180;
  sAngle:=Sin(Angle);
  cAngle:=Cos(Angle);
  xDiff:=(Dst.Width-Bmp.Width)div 2;
  yDiff:=(Dst.Height-Bmp.Height)div 2;
  Tmp:=Dst.Bits;{what means?}
  for y:=0 to Dst.Height-1 do
  begin
    py:=2*(y-cy)+1;
    for x:=0 to Dst.Width-1 do
    begin
      px:=2*(x-cx)+1;
      xpr:=Round(px*cAngle-py*sAngle);
      ypr:=Round(px*sAngle+py*cAngle);
      ix:=((xpr-1)div 2+cx)-xDiff;
      iy:=((ypr-1)div 2+cy)-yDiff;
      if(ix>-1)and(ix<Bmp.Width)and(iy>-1)and(iy<Bmp.Height)then
      Tmp^:=Bmp.Pixels[iy,ix]; {what means?}
      Inc(Tmp);
    end;
    Tmp:=Pointer(Integer(Tmp)+Dst.Gap); {what means?}
  end;
end;原理: 
                    cos(Alpha), sin(Alpha), 0  
只需要用源矩阵乘以  -sin(Alpha),cos(Alpha), 0
                    0, 0, 1 呵呵:))哈哈:))

解决方案 »

  1.   

    to: shines
       你怎么把我的话也抄上去了?哈哈!
       不过,这是真的,如果真的按下面下矩阵计算每个点,目标区有一些点会是白点(因为有些源点通过计算和四舍五入在目标中凑到一起了),我以前解决的办法是从目标求的源点的坐标和像素值,不过首先要取到目标区的区域(往往是斜的)。
                        cos(Alpha), sin(Alpha), 0  
                        -sin(Alpha),cos(Alpha), 0
                        0, 0, 1 to: ming1
    你还没有搞定?不是有人已经替你解释了吗?实在不行,一个点一个点算吧,等画出来了再考虑速度问题。
      

  2.   

    http://www.crosswinds.net/~khojasteh/delphi-components.htmlTRotateImage v1.21  
      This component is a visual component similar to TImage with ability to rotate the image in any arbitrary angle. TRotateImage can be used on Delphi 3, 4, and 5.  
      

  3.   

    那个过程怎么调用呢?如何体现呢?
    比如说旋转后的图放在另外一个Timage控件中,该怎么办呢?
      

  4.   

    你难道没有下载我说的控件吗,有现成的例子及DEMO!http://www.crosswinds.net/~khojasteh/delphi-components.htmlTRotateImage v1.21  
      This component is a visual component similar to TImage with ability to rotate the image in any arbitrary angle. TRotateImage can be used on Delphi 3, 4, and 5.