News:

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

Main Menu

FloodFill and ExtFloodFill

Started by zedd151, February 26, 2025, 03:08:52 PM

Previous topic - Next topic

satpro

Quote from: NoCforMe on March 01, 2025, 08:43:05 AMSo could you possibly give a very brief overview of what DD does and how to use it? It might be worthwhile learning it, despite the barriers of having to deal with COM and "interfaces" intended for C++.

Thanks.
I will be happy to, and thank you.  In my opinion DirectDraw is a gem from another time.  Nothing really works, but it does let you access screen ram like in the old days.  And that's big.  Microsoft (obviously) does not want us tinkering with the primary surface.

What I will do is write something separate and explain some things that are not necessarily in all of the docs.  In fact, the farther back you go in time, the more MS was willing to share.  Objects, how to call COM, video sync, what works and what doesn't -- all of it will be covered.

I will show you how to draw there -- it is liberating and so much faster than using the graphics card.  For example, you can fill a box or draw any line before equivalent DirectX COM code executes that does the same, exact thing!  I'll explain this more, but one thing I have found is that once I bypassed the card (I'm talking doing it all in system memory and then SSE-copying directly to video ram) cpu usage goes way down, and the program itself runs faster and smoother -- the exact opposite of what you might expect.

Again, thank you for wishing to give this a second look.  I'll get on that "write" away.

jj2007

Quote from: satpro on March 01, 2025, 10:08:36 AMcpu usage goes way down, and the program itself runs faster and smoother -- the exact opposite of what you might expect

That is indeed interesting, as we are always taught that graphics cards are so much faster than ordinary x86 cpus :cool:

NoCforMe

Quote from: satpro on March 01, 2025, 10:08:36 AMAgain, thank you for wishing to give this a second look.  I'll get on that "write" away.

Well, thank you (in advance).
If you could, would you include at least a couple of drawing operations like lines, ellipses, maybe filled shapes?

Don't care about the programming style here, so don't worry about that. Just want to see how it works "under the hood".
Assembly language programming should be fun. That's why I do it.

daydreamer

I have made several ddraw program and posted in forum before
But coding style more kinda dos style with library or own proc 's for draw different shapes
Fast speed write directly to vram,but the way graphics port worked oneway before 100 * slower reading vram
Isn't it replaced with newer interface ,alternative to GDI it draws hardware accelerated shapes ?

But don't forget d3d9 isn't only Poly's,you also have linelist, pointlist

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

TimoVJL

Not so fun ?
Introduction to DirectWrite

Only two functions to import, D2D1CreateFactory() and DWriteCreateFactory()
so perhaps using dynamic way, so don't need those import libraries.
May the source be with you


zedd151

Suggestion:
Maybe someone can start a new topic dedicated to these Direct Draw discussions?

Perhaps not relevant in a thread where the topic was gdi32 FloodFill and ExtFloodFill. And the issue with those gdi32 functions has been resolved, several posts ago.
¯\_(ツ)_/¯   :azn:

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

zedd151

#52
Quote from: zedd151 on March 01, 2025, 03:50:05 AM:rolleyes:  um.... I found the problem with FloodFill.
Which worked fine in the example Here.

However, after adding several drawing function then add the funtion that uses FloodFill, the drawing is not bothered by moving the window below the task bar anymore... but now when the window is minimized using the window borders similar issues with it:


I had even tried breaking up the outline of the X into 5 pieces to FloodFill smaller sections but that did not help.

The only way I found to resolve this is to call InvalidateRect in WM_SIZE, which restores everything being painted, if the window gets resized using the window border.

Maybe it is better to stick with bitmap images?
Unless there is a way to create the X (using FloodFill) only once. And keep a memory bitmap of it, to be blitted when needed. I confess though, that I have no clue how to do that.  :sad:

Most likely I will revert to using bitmaps...
¯\_(ツ)_/¯   :azn:

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

NoCforMe

Quote from: zedd151 on March 02, 2025, 01:40:56 AMSuggestion:
Maybe someone can start a new topic dedicated to these Direct Draw discussions?
Your wish is my command.
I started a new thread. It's just a placeholder for now, to be fleshed out as more info comes in.
Speaking of which, @satpro, anytime you have some example code for us you can post it there.
Assembly language programming should be fun. That's why I do it.

NoCforMe

Quote from: zedd151 on March 02, 2025, 10:47:36 AMThe only way I found to resolve this is to call InvalidateRect in WM_SIZE, which restores everything being painted, if the window gets resized using the window border.

Well, that's exactly what you should be doing. Does that solve the redrawing problem? If so, then, as they say, Bob's your uncle.
Assembly language programming should be fun. That's why I do it.

zedd151

Quote from: NoCforMe on March 02, 2025, 11:00:37 AM
Quote from: zedd151 on March 02, 2025, 01:40:56 AMSuggestion:
Maybe someone can start a new topic dedicated to these Direct Draw discussions?
Your wish is my command.
...
Siekmanski will be around shortly to help you guys out... a little bird told me.
¯\_(ツ)_/¯   :azn:

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

zedd151

#56
Quote from: NoCforMe on March 02, 2025, 11:02:30 AMWell, that's exactly what you should be doing. Does that solve the redrawing problem? If so, then, as they say, Bob's your uncle.
Just when I thought I had that problem knackered. Is that a legit way to handle it? And yes, it does resolve the drawing irregularities.  Under normal circumstances it was drawing fine otherwise, and no gdi leaks.

Much experimenting on my part to figure all of this out.
¯\_(ツ)_/¯   :azn:

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

NoCforMe

Quote from: zedd151 on March 02, 2025, 11:16:32 AM
Quote from: NoCforMe on March 02, 2025, 11:02:30 AMWell, that's exactly what you should be doing. Does that solve the redrawing problem? If so, then, as they say, Bob's your uncle.
Just when I thought I had that problem knackered. Is that a legit way to handle it? And yes, it does resolving the drawing irregularities.  Under normal circumstances it was drawing fine otherwise, and no gdi leaks.

Yes; the overall point is that you, the programmer, are responsible for making sure things are redrawn when certain events occur, like the window being resized. Not all of this is done automagically by Windows, as you discovered.

And it really has nothing to do with GDI leaks, which happen when you create objects and then forget to delete them. That's a separate issue.
Assembly language programming should be fun. That's why I do it.

zedd151

Quote from: NoCforMe on March 02, 2025, 12:12:34 PM
Quote from: zedd151 on March 02, 2025, 11:16:32 AM
Quote from: NoCforMe on March 02, 2025, 11:02:30 AMWell, that's exactly what you should be doing. Does that solve the redrawing problem? If so, then, as they say, Bob's your uncle.
Just when I thought I had that problem knackered. Is that a legit way to handle it? And yes, it does resolving the drawing irregularities.  Under normal circumstances it was drawing fine otherwise, and no gdi leaks.

Yes; the overall point is that you, the programmer, are responsible for making sure things are redrawn when certain events occur, like the window being resized. Not all of this is done automagically by Windows, as you discovered.
okay.


QuoteAnd it really has nothing to do with GDI leaks, which happen when you create objects and then forget to delete them. That's a separate issue.
yes, I know is a separate issue. But it does happens a lot more than you would think it does.  And not just to me.   :badgrin:
¯\_(ツ)_/¯   :azn:

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

NoCforMe

Quote from: zedd151 on March 02, 2025, 12:19:08 PM
Quote from: NoCforMe on March 02, 2025, 12:12:34 PMAnd it really has nothing to do with GDI leaks, which happen when you create objects and then forget to delete them. That's a separate issue.
yes, I know is a separate issue. But it does happens a lot more than you would think it does.  And not just to me.  :badgrin:
Oh, yeah, I know all about GDI leaks. (Don't ask me how I know.)
That's why Task Manager is your friend.
Assembly language programming should be fun. That's why I do it.