Author |
Topic: Fast RGB 'lerp' in BASIC (Read 496 times) |
|
KenDown
Full Member
member is offline


Posts: 181
|
 |
Re: Fast RGB 'lerp' in BASIC
« Reply #8 on: Nov 12th, 2016, 04:12am » |
|
By the way, given that the colours are defined in hexadecimal, which means that the maximum for any one component is &FF, is there any conceivable harm in reducing the line to
COLOUR 1,c%>>16,c%>>8,c%AND&FF
instead of
COLOUR 1, (c% AND &FF0000)>>16, (c% AND &FF00)>>8, c% AND &FF
I know why you have done the AND&FF000 but is it necessary? (In fact I suspect that I could even get rid of the final AND&FF)
|
|
Logged
|
|
|
|
David Williams
Developer
member is offline

meh

Gender: 
Posts: 452
|
 |
Re: Fast RGB 'lerp' in BASIC
« Reply #9 on: Nov 12th, 2016, 04:29am » |
|
on Nov 12th, 2016, 04:12am, KenDown wrote:By the way, given that the colours are defined in hexadecimal, which means that the maximum for any one component is &FF, is there any conceivable harm in reducing the line to
COLOUR 1,c%>>16,c%>>8,c%AND&FF |
|
It certainly seems to work, so the interpreter is probably already performing an 'AND &FF' on each of the RGB values. Well spotted - it's nice to learn something new!
David. --
|
|
|
|
|