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.

DarkBASIC Professional Discussion / make black transparent on a bitmap?

Author
Message
Daniel wright 2311
User Banned
Posted: 22nd Oct 2011 09:39
can I make black transparent on a bitmap? And if yes then how?

my signature keeps being erased by a mod So this is my new signature.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 22nd Oct 2011 12:20
Set image colorkey
and
Set object transparency

My signature is NOT a moderator plaything! Stop changing it!
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Oct 2011 19:36
Black is the default transparent color when Darkbasic starts up. The best way is to change the image to an actual transparency and save it as a .png.

basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 24th Oct 2011 07:02
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 24th Oct 2011 10:53 Edited at: 24th Oct 2011 11:14
@Basjak,

The only thing I can't figure out is why you went with Binary when it would have been much easier to use ARGB hex values

For example an (R,G,B,) value of (73,148,183) a turqouise blue
with say 50% Transparency or Alpha becomes...



-----------------------------------

@Daniel wright 2311,
I use to encounter issues with bitmaps and transparency. My answer to the issue was to use load image and paste image noting the transparency flags. Even when using load bitmap command I generally stick to this routine (Not sure if it's actually an issue anymore, but we all get into our habits and never look back) as my failsafe.

LOAD BITMAP "Filename.bmp",Bitmap Number
GET IMAGE Image Number, Left, Top, Right, Bottom, Texture Flag

Texture Flag
Integer
The value of the texture flag to use (0-use stretching, filter, colorkey, or 1-no stretching, no filter, colorkey, or 2-use stretching, no filter, no colorkey, or 3-no stretching, no filter, no colorkey


PASTE IMAGE Image Number, X, Y, Transparency

If the optional transparency flag is set to one, by default all coloured pixels of RGB(0,0,0) are not drawn. Or whatever color you set using SET IMAGE COLORKEY color.


DELETE BITMAP Bitmap Number

Hope that helps.

Your signature has been erased by a mod please reduce it to 600 x 120.
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 24th Oct 2011 19:50
@zenassem:
Quote: "The only thing I can't figure out is why you went with Binary when it would have been much easier to use ARGB hex values"


I know about this option. the problem is you cannot find a function in Dbpro main commands to join these values together without the need of using memblock or math library in Styx plug-in. so I made it with a single line using binary presentation.

for me, binary presentation is easier when I use bit commands.
Daniel wright 2311
User Banned
Posted: 24th Oct 2011 19:52
Well thanks guys, this helped.

my signature keeps being erased by a mod So this is my new signature.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 24th Oct 2011 23:26
Quote: "I know about this option. the problem is you cannot find a function in Dbpro main commands to join these values together without the need of using memblock or math library in Styx plug-in. so I made it with a single line using binary presentation.

for me, binary presentation is easier when I use bit commands. "


Ahhhhh!!! I knew I was missing something.

Your signature has been erased by a mod please reduce it to 600 x 120.

Login to post a reply

Server time is: 2026-07-10 08:57:46
Your offset time is: 2026-07-10 08:57:46