picture.datatype: gi_RastPort should not be directly accessed
[AROS.git] / rom / graphics / setrgb4cm.c
blob288e8e014f0a52260491e97597177578d52bb78c
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function SetRGB4CM()
6 Lang: english
7 */
8 #include <graphics/view.h>
9 #include "graphics_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/graphics.h>
16 AROS_LH5(void, SetRGB4CM,
18 /* SYNOPSIS */
19 AROS_LHA(struct ColorMap *, cm, A0),
20 AROS_LHA(WORD , n , D0),
21 AROS_LHA(UBYTE , r , D1),
22 AROS_LHA(UBYTE , g , D2),
23 AROS_LHA(UBYTE , b , D3),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 105, Graphics)
28 /* FUNCTION
29 Set one color in the ColorMap.
31 INPUTS
32 cm - ColorMap structure obtained via GetColorMap()
33 n - the number of the color register to set
34 r - red level (0-15)
35 g - green level (0-15)
36 b - blue level (0-15)
38 RESULT
39 Store the (r,g,b) triplet at index n in the ColorMap structure.
40 The changes will not be immediately displayed. Use this function
41 before linking the ColorMap to a ViewPort.
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 GetColorMap(), SetRGB4(), GetRGB4(), graphics/view.h
52 INTERNALS
53 This function depends on the ColorMap->ColorTable structure
55 HISTORY
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 if (NULL != cm && n < cm->Count)
63 /* Preserve the highest nibble. Needed for interoperability
64 with m68k graphics.library. Exact purpose is currently
65 unknown - sonic */
66 UWORD a = ((UWORD *)cm->ColorTable)[n] & 0xF000;
68 ((UWORD *)cm->ColorTable)[n] = a | (r << 16) | (g << 8) | b;
70 if (cm->Type > COLORMAP_TYPE_V1_2)
71 ((UWORD *)cm->LowColorBits)[n] = 0;
74 AROS_LIBFUNC_EXIT
76 } /* SetRGB4CM */