mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Kandinsky: Introduce KDColorRGB
Change-Id: Ic64f2ff9a441580940d37151e190fd0a3d954d8a
This commit is contained in:
18
kandinsky/test/color.c
Normal file
18
kandinsky/test/color.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <quiz.h>
|
||||
#include <kandinsky.h>
|
||||
#include <assert.h>
|
||||
|
||||
QUIZ_CASE(kandinsky_color_rgb) {
|
||||
KDColor foo = KDColorRGB(0xFF, 0, 0);
|
||||
assert(KDColorRGB(0xFF, 0, 0) == 0xF800);
|
||||
assert(KDColorRGB(0, 0xFF, 0) == 0x07E0);
|
||||
assert(KDColorRGB(0, 0, 0xFF) == 0x1F);
|
||||
/* R = 0x12 = 0b 0001 0010. 5 most important bits are 00010.
|
||||
* G = 0x34 = 0b 0011 0100. 6 most important bits are 001101.
|
||||
* B = 0x56 = 0b 0101 0110. 5 most important bits are 01010.
|
||||
* KDColor = 0b 00010 001101 01010
|
||||
* = 0b 0001 0001 1010 1010
|
||||
* = 0x 1 1 A A */
|
||||
assert(KDColorRGB(0x12, 0x34, 0x56) == 0x11AA);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user