我在图形编程遇到的问题(100分)

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

chenfeng1029

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure tform1.botton1click(sender:tobject)
var
newbmp:=tbitmap;
i,j,bmpheight,bmpwidth:integer;
begin
newbmp:=tbitmap.create;
newbmp.width:=image1.width;
newbmp.height:=image1.height;
bmpheight.height:=image1.height;
bmpwidth:=image1.width;
for i:=bmpheightdo
wnto 1do
forj:=1 to ido
begin
newbmp.canvas.copyrect(rect(0,j-1,bmpwidth,j),image1.canvas,rect(o,i-1,bmpwidth,i));
form1.canvas.draw(20,20,newbmp);
end;
newbmp.free;
end;
end.
以上是一个图形的流动效果,这个过程我知道大概,但还有许多地方不懂,请高手们在每段给我一些
标志性的提示,即每行是什么意思,
还有这个是bitmap格式的图片,如果我选用JPEG格式,我应该对程序相应的做如何修改,
那位告诉答的好,小弟我在奉贤上50分,
 
procedure tform1.botton1click(sender:tobject)
var
newbmp:tbitmap;
i,j,bmpheight,bmpwidth:integer;
begin
newbmp:=tbitmap.create;
//创建位图
newbmp.width:=image1.width;//位图的宽度和高度设定
newbmp.height:=image1.height;
bmpheight.height:=image1.height;
bmpwidth:=image1.width;
for i:=bmpheightdo
wnto 1do
for j:=1 to ido
begin
//拷贝image1上的东东到你创建的位图里
newbmp.canvas.copyrect(rect(0,j-1,bmpwidth,j),image1.canvas,rect(o,i-1,bmpwidth,i));
//将创建位图里的东东绘制到form1的画布上
form1.canvas.draw(20,20,newbmp);
end;
newbmp.free;//释放内存
end;
end.

以上是对BMP的操作,如果想操作JPG,你需要
uses JPEG;
var
bmp :TBitmap;
jpg :TJpegImage;
begin
jpg :=TJpegImage.Create;
jpg.LoadFromFile('....');
bmp :=TBitmap.Create;
bmp.Assign(jpg);
..............
jpg.Free;
bmp.Free;
end;
 
很高兴,能给我答案,THANK YOU!
但我还有些地方不懂,请多指教。
bmpheight:=image1.height;
bmpwidth:=image1.width
什么意思,还有,既然定义了位图。为什么还需要后面的bmpheight,bmpwidth等参数,
还有当选择JPEG格式时,是否还要对newbmp.canvas.copyrect(rect(0,j-1,bmpwidth,j),image1.canvas,rect(o,i-1,bmpwidth,i));
进行修改
 
//将iange1的宽度和高度赋予2个整型变量
bmpheight:=image1.height;
bmpwidth:=image1.width
>还有当选择JPEG格式时 :
newbmp.Assign(jpg);
......
//以后的操作一样的
 
你现在还在线吗,我是否和你这位高手交个朋友,我的QQ是38746132
阁下是否可以告诉我,你的QQ或是E-MAIL。我想这个要求不过分。哈,先谢了
 
多人接受答案了。
 
mail : forevertyn@263.net
 
顶部