如何旋转图像任意度!(100分)

  • 主题发起人 主题发起人 lhdyesok
  • 开始时间 开始时间
L

lhdyesok

Unregistered / Unconfirmed
GUEST, unregistred user!
请问如何旋转图像90度和任意度,速度要快,最好有源码?
 
各位大哥帮帮忙,我是新手,帮忙顶一下吧!
 
90度和180度这些简单,但任意角度就很难了,做得不好会严重失真!
我这有一个FastLib控件,有源码,可以自己分析一下。需要的话请来信说明!
coolqiang@163.net
 
谢谢,现在发给我行吗?

我的E-Mail:Li_Hong_De@163.com
 
给你一个我的代码,例子:如果你要30度旋转。du:=30*pi/180;

function sy_rotate(sm:Tbitmap;du:extended):Tbitmap;
var
i,j:integer;
dest:Tbitmap;
x,y:integer;
x0,y0:integer;
temp_sin,temp_cos:extended;
begin
dest:=Tbitmap.Create;
dest.Width:=sm.Width;
dest.Height:=sm.Height;
y0:=floor(sm.Height/2);
x0:=floor(sm.width/2);

for i:=0 to sm.Height-1 do
begin
temp_sin:=(i-y0)*sin(du);
temp_cos:=(i-y0)*cos(du);
for j:=0 to sm.Width-1 do
begin
x:=floor((j-x0)*cos(du)-temp_sin+x0+0.5);
y:=floor((j-x0)*sin(du)+temp_cos+y0+0.5);
if (x=236)and (y=132) then showmessage('cch');
if (x>=0) and (y>=0) and (x<=sm.Width-1)and(y<=sm.Height-1) then
begin
dest.Canvas.Pixels[x,y]:=sm.Canvas.Pixels[j,i];
end;//end if x,y,....
end;//end for j;
end;//end for i;
result:=dest;
end;
 
楼上的大哥这样会不会比较慢啊,我看过一些资料,好像说用ScanLine会快很多,但不知道ScanLine是怎么样使用,请问哪里有scanline的资料啊!
我是想用ScanLine实现图像旋转,谢谢!
 
怎么还是没人顶啊!
 
这么久的时间过去了,怎么还是没人顶啊!
 
后退
顶部