11-07-2022, 12:33 AM
(This post was last modified: 11-07-2022, 12:37 AM by PhilOfPerth.)
(11-06-2022, 02:33 PM)SMcNeill Wrote: Perhaps not the greatest of keywords to start with, but that's the nature of randomness. It is what it is, so with no further ado, here's _GREEN32 explained and showcased.Agreed, that's probably not the most sought-after function explanation we have, but it's one I had never heard of, and adds another little toy (actually, four toys) to my toybox.
What is _GREEN32? It's a simple command that takes a color value and returns the green component back to you from it.
When would you use it? Basically when you have a color (perhaps taken from one of the color names), and you need to know what the green value is in it.
Example:
Code: (Select All)Screen _NewImage(640, 480, 32)
$Color:32
Print "Lime : "; Hex$(Lime)
Print "======"
Print "Alpha: "; Hex$(_Alpha32(Lime)), _Alpha32(Lime)
Print "Red : "; Hex$(_Red32(Lime)), _Red32(Lime)
Print "Green: "; Hex$(_Green32(Lime)), _Green32(Lime)
Print "Blue : "; Hex$(_Blue32(Lime)), _Blue32(Lime)
As you can see from the simple example above, _GREEN32 can be used to easily get back the green color values from whatever 32-bit color you send to it. Used in conjection with _ALPHA32, _RED32, and _BLUE32, you can quickly and easily break down a complex color value into its component parts with almost no effort on your part.
And if you intend, as it appears, to cover one more keyword each day/week/month, I'm keen to see the next edition! Great idea!
(although I would prefer non-randomness, with ascending order of usefulness)
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)