summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-04-08 09:04:35 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-04-08 09:04:35 +0100
commitbeb50d953be276106e166c1a1c6ed33761bf0627 (patch)
tree82fdc62ac07d301b45697c12d8173d36c0352844
parenteb124eb39b49ce513e5585657fcec92efe6f51b2 (diff)
downloadfpGUI-beb50d953be276106e166c1a1c6ed33761bf0627.tar.xz
New overloaded LoadImage_PNG()
This allows us to read the image from a byte array, just like we do with BMP images.
-rw-r--r--src/corelib/fpg_imgfmt_png.pas16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas
index c0659d2e..c95150e4 100644
--- a/src/corelib/fpg_imgfmt_png.pas
+++ b/src/corelib/fpg_imgfmt_png.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -31,6 +31,7 @@ uses
function LoadImage_PNG(const AFileName: TfpgString): TfpgImage; overload;
function LoadImage_PNG(AStream: TStream): TfpgImage; overload;
+function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage; overload;
function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage; overload;
function LoadImage_PNGcrop(const AMaxWidth, AMaxHeight: integer; const AFileName: TfpgString): TfpgImage;
@@ -114,6 +115,19 @@ begin
end;
end;
+function LoadImage_PNG(const AImageData: Pointer; const AImageDataSize: LongWord): TfpgImage;
+var
+ s: TMemoryStream;
+begin
+ s := TMemoryStream.Create;
+ try
+ s.Write(AImageData^, AImageDataSize);
+ Result := LoadImage_PNG(s);
+ finally
+ s.Free;
+ end;
+end;
+
function LoadImage_PNG(AInstance: THandle; const AResName: String; AResType: PChar): TfpgImage;
var
res: TResourceStream;