关于快速像素替换问题? 这个快速是什么意思?怎样算快?我想,如果是屏幕上显示的图像,只能是获取其Canvas之后,通过pixel或者scanline来访问啦。不过我估计这样的方法是不快。当然,如果是特定的图片文件格式,那么就很有可研究的了,可惜我不会 :) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 要是能整块的bitblt几下就快了! 不知下面的代码是否有用!unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;type TForm1 = class(TForm) btnStartDraw: TButton; btnQuit: TButton; Image1: TImage; procedure FormCreate(Sender: TObject); procedure FormPaint(Sender: TObject); procedure btnStartDrawClick(Sender: TObject); private { Private declarations } Earthmap : HBitmap; public { Public declarations } procedure DrawBitmap(PaintDC : HDC; Bitmap : HBitmap; X, Y : integer); end;var Form1: TForm1; AWidth, AHeight : integer; implementation{$R *.DFM}{$R earth.res}{ TForm1 }procedure TForm1.DrawBitmap(PaintDC: HDC; Bitmap: HBitmap; X, Y: integer);var MemDC : HDC; OldBitmap : HBitmap;begin MemDC := CreateCompatibleDC(PaintDC); OldBitmap := SelectObject(MemDC, Bitmap); if (EarthMap <> 0) then BitBlt(PaintDC, X, Y, AWidth, AHeight, MemDC, 0, 0, SRCCOPY); SelectObject(MemDC, OldBitmap); DeleteObject(MemDC);end;procedure TForm1.FormCreate(Sender: TObject);var BitmapStruct : Windows.TBitmap; //"Windows." can't be removed;begin Earthmap := LoadBitmap(hInstance, 'EARTH'); GetObject(Earthmap,sizeof(Windows.TBitmap), @BitmapStruct); AWidth := BitmapStruct.bmWidth; AHeight := BitmapStruct.bmHeight; PostMessage(Handle, WM_SIZE, 0, 0);end;procedure TForm1.FormPaint(Sender: TObject);var times : integer;begin for times := 0 to 5 do DrawBitmap(GetDC(Handle), Earthmap, 20* times , 20 * times);end;procedure TForm1.btnStartDrawClick(Sender: TObject);begin DrawBitmap(GetDC(Handle), Earthmap, 20 , 0);end;end. 如何将image 中的图像保存 到ini 文件中,且能读取出来? sql server 中怎么删除某个字段的索引? 对于ASP程序员的思考和担忧,请大家来探讨一下 字段值不能为空格的问题 COM究竟有什么用啊? 菜鸟问题,开方如何表示? 请问如何侦听串口? delphi的建模工具有那些?常用哪个?大家开发DELPHI项目都建模吗? 在edit中新增FCharCase属性,实现首字母的选择 关于一个方法中启用和关闭全局钩子的问题 为什么delphi的ado控件不能用,提示需要microsoft access components 2.1 请帮忙看看这段SQL语句。谢谢
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
btnStartDraw: TButton;
btnQuit: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure btnStartDrawClick(Sender: TObject);
private
{ Private declarations }
Earthmap : HBitmap;
public
{ Public declarations }
procedure DrawBitmap(PaintDC : HDC; Bitmap : HBitmap;
X, Y : integer);
end;var
Form1: TForm1;
AWidth, AHeight : integer;
implementation{$R *.DFM}
{$R earth.res}{ TForm1 }procedure TForm1.DrawBitmap(PaintDC: HDC; Bitmap: HBitmap; X, Y: integer);
var
MemDC : HDC;
OldBitmap : HBitmap;
begin
MemDC := CreateCompatibleDC(PaintDC);
OldBitmap := SelectObject(MemDC, Bitmap);
if (EarthMap <> 0)
then BitBlt(PaintDC, X, Y, AWidth, AHeight, MemDC, 0, 0, SRCCOPY);
SelectObject(MemDC, OldBitmap);
DeleteObject(MemDC);
end;procedure TForm1.FormCreate(Sender: TObject);
var
BitmapStruct : Windows.TBitmap; //"Windows." can't be removed;
begin
Earthmap := LoadBitmap(hInstance, 'EARTH');
GetObject(Earthmap,sizeof(Windows.TBitmap), @BitmapStruct);
AWidth := BitmapStruct.bmWidth;
AHeight := BitmapStruct.bmHeight;
PostMessage(Handle, WM_SIZE, 0, 0);
end;procedure TForm1.FormPaint(Sender: TObject);
var
times : integer;
begin
for times := 0 to 5 do
DrawBitmap(GetDC(Handle), Earthmap, 20* times , 20 * times);
end;procedure TForm1.btnStartDrawClick(Sender: TObject);
begin
DrawBitmap(GetDC(Handle), Earthmap, 20 , 0);
end;end.