Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / What "color" are transparent? How to make things in a picture transparent?

Author
Message
Alahadi
14
Years of Service
User Offline
Joined: 24th Dec 2009
Location: Sweden
Posted: 11th Feb 2010 23:16
If I want to make a ball, I make one in paint(for example) but it will be a white square with a ball(in some color) in. Now I want to set this ball in my program but I just want the baal to be seen not the background.

I've noticed that there is some color that makes it transparent, but what color is that?

My question are simple: How to make things in a picture transparent?
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 12th Feb 2010 05:30
My recommendation is to skip the complications and make your image a .png file with the areas transparent that you want them to be.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 12th Feb 2010 07:45
Quote: " My recommendation is to skip the complications and make your image a .png file with the areas transparent that you want them to be. "


Aldur
17
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 12th Feb 2010 07:59
If you don't choose to go down the png path, you can always use the command:
dbSetImageColorkey() and declare a color that you wish to be read as transparent on an image within the brackets in dword format.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 12th Feb 2010 08:05
which is simply a headache, using an alpha channeled image, you can make more than one color transparent, and you can control the transparency of each part of the image, unlike dbSetSpriteAlpha which controls the overall alpha of it, using .png or .tga is a much better option

Aldur
17
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 12th Feb 2010 15:46
I agree with Hassan but I posted my previous post in order to answer the question of this thread.
The command I posted above (dbSetColorkey()) does not work with some formats, I'm not sure which ones though.

Tweety J
14
Years of Service
User Offline
Joined: 28th Jan 2010
Location:
Posted: 13th Feb 2010 20:25
I use both PNGs and a color key... in a PNG, you can use the ALPHA channel for a see through image, and the color keys can be used for transparent sections. If I don't need anything to be see through, but just not there, Color keys are easier..
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 14th Feb 2010 00:12
I'm not sure I agree with that. Using color keys makes it hard to reduce the harsh, ragged borders of the image. Although not 100% effective using alpha channel can help to soften the edges.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-11-20 03:39:38
Your offset time is: 2024-11-20 03:39:38