Make an Image Transparent
Blitz3D Forums/Blitz3D Programming/Make an Image Transparent
| ||
Hello, I was just wandering is there a way to make an image transparent in blitz?? |
| ||
transparent? you mean half-transparent? This is relatively slow if you do it in 2D, using DrawImage etc. It is much faster when you use Sprites or quads in 3d Mode instead. However, in 2D Mode you would need to read the background pixel, read the image pixel, mix them 50:50 and write the result to the screen. Of course, you need to do this with all pixels of the image. You would use Readpixelfast and Writepixelfast commands. there are some tricks to mix 2 pixels quickly: rgb1=readpixelfast(x,y,imagebuffer(img)) and $FEFEFE rgb2=readpixelfast(x2,y2,backbuffer()) and $FEFEFE mix=(rgb1 shr 1)+(rgb2 shr 1) writepixelfast x2,y2,mix,backbuffer() If you have Blitz3D you better use one of the examples to use Sprites or Quads as Pseudo-Images. That's much faster and you can make them as transparent as you want, zoom them, rotate them etc etc etc. Check out the Code Archives. |
| ||
there was a hack wasnt there,... it was pretty fast or was it b+ only... |
| ||
direct image buffer access - pretty untested IMHO (dynamic storage method choice...). Also - not sure if the 16Bit conversion was released too. |