Puzzled By SetColorTexture
This question is not crucial but I am puzzled and would be grateful for a pointer in the right direction.
MapFrame.texture:SetColorTexture(0, 0, 0) gives me black. MapFrame.texture:SetColorTexture(255, 255, 255) gives me white. MapFrame.texture:SetColorTexture(255, 0, 0) gives me red. MapFrame.texture:SetColorTexture(0, 255, 0) gives me green. But MapFrame.texture:SetColorTexture(12, 34, 56) gives me white as do a whole lot of other combinations. I've confirmed the unexpected whites by screenshot, paste into Paint and using the color picker. How can this be? Why are combnations like 12, 34, 56 giving me white? Thanks in advance. |
It's a normalized value, so use something like
Code:
MapFrame.texture:SetColorTexture(12/255, 34/255, 56/255) |
Thanks. I am trying that but it still gives unexpected results.
MapFrame.texture:SetColorTexture(12/255, 34/255, 56/255) gives me a RGB of 9/79/112 - is there something I'm missing if I want to have a RGB of 12,34,56. Sorry for such a trivial question. |
Grab a calculator and enter 12 divided by 255. I'd be surprised if you ended up with 9.
1 is to WoW what 255 is to Paint. |
SetColorTexture uses values up to 1.
So if you want to have 12, 34 and 56 as a texture then use MapFrame.texture:SetColorTexture(0.05, 0.1, 0.2) |
Quote:
local g = 34/255; local b = 56/255; MapFrame.texture:SetColorTexture(r, g, b) In Paint, the resulting frame color is 7, 79, 112. I wonder if I have a faulty graphics card or something. Yet the values that are entered as 255 and 0 work fine. Thanks for trying. |
Quote:
My best guess is that values over 1 are defaulted to 1. So MapFrame.texture:SetColorTexture(255, 0, 0) becomes MapFrame.texture:SetColorTexture(1, 0, 0) and gives you red. So your MapFrame.texture:SetColorTexture(12, 34, 56) becomes MapFrame.texture:SetColorTexture(1, 1, 1) which actually is the correct code for white so it gives you white. |
Quote:
Colour wheels in WoW and Paint. The swatch colours seem pretty close not withstanding the different background colours. Image (removed) |
I'm puzzled at there those numbers come from as well but as I don't have a practical application, I'll leave it for now. Thanks again.
|
All times are GMT -6. The time now is 10:44 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI