Jump to content

GDIPlus - Redraw Transparent Image Problem


ripdad
 Share

Recommended Posts

This is what I want to do:

1. Load a regular image using GUICtrlCreatePic() onto the GUI.
2. Load a completely transparent image in GDIPlus on top of the GUI image.
3. Draw on the transparent image.
4. Redraw/Clear the transparent image when ready.

It works, but there's a problem.

It draws, but I can't get it to clear the previous drawing.

So, I made a half transparent, half background color (yellow) image.

What does it do? (shaking my head)

It clears the yellow half, but not the transparent half of the same image.

This doesn't make any sense to me.

Any suggestions? I would appreciate it!

I don't need help with the script -- I just need an explanation why,
and/or perhaps some kind of work-around.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

As I understand it, a layer on top of another layer is just that. But hey, I will give it a shot, just to be thorough.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

It didn't work.

I would expect that it would clear whatever I draw on the transparent image. It doesn't.

It's like it's ignoring the transparency layer and writing directly to the GUI dialog.

If I'm working with transparency layers in an image editor, and I delete a layer, it's gone, along with whatever I drew on that layer.

So, this is not making much sense with GDIPlus.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

21 minutes ago, ripdad said:

It didn't work.

I would expect that it would clear whatever I draw on the transparent image. It doesn't.

It's like it's ignoring the transparency layer and writing directly to the GUI dialog.

If I'm working with transparency layers in an image editor, and I delete a layer, it's gone, along with whatever I drew on that layer.

So, this is not making much sense with GDIPlus.

 

Try re-writing the var that contains the transparent image then re-writing it again to contain the transparent image...? or maby it is actually drawing on the gui and not the image?

Link to comment
Share on other sites

Tried that using _GDIPlus_ImageGetGraphicsContext(), which contains the image. No success.

Also tried a series of "Dispose".

I shouldn't have any problems with this, since it will work with any normal image; even when I look behind them.

I suppose it might be some kind of quirk or bug at this point. Just like to cover all my bases here.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

rm4453,

Found the solution...

_GDIPlus_GraphicsClear()

Should have known that, but I've never used it before.

Thanks for your help.

 

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...