Minor fixes to comments.
[AROS.git] / rom / graphics / setrgb4.c
blob4c8b2d0615141f817a907a1cf674d9148f380cb5
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set one color register for this Viewport
6 Lang: english
7 */
8 #include "graphics_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <graphics/view.h>
14 #include <proto/graphics.h>
16 AROS_LH5(void, SetRGB4,
18 /* SYNOPSIS */
19 AROS_LHA(struct ViewPort *, vp, 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, 48, Graphics)
28 /* FUNCTION
29 Changes a single color of a viewport.
31 INPUTS
32 vp - Modify this viewport
33 n - Change this color. If the color is outside the range of
34 valid colors, it will be ignored.
35 r, g, b - The new values for the red, green and blue. The
36 valid range is from 0x0 (no intensity) to
37 0xF (full intensity).
39 RESULT
40 If there is a ColorMap for this viewport, then the value will
41 be stored in the ColorMap.
42 The selected color register is changed to match your specs.
43 If the color value is unused then nothing will happen.
45 NOTES
46 Lower order bits of the palette specification will be discarded,
47 depending on the color palette resolution of the target graphics
48 device. Use 0xf for the full value, 0x7 for 50%,
49 etc. You can find out the palette range for your screen by
50 querying the graphics data base.
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 INTERNALS
60 HISTORY
62 *****************************************************************************/
64 AROS_LIBFUNC_INIT
66 if (!vp)
67 return;
69 SetRGB32(vp, n, r * 0x11111111,
70 g * 0x11111111,
71 b * 0x11111111);
73 /************************************************************
74 / This is the code that works correctly on the real thing
75 struct ColorMap * CM = vp->ColorMap;
77 / is there a ColorMap connected to the ViewPort?? /
78 if (NULL != CM)
80 struct View * MyView = ViewAddress();
81 if(CM->Count > n)
83 WORD * RGBValues = CM->ColorTable;
84 RGBValues[n] = ((r & 0x000f) << 8) +
85 ((g & 0x000f) << 4) +
86 (b & 0x000f);
89 / Make the changes visible /
90 MakeVPort(MyView, MyView->ViewPort);
91 MrgCop(MyView);
92 LoadView(MyView);
94 ************************************************************/
96 AROS_LIBFUNC_EXIT
98 } /* SetRGB4 */