- if tmpImage.Picture.Graphic.InheritsFrom(TPngImage) then begin
- png := TPngImage(tmpImage.Picture.Graphic);
- png.Resize(w, h);
- ms := TMemoryStream.Create;
- png.SaveToStream(ms);
- ms.Position := 0;
- LoadPNG(ms);
- FreeAndNil(ms);
- end else begin
- bmp := Graphics.TBitmap.Create;
- bmp.Width := w; // Texturbreite PowerOf2
- bmp.Height := h; // Texturhöhe PowerOf2
- bmp.PixelFormat := pf32bit;
- bmp.Canvas.StretchDraw(Rect(0, 0, NewImageWidth, NewImageHeight), png);
- AssignFromBitmap(bmp);
- FreeAndNil(bmp);
- end;