请大家帮帮我,《如何把*.jpg》旋转90度啊???谢谢大家。(100分)

  • 主题发起人 主题发起人 原振侠
  • 开始时间 开始时间

原振侠

Unregistered / Unconfirmed
GUEST, unregistred user!
[:(]各位哥哥姐姐,帮帮忙啊,小弟我用image控件,完成图形旋转90度怎么也不成啊,*.bmp格式的我会两种转法,可是*.jpg怎么样才可以转啊????
我把书都翻完了可是还是没有解决,不知哪位可以帮帮我,谢谢。
 
笨办法就是程序转换为bmp然后旋转90度然后再换回来。
 
同意maming的
var bmp: TBitmap;
begin
bmp := Tbitmap.create;
try
bmp.assign(你的Jpeg对象);
(旋转位图过程)
jpeg.assign(bmp);
finally
bmp.free;
end;
end;
 
用TImgEdit控件,本身带有旋转功能,
ImgEdit.RotateLeft
ImgEdit.RotateRight(
 
“旋转90度”按钮的On Click事件。

procedure TForm1. Button2Click (Sender: TObject);
var
i,j:integer;
begin
//确定旋转后位图的大小
image2.Picture.Bitmap.Height:=image1.picture.width;
image2.Picture.Bitmap.Width:=image1.picture.height;
for i:=0 to image1.Height do
for j:=0 to image1.Width do
image2.canvas.Pixels[(-i+ image1.Height),
j]:=image1.canvas.Pixels[j,i];
end;

 
谢谢各位关心,小弟我实以下,成功立刻给各位加分。
再次谢谢关心
 
在源码空间下载一个imageEN控件,上面有这样的示例。
 
老问题了

//------------------------------------------------------------------------------
procedure SmoothRotate(Bmp,Dst:TBitmap;cx,cy:Integer;Angle:Extended);
var
Top,Bottom,Left,Right,eww,nsw,fx,fy,wx,wy: Extended;
cAngle,sAngle: Double;
xDiff,yDiff,ifx,ify,px,py,ix,iy,x,y: Integer;
nw,ne,sw,se, Tmp: PFColor;
begin
if not assigned(bmp) or not assigned(dst) then exit;
bmp.pixelformat := pf24bit;
dst.pixelformat := pf24bit; // only work with 24-bit bitmap
// if u can sure they r all 24-bit, u can
// delete these 2 lines
Angle:=-Angle*Pi/180;
sAngle:=Sin(Angle);
cAngle:=Cos(Angle);
xDiff:=(Dst.Width-Bmp.Width)div 2;
yDiff:=(Dst.Height-Bmp.Height)div 2;
for y:=0 to Dst.Height-1 do
begin
tmp := dst.scanline[y];
py:=2*(y-cy)+1;
for x:=0 to Dst.Width-1 do
begin
px:=2*(x-cx)+1;
fx:=(((px*cAngle-py*sAngle)-1)/ 2+cx)-xDiff;
fy:=(((px*sAngle+py*cAngle)-1)/ 2+cy)-yDiff;
ifx:=Round(fx);
ify:=Round(fy);

if(ifx > -1)and(ifx < Bmp.Width)and(ify > -1)and(ify < Bmp.Height) then
begin
eww:=fx-ifx;
nsw:=fy-ify;
iy:=TrimInt(ify+1,0,Bmp.Height-1);
ix:=TrimInt(ifx+1,0,Bmp.Width-1);
nw := pointer(integer(bmp.scanline[ify])+ifx*3);
ne := pointer(integer(bmp.scanline[ify])+ix*3);
sw := pointer(integer(bmp.scanline[iy])+ifx*3);
se := pointer(integer(bmp.scanline[iy])+ix*3);

Top:=nw^.b+eww*(ne^.b-nw^.b);
Bottom:=sw^.b+eww*(se^.b-sw.b);
Tmp^.b:=(Round(Top+nsw*(Bottom-Top))) and $ff;

Top:=nw^.g+eww*(ne^.g-nw^.g);
Bottom:=sw^.g+eww*(se^.g-sw^.g);
Tmp^.g:=(Round(Top+nsw*(Bottom-Top))) and $ff;

Top:=nw^.r+eww*(ne^.r-nw^.r);
Bottom:=sw^.r+eww*(se^.r-sw^.r);
Tmp^.r:=(Round(Top+nsw*(Bottom-Top))) and $ff;
end;
tmp := pointer(integer(tmp)+3);
end;
end;
end;
 
我记得用acdsee可以,你是以下。如果可以给我粉。
 
谢谢各位,我已经给4为各加了25分,清风97你说的好象是VB里的东东把,所以没给你加分还是要谢谢你。
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部