var
aTempBitmap : HBITMAP;
aOleVariant : OleVariant;
iMin, iMax : Integer;
Val : pSafeArray;
pBitmap : Pointer;
begin
// Infos loggen:
WriteToLogFile(Format('
aIproImage.Info.Width = %d', [aIproImage.Info.Width]));
WriteToLogFile(Format('
aIproImage.Info.Height = %d', [aIproImage.Info.Height]));
WriteToLogFile(Format('
aIproImage.Info.DPIX = %d', [aIproImage.Info.DPIX]));
WriteToLogFile(Format('
aIproImage.Info.DPIY = %d', [aIproImage.Info.DPIY]));
WriteToLogFile(Format('
aIproImage.Info.BytesPerLine = %d', [aIproImage.Info.BytesPerLine]));
WriteToLogFile(Format('
aIproImage.Info.BitsPerPixel = %d', [aIproImage.Info.BitsPerPixel]));
// Bilddaten in ein OleVariant laden
aOleVariant := aIproImage.Get( aIproImage.Info,
0,
0,
0,
0,
aIproImage.Info.Width,
aIproImage.Info.Height);
Val := PSafeArray(TVariantArg(aOleVariant).ppArray);
WriteToLogFile(Format('
ElementSize = %d', [Val.cbElements]));
ActiveX.SafeArrayGetLBound(Val, 1, iMin);
ActiveX.SafeArrayGetUBound(Val, 1, iMax);
WriteToLogFile(Format('
iMin=%d', [iMin]));
WriteToLogFile(Format('
iMax=%d', [iMax]));
SafeArrayAccessData(Val, pBitmap);
// PixelFormat setzen:
case aIproImage.Info.BitsPerPixel
of
ITYPE_BW : aBitmap.PixelFormat := pf1bit;
ITYPE_GRAY4 : aBitmap.PixelFormat := pf4bit;
ITYPE_8BIT : aBitmap.PixelFormat := pf8bit;
ITYPE_TRUECOLOR : aBitmap.PixelFormat := pf24bit;
end;
aTempBitmap := CreateBitmap( aIproImage.Info.Width,
aIproImage.Info.Height,
1,
aIproImage.Info.BitsPerPixel,
pBitmap);
WriteToLogFile(Format('
aTempBitmap (Typ Handle)=%d', [aTempBitmap]));
aBitmap.Width := const_ImageWidth;
aBitmap.Height := const_ImageHeight;
aBitmap.Handle := aTempBitmap;
SafeArrayUnaccessData(Val);