05-09-2012 06:37 PM
hello all,
how can i make a custom 12 bit (4096) colorbox similar to the one in labview but only show the 4096 colors, i
i converted 12 bit RGB to 24 RRGGBB and picked equivalent colors from labview colorbox into an array, but physical size of the array is too large for those 4096 colors with array seperatorsto show on my VI
can it be made to look like the color selector in labview, which gives continues R G B values below
i dont necessarily need a running VI like the Labview color box, but need those colors in small foot print and be able to select any one of them easily.
Thanks in advance
05-10-2012 02:17 AM
Use a picture control and the picture VIs to build the palette with no borders between the colors. Then use events to get the current color when moving over the palette. You can see an example here which uses the full palette. All you need to do is replace the image with your own.
05-10-2012 09:07 AM
freemason,
Your question intrigued me a little as I have recently been thinking about custom color selections. There was an example posted in another thread of that provided a method for popping up the color box selector to change background colors in a table. I used this example to make a modification to only allow 12-bit colors to be selected. I made a modification to the native unflatten pixmap.vi to limit the colors to 12-bit.
I'm not sure if this is anything similar to what you were needing to do, but thought I'd share.
I've attached the example Color Selector.vi & my modified sub-VI.
Regards,
James
05-10-2012 02:43 PM
Thanks James,
its a good implementation but what i need is a little different.
i have LCD screen which supports 12 bit color in RGB hex command,
so i need to pick RRGGBB equivalent 24 bit colors from the labview colors and frame it in a way that looks like the pop-up color bar , same size , but contain only 4096 colors and i should be able to select one to , convert the hex string back to RGB and send it to LCD screen via serial.
if i output the 8 bit pixmap array, all the elements of array from your picture control (color bar) are within 8 bit (0-255) range.
my question is about your conversion process, shouldnt the 12 bit pixmap array elements be with in 0-4095?
I see that you are masking each 8 bit by 1111 0000 and getting an equivalent color of the 24 bit by doing so
your 12 bit array elements in hex are R0G0B0 format which by the way produces equivalent color.
if i remove the alternate 0's and just pick RGB values from your output i am getting an equivalent 12 bit color which is a little lighter than the original on my LCD,
if i replace the alternate 0's with same R G B to make RRGGBB i am still getting a similar color only darker this time on my LCD.
is this the correct conversion from 24 to 12 bit? or is it just picking equivalent colors
-Thanks
05-10-2012 02:48 PM
hi tst,
i got how the mousing events are working to pick the color,
but how do i build that palatte , can you post a sample
Thanks
05-10-2012 04:41 PM
freemason,
I did this conversion in the attached VI first, but didn't include it.
Maybe this is what you need so you control only displays the available colors (4096).
Depending on your screen resolution, the difference is very subtle.
Just run, copy the indicator out and convert to a control?
With regards to the exact color set, I'd say you can adjust the mask to match whatever your LCD supports.
Regards,
James
05-10-2012 05:04 PM
Thanks James,
does the 12 bit color bar has actual 4096 colors or is it just a visual copy of the 24 bit values. im confused.
also can you please let me know how you created the first 24 bit color bar,
i am trying to use a draw point 1 pixel vi and use the 4096 colors placed one after and 1 line after the other to create that bar.
is it just a copy paste of a trimmed bmp image of color picker ?
05-11-2012 04:10 AM
@freemason wrote:
hi tst,
but how do i build that palatte , can you post a sample
You draw rectangles in a nested for loop. The important part is the shift register, which makes sure you're always updating the same picture. The reshape array primitive converts your array from 1D to 2D.
05-11-2012 10:44 AM
Thanks tst,
i used your code and also the draw unflatten pixmap, both produces the color bar, but
the arrangement of colors is different , the blues appear as bars in between, because the colors are all arranged in a squential order which originally does not correspond to the same color group
(see attached)
any idea how to place the red to yellow green light blue blue magenta order like the main 24 bit color picker bar
i could search in the 24 bit array (16.7 million) to find the location of the 12 bit values and then place accordingly but i think its crude,
any better method,
thanks
05-11-2012 10:56 AM
Your code doesn't exactly match Tst's. You are using a different array of strings than the array of U32 he is using.
Or you are indexing your array differently.