05-30-2010, 07:32 PM
brianmount Wrote:We have a template that contains a PNG file. The original PNG did not define a transparent color, but Rob marked white as transparent in the interface editor. In the editor, the image shows up masked properly, but my program is missing the transparency, and showing a white fill rectangle around the image.
That is to be expected since the masked blit operation isn't supported in the RIVA protocol right now, so you are just getting it as a regular blit. So you are drawing the non-masked version of it.
Quote:What is the effect of setting a transparent color in the interface editor? What sort of file do you wind up sending? Will it use color transparency, or alpha transparency?
Normally you wouldn't do it for a PNG file, since they are alpha transparency based, though you can. What it should do (and will once we do V2 of the protocol) is send you a masked blit command, which will reference the image as usual, but also provide you with a transparency color. You would grab the image from your cache, mask it with the color, and draw the masked version.
The way it normally works is that you create a mask image, which is a monochrome version of the image where every pixel that is not of the color is black and every pixel that is of the color is white. And you create a 'masked off' version of the original. Then you use this with the correct raster op to create a 'hole' in the screen. Then you use another raster op to then blit the masked off image into that hole. This process is pretty documented out there in the internet if you want to look it. If you search for bit blit and color transparency you should find plenty of descriptions. The specific details will depend on the OS API.
I'm thinking that the RIVA clients may want to have the option to store masled versions of images. If you are ever asked to draw an image masked, then you will always be asked to draw it masked, and with the same color. Because the image is put into the repository as a color based transparency image with a particular color.
So, if you ever get a request to do a masked draw of the image, you can probably go ahead and just put the monochrome mask image into the image cache and keep it around, along with the pre-masked original image. Then, when you are asked to draw it masked, you already done all the work and just quickly do the two blits that will blend it into the background. This is what the regular IV does. Each cache entry has the option to hold a mask in addition to the image itself, and a flag that indicates whether it's a masked image or not.
Dean Roddey
Explorans limites defectum
Explorans limites defectum