This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to use new datatype RGB-W
#7
(23.08.2020, 10:02)Erwin van der Zwart Wrote: Hi,

Use this for 4 byte RGBW:
Code:
value = event.getvalue()

-- Split
R = bit.rshift(bit.band(value,0xff000000),24)
G = bit.rshift(bit.band(value,0x00ff0000),16)
B = bit.rshift(bit.band(value,0x0000ff00),8)
W = bit.band(value,0x000000ff)

-- Merge
RGBW = R * 0x1000000 + G * 0x10000 + B * 0x100 + W
BR,

Erwin

I think there is a little mistake in that code because the colors shown by the icon don't match both ways: splitting and merging.
Reply


Messages In This Thread
How to use new datatype RGB-W - by gdimaria - 14.08.2020, 12:30
RE: How to use new datatype RGB-W - by Daniel - 14.08.2020, 12:57
RE: How to use new datatype RGB-W - by admin - 14.08.2020, 12:59
RE: How to use new datatype RGB-W - by gdimaria - 25.08.2020, 09:49
RE: How to use new datatype RGB-W - by admin - 25.08.2020, 11:38
RE: How to use new datatype RGB-W - by admin - 25.08.2020, 13:00
RE: How to use new datatype RGB-W - by Daniel - 25.08.2020, 15:57
RE: How to use new datatype RGB-W - by admin - 26.08.2020, 08:12
RE: How to use new datatype RGB-W - by Daniel - 26.08.2020, 08:12
RE: Urgent! - by gdimaria - 18.09.2020, 08:07
RE: How to use new datatype RGB-W - by Daniel - 18.09.2020, 08:09
RE: How to use new datatype RGB-W - by admin - 18.09.2020, 08:12
RE: How to use new datatype RGB-W - by Daniel - 22.09.2020, 13:52
RE: How to use new datatype RGB-W - by Daniel - 22.09.2020, 15:20
RE: How to use new datatype RGB-W - by Daniel - 23.09.2020, 07:55
RE: How to use new datatype RGB-W - by Daniel - 23.09.2020, 08:18
RE: How to use new datatype RGB-W - by Daniel - 24.09.2020, 08:44

Forum Jump: