網路城邦
上一篇 回創作列表 下一篇  字體:
delphi BMP high speed access
2010/12/23 22:39:00瀏覽125|回應0|推薦0
type
  type_bgr =record
    b,g,r:byte;
  end;
var
  stm_1:Tmemorystream;
  bmp1:TBitmap;
  p1:^byte;
  p_bgr:^type_bgr;
  i1:integer;
begin
  stm_1:=Tmemorystream.Create;
  bmp1:=TBitmap.Create;
  bmp1.Width:=8;
  bmp1.Height:=10;
  bmp1.PixelFormat:=pf24bit;
  bmp1.SaveToStream(stm_1);
  bmp1.SaveToFile(test.bmp);
  listbox1.Items.Add(format(pos=%d size=%d,[stm_1.Position,stm_1.size]));
  stm_1.Position:=0;
  p1:=stm_1.Memory;
  inc(p1,54);
  p_bgr:=@(p1^);
  for i1:=1 to 8*10 do
  begin
    p_bgr^.r:=$ff;
    p_bgr^.g:=$0;
    p_bgr^.b:=$0;
    inc(p_bgr);
  end;
  image1.Picture.Bitmap.LoadFromStream(stm_1);
  p1:=image1.Picture.Bitmap.ScanLine[9];
  p_bgr:=@(p1^);
  for i1:=1 to 8*10 do
  begin
    p_bgr^.r:=$0;
    p_bgr^.g:=$ff;
    p_bgr^.b:=$0;
    inc(p_bgr);
  end;
end;
( 心情隨筆心情日記 )
回應 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=greatcat&aid=4726590