帮我看看旋转图象的“RotateBmp”过程怎么使用(从其他贴子抄的)(50分)

  • 主题发起人 主题发起人 tzh1
  • 开始时间 开始时间
T

tzh1

Unregistered / Unconfirmed
GUEST, unregistred user!
以下这个使用后图象怎么不旋转?
procedure RotateBmp(bmp: TBitmap;
Center: TPoint;
angle: Integer);
var
tmpbmp: TBitmap;
i, j, x, y, px, py: Integer;
cAngle, sAngle: extended;
p1, p2: Pchar;
begin
while angle < 0do
angle := angle + 360;
angle := angle mod 360;
sAngle := sin(- angle * pi / 180);
cAngle := cos(- angle * pi / 180);
tmpbmp := tbitmap.create;
tmpbmp.assign(bmp);
for i := 0 to tmpbmp.height - 1do
begin
p1 := pchar(tmpbmp.scanline);
py := 2 * (i - center.y) - 1;
for j := 0 to tmpbmp.width - 1do
begin
px := 2 * (j - center.x) - 1;
x := (round(px * cAngle - py * sAngle) - 1) div 2 + center.x;
y := (round(px * sAngle + py * cAngle) - 1) div 2 + center.y;
if (x>=0) and (x=0) and (y<=tmpbmp.height) then
begin
p2 := pchar(bmp.scanline[y]) + x * 3;
move(p1^, p2^, 3);
end;
inc(p1, 3);
end;
end;
end;
 
从程序看它只能处理256色图像,你给的图像对不对?
 
错了吧?
只能处理24位真彩色图象
 
to Another_eYes:
这就是从您那抄的,怎么使?
 
必须是24位真彩图才行.
可以用Bitmap.PixelFormat := pf24Bit;强行将Bitmap转成24位真彩再调用
 
??不是很简单吗??
 
to Another_eYes: Answer is ok. tzh1 gei给他加分!
 
to Another_eYes:
我试了,怎么还不行,能手把手的交一下?
 
附加功能 将问题提前
 
tzh1:如果还想接着讨论请定期提前自己的帖子,如果不想继续讨论请结束帖子。
 
是一个过程RotateBmp
也加了Bitmap.PixelFormat := pf24Bit;//强行将Bitmap转成24位真彩再调用
那怎么调用呢?调用后的结果应该怎么可以看到呢?
请做个调用该过程的例子,并将结果体现在Timage控件.谢谢
 
接受答案了.
 
这个函数到底是什么调用的,结果在哪呢?
 
后退
顶部