Png transparency

Hello people, probably its a silliy question but i didnt find the way to change the transparency color in a png when i used it as a texture. Im using texture from a png file to make a button, however when i create the button, the png transparency appears always black and i want to change that color.

Some pictures to explain myself better :wink:

the original png:

what i got:

what i want:


If you add an alphastate to the button, that should make the transparent parts… transparent.

Below is the code for that taken from the wiki (the wiki entry is quite long and I think this code is all you should need).

      AlphaState as = display.getRenderer().createAlphaState();

thanks, may be i coudnt express myself ok. i dont want to make transparent anything, i want to change the color of the pixels which appears transparent in the PNG file.

inf fat the code to do sth transparent is :

        final BlendState alphaState = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();

if i dont use BlendState i get a black background in the image, i only want to change that black background.

Sorry if i cant express myself well, my english isnt the best ;)

Well i solved it. i put a quad with the png image and the transparency over a colored box. In the same way i put a  disk over a cylinder to make a "cylinder button". I dont know if its the best way but it works  :smiley:

You can also open it in Photoshop, right-click the Gradient-Tool, select Paint-Bucket, change your foreground color to red, and then paint dump in the transparent areas. That would change it from being transparent to red.

well, i didnt say nothing about this, but i need to change the color as i run my application, so it will be a little hard to use the photoshop approach ;).


Oh very good. Your solution is definitely good then.