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 / Saving PNG with Alpha

Author
Message
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 30th Jun 2013 04:37 Edited at: 30th Jun 2013 05:05
OK, in another thread I used this to LOAD an image that was using transparency. It loads the image I made with GIMP just fine with the bottom part of the function below. However, I am wanting to make this same picture with transparency in PNG format, just like my picture below. But I end up creating nothing but black texture every time. It won't grab the yellow filled disc I create, nor will the black around the disc become transparent.

This doesn't matter if I have a camera set up or not. Its the same result every time.

Ideas ?



Here is a working PNG. I am trying to recreate this PNG with DBP and then save it to be called back into the program.




This is what I keep ending up with :




Here is the sun image I made with transparency using GIMP ( which is the yellow disc looking PNG file above ) and so this is what its supposed to look like. But in DBPro, I can't seem to achieve this correctly.

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Jun 2013 19:19
Code works fine for me with your image.

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 30th Jun 2013 19:40
Why not arrange it so you don't have to run the program twice?


I haven't tested but you shouldn't need to sync because the image isn't being drawn on screen.
I don't like how you are using "sun_texture_num" as both the texture number and object number as well, that is needlessly confusing.

The difficulty in learning is not acquiring new knowledge but relinquishing the old.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Jun 2013 19:53
This works for me:



I'm using IanM's Matrix1 version of the rgb() function (it includes alpha) and I also needed to set the bitmap format at the beginning to ensure DBPro used the alpha component.

And I agree with OBese87 that you shouldn't need to sync the screen.
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 30th Jun 2013 22:14 Edited at: 30th Jun 2013 22:15
@Green Gandolf, That's EXACTLY what I needed. Thank you.

@OBese87 I hear ya.

Quote: "And I agree with OBese87 that you shouldn't need to sync the screen."


This is what I wasn't aware of. OK thanks.

Login to post a reply

Server time is: 2026-07-08 12:46:56
Your offset time is: 2026-07-08 12:46:56