Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Set or paint with transparent color?
Set or paint with transparent color? [message #7860] Sat, 27 January 2007 06:18 Go to next message
snap2000 is currently offline  snap2000
Messages: 14
Registered: January 2007
Promising Member
Is there any way that I can paint with or set a transparent color on my own Ctrl? For example, if I were to draw a playing card as a ctrl, and I wanted to round the borders slightly, it would be easier to "erase" the corners than to go out of my way to not try to paint the corners in the first place.
Re: Set or paint with transparent color? [message #7861 is a reply to message #7860] Sat, 27 January 2007 08:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
snap2000 wrote on Sat, 27 January 2007 00:18

Is there any way that I can paint with or set a transparent color on my own Ctrl? For example, if I were to draw a playing card as a ctrl, and I wanted to round the borders slightly, it would be easier to "erase" the corners than to go out of my way to not try to paint the corners in the first place.


Not sure I quite understand, but I guess the straight reply is no.

The problem is that it is not known what is the correct background. If things are transparent, the only correct solution to get the right appearance is to paint things in z-order...

MIrek
Re: Set or paint with transparent color? [message #7872 is a reply to message #7861] Sun, 28 January 2007 06:34 Go to previous messageGo to next message
snap2000 is currently offline  snap2000
Messages: 14
Registered: January 2007
Promising Member
luzr wrote on Fri, 26 January 2007 23:04

snap2000 wrote on Sat, 27 January 2007 00:18

Is there any way that I can paint with or set a transparent color on my own Ctrl? For example, if I were to draw a playing card as a ctrl, and I wanted to round the borders slightly, it would be easier to "erase" the corners than to go out of my way to not try to paint the corners in the first place.


Not sure I quite understand, but I guess the straight reply is no.

The problem is that it is not known what is the correct background. If things are transparent, the only correct solution to get the right appearance is to paint things in z-order...

MIrek


That's fair enough.

So is there no way to be able to paint a mask on a Ctrl, for example?


EDIT: Maybe I should try another approach to my question... So, ini my playing card, by painting a transparent color, I mean is there any way that I can set the color to "don't paint me", so that instead of being erased, it becomes transparent. Another way would be coloring it pink, for example, and setting pink as the transparent color that isn't drawn (this also applies to an upcoming concern, making a color transparent in an image, such as pink)?

Does that seem any more possible?

[Updated on: Sun, 28 January 2007 06:37]

Report message to a moderator

Re: Set or paint with transparent color? [message #7874 is a reply to message #7872] Sun, 28 January 2007 08:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, I am not sure why you are trying so complicated approaches.

If you need transparent background and round corners, do just that.

Make your widget Transparent(), draw round corner images in .iml designer (with transparent areas) and draw your cards...

Mirek
Re: Set or paint with transparent color? [message #7881 is a reply to message #7874] Sun, 28 January 2007 21:16 Go to previous messageGo to next message
snap2000 is currently offline  snap2000
Messages: 14
Registered: January 2007
Promising Member
luzr wrote on Sat, 27 January 2007 23:35

Actually, I am not sure why you are trying so complicated approaches.

If you need transparent background and round corners, do just that.

Make your widget Transparent(), draw round corner images in .iml designer (with transparent areas) and draw your cards...

Mirek


I wanted to be able to know if I make certain things dynamic, and later I'll be wanting to include external images from the hard drive, and make a certain color show as transparent (e.g. Chess pieces).

But, I suppose for the sake of learning, I'll just try it this way. Thanks. Smile

[Updated on: Sun, 28 January 2007 21:18]

Report message to a moderator

Re: Set or paint with transparent color? [message #7884 is a reply to message #7881] Sun, 28 January 2007 22:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Quote:


I'll be wanting to include external images from the hard drive, and make a certain color show as transparent



Ah, sorry, that is completely different thing Smile

Sure, you can do that as well. In fact, with new Image, this is quite trivial, just load your image, make ImageBuffer for it, get a pointer to pixels and scan through replacing your transparent color with empty space....

Mirek
Re: Set or paint with transparent color? [message #7887 is a reply to message #7884] Mon, 29 January 2007 00:11 Go to previous messageGo to next message
snap2000 is currently offline  snap2000
Messages: 14
Registered: January 2007
Promising Member
luzr wrote on Sun, 28 January 2007 13:27

Quote:


I'll be wanting to include external images from the hard drive, and make a certain color show as transparent



Ah, sorry, that is completely different thing Smile

Sure, you can do that as well. In fact, with new Image, this is quite trivial, just load your image, make ImageBuffer for it, get a pointer to pixels and scan through replacing your transparent color with empty space....

Mirek



Okay, so it's not as simple as setting an attribute, but it's doable.

Although, that means that I can also achieve my previous desire by writing to an image object and using ImageBuffer to do the same thing, no? Smile
Re: Set or paint with transparent color? [message #7888 is a reply to message #7887] Mon, 29 January 2007 07:27 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
snap2000 wrote on Sun, 28 January 2007 18:11

luzr wrote on Sun, 28 January 2007 13:27

Quote:


I'll be wanting to include external images from the hard drive, and make a certain color show as transparent



Ah, sorry, that is completely different thing Smile

Sure, you can do that as well. In fact, with new Image, this is quite trivial, just load your image, make ImageBuffer for it, get a pointer to pixels and scan through replacing your transparent color with empty space....

Mirek



Okay, so it's not as simple as setting an attribute, but it's doable.

Although, that means that I can also achieve my previous desire by writing to an image object and using ImageBuffer to do the same thing, no? Smile


Sure.

Mirek
Previous Topic: Grabbing mouse events
Next Topic: Native common dialogs
Goto Forum:
  


Current Time: Tue May 07 00:57:55 CEST 2024

Total time taken to generate the page: 0.02680 seconds