2 Copyright © 1995-2001, 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
)
47 29-10-95 digulla automatically created from
48 graphics_lib.fd and clib/graphics_protos.h
50 *****************************************************************************/
53 AROS_LIBBASE_EXT_DECL(struct GfxBase
*,GfxBase
)
55 struct TagItem
*tag
, *tstate
= tags
;
56 BOOL havedriverdata
= FALSE
;
58 while ((tag
= NextTagItem ((const struct TagItem
**)&tstate
)))
63 SetFont (rp
, (struct TextFont
*)(tag
->ti_Data
));
67 SetAPen (rp
, tag
->ti_Data
);
71 SetBPen (rp
, tag
->ti_Data
);
75 SetDrMd (rp
, tag
->ti_Data
);
78 case RPTAG_OutlinePen
:
79 SetOutlinePen (rp
, tag
->ti_Data
);
83 SetWriteMask (rp
, tag
->ti_Data
);
89 case RPTAG_DrawBounds
:
97 if (tag
->ti_Tag
== RPTAG_FgColor
)
99 attr
= aHidd_GC_Foreground
;
100 RP_FGCOLOR(rp
) = (ULONG
)tag
->ti_Data
;
104 attr
= aHidd_GC_Background
;
105 RP_BGCOLOR(rp
) = (ULONG
)tag
->ti_Data
;
108 if (!rp
->BitMap
) break;
109 if (!IS_HIDD_BM(rp
->BitMap
)) break;
113 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
118 struct TagItem col_tags
[] =
124 ULONG rgb
= (ULONG
)tag
->ti_Data
;
126 /* HIDDT_ColComp are 16 Bit */
127 col
.alpha
= (HIDDT_ColComp
)((rgb
>> 16) & 0x0000FF00);
128 col
.red
= (HIDDT_ColComp
)((rgb
>> 8) & 0x0000FF00);
129 col
.green
= (HIDDT_ColComp
)(rgb
& 0x0000FF00);
130 col
.blue
= (HIDDT_ColComp
)((rgb
<< 8) & 0x0000FF00);
132 col_tags
[0].ti_Data
= HIDD_BM_MapColor(HIDD_BM_OBJ(rp
->BitMap
), &col
);
133 OOP_SetAttrs(RP_DRIVERDATA(rp
)->dd_GC
, col_tags
);
139 case RPTAG_PatternOriginX
:
140 RP_PATORIGINX(rp
) = (WORD
)tag
->ti_Data
;
143 case RPTAG_PatternOriginY
:
144 RP_PATORIGINY(rp
) = (WORD
)tag
->ti_Data
;
147 case RPTAG_ClipRectangle
:
150 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
157 RP_DRIVERDATA(rp
)->dd_ClipRectangle
= *(struct Rectangle
*)tag
->ti_Data
;
158 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
|= RPCRF_VALID
;
162 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
&= ~RPCRF_VALID
;
167 case RPTAG_ClipRectangleFlags
:
170 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
175 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
&= ~(RPCRF_RELRIGHT
| RPCRF_RELBOTTOM
);
176 RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
|= (tag
->ti_Data
& (RPCRF_RELRIGHT
| RPCRF_RELBOTTOM
));
180 case RPTAG_RemapColorFonts
:
183 rp
->Flags
|= RPF_REMAP_COLORFONTS
;
187 rp
->Flags
&= ~RPF_REMAP_COLORFONTS
;
197 RELEASE_DRIVERDATA(rp
, GfxBase
);