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.

Code Snippets / [DBP] - colour transparency

Author
Message
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 11th Oct 2011 07:27
I posted recently what I thought a bug in reading a colour value:
http://forum.thegamecreators.com/?m=forum_view&t=190061&b=15

so, I sat this evening to see what\'s going on, and I managed to know how to create transparent colours. am not new to DBpro but I just found out the following:

Quote: "colour=RGB(any,any,any)-ALPHA*16777215"

where \"ALPHA\" is the transparency value between 0,255.
the bigger the \"ALPHA\" is, the more transparent the colour.

here you go a simple code. I hope you enjoy this information:
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 11th Oct 2011 20:04
Nice. Could do this:



"everyone forgets a semi-colon sometimes." - Phaelax
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 11th Oct 2011 23:38
sure I agree with you but just wanted to explain the idea in details.
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 13th Oct 2011 02:46
ok guys these two functions can help you set the transparency level for any colour. remember that alpha=[0,255].

enderleit
16
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 20th Nov 2011 07:35
Or...



Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 22nd Nov 2011 17:52 Edited at: 22nd Nov 2011 23:44
Nice work. If you like hexadecimals then you can also write the alpha, red, green and blue directly:

Colour = 0xAARRGGBB - Where your replace letters with hexadecimals

Semi Transparent Black = 0x50000000
Semi Transparent Red = 0x50FF0000
Semi Transparent Green = 0x5000FF00
Semi Transparent Blue = 0x500000FF
Semi Transparent White = 0x50FFFFFF

Opaque Black - 0x000000
Opaque Red- 0xFF0000
Opaque Green - 0x00FF00
Opaque Blue - 0x0000FF
Opaque White - 0xFFFFFF

Also

Opaque Black - 0xFF000000
Opaque Red- 0xFFFF0000
Opaque Green - 0xFF00FF00
Opaque Blue - 0xFF0000FF
Opaque White - 0xFFFFFFFF



ARGB Function:


Login to post a reply

Server time is: 2024-04-19 23:01:42
Your offset time is: 2024-04-19 23:01:42