Draw a texture with alpha?

BlitzMax Forums/MiniB3D Module/Draw a texture with alpha?

ima747(Posted 2008) [#1]
Is it possible to create a texture/brush on the fly with alpha transparency?

For example. you have a flat surface, and a texture applied but the texture is transparent, making the surface transparent since there's nothing to see in the texture. Then you draw a line across the surface with an alpha of value of 128 so you can still see through it but there's something on the previously invisble surface now.

I know I could create a masked image and use backbuffertotex and then make that a texture to have masked transparency but I can't seem to find a way to use draw commands with alpha and be able to capture it. All the documentation I can find is from B3D and you just set the draw buffer to the texture's buffer, draw away then set it back to the backbuffer but BlitzMax doesn't support drawing anywhere but to the backbuffer it seems...


Mr. Write Errors Man(Posted 2008) [#2]
I create textures on the fly by giving a pixmap to a TTexture. I haven't tried if it supports alpha of the pixmap, but I don't see why it wouldn't.


ima747(Posted 2008) [#3]
That should but I don't think there's a way to use draw commands (drawline, drawpoly, etc.) on a pixmap, only the backbuffer. If I just needed lines I could make my own drawline function but I need more than just lines so re-writing all the draw functions doesn't sound like fun if there's an easier way.


Mr. Write Errors Man(Posted 2008) [#4]
How many and how different shapes do you really need? If not too many, you might load the different shapes into pixmaps as premade images and then read and write pixels on the destination pixmap as required.


ima747(Posted 2008) [#5]
I need the user to be able to draw (think vector graphics pain program) and use that as a texture. Additionally I need to mix in other chunks of pictures with alpha as fill textures for shapes they draw... hence the desire for base draw commands like drawline, with alpha so the texture can be translucent etc...