6 #include "rpage/aos/inc.prl" 9 #include <intuition/intuition.h> 10 #include <graphics/gfxbase.h> 11 #include <graphics/gfxmacros.h> 12 #include <hardware/custom.h> 17 extern struct GfxBase *GfxBase;
32 return (
UWORD)((r << 16) | (g << 8) | b);
53 return (
UWORD)((r << 8) | (g << 4) | b);
59 while ((1 << i) < colors)
67 WORD r, g, b, x, y, z;
78 r = (A & 0x0f00) >> 8;
79 g = (A & 0x00f0) >> 4;
86 return (
UWORD)((r << 8) | (g << 4) | b);
91 UWORD r, g, b, x, y, z;
99 x = (B & 0x0f00) >> 8;
100 y = (B & 0x00f0) >> 4;
109 r = (A & 0x0f00) >> 8;
110 g = (A & 0x00f0) >> 4;
136 return (
UWORD)((r << 8) | (g << 4) | b);
142 r = ((
ULONG)(A & 0x0f00)) << 12;
143 g = (A & 0x00f0) << 8;
144 b = (A & 0x000f) << 4;
146 return (
ULONG)(r | g | b);
152 r = (A & 0xF00000) >> 12;
153 g = (A & 0x00F000) >> 8;
154 b = (A & 0x00F0) >> 4;
156 return (
UWORD)(r | g | b);
161 ULONG r, g, b, x, y, z;
163 x = (B & 0xff0000) >> 16;
164 y = (B & 0x00ff00) >> 8;
167 r = (A & 0xff0000) >> 16;
168 g = (A & 0x00ff00) >> 8;
182 return (r << 16) | (g << 8) | b;
192 r = (A & 0xff0000) >> 16;
193 g = (A & 0x00ff00) >> 8;
200 return (r << 16) | (g << 8) | b;
205 ULONG r, g, b, x, y, z;
213 x = (B & 0xff0000) >> 16;
214 y = (B & 0x00ff00) >> 8;
223 r = (A & 0xff0000) >> 16;
224 g = (A & 0x00ff00) >> 8;
250 return (r << 16) | (g << 8) | b;
265 void mix_rgb4_palette_to_black(
struct ViewPort *vp, color444 *pal,
UWORD pal_size,
270 for (i = 0; i < pal_size; i++)
272 UWORD col = mix_rgb4_colors(pal[i], 0x000, fade);
273 SetRGB4(vp, i, (col & 0x0f00) >> 8, (col & 0x00f0) >> 4, col & 0x000f);
290 void set_palette_to_black(
struct ViewPort *vp,
UWORD first_color,
UWORD last_color)
293 for (loop = first_color; loop <= last_color; loop++)
294 SetRGB4(vp, loop, 0x0, 0x0, 0x0);
297 void set_palette_to_grey(
struct ViewPort *vp,
UWORD first_color,
UWORD last_color)
300 for (loop = first_color; loop <= last_color; loop++)
304 luma =
range_adjust(loop, first_color, last_color, 0, 255);
305 SetRGB32(vp, loop, luma << 24, luma << 24, luma << 24);
307 luma =
range_adjust(loop, first_color, last_color, 0, 15);
308 SetRGB4(vp, loop, luma, luma, luma);
313 void set_palette(
struct ViewPort *vp,
UWORD **palette,
UWORD first_color,
UWORD last_color)
319 for (loop = first_color; loop <= last_color; loop++)
322 unsigned int r, g, b;
323 r = ((*palette)[loop] >> 16) & 0xff;
324 g = ((*palette)[loop] >> 8) & 0xff;
325 b = (*palette)[loop] & 0xff;
326 SetRGB32(vp, loop, r << 24, g << 24, b << 24);
329 r = ((*palette)[loop] >> 8) & 0xf;
330 g = ((*palette)[loop] >> 4) & 0xf;
331 b = (*palette)[loop] & 0xf;
332 SetRGB4(vp, loop, r, g, b);
340 LoadRGB32(vp, (
ULONG *)*palette, last_color);
342 LoadRGB4(vp, (
UWORD *)*palette, last_color);
int range_adjust(int val, int in_lower, int in_upper, int out_lower, int out_upper)