semitransparent sprites

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mindplay.

I have been trying out the demo version, and I'm stuck with some concerns about it's 3D sprite support...

The Sprite3D library seems pretty neat - it's exactly what I need, 2D sprites, accellerated with 3D hardware, lots of nice blending options and so on, BUT... none of the example show sprites with semitransparent areas, i.e. an alpha-channel - transparency. Is semitransparent sprites at all possible in PB??

And if it is - how do I get my semitransparent graphics out of photoshop and into PB? it only seems to support BMP files, and photoshop does have options for saving 32-bit BMP files - I would have thought these would include the alphachannel, when you save an image with a single layer, but for some reason it doesn't. When I load the BMP file back into photoshop, it has lost transparency, and instead has a single additional channel which is just black. So how can you make BMPs that preserve transparency?

Please note, I'm not interrested in how to mask out a single color from a 24-bit image - this is not useful, because you get jagged edges, and it looks horrible when zoomed, so .. :wink:

Thanks :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mindplay.

Can nobody answer? Does PureBasic support semitransparent sprites or not??
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Manolo.
Originally posted by mindplay

Can nobody answer? Does PureBasic support semitransparent sprites or not??
Hi,
I dont work with sprites, but I think that te next explanation from the PureBasic Help can help you:

Syntax

DisplayTranslucideSprite(#Sprite, x, y, Intensity)
Description

Display the #Sprite at the specified position on the current screen. The color 0 is considered transparent (this color will not be displayed). The intensity controls the transparency of the sprite over the background. Intensity values can vary from 0 (fully transparent) to 255 (opaque). This effect is also known as 'AlphaBlending'. This command is clipped, so it's perfectly legal to display the sprite outside of the screen.

Regards,
Manolo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Sorry for the late answer and the answer to your question is no, PB doesn't support sprite with 'alpha channel' transparency (256 levels). It just a translucide effect, with 256 unique level. I plan to add this feature in a near future tough.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Kale.

try this post, it has a sample of code dealing with transparent sprites:

viewtopic.php?t=4631

--Kale

Getting used to PureBasic and falling in Love! :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mindplay.

Fred,

That's good news :) ... you'll probably need to support an additional file format for loading graphics though, since BMP doesn't support alpha ... if I may suggest, go for a 32-bit uncompressed TGA loader - it's an extremely simple file format, and widely supported in most graphics apps (including photoshop and 3d studio) ... a description of the file format is here:

http://www.organicbit.com/closecombat/formats/tga.html
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Thanks for your input.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mindplay.

Is there a change log somewhere? I'd like to keep an eye on coming releases, to see when/if this gets implemented ... I'm not registered, but I will, as soon as this one missing feature is implemented - it's the one thing holding me back, everything else is ... pure ... heaven :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Go to:

http://www.purebasic.com/

In the news Section, there's everything about the new Updates, there is always a link to a detailed List of changes made.

Timo
Post Reply