C language > Windows questions

GDI+ flat

(1/1)

iwrbc:
Hi,
I am trying to reproduce some of the code in this thread https://forum.pellesc.de/index.php?topic=7146.0. I am confused by this block of code:

--- Code: --- GpBitmap *bitmap = NULL;
GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap); // create a bitmap object with specified width/height/color
GpGraphics *graph;
GdipGetImageGraphicsContext(bitmap, &graph); // create a graphic object via bitmap object

--- End code ---
Because if I copy that to my program, the last line of this block gives a compiler error:
error #2140: Type error in argument 1 to 'GdipGetImageGraphicsContext'; expected 'GpImage (aka (incomplete) struct tagGpImage) *' but found 'GpBitmap (aka (incomplete) struct tagGpBitmap) *'. Which is consistent with the contents of fGdiPlusFlat.h

Am I doing something wrong? Or is there another way to create a graphic object from a bitmap?
BTW My ultimate goal is to create, display and save a bitmap as a .png-file, like in this post https://stackoverflow.com/questions/39551863/creating-gdi-bitmaps-in-memory-and-then-saving-as-png.
Any help is appreciated.

TimoVJL:
Perhaps have to cast it , as GpImage is for common usage

--- Code: --- GdipGetImageGraphicsContext((GpImage*)bitmap, &graph); // create a graphic object via bitmap object
--- End code ---

C++ (Cpp) GdipGetImageGraphicsContext Examples

frankie:
First of all be sure to have the last version of my fGdiPlusFlat.h header file that you can download from here.
Then download the manual here.
Then try the attached example that shows how to save an image (is the sample in the thread you showed).

iwrbc:
Great, thanks for fast reply, I got it working.

Navigation

[0] Message Index

Go to full version