AGB  ·  Datenschutz  ·  Impressum  







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

OleVariant --> Bitmap

Offene Frage von "semo"
Ein Thema von semo · begonnen am 5. Apr 2006
Antwort Antwort
Benutzerbild von semo
semo

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

OleVariant --> Bitmap

  Alt 5. Apr 2006, 08:57
Zitat:
Get ( ImgInfo As Info, Left As Long, Top As Long, Width As Long, Height As Long, [DstWidth], [DstHeight] ) As Variant

This method is used to export a rectangular area of the image into a buffer available to the application. The Left, Top, Width, Height parameters specify the source rectangular area. When all parameters are zero (0), the whole image will be exported. The function stretches or compresses the area if necessary to fit the dimensions specified by the DstWidth and DstHeight parameters for the destination. The type of the optional parameters is Long; when they are not specified, the destination size will be equal to the original size. The applied stretching mode will be influenced by the Stretch property of the Document object. The line order, the padding and – for 24-bit color images – the RGBorder attributes of the retrieved image can be controlled by the LineOrder, Padding and RGBOrder properties of the Document object.

The basic attributes of the exported image are returned in the ImgInfo parameter. The exported bitmap is returned as a Variant containing a SAFEARRAY of bytes (a Byte array in Visual Basic). To free the returned Variant in C++, use the VariantClear Win32 API function or set the Variant to Empty in Visual Basic. It is recommended to check the type of the returned bitmap (BitsPerPixel property of the Info object), since it is not guaranteed, that it will be the same as for the original image.
dies ist ein auszug aus einer hilfedatei, das beispiel ist aber wie man sieht für vb.
ich habe eine typelibrary vorliegen und will nun aus dem olevariant, welches ich über get() bekomme, in dem die bilddaten in einem array vorhanden sind in ein bitmap laden um dieses dann anzuzeigen....

hat da jemand eine idee?

Delphi-Quellcode:
procedure Tmainform.ConvertOleVarianttoBitmap(Data : OleVariant);
var
  ms : TMemoryStream;
  p : Pointer;
  MyBitmap : TBitmap;
begin
  ms:=TMemoryStream.Create;
  p:=VarArrayLock(Data);
  try
    ms.Write(p^,VarArrayHighBound(Data,1)+1);
  finally
    VarArrayUnlock(Data);
  end;
  ms.seek(0,soFromBeginning);
  myBitmap:=TBitmap.Create;
  myBitmap.LoadFromStream(ms);
  image.Picture.Assign(myBitmap);
  ms.Free;
  myBitmap.Free;
end;
funktionert nicht, da der header des bitmap nicht ok ist. es kommt ne unschöne fehlermeldung.
  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 01:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz