Einzelnen Beitrag anzeigen

scp

Registriert seit: 31. Okt 2003
1.120 Beiträge
 
Delphi 7 Personal
 
#2

Re: Problem beim laden einer LCD Animation als Bitmap

  Alt 11. Apr 2006, 01:17
Habs doch noch gefunden :
Delphi-Quellcode:
procedure LoadLCDAniFromStream(Stream: TStream; index: integer; Bmp: TBitmap);
var
  LCDAHeader: TLCDAHeader;
  buf: packed array[0..LCD_ROWS-1,0..LCD_COLS-1] Of Byte;
  pix: Word;
  x,y: integer;
begin
  If (Stream.Size >= SizeOf(LCDAHeader)+index*LCD_BUFFER_SIZE) then
  begin
    Stream.Read(LCDAHeader, SizeOf(LCDAHeader));

    Stream.Seek((index-1)*SizeOf(buf), soFromCurrent);
    Stream.Read(buf, SizeOf(buf));

    for y := 0 to LCD_ROWS*8-1 do
      for x := 0 to LCD_COLS-1 do
      begin
        pix := (buf[y shr 3][x] shr (y and 7)) and 1;
        
        If Pix = 0 then
          Bmp.Canvas.Pixels[x, y] := clLCDBack
        else
          Bmp.Canvas.Pixels[x, y] := clLCDFront;
        end;
   end;
end;
Quelle:
http://cvs.tuxbox.org/cgi-bin/viewcv...tapps/bmp2raw/
(aus packed2raw() in raw.c)
  Mit Zitat antworten Zitat