2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function SetRPAttrsA()
8 #include "graphics_intern.h"
9 #include <proto/utility.h>
10 #include <proto/oop.h>
11 #include "gfxfuncsupport.h"
13 /*****************************************************************************
16 #include <graphics/rastport.h>
17 #include <graphics/rpattr.h>
18 #include <utility/tagitem.h>
19 #include <proto/graphics.h>
21 AROS_LH2(void, SetRPAttrsA
,
24 AROS_LHA(struct RastPort
*, rp
, A0
),
25 AROS_LHA(struct TagItem
*, tags
, A1
),
28 struct GfxBase
*, GfxBase
, 173, Graphics
)
31 Modify rastport with values from a taglist.
38 RPTAG_Font (struct TextFont *) - Font for Text()
39 RPTAG_APen (UBYTE) - Primary rendering pen
40 RPTAG_BPen (UBYTE) - Secondary rendering pen
41 RPTAG_DrMd (UBYTE) - Drawing mode (graphics/rastport.h)
42 RPTAG_OutlinePen (UBYTE) - Area Outline pen
43 RPTAG_WriteMask (ULONG) - Bit mask for writing
46 RPTAG_FgColor (ULONG) - Primary rendering color in A8R8G8B8 format.
47 Only working on hicolor/truecolor bitmaps/screens.
48 RPTAG_BgColor (ULONG) - Secondary rendering color in A8R8G8B8 format.
49 Only working on hicolor/truecolor bitmaps/screens.
50 RPTAG_PatternOriginX (WORD) - X origin of pattern
51 RPTAG_PatternOriginY (WORD) - Y origin of pattern
52 RPTAG_ClipRectangle (struct Rectangle *) - Clipping rectangle
53 RPTAG_ClipRectangleFlags (LONG) - RPCRF_RELRIGHT | RPCRF_RELBOTTOM (see graphics/rpattrs.h)
54 RPTAG_RemapColorFonts (BOOL) - Automatically remap colorfonts to their color
55 on hicolor/truecolor screens.
66 GetRPAttrsA(), graphics/rpattr.h
71 29-10-95 digulla automatically created from
72 graphics_lib.fd and clib/graphics_protos.h
74 *****************************************************************************/
78 struct TagItem
*tag
, *tstate
= tags
;
79 BOOL havedriverdata
= FALSE
;
81 while ((tag
= NextTagItem ((const struct TagItem
**)&tstate
)))
86 SetFont (rp
, (struct TextFont
*)(tag
->ti_Data
));
90 SetAPen (rp
, tag
->ti_Data
);
94 SetBPen (rp
, tag
->ti_Data
);
98 SetDrMd (rp
, tag
->ti_Data
);
101 case RPTAG_OutlinePen
:
102 SetOutlinePen (rp
, tag
->ti_Data
);
105 case RPTAG_WriteMask
:
106 SetWriteMask (rp
, tag
->ti_Data
);
112 case RPTAG_DrawBounds
:
120 if (tag
->ti_Tag
== RPTAG_FgColor
)
122 attr
= aHidd_GC_Foreground
;
123 RP_FGCOLOR(rp
) = (ULONG
)tag
->ti_Data
;
127 attr
= aHidd_GC_Background
;
128 RP_BGCOLOR(rp
) = (ULONG
)tag
->ti_Data
;
131 if (!rp
->BitMap
) break;
132 if (!IS_HIDD_BM(rp
->BitMap
)) break;
136 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
141 struct TagItem col_tags
[] =
147 ULONG rgb
= (ULONG
)tag
->ti_Data
;
149 /* HIDDT_ColComp are 16 Bit */
150 col
.alpha
= (HIDDT_ColComp
)((rgb
>> 16) & 0x0000FF00);
151 col
.red
= (HIDDT_ColComp
)((rgb
>> 8) & 0x0000FF00);
152 col
.green
= (HIDDT_ColComp
)(rgb
& 0x0000FF00);
153 col
.blue
= (HIDDT_ColComp
)((rgb
<< 8) & 0x0000FF00);
155 col_tags
[0].ti_Data
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
156 OOP_SetAttrs(RP_DRIVERDATA(rp
)->dd_GC
, col_tags
);
162 case RPTAG_PatternOriginX
:
163 RP_PATORIGINX(rp
) = (WORD
)tag
->ti_Data
;
166 case RPTAG_PatternOriginY
:
167 RP_PATORIGINY(rp
) = (WORD
)tag
->ti_Data
;
170 case RPTAG_ClipRectangle
:
173 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
180 RP_DRIVERDATA(rp
)->dd_ClipRectangle
= *(struct Rectangle
*)tag
->ti_Data
;
181 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
|= RPCRF_VALID
;
185 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
&= ~RPCRF_VALID
;
190 case RPTAG_ClipRectangleFlags
:
193 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
198 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
&= ~(RPCRF_RELRIGHT
| RPCRF_RELBOTTOM
);
199 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
|= (tag
->ti_Data
& (RPCRF_RELRIGHT
| RPCRF_RELBOTTOM
));
203 case RPTAG_RemapColorFonts
:
206 rp
->Flags
|= RPF_REMAP_COLORFONTS
;
210 rp
->Flags
&= ~RPF_REMAP_COLORFONTS
;
220 RELEASE_DRIVERDATA(rp
, GfxBase
);