News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

gdiplus tests

Started by zedd151, March 12, 2025, 02:18:44 AM

Previous topic - Next topic

zedd151

#45
Quote from: TimoVJL on March 12, 2025, 10:50:04 PM
Quoteto be clear, Timo.. if I do use a gdi+ API to draw to the DC, will I then need to use GdipDeleteGraphics?
Just in case, that you use GdipCreateFromHDC or similar function
Okay, now I think I got it. Thanks man!

:biggrin:
I'll tinker some more with gdi+ in the future.
For now, this is enough for me to begin using smaller (in kb) images instead of huge 24 bit bitmaps. I will polish up the code, and post it as a "proper example" for others to possibly learn from, away from the distractions here in this WIP thread.

Thanks to all that posted helpful information, and to those that had good (possibly misguided) intentions.
And thank you once again Timo, your help has been invaluable.

Do you have any gdi+ examples in C that you could share, Timo?
I am not adverse to learning from C example code. (As long as it will compile with gcc that is)  :smiley:
... if you don't have anything already written, that's ok.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

jj2007

Quote from: zedd151 on March 12, 2025, 10:00:33 PMAre there other gdip apis that would need GdipDeleteGraphics also?

In my code it's GdipCreateFromHDC that creates the graphics object to be deleted later.

zedd151

That's what I understood from earlier. Thx for the confirmation.  :thumbsup:

Quote from: TimoVJL on March 12, 2025, 01:34:34 PMif object is created with GdipCreateFromHDC() in WM_PAINT, it should be destroyed with GdipDeleteGraphics() after it isn't needed anymore.

¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

NoCforMe

@Zedd: to lessen the confusion here, you should realize that since there are several types of "objects" here, you need to use the relevant function (not an API: the whole schmear is the API) to release/delete/destroy/dispose that object:
  • bitmaps
  • graphics
  • images
So if you create a bitmap, then you wouldn't use GdipDeleteGraphics(), because that applies to a different class of objects (graphics vs. bitmaps). (Unless you create a graphic object from a bitmap, in which case you would use that function.)

I've been able to figure at least that much out so far ...
Assembly language programming should be fun. That's why I do it.

zedd151

All I know is my little example is fine as far as the gdi+ code goes. And I'm happy as a camper to be done with gdi+. Yuck. What a big mess.  :biggrin:
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

jj2007

Quote from: zedd151 on March 13, 2025, 09:36:57 AMYuck. What a big mess.  :biggrin:

Agreed :badgrin:

include \masm32\MasmBasic\Res\MbGui.asm
Event Paint
  GuiImage CL$(), fit
GuiEnd

P.S.: Drag tweety over the exe, then size the window :smiley:

NoCforMe

I second that emotion.
So Zedd: any motivation on your part to look into DirectDraw? Since you've been taking the Magical Mystery Tour of Win32 Graphics Techniques?
Assembly language programming should be fun. That's why I do it.

zedd151

#52
Quote from: NoCforMe on March 13, 2025, 09:55:46 AMI second that emotion.
So Zedd: any motivation on your part to look into DirectDraw? Since you've been taking the Magical Mystery Tour of Win32 Graphics Techniques?
Hell no. After this fiasco. (Not really a fiasco, my code was okay in the end, but the confusion after - definite fiasco)
I think DirectDraw would break my brain.

Quote from: jj2007 on March 13, 2025, 09:53:10 AMP.S.: Drag tweety over the exe, then size the window :smiley:

"GdiPlusEasy.exe"... Easy my ass! 49 gdiplus functions/apis???  :dazzled:  (whatever the hell you'd call 'em, David)

But it was a cute feature.  :azn:  animate on resizing
Bug report: Menu items do not work on click.  :biggrin:

Yves           Yours

Free Yves! Let him go... can't you see he is flapping his wings faster while in captivity trying to escape?
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

adeyblue

Quote from: zedd151 on March 13, 2025, 10:03:01 AM"GdiPlusEasy.exe"... Easy my ass! 49 gdiplus functions/apis???  :dazzled:  (whatever the hell you'd call 'em, David)

I remember when JJ would be posting in astonishment at the prospect of such a simple task needing to import 10 dlls and nearly 300 functions. What happened to that guy? Looks like he's gotten into bed with  the bloat industry *idk what the smiley codes are, imagine there's one here*

zedd151

¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

NoCforMe

Point taken.

In fairness to JJ, though, everything he does, all that pain he goes through with those 10 DLLs and 300 functions, ends up in his baby, his project, MasmBasic. Where it then becomes available to its users (I'm not one of them, BTW) as a very easy-to-use facility, often accomplishing in a single line of code what it takes the rest of us 10 or 100 times that. Which is a pretty good piece of work if you ask me.

Regarding terminology: since when did "functions" become aggrandized to "APIs"? An API ("application programming interface") is the entire collection of things--functions, structures, enumerations, etc.--that accomplish certain tasks. GDI+ is an API; GdipDeleteGraphics() is just a function within that API.

I notice this undue promotion of meaning occurs in lots of other places online, not just here. But let's nip it in the bud, shall we?
Assembly language programming should be fun. That's why I do it.

zedd151

¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

NoCforMe

That's "Perfessor" to you.
Assembly language programming should be fun. That's why I do it.

sinsi

Quote from: NoCforMe on March 13, 2025, 02:51:51 PMRegarding terminology: since when did "functions" become aggrandized to "APIs"? An API ("application programming interface") is the entire collection of things--functions, structures, enumerations, etc.--that accomplish certain tasks. GDI+ is an API; GdipDeleteGraphics() is just a function within that API.
To nitpick further, traditionally a "function" was a procedure you called and got a result back.
Not all Windows procedures return a result, so not all Windows procedures are functions.
Perhaps we could use the term "Windows API call"?
:biggrin:

jj2007

Quote from: zedd151 on March 13, 2025, 10:03:01 AMBut it was a cute feature.  :azn:  animate on resizing

Well, not really a feature :badgrin:

Some trigger is needed to animate a GIF: a timer, resizing, mousemove...

GuiParas equ "An image, hooray!!!!", w300, h300, icon Butterfly
include \masm32\MasmBasic\Res\MbGui.asm

Event Message
  If_ uMsg_==WM_MOUSEMOVE Then GuiCls

Event Paint
  GuiImage CL$(), fit
GuiEnd