代码纠正 ( 积分: 100 )

  • 主题发起人 CHINESEWHOAMI
  • 开始时间
C

CHINESEWHOAMI

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TTPLL.SpeedButton3Click(Sender: TObject);
var x,y : Integer;
TmpBitMap : TBitmap;
begin
TmpBitMap:=TBitmap.Create;
TmpBitMap.Assign(Image1.Picture.Graphic);
with Image1do
begin
Picture.Bitmap.Height:= TmpBitMap.Width;
Picture.Bitmap.Width:= TmpBitMap.Height;
for x:=0 to Heightdo
for y:=0 to Widthdo
Canvas.Pixels[TmpBitMap.Height-x,y]:=TmpBitMap.Canvas.Pixels[y,x];
end;
end;
是一段图片旋转代码,但其结果是图像会乱掉,请各位兄弟帮忙看一下
 

壁画

Unregistered / Unconfirmed
GUEST, unregistred user!
给你一段以前的代码,你参考。
procedure Rotate90(const Bitmap:TBitmap);
var
i,j:Integer;
rowIn,rowOut:pRGBTriple;
Bmp:TBitmap;
Width,Height:Integer;
P:pByteArray;
begin
Bmp:=TBitmap.Create;
Bmp.Width:=Bitmap.Height;
Bmp.Height:=Bitmap.Width;
Bmp.PixelFormat:=Bitmap.PixelFormat;
// pf24bit;
Width:=Bitmap.Width-1;
Height:=Bitmap.Height-1;
for j:=Heightdo
wnto 0do
begin
rowIn:=Bitmap.ScanLine[j];
for i:=0 to Widthdo
begin
rowOut:=Bmp.ScanLine;
Inc(rowOut,j);//修改了这里,选择270度。
rowOut^:=rowIn^;
Inc(rowIn);
end;
end;
Bitmap.Assign(Bmp);
end;
 
C

CHINESEWHOAMI

Unregistered / Unconfirmed
GUEST, unregistred user!
接受答案了.
 

Similar threads

顶部