lemur color

Discuss problems and solutions.
Post Reply
analog604
Regular
Posts: 262
Joined: 29 Dec 2011 15:40
Location: north east, usa

lemur color

Post by analog604 »

Hi!

What is the formula to convert a lemur color value (color="65793") to the RGB values?

I'm not asking so I can do this in Lemur script, but for an JZML to Canvas object code conversion program that I have written.

Jay
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: lemur color

Post by electrofux »

Not sure but wasnt the colorpicker in the Lemur Modules Forum doing the conversion?

https://forum.liine.net/viewtopic.php?p=13248#p13248
analog604
Regular
Posts: 262
Joined: 29 Dec 2011 15:40
Location: north east, usa

Re: lemur color

Post by analog604 »

While the colorpicker in that template is neat (and I have seen that thread), I need to do the opposite. :o

Again not using Lemur scripting, but another language PERL.

Even without the colors being translated to the canvas RGB, the program does create working Lemur canvas_ script which can save days of scripting work in Lemur. :)

It turns all switches and pads (even multicolumn) into hit regions so on_cursor scripting is much less.. painful. Also draws the regions.

One could do page layout in the editor, run the canvas convertor, then copy the output to another template as code... without being an expert in canvas_ scripting. Still it is basic, no fancy arcs and curves yet.

Jay
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: lemur color

Post by Macciza »

Hi
You need to reverse the colour formula mentioned in the manual
I recall doing it at some time, not sure if it is posted here or somewhere on my drive
Will try to find it or redo it,

Cheers
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: lemur color

Post by Macciza »

Yeah
Here you go - try this as a one-liner . . .
asRGB(colour) = {( color >> 16 ) & 0xFF,( color >> 8 ) & 0xFF,color & 0xFF}/127 // returns 0...1 values

As 7 bit 0 - 127 values
asRGB_7(colour) = {( color >> 16 ) & 0xFF,( color >> 8 ) & 0xFF,color & 0xFF}

And to reverse . . .
asColor_7(r,g,b) = (r << 16) + (g << 8) + b

Cheers
MM

Edit: first version was for returning 7 bit values, fixed now for asRGB(colour) to return 0....1 values
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
analog604
Regular
Posts: 262
Joined: 29 Dec 2011 15:40
Location: north east, usa

Re: lemur color

Post by analog604 »

Hi Macciza! That is fantastic, thank you for the code. I integrated the formula into the converter program without issue. :)
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: lemur color

Post by Macciza »

No worries
Are you looking at posting the code at all?

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
analog604
Regular
Posts: 262
Joined: 29 Dec 2011 15:40
Location: north east, usa

Re: lemur color

Post by analog604 »

Yes I'll be posting the code and perhaps a little intro on how to use it.
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Joe Soap
Regular
Posts: 462
Joined: 07 Jul 2012 15:04

Re: lemur color

Post by Joe Soap »

This sounds legendary.
analog604
Regular
Posts: 262
Joined: 29 Dec 2011 15:40
Location: north east, usa

Re: lemur color

Post by analog604 »

and.. I am pleased to report that it works and will produce a working JZLIB (or only raw script code). :D
Still have some fine tuning to go before posting it, but the savings in time for creating cursor hit regions out of a multi-row switch or pad is amazing. It can optionally turn objects into an array of circles and rounded rectangles, also with hit regions.
If one of you guys are comfortable running Perl on the command line, let me know (PM me) and you can try it out.
I test it in OS X terminal, but it will run within any other unix shell or possibly Windows with Perl installed.
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Post Reply