wrong version committed
[AROS.git] / rom / graphics / setrgb32cm.c
blob1ee0eb12ed59b1b8c4538e4267634ff15d3306fe
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function SetRGB32CM()
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, SetRGB32CM,
18 /* SYNOPSIS */
19 AROS_LHA(struct ColorMap *, cm, A0),
20 AROS_LHA(ULONG , n , D0),
21 AROS_LHA(ULONG , r , D1),
22 AROS_LHA(ULONG , g , D2),
23 AROS_LHA(ULONG , b , D3),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 166, 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 (32 bit left justified fraction)
35 g - green level (32 bit left justified fraction)
36 b - blue level (32 bit left justified fraction)
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. Do not access the entries
42 in the ColorTable yourself, as the ColorTable format is subject to
43 change.
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 GetColorMap(), SetRGB32(), GetRGB32(), SetRGB4CM(), graphics/view.h
54 INTERNALS
55 This function depends on the ColorMap->ColorTable structure
57 HISTORY
59 *****************************************************************************/
61 AROS_LIBFUNC_INIT
63 if (NULL != cm && n < cm->Count)
65 /* Preserve the highest nibble. Needed for interoperability
66 with m68k graphics.library. Exact purpose is currently
67 unknown - sonic */
68 UWORD a = cm->ColorTable[n];
70 cm->ColorTable[n] = (a & 0xF000) |
71 ((r >> 20) & 0x0f00) |
72 ((g >> 24) & 0x00f0) |
73 ((b >> 28) & 0x000f);
75 if (cm->Type > COLORMAP_TYPE_V1_2)
76 cm->LowColorBits[n] = ((r >> 16) & 0x0f00) |
77 ((g >> 20) & 0x00f0) |
78 ((b >> 24) & 0x000f);
81 AROS_LIBFUNC_EXIT
83 } /* SetRGB32CM */