09-18-2008 04:12 AM
Solved! Go to Solution.
09-18-2008 04:41 AM
Hi there
you can create a modal FP without title bar, tool bar, menu, scroll bars etc, run the VI, place the FP over the last tab page using Front Panel Window:Panel Bounds and set the FP properties "Run transparently = TRUE" and the Transparency to a value between 0 and 100. Should work!
09-18-2008 06:40 AM
Could you explain better how I place a front panel over another front panel??
I created the transparent VI like you said, but how can I change the transparent property programmatically?
The flow is : Print button value change event ---> make a fading transition (from 100% transparent to 0% transparent)
thanks
09-22-2008 07:51 AM
Hi,
to set transparency programmatically, you can use property node "FP: Transparency" (place a property node, set class to VI server -> VI -> VI, select Front panel window -> Transparency). If you want to obtain a fading effect, connect the input value to 100 - the iteration terminal of a for loop iterating 100 times. In this way, the transparency property will change from 100 to 0 %.
I hope this will help!
Bye!
Licia
12-03-2008 06:23 AM
But I don't want to create another VI to place over the FP, and set its transparency....
I want to control only the picture control transparency.
Need to extract the content of the image, alter bit by bit and re-draw??? seems weird and time consuming (in a loop N step)
12-03-2008 06:38 AM
Slyfer wrote:Need to extract the content of the image, alter bit by bit and re-draw???
Since LabVIEW does not support transparency for controls and you don't want a separate VI, the answer is yes. Note that to do transparency, you need to get every pixel of the BG and FG images, break into its RGB components and then average the two values (using a weight for the percentage of transparency) and build the image back. The code for this is actually pretty simple.
12-03-2008 09:20 AM - edited 12-03-2008 09:24 AM
tst, try to run my vis, it's LV8.5.1
telle me if it's what you meant and if it can be made better. If there are too much "steps" in the fade effect, I notice bad "redrawing" performance
That is the smooth FX I was intended to do.
Around the forum I found the PNG files support alpha blending channel, but I am not able to exploit it, because that value (alpha) should be in the "mask" variable of the image, and with my files it's always empty value (I tried with PNG images but they were 24 bit, not 32 like it's said in the documentation)
thanks
12-04-2008 10:35 AM
Here's one which seems to work smoothly (backsaved to 8.0). Note that I disabled the Erase First property on the picture control.
You should note that this will only work if both images are exactly the same size, as the arrays need to be aligned.
As for the transparent PNG, LabVIEW does read the alpha channel, but ignores it when drawing. You can do the same sort of sort of merging we did here by reading the alpha channel yourself (every fourth element of the image array, which you can get by using the Decimate Array function). You would probably want to have some code to pad the images so that they are the same size.
If you come up with something, why not post it, so that others can use it as well?
12-05-2008 02:32 AM
tst, thanks for the improvement. I forgot it's better for LV to operate with array data type, so I changed my code avoiding the inner for loop.
The "flickering" update was due to the "erase first" property, which must be turned off, and can be changed programmatically at runtime also.
If I came up with a general subroutine, where can I post it? How can I merge the GPL into it?
12-05-2008 05:22 AM
You should note that my quick example wasn't that efficient either, as it does stuff inside the loop which could be moved outside and done once (not that it really matters, since the LV compiler recognizes this and does the optimization automatically).
As for releasing this, most people who post a code snippet or only a few VIs don't bother with a license and just post the code. If you do want to use a license, I would advise against GPL as it's very restrictive. BSD is very convenient for the user. If you want, the LAVA forums had some discussions on this and you can search there. If you want to see an example of code with a license, you can download the very useful toolkits from OpenG.
As for where to post it, you can simply post it here and hopefully someone will search and run into it. Alternatively, you can try sending it to NI's code sharing site and to the LAVA forums' code repository.