r4493@vps: verhaegs | 2007-04-19 14:44:00 -0400
[AROS.git] / rom / graphics / setrgb4.c
blobbe96eb79f294c3a8f4f04e4e20458c95f9b08ced
1 /*
2 Copyright © 1995-2001, 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
65 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
67 SetRGB32(vp, n, r * 0x11111111,
68 g * 0x11111111,
69 b * 0x11111111);
71 /************************************************************
72 / This is the code that works correctly on the real thing
73 struct ColorMap * CM = vp->ColorMap;
75 / is there a ColorMap connected to the ViewPort?? /
76 if (NULL != CM)
78 struct View * MyView = ViewAddress();
79 if(CM->Count > n)
81 WORD * RGBValues = CM->ColorTable;
82 RGBValues[n] = ((r & 0x000f) << 8) +
83 ((g & 0x000f) << 4) +
84 (b & 0x000f);
87 / Make the changes visible /
88 MakeVPort(MyView, MyView->ViewPort);
89 MrgCop(MyView);
90 LoadView(MyView);
92 ************************************************************/
94 AROS_LIBFUNC_EXIT
96 } /* SetRGB4 */