Hi all!
While playing with colors for pairtaghighlighter plugin, I saw that Scintilla is using BGR instead of normal RGB. I found existing code in Geany source to use it in my plugin.
utils_invert_color from utils.c deals with replacing blue with red, but with mistake.
Below are results of my testing with random color: 11111111 11001100 10011001 - input color 10011001 11001100 11111111 - result of my function (rgb2bgr) 00000000 00110011 01100110 - result of utils_invert_color
A little source file is attached. If it is really mistake (maybe I don't know something), I will do commit and pull request.
Any comments about this?
Hi,
Le 30/10/2013 21:10, Volodymyr Kononenko a écrit :
While playing with colors for pairtaghighlighter plugin, I saw that Scintilla is using BGR instead of normal RGB. I found existing code in Geany source to use it in my plugin.
utils_invert_color from utils.c deals with replacing blue with red, but with mistake.
Below are results of my testing with random color: 11111111 11001100 10011001 - input color 10011001 11001100 11111111 - result of my function (rgb2bgr) 00000000 00110011 01100110 - result of utils_invert_color
utils_invert_color() *inverts* a color, it doesn't transform RGB to BGR or something. It's used e.g. in the "invert syntax highlighting colors" feature. It's basically the C "~" operator. And if you expect this, you'll see it works just fine: 1 becomes 0 and 0 becomes 1.
Not sure why we don't simply do ((~color) & 0xffffff), but that's just an implementation detail.
Regards, Colomban
Ok. Now I've found an appropriate one - rotate_rgb. False alarm, thanks :)
On 30 October 2013 23:03, Colomban Wendling lists.ban@herbesfolles.orgwrote:
Hi,
Le 30/10/2013 21:10, Volodymyr Kononenko a écrit :
While playing with colors for pairtaghighlighter plugin, I saw that Scintilla is using BGR instead of normal RGB. I found existing code in Geany source to use it in my plugin.
utils_invert_color from utils.c deals with replacing blue with red, but with mistake.
Below are results of my testing with random color: 11111111 11001100 10011001 - input color 10011001 11001100 11111111 - result of my function (rgb2bgr) 00000000 00110011 01100110 - result of utils_invert_color
utils_invert_color() *inverts* a color, it doesn't transform RGB to BGR or something. It's used e.g. in the "invert syntax highlighting colors" feature. It's basically the C "~" operator. And if you expect this, you'll see it works just fine: 1 becomes 0 and 0 becomes 1.
Not sure why we don't simply do ((~color) & 0xffffff), but that's just an implementation detail.