Image Trasnaprecy

Blitz3D Forums/Blitz3D Beginners Area/Image Trasnaprecy

MoonShadow(Posted 2006) [#1]
SORRY FOR THE TITLE OF THE POST COMENT-
-IMAGE TRANSPARENCY-

2d question I guess-

Not hide a RGB color, but blend an image over another one. How do you blend (lightly transparency looking) over a background or whatever, another image?


MoonShadow(Posted 2006) [#2]
I try to use [Maskimage i,R,G,B]
but it only hide completly the color of the pixels.


JazzieB(Posted 2006) [#3]
The only way of doing this in 2D is to write a function that uses ReadPixelFast and WritePixelFast to calculate the colour to draw each pixel of your image on to the screen. This has been mentioned so many times before, so you should find plenty of examples (there's likely one in the code archives). However, this is slow and is only really ideal for small images.

If you have Blitz3D, then you can make use of 3D sprites, which are hardware accelerated and very fast. The only problem with this is that you then need to convert 2D screen co-ordinates into 3D world ones to get them to display in the right place. Again, try the archives.

A second alternative with Blitz3D is to look into the 2D in 3D sprite libs that people have written. Some are free, some have a small fee (I think there are demos you can try). You'll probably find links to these in the Toolbox section.


MoonShadow(Posted 2006) [#4]
THANKS JazzieB-


Sir Gak(Posted 2006) [#5]
The only way of doing this in 2D is to write a function that uses ReadPixelFast and WritePixelFast to calculate the colour to draw each pixel of your image on to the screen. This has been mentioned so many times before, so you should find plenty of examples (there's likely one in the code archives). However, this is slow and is only really ideal for small images.


I did this for a game, and indeed found that it slowed down the game horribly. My workaround fixed this, though. I pre-computed the color changes prior to the battle-screen where the blended colors were to be used. Then the pre-blended color images were then simply drawn to the screen with DrawImage, and the battle screen moved like greased lightning.


Ross C(Posted 2006) [#6]
Use a checkered mask pattern. Works well at decent resolutions :o)


n8r2k(Posted 2006) [#7]
lol, in correcting transparency, you spelled comment wrong, whoooo haa hah haaaahahaha, muhahah, *cough* *cough*

okay, i will now try to return to complete sanity,

adding to Ross C, basically if you are using 2d and you have an image premade, you could make a chekered masked pattern, combine the two images onto a blitz created image, then do the same for the second image only flip the checkered pixels, and place the two images ontop of eachother. this might not be the best method for whatever your doing, it depends, you might want to try it though.

i am sorry for what ever my evil side said earlier in this post


MoonShadow(Posted 2006) [#8]
Thanks people!

-n8r2k is ok, I have to deal with that almos every day. My best friend is 1/2 evil!