Re: RGB => red, green, blue function?
Posted in 1995
Jon Dallara (dallara@hpcc01.corp.hp.com) wrote: : Hello Again, : This is probably a easy question, but I can't seem to find it documented : anywhere. How do you convert a RGB value to its component red, green, blue : values? (i.e. RGB 16711935 = 255 red, 0 green, 255 blue) HSTools seems : to have every function except one for doing this. : Thanks in Advance, : Jon. : Jon Dallara : Hewlett-Packard : Optoelectronics Division : 370 W. Trimble Rd. : San Jose CA 95131 : jon@hpoemg.sj.hp.com jon@hpoemd.sj.hp.com Here's a 4GL function that will do what you need: (You'll have to change it for HS Tools yourself) function getRGB(c) define c, r, g, b, bit8 integer let bit8 = 256 let b = c mod bit8 let c = c / bit8 let g = c mod bit8 let c = c / bit8 let r = c mod bit8 return r,g,b end function -- ;,._..___...-''^``--._ |\\, Catalin Badea ```--,,,--, `-_ .`/ ,\\ Senior Technical Architect {\\ ` ``-_' / } Tecsys Inc. ; ; ; `;;' `.;. `.._ ,,,_. ``--.._. cat@tecsys.com ``--..,) ```----...._,) include system "disclaim.4gh"