NO

Author Topic: Another updated port to C of GDI+  (Read 29701 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Another updated port to C of GDI+
« on: May 17, 2016, 08:00:04 PM »
The use of GDI+ is mainly limited because of the lacking of header to use the so called flat API's.
Searching around some hackings can be found, but they are old and in some cases limited.
I made a fast workout of last SDK and this is the result.
I'll look forward for comments and suggestions to make it a final release.

P.S. The test program of course is based on the historic GdiPlus demo.

EDIT: Removed some bugs and added 64bits version (see note in newer post).
EDIT: I forgot to put inside the fGdiPlus.h  >:(. Updated
EDIT: Updated version
« Last Edit: May 20, 2016, 01:42:20 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #1 on: May 18, 2016, 08:22:26 AM »
Nice job with the header 'fGdiPlusFlat.h'

John

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Another updated port to C of GDI+
« Reply #2 on: May 18, 2016, 03:21:09 PM »
Thanks John  :)
I have updated the project, I've found problems compiling for 64bits:
  • Allocations made with malloc were erroneously deallocated with GdipFree and crashed under 64bits. Corrected using GdipAlloc for allocation.
  • GUID's for Imaging are'nt defined in GdiPlus.Dll under 64bits. Added symbol to force instantiation.
If somebody can check for other problems I'll be glad.
If there are no more problems I'll publish under contributions.
« Last Edit: May 18, 2016, 03:23:24 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #3 on: May 18, 2016, 03:53:00 PM »
Yes you're right about malloc, well done.

John

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: Another updated port to C of GDI+
« Reply #4 on: May 18, 2016, 09:25:05 PM »
Can you post a link to fGdiPlusFlat.h?

http://forum.pellesc.de/index.php?topic=4165.msg21438#msg21438 is not the right one.

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #5 on: May 19, 2016, 07:12:53 AM »
Attached.

John

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Another updated port to C of GDI+
« Reply #6 on: May 19, 2016, 09:31:53 AM »
JJ It was my wrong. I forgot to add the include file.
I have update the download with the last version, that is slightly different from the older previous one supplied by John.
Thanks John anyway.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #7 on: May 19, 2016, 09:45:20 AM »
In your new download you have

#include <fGdiPlusFlat.h>

instead of

#include "fGdiPlusFlat.h"

John

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Another updated port to C of GDI+
« Reply #8 on: May 19, 2016, 11:20:03 AM »
Yes because I have put the fGdiPlusFlat.h in "PellesC\include\win" to use it in more projects that I'm testing.
If the file works this should be the final location, to copy it in each project is not effective.
I'll update the download.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #9 on: May 19, 2016, 08:01:20 PM »
'if the file works'! Of course it'll work.  :)

John
 

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: Another updated port to C of GDI+
« Reply #10 on: May 20, 2016, 04:05:15 AM »
I have update the download with the last version, that is slightly different from the older previous one supplied by John.

Thanks to both of you.

Btw it chokes with main.c(33): fatal error #1035: Can't find include file <fGdiPlusFlat.h>, but that can be "healed" by using quotes instead of brackets:

#include "fGdiPlusFlat.h"

Apparently <file.h> searches the default include folder, while "file.h" searches in the current folder - see this SOF thread.
« Last Edit: May 20, 2016, 02:27:42 PM by jj2007 »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Another updated port to C of GDI+
« Reply #11 on: May 20, 2016, 01:44:26 PM »
Thanks John. I have updated the download, maybe you want add it to your site together with the old GDI+ sample.
JJ As I told to John in my former post I used <> because I have put my copy in the PellesC include directory. Anyway I updated the sample. Now is correct.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #12 on: May 20, 2016, 02:02:05 PM »
Yes, I will add it to my site.

EDIT: Ok, done.

John



« Last Edit: May 20, 2016, 03:24:40 PM by JohnF »

JohnF

  • Guest
Re: Another updated port to C of GDI+
« Reply #13 on: May 22, 2016, 11:00:46 AM »
So, to anyone doing GdiPlus demo(s) you are welcome to have it on my web site! :)

EDIT: Using Frankie's new header of course.

John


« Last Edit: May 22, 2016, 01:02:58 PM by JohnF »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Another updated port to C of GDI+
« Reply #14 on: May 26, 2016, 07:18:55 PM »
attached you'll find the last version of fGdiPlusFlat.h with the first part of a paper on use of GDI+ under C and a test program.
The examples in the paper are coded in the example program.
Let me know your comments.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide