在线求助!! ( 积分: 50 )

  • 主题发起人 主题发起人 龙飞凤舞316
  • 开始时间 开始时间

龙飞凤舞316

Unregistered / Unconfirmed
GUEST, unregistred user!
有个旋转涵数如下,如果要水平翻转,要如何改一下??
procedure RotateBmp(Bitmap: TBitmap; Angle: integer);
var
i,j: Integer;
rowIn, rowOut: pRGBTriple;
Bmp: TBitmap;
Width,Height:Integer;
begin
if not (Angle in [1..3]) then exit;
Bmp:=TBitmap.Create;
try
if Angle=2 then
begin
Bmp.Width := Bitmap.Width;
Bmp.Height :=Bitmap.Height;
end
else
begin
Bmp.Width := Bitmap.Height;
Bmp.Height := Bitmap.Width;
end;
Bmp.PixelFormat := pf24bit;
Width:=Bitmap.Width-1;
Height:=Bitmap.Height-1;
for j := 0 to Height do
begin
rowIn := Bitmap.ScanLine[j];

if Angle=1 then
for i := 0 to Width do
begin
rowOut := Bmp.ScanLine;
Inc(rowOut,Height - j);
rowOut^ := rowIn^;
Inc(rowIn);
end;

if Angle=2 then
for i := 0 to Width do
begin
rowOut := Bmp.ScanLine[Height - j];
Inc(rowOut,Width - i);
rowOut^ := rowIn^;
Inc(rowIn);
end;

if Angle=3 then
for i := 0 to Width do
begin
rowOut := Bmp.ScanLine[Width - i];
Inc(rowOut,j);
rowOut^ := rowIn^;
Inc(rowIn);
end;
end;
Bitmap.Assign(Bmp);
finally
bmp.Free;
end;
end;
 
有个旋转涵数如下,如果要水平翻转,要如何改一下??
procedure RotateBmp(Bitmap: TBitmap; Angle: integer);
var
i,j: Integer;
rowIn, rowOut: pRGBTriple;
Bmp: TBitmap;
Width,Height:Integer;
begin
if not (Angle in [1..3]) then exit;
Bmp:=TBitmap.Create;
try
if Angle=2 then
begin
Bmp.Width := Bitmap.Width;
Bmp.Height :=Bitmap.Height;
end
else
begin
Bmp.Width := Bitmap.Height;
Bmp.Height := Bitmap.Width;
end;
Bmp.PixelFormat := pf24bit;
Width:=Bitmap.Width-1;
Height:=Bitmap.Height-1;
for j := 0 to Height do
begin
rowIn := Bitmap.ScanLine[j];

if Angle=1 then
for i := 0 to Width do
begin
rowOut := Bmp.ScanLine;
Inc(rowOut,Height - j);
rowOut^ := rowIn^;
Inc(rowIn);
end;

if Angle=2 then
for i := 0 to Width do
begin
rowOut := Bmp.ScanLine[Height - j];
Inc(rowOut,Width - i);
rowOut^ := rowIn^;
Inc(rowIn);
end;

if Angle=3 then
for i := 0 to Width do
begin
rowOut := Bmp.ScanLine[Width - i];
Inc(rowOut,j);
rowOut^ := rowIn^;
Inc(rowIn);
end;
end;
Bitmap.Assign(Bmp);
finally
bmp.Free;
end;
end;
 
有第三方圖像控件,功能強大處理方便。
網上有很多地方都可以下載。
 
好,帮顶



--------签名档---------------------------

比肩国内顶尖源码下载站点 -> 源码我爱你

http://www.source520.com
http://www.source520.net

80G源码电子书免费免注册下载,大量精辟技术文档库随时更新
******************************************************************
附:为了站点持续发展,现有本站近年来收藏的大量大型商业源码低价出售,
详情请进入以下链接查看:
http://www.source520.com/building_delphi.htm

浏览商业代码请从如下URL进入查看实物:
1.商业源码库1: ftp://source520see3:browse@61.152.199.245/
2.商业源码库2: ftp://source520see2:browse@61.152.199.245/
 

Similar threads

后退
顶部