AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

PSafeArray nach Bitmap

Offene Frage von "semo"
Ein Thema von semo · begonnen am 20. Mai 2006 · letzter Beitrag vom 20. Mai 2006
Antwort Antwort
Benutzerbild von semo
semo

Registriert seit: 24. Apr 2004
755 Beiträge
 
Delphi 2010 Professional
 
#1

Re: PSafeArray nach Bitmap

  Alt 20. Mai 2006, 22:16
hier einmal nen bissl mehr code:

Delphi-Quellcode:
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);
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:17 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz