MCPcopy Create free account
hub / github.com/android/ndk-samples / init_palette

Function init_palette

bitmap-plasma/app/src/main/cpp/plasma.cpp:130–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130static void init_palette(void) {
131 int nn, mm = 0;
132 /* fun with colors */
133 for (nn = 0; nn < PALETTE_SIZE / 4; nn++) {
134 int jj = (nn - mm) * 4 * 255 / PALETTE_SIZE;
135 palette[nn] = make565(255, jj, 255 - jj);
136 }
137
138 for (mm = nn; nn < PALETTE_SIZE / 2; nn++) {
139 int jj = (nn - mm) * 4 * 255 / PALETTE_SIZE;
140 palette[nn] = make565(255 - jj, 255, jj);
141 }
142
143 for (mm = nn; nn < PALETTE_SIZE * 3 / 4; nn++) {
144 int jj = (nn - mm) * 4 * 255 / PALETTE_SIZE;
145 palette[nn] = make565(0, 255 - jj, 255);
146 }
147
148 for (mm = nn; nn < PALETTE_SIZE; nn++) {
149 int jj = (nn - mm) * 4 * 255 / PALETTE_SIZE;
150 palette[nn] = make565(jj, 0, 255);
151 }
152}
153
154static __inline__ uint16_t palette_from_fixed(Fixed x) {
155 if (x < 0) x = -x;

Callers 1

init_tablesFunction · 0.85

Calls 1

make565Function · 0.85

Tested by

no test coverage detected