2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Set one color register for this Viewport
8 #include <aros/debug.h>
9 #include "graphics_intern.h"
10 #include "gfxfuncsupport.h"
11 #include <proto/oop.h>
13 /*****************************************************************************
16 #include <graphics/view.h>
17 #include <proto/graphics.h>
19 AROS_LH5(void, SetRGB32
,
22 AROS_LHA(struct ViewPort
*, vp
, A0
),
23 AROS_LHA(ULONG
, n
, D0
),
24 AROS_LHA(ULONG
, r
, D1
),
25 AROS_LHA(ULONG
, g
, D2
),
26 AROS_LHA(ULONG
, b
, D3
),
29 struct GfxBase
*, GfxBase
, 142, Graphics
)
32 Changes a single color of a viewport.
35 vp - Modify this viewport
36 n - Change this color. If the color is outside the range of
37 valid colors, it will be ignored.
38 r, g, b - The new values for the red, green and blue. The
39 valid range is from 0x000000 (no intensity) to
40 0xFFFFFFFF (full intensity).
43 If there is a ColorMap for this viewport, then the value will
44 be stored in the ColorMap.
45 The selected color register is changed to match your specs.
46 If the color value is unused then nothing will happen.
49 Lower order bits of the palette specification will be discarded,
50 depending on the color palette resolution of the target graphics
51 device. Use 0xffffffff for the full value, 0x7fffffff for 50%,
52 etc. You can find out the palette range for your screen by
53 querying the graphics data base.
65 *****************************************************************************/
72 HIDDT_ColorModel colmod
;
74 if (vp
->ColorMap
) SetRGB32CM(vp
->ColorMap
, n
, r
, g
, b
);
76 /* Get bitmap object */
77 bm
= vp
->RasInfo
->BitMap
;
81 D(bug("!!!!! Trying to use SetRGB32() call on non-hidd bitmap!!!\n"));
85 if (NULL
== HIDD_BM_COLMAP(bm
))
87 D(bug("!!!!! Trying to use SetRGB32() call on bitmap with no CLUT !!!\n"));
92 /* HIDDT_Color entries are UWORD */
93 hidd_col
.red
= r
>> 16;
94 hidd_col
.green
= g
>> 16 ;
95 hidd_col
.blue
= b
>> 16;
98 OOP_GetAttr(HIDD_BM_OBJ(bm
), aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
99 OOP_GetAttr(pf
, aHidd_PixFmt_ColorModel
, &colmod
);
101 if (vHidd_ColorModel_Palette
== colmod
|| vHidd_ColorModel_TrueColor
== colmod
)
103 HIDD_BM_SetColors(HIDD_BM_OBJ(bm
), &hidd_col
, n
, 1);
106 bug("SetRGB32: bm %p, hbm %p, col %d (%x %x %x %x) mapped to %x\n"
110 , hidd_col.red, hidd_col.green, hidd_col.blue, hidd_col.alpha
114 HIDD_BM_PIXTAB(bm
)[n
] = hidd_col
.pixval
;