01-18-2024 04:32 PM
Okay so I have a front panel, with some boolean controls on it. I want to get the image of that control, and I want to put that image on top of other images. The background color of the other images is controllable, so if I use the Get Image invoke node method on the control reference, and just set the background color to what the background is of the pane that the boolean is on, then it is convincing enough. But I am having issues when these boolean controls are in other controls. If it is in a Cluster for instance I need to get the image of the background of the cluster. Clusters can be transparent so I need to keep getting the owner controls until I find one that isn't transparent. For bonus points I can also use the Create Mask VI to mask out a color, and I can use the color of the background element to get an even cleaner image of my boolean control.
This is all a pain but doable. The issue I have is when my boolean is in an array. My main goal is to just get the boolean control, with the alpha or specific colors masked out. But when it comes to having booleans in arrays that is an issue. Any suggestions? Attached is a demo of what I mean. Set the enum then run it. For the scalar we just get the pane color. For clusters we get the color, then if it is transparent, keep going up until we find a color, or find the pane. But how do I handle the array? Thanks.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
Solved! Go to Solution.
01-18-2024 05:04 PM
A little janky, but you can get the reference to the boolean text and extract its background color:
01-18-2024 07:53 PM
Some things just aren't accessible through property/invoke nodes. Here's my kludge:
01-19-2024 01:04 AM
I amc urious about what this is actually useful for? Do you want to display this on some dedicated display?
01-19-2024 08:12 AM
Paul I think I like your method more. I didn't realize you could make the array elements hidden that might work more reliably since getting the background color is also helpful when other controls are in the array. Still I did try some other array types and got weird colors using your method. I think I'll hide the array elements, then get the image size, but then try to pick the center pixel (divide width by 2 then height by 2) then pick that color. How was the divide by 3 you used, supposed to work? I get that there are 3 bytes per pixel but where in the image are getting the color from? I'd want to avoid the edges since the array will likely have some kind of a border. Since there are an unknown number of rows or columns being shown I thought staying in the center would fix that.
@Quiztus2 wrote:
I amc urious about what this is actually useful for? Do you want to display this on some dedicated display?
This is for a pet project I've worked on, off and on over the years. It converts a VIs front panel to a web page that you can interact with. I'm making pretty good progress but it is one of those things that I'll never get 100% complete on. Here is the last public release a while ago.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-19-2024 09:41 AM
@Hooovahh wrote:
Paul I think I like your method more. I didn't realize you could make the array elements hidden that might work more reliably since getting the background color is also helpful when other controls are in the array. Still I did try some other array types and got weird colors using your method. I think I'll hide the array elements, then get the image size, but then try to pick the center pixel (divide width by 2 then height by 2) then pick that color. How was the divide by 3 you used, supposed to work? I get that there are 3 bytes per pixel but where in the image are getting the color from? I'd want to avoid the edges since the array will likely have some kind of a border. Since there are an unknown number of rows or columns being shown I thought staying in the center would fix that.
@Quiztus2 wrote:
I amc urious about what this is actually useful for? Do you want to display this on some dedicated display?
This is for a pet project I've worked on, off and on over the years. It converts a VIs front panel to a web page that you can interact with. I'm making pretty good progress but it is one of those things that I'll never get 100% complete on. Here is the last public release a while ago.
Dividing by 3 ensures that the R, G, B boundaries line up. Off the top of my head I figured that would grab a point 1/3 the way down and 1/3 the way over. Maybe that's not correct and it sometimes grabs a pixel near the edge.
01-19-2024 09:46 PM
I expected this to work, but it's way off and I don't see the error.
01-20-2024 08:57 AM - edited 01-20-2024 09:07 AM
The red dots were killing me.
Here is is fixed up (I also simplified the math and the BD),
01-22-2024 08:47 AM
And now for a styling question: Which looks better:
A:
B:
01-22-2024 08:55 AM
I like A better, but it really doesn't matter.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord