Suggestion-> Specify transparent color when LOADSPRITE

Previous topic - Next topic

goomoo

Normally GLBasic uses the pink color(rgb(255,0,128)) as sprite's transparent color, this is not well. Suppose the main color hue of background image is blue, when we use Pink as transparent color ,there will be some Pink pixels surround the sprite, it looks bad. But if we specify Blue as transparent color,  it will be looks better.


Another perfect way is to use PNG image as sprite, GLBasic can get  transparent infomation from PNG images' alpha channels, further more, this way can get semi-transparent effects.

Best regards.

Goomoo Zeng

Kitty Hello

I take care of this like that: Create a blue image, hwatever. Then, write it as bitmap to disk. Next, load it with MSPaint program, fill the blue part with the pink, save it. Now you have a transparent sprite with a blue border.
PNG would bloat up the executable size a lot, since I had to include zlib. I'd rather stay with BMP.

LudoAtHome

I'm a complete newby trying to evaluate ...

I was interested by this thread, and found out that the FONTS are not transparant either.
How can you make a transparent font ?

Ludo

Kitty Hello

OK. Use the Menu: Tools/Font Creator. Fonts (very stupid) use RGB(0,0,0) as transparent color. It should have changed but for compatibility reasons with the very old DiNGS Game Basic I kept this... Would be a slap in the face to change it - what do others think?

Hemlos

What would be the point of a transparent font?!
Bing ChatGpt is pretty smart :O

Kitty Hello

The pixels not belonging to a character are transparent.

Hemlos

Black transparency is more asthetic than the pink, i dont like those edges.
If you want to make a black font, you can just use rgb(1,1,1)
As far as the pink edge thing with sprites, that becomes a very tedious process in changing the edges of sprites transparency...not to mention it ruins the quality of the original image.
I do like the idea of a black transparency, i think i did suggest that myself, a long time ago in the DiNGs days heh.
Perhaps you can make a command?
Code (glbasic) Select
SPRITE_TRANSPARENT Color#And make it reuseable in case color schemes or sprites change?
-hem
Bing ChatGpt is pretty smart :O

Kitty Hello

Might be an option. The pixel border will have the color of the neighbour pixels. You will _not_ see any pink artefcts anymore now, if your transparent pixels are 100% RGB(255,0,128). Again: For transparent pieces, use MSPaint. It's the best for this purpose, as it does not blend the pink with any neighbour pixels (anti-aliasing)

kanati

It would still be better to allow the user to define which color he/she wants to be transparent.  That's my vote...  A transparent color flag on the sprite loading...

Hemlos

The only time Pink aliasing is a problem is if the image was originally created using true pink for the background ON THE SAME LAYER, thus pixels fading into a an edge retain a pink shade. You can try to use layers of color in more advanced image software, like paint shop pro, but make sure you save it to the correct bmp format. MSPaint will create the proper format if you open and save it in there. You can also make sure your background color is the right shade of pink with the easy color tool.

Quote1 .Typically what i do when i want an image with special edges..i use a black background in my image program.

2. next i apply my special effects to the images

3. i select and copy everything that isnt black..if theres a hole...i fill it.

4. then afterwards i open mspaint(easy to use colors) and paste the work onto the pink background.
This produces images with no pink antialiasing on one layer.
The idea is to separate your image from the pink background while you are working on it, and aftwerwards put it onto a pink background.
Bing ChatGpt is pretty smart :O