AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Projekte AnimatePNG
Thema durchsuchen
Ansicht
Themen-Optionen

AnimatePNG

Ein Thema von EWeiss · begonnen am 20. Mär 2017 · letzter Beitrag vom 8. Jun 2018
 
EWeiss
(Gast)

n/a Beiträge
 
#16

AW: AnimatePNG

  Alt 26. Mär 2017, 19:48
Ich versuche ein HBitmap in ein GDIPlus konformes Format zu bringen

Delphi-Quellcode:
function BitmapToImage(Hdib: HBitmap): Pointer;
var
  lpImg: Pointer;
  bi: tagBITMAPINFO;
  bm: Bitmap;
  BitmapLength: LongWord;
  bmpBits: TBytes;
  DC: HDC;
begin
  Result := nil;

  DC := GetDc(0);

  if Hdib <> 0 then
  begin
    GetObject(Hdib, sizeof(bm), @bm);

    bi.bmiHeader.biSize := SIZEOF(bi.bmiHeader);
    bi.bmiHeader.biWidth := bm.bmWidth;
    bi.bmiHeader.biHeight := -bm.bmHeight;
    bi.bmiHeader.biPlanes := 1;
    bi.bmiHeader.biBitCount := 32;
    bi.bmiHeader.biCompression := BI_RGB;

    BitmapLength := bm.bmWidth * bm.bmHeight * 4;
    SetLength(bmpBits, BitmapLength + 1);

    GetDIBits(DC, Hdib, 0, bm.bmHeight, @bmpBits[0], bi, DIB_RGB_COLORS);

    if @bmpBits[0] <> nil then
    begin
      if Gdip_CreateBitmapFromScan0(bm.bmWidth, bm.bmHeight, bm.bmWidth * 4, PixelFormat32bppARGB,
        @bmpBits[0], lpImg) = OK then
          Result := lpImg;
    end;
    ReleaseDC(0, DC);
  end;
end;
Es läuft alles durch nur beim aufruf von
GDIP_DrawImageRectRectI kracht es mal wieder.

Ich sehen keinen Fehler in meinem Code.
Eventuell TBytes ?

gruss

Geändert von EWeiss (27. Mär 2017 um 19:34 Uhr)
  Mit Zitat antworten Zitat
 


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:05 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