Thema: AnimatePNG

Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#75

AW: AnimatePNG

  Alt 26. Mär 2017, 20:38
Ok. APNG funktioniert nun soweit ohne das ich Tausende Units oder fremd Komponente einbinden musste.
Das Problem von oben.

Musste
bmpBits: TBytes;
in meine Classe TAnimatePNG Privat verschieben danach ging es.

Andererseits ist obige Funktion nicht das wahre vom Ei da ich dort ein unnötiges DC aufrufen muss.
Also dann besser so.

Ok zurück muss doch die obere verwenden diese hier ist wegen der Kompatibilität zu 16Bit.
Delphi-Quellcode:
function TAnimatePng.BitmapToImage(Hdib: HBitmap): Pointer;
type
  TByteArray = array of Byte;
var
  BitmapLength: LongWord;
  bi: tagBITMAP;
  lpImg: Pointer;
begin

  Result := nil;
  bmpBits := nil;

  GetObject(Hdib, sizeof(bi), @bi);

  BitmapLength := bi.bmWidth * bi.bmHeight * (bi.bmBitsPixel div 8);
  SetLength(bmpBits, BitmapLength + 1);
  GetBitmapBits(Hdib, BitmapLength, @bmpBits[0]);

  if @bmpBits[0] <> nil then
  begin
    if Gdip_CreateBitmapFromScan0(bi.bmWidth, bi.bmHeight, bi.bmWidth * 4, PixelFormat32bppARGB,
      @bmpBits[0], lpImg) = OK then
      Result := lpImg;
  end;

  DeleteObject(Hdib);
end;
gruss

Geändert von EWeiss (31. Mär 2017 um 18:36 Uhr)
  Mit Zitat antworten Zitat