picture.datatype: gi_RastPort should not be directly accessed
[AROS.git] / rom / graphics / loadrgb4.c
blob9d5c692844c2546201d38f466695d6db897b3cd0
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/graphics.h>
16 AROS_LH3(void, LoadRGB4,
18 /* SYNOPSIS */
19 AROS_LHA(struct ViewPort *, vp, A0),
20 AROS_LHA(UWORD *, colors, A1),
21 AROS_LHA(WORD , count, D0),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 32, Graphics)
26 /* FUNCTION
27 Load RGB color values from table.
29 INPUTS
30 vp - ViewPort
31 colors - pointer to table of RGB values (0...15)
32 background-- 0x0RGB
33 color1 -- 0x0RGB
34 color2 -- 0x0RGB
35 ...
36 count - number of UWORDs in the table
38 RESULT
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 LoadRGB32()
49 INTERNALS
51 HISTORY
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 WORD t;
59 if (!vp)
60 return;
62 ASSERT_VALID_PTR(vp);
63 ASSERT_VALID_PTR(colors);
65 /* TODO: Optimization */
67 for (t = 0; t < count; t ++ )
69 ULONG red = (colors[t] & 0xF00) >> 8;
70 ULONG green = (colors[t] & 0x0F0) >> 4;
71 ULONG blue = (colors[t] & 0x00F);
73 SetRGB32(vp, t, red * 0x11111111,
74 green * 0x11111111,
75 blue * 0x11111111);
78 AROS_LIBFUNC_EXIT
80 } /* LoadRGB4 */