LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pixmap handling with transparency

Firstly, apologies for a few related posts over the last few days, I'm not spamming, I'm just tearing my hair out with my problems.....

 

I'll try to distill the problem down to the following:

 

I want to replace some existing 2D picture control functionality with 3D picture control functionality.  In order to nicely transfer the functionality I need to be able to add transparency to the pixmaps I can generate from the 2D code in order to apply partially transparent textures to 3D objects (quads or height fields).

 

I can apply the "normal" 2D pixmaps but layering 3D items over each other only shows the upper one (since there's no transparency).

 

I have looked at a "Blending.vi" example posted HERE and have thought to understand it but I cannot for the life of me create a 32-bit pixmap with transparency from a standard 2D colour pixmap (8-bit) without transparency).

 

Here's my failing VI where I am trying to set a specific colour to transparent in my superduper pixmap transformation VI.

 

Any tips at all are more than welcome.....

 

Shane.

0 Kudos
Message 1 of 3
(2,944 Views)

A lot of ground to cover to get from point a to point b.

 

(1) Create Mask.vi is your friend.  Does the job of generating the mask given a transparent color, as long as you remember point 2.

(2) 8-bit images are indexed, and the exact color you choose to be transparent must be in the color table.  Picture to Pixmap does not always use the exact value you pass for background.  I do not know enough about your images to suggest a strategy to pick the right color, so for the example I simply choose an index from the color table by hand.

(3)  32-bit PNG works apparently so I used the same trick to stuff the alpha information back into the image data.  I included a slightly modified subVI of mine to convert 8-bit images + mask to 32-bit.

Download All
Message 2 of 3
(2,926 Views)

Thanks Darin,

 

I have gotten my solution to work int he mean time.  I was setting the wrong values for transparency.  I thought a value of 255 was transparent where it is actually opaque and 0 is transparent.

 

Thanks

 

Shane.

Message 3 of 3
(2,924 Views)