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 / Solid sprite with alpha control??

Author
Message
Petr
16
Years of Service
User Offline
Joined: 1st May 2008
Location:
Posted: 9th May 2008 09:35
Hi,

I need some help here.

I need a sprite that is solid and that I can control its alpha (basically I need to fade in/out pictures with black in them) but I am only getting one of the two:

Alpha works but black color is see through:
dbSetSprite(1, 1, 1);
dbSetSpriteAlpha(1, 128);

Black is now solid but alpha does not work:
dbSetSprite(1, 1, 0);
dbSetSpriteAlpha(1, 128);

Thanks.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 9th May 2008 18:11
I'm not sure how you're going about it but can you use dbSetImageColorKey to set the transparency color of your image to something other than black?

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 9th May 2008 19:42 Edited at: 9th May 2008 20:09
This happened yesterday in the DBPro forum. Let's see if it is the same thing.

Alpha transparency is not the same thing as image transparency. Image transparency is only a single color key, like Lilith said.

Images with alpha channels use a separate channel for the alpha. PNG and TGA are the best for this, but MSPaint does not save an alpha channel, just the RGB.

You need a paint program that uses an alpha channel for that to work.

If you don't have such a program, you can post the image and I can fix it for you.

This image uses the red channel as the source for the alpha, so it really doesn't show a great use of alpha...but, your program should be able to set the transparency of the flag using alpha:

Attachments

Login to view attachments
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th May 2008 02:33
You can also do what JinZai said programmatically...

1: load image
2: make memblock from image (1st DWORD = width, 2nd DWORD = Height, 3rd DWORD = Bit Depth usually 32 in DarkGDK for me so far) After that, each pixel is a DWORD. Each DWORD has four bytes, one for red, green, blue, and alpha.. I forget the order... but....
4: By manipulating the Alpha channel, you can poke holes, or fade stuff more or less that other parts in same image...

Its cool once you get it going.

Petr
16
Years of Service
User Offline
Joined: 1st May 2008
Location:
Posted: 13th May 2008 08:08
Thanks for all the answers.

Login to post a reply

Server time is: 2024-09-29 19:28:17
Your offset time is: 2024-09-29 19:28:17