Einzelnen Beitrag anzeigen

Benutzerbild von littleDave
littleDave

Registriert seit: 27. Apr 2006
Ort: München
556 Beiträge
 
Delphi 7 Professional
 
#10

Re: ActiveX.Image -> Buffer --> TBitmap

  Alt 9. Okt 2008, 15:42
Also mir fällt noch ScanLine ein.
Ich würd es mal so ähnlich versuchen:
Delphi-Quellcode:
const
    ImgWidth = 1024;
    ImgHeight = 768;
    BufferSize = ImgWidth *
                 ImgHeight *
                 3; // 24 Bit Farbtiefe, 8 Bit Farbtiefe wäre * 1

var bmp : TBitmap;
    pBuffer : pointer;
    iSize : cardinal;
begin
  GetMem(pBuffer, BufferSize);
  try
    iSize := uEyeCam1.CopyImage(Cardinal(pBuffer), BufferSize);

    bmp := TBitmap.Create;
    try
      bmp.Width := ImgWidth; { die Breite des Bildes im Puffer }
      bmp.Height := ImgHeight; { die Höhe des Bildes im Puffer }
      bmp.PixelFormat := pf24Bit; { das Pixelformat };

      // Inhalt des Bildes kopieren
      Move(pBuffer^, bmp.ScanLine[bmp.Height-1]^, iSize);
      
      // Bild auf MainForm zeichen
      BitBlt(Form1.Canvas.Handle, 0, 0, ImgWidth, ImgHeight, bmp.Canvas.Handle, 0, 0, SRCCOPY);
    finally
      bmp.Free;
    end;
  finally
    FreeMem(pBuffer);
  end;
end;
Jabber: littleDave@jabber.org
in case of 1 is 0 do external raise while in public class of object array else repeat until 1 is 0
  Mit Zitat antworten Zitat