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.
36 - RPTAG_Font: text font
37 - RPTAG_APen: primary pen
38 - RPTAG_BPen: secondary pen
39 - RPTAG_DrMd: draw mode
40 - RPTAG_OutlinePen: outline pen
41 - RPTAG_WriteMask: bit mask
42 - RPTAG_MaxPen: see SetMaxPen()
48 - RPTAG_PatternOriginX:
49 - RPTAG_PatternOriginY:
50 - RPTAG_ClipRectangle: (struct Rectangle *)
51 - RPTAG_ClipRectangleFlags: RPCRF_RELRIGHT | RPCRF_RELBOTTOM
52 - RPTAG_RemapColorFonts: (BOOL)
67 29-10-95 digulla automatically created from
68 graphics_lib.fd and clib/graphics_protos.h
70 *****************************************************************************/
74 struct TagItem
*tag
, *tstate
= tags
;
75 BOOL havedriverdata
= FALSE
;
77 while ((tag
= NextTagItem ((const struct TagItem
**)&tstate
)))
82 SetFont (rp
, (struct TextFont
*)(tag
->ti_Data
));
86 SetAPen (rp
, tag
->ti_Data
);
90 SetBPen (rp
, tag
->ti_Data
);
94 SetDrMd (rp
, tag
->ti_Data
);
97 case RPTAG_OutlinePen
:
98 SetOutlinePen (rp
, tag
->ti_Data
);
101 case RPTAG_WriteMask
:
102 SetWriteMask (rp
, tag
->ti_Data
);
108 case RPTAG_DrawBounds
:
116 if (tag
->ti_Tag
== RPTAG_FgColor
)
118 attr
= aHidd_GC_Foreground
;
119 RP_FGCOLOR(rp
) = (ULONG
)tag
->ti_Data
;
123 attr
= aHidd_GC_Background
;
124 RP_BGCOLOR(rp
) = (ULONG
)tag
->ti_Data
;
127 if (!rp
->BitMap
) break;
128 if (!IS_HIDD_BM(rp
->BitMap
)) break;
132 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
137 struct TagItem col_tags
[] =
143 ULONG rgb
= (ULONG
)tag
->ti_Data
;
145 /* HIDDT_ColComp are 16 Bit */
146 col
.alpha
= (HIDDT_ColComp
)((rgb
>> 16) & 0x0000FF00);
147 col
.red
= (HIDDT_ColComp
)((rgb
>> 8) & 0x0000FF00);
148 col
.green
= (HIDDT_ColComp
)(rgb
& 0x0000FF00);
149 col
.blue
= (HIDDT_ColComp
)((rgb
<< 8) & 0x0000FF00);
151 col_tags
[0].ti_Data
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
152 OOP_SetAttrs(RP_DRIVERDATA(rp
)->dd_GC
, col_tags
);
158 case RPTAG_PatternOriginX
:
159 RP_PATORIGINX(rp
) = (WORD
)tag
->ti_Data
;
162 case RPTAG_PatternOriginY
:
163 RP_PATORIGINY(rp
) = (WORD
)tag
->ti_Data
;
166 case RPTAG_ClipRectangle
:
169 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
176 RP_DRIVERDATA(rp
)->dd_ClipRectangle
= *(struct Rectangle
*)tag
->ti_Data
;
177 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
|= RPCRF_VALID
;
181 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
&= ~RPCRF_VALID
;
186 case RPTAG_ClipRectangleFlags
:
189 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
194 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
&= ~(RPCRF_RELRIGHT
| RPCRF_RELBOTTOM
);
195 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
|= (tag
->ti_Data
& (RPCRF_RELRIGHT
| RPCRF_RELBOTTOM
));
199 case RPTAG_RemapColorFonts
:
202 rp
->Flags
|= RPF_REMAP_COLORFONTS
;
206 rp
->Flags
&= ~RPF_REMAP_COLORFONTS
;
216 RELEASE_DRIVERDATA(rp
, GfxBase
);