请问建立bitmap:=Tbitmap.create,怎样设置可以通过loadfromfile载入合乎自己要求大小的位图,也就是无论位图实际多大,载入后自己缩放为我想要的大小.
我要通过内存中的位图数据得到自己想要的一定大小的缓存数据
我要通过内存中的位图数据得到自己想要的一定大小的缓存数据
解决方案 »
- dllMDI窗体有没有办法调用父窗体的方法
- *** SQL Server数据导出及脚本生成的问题
- delphi的消息处理时,怎么从hwnd转换到self的。
- 关于RichEdit的问题!
- !!请问三层结构中如何避免客户端数据重复输入!!
- 怎樣控制字段值的顯示格式﹖如字段值為1245.356﹐要使它顯示為1245.36﹐即保留到小數點后兩位。請高手救救小弟﹗謝謝﹗﹗
- 请问如何不通过滚动条知道RichEdit文本的高度
- 庆祝成为三级用户,散分!
- 请教高手,如何解决同步运行一个外部程序的问题?
- 邮箱被偷了,我该怎么办?(急!)
- 请问高手:从区位码到字符是用哪个API函数,它位于哪个库?
- 请大家看看,sql问题!
TBitmap.Canvas.StretchDraw
TBitmap.Canvas.CopyRect
procedure TForm1.PlayClick(Sender: TObject);
var
fn,MyfileExt:string;
imjpg:TJPEGImage;
prgb:PRGBArraye;
i,j,k,n,h,w:integer;
red,green,rbyte,gbyte:byte;begin
if listview1.Items.Count>0 then
begin
form3.Show;
form3_play:=true;
while form3_play=true do
begin
s.canvasdc:=form3.Image1.Canvas.Handle;
for i:=0 to listview1.Items.Count-1 do
begin
listview1.Items.Item[i].Focused:=true;
if form3_play=false then break;
bitmap:=Tbitmap.Create;
fn:=listview1.Items.Item[i].Caption;
MyfileExt:=ExtractFileExt(fn);
if MyfileExt='.bmp' then
begin
bitmap.LoadFromFile(fn);
end;
if (MyfileExt='.jpg')or (MyfileExt='.jpeg') then
begin
imjpg:=TJPEGimage.create;
imjpg.LoadFromFile(fn);
imjpg.PixelFormat:=jf24bit;
bitmap.Assign(imjpg);
end;
Bitmap.PixelFormat:=pf24bit; //问题解决了,载入256色文件后,设定这项就可以了
IF Bitmap.PixelFormat <> pf24bit
THEN showmessage('GetImageSpace: ' +
'Bitmap must be 24-bit color.');
buf_s:=AllocMem((led_Height*led_Width)div 8);
k:=0;
rbyte:=0;
gbyte:=0;
if led_height>bitmap.Height then h:=bitmap.Height
else h:=led_height;
if led_width>bitmap.Width then w:=bitmap.Width
else w:=led_width;
for j:=0 to h-1 do
begin
prgb:=Bitmap.ScanLine[j];
for n:=0 to w-1 do
begin
if prgb[n].rgbtGreen>128 then green:=1 else green:=0;
if prgb[n].rgbtRed>128 then red:=1 else red:=0;
gbyte:=green or (gbyte shl 1);
rbyte:=red or (rbyte shl 1);
if ((n+1) mod 8)=0 then
begin
buf_s[k]:=gbyte and rbyte;
inc(k);
gbyte:=0;
rbyte:=0;
end;
end;
end; s.utdj(bitmap.Canvas.Handle,buf_s,StrToInt(listview1.Items.Item[i].SubItems.Strings[5]),
StrToInt(listview1.Items.Item[i].SubItems.Strings[6]),StrToInt(listview1.Items.Item[i].SubItems.Strings[7]),StrToInt(listview1.Items.Item[i].SubItems.Strings[8]));
bitblt(form3.Image1.Canvas.Handle,0,0,420,420,bitmap.Canvas.Handle,0,0,srccopy);
delay(strtoint(listview1.Items.Item[i].SubItems.Strings[2])*1000);
freemem(buf_s,(led_Height*led_Width)div 8);
bitmap.Free;
if (MyfileExt='.jpg')or(MyfileExt='.jpeg')then imjpg.Free;
end;//i
end;//while
form3.Close;
end;//if
end;
以上的程序只得到了小于屏幕大小的图像数据或是在大的图像上截取了屏幕大小的数据区!我想得到和屏幕大小相同的图像的数据!就是这样,请多帮忙!