2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function GetRPAttrsA()
8 #include <graphics/rpattr.h>
9 #include <graphics/rastport.h>
10 #include <graphics/gfx.h>
11 #include "graphics_intern.h"
12 #include <proto/utility.h>
14 #include "gfxfuncsupport.h"
16 /*****************************************************************************
19 #include <proto/graphics.h>
21 AROS_LH2(void, GetRPAttrsA
,
24 AROS_LHA(struct RastPort
*, rp
, A0
),
25 AROS_LHA(struct TagItem
*, tags
, A1
),
28 struct GfxBase
*, GfxBase
, 174, Graphics
)
32 Read the current settings of a RastPort into variables.
33 The ti_Tag field specifies the attribute to read and the
34 ti_Data field points to an address where to store the result.
35 All results are stored as IPTRs!
38 rp = pointer to a RastPort structure
39 tags = pointer to a taglist specifying the attributes to read and
40 the addresses to store the results
43 RPTAG_Font (UBYTE) - Font for Text()
44 RPTAG_APen (UBYTE) - Primary rendering pen
45 RPTAG_BPen (UBYTE) - Secondary rendering pen
46 RPTAG_DrMd (UBYTE) - Drawing mode (graphics/rastport.h)
47 RPTAG_OutlinePen (UBYTE) - Area Outline pen
48 RPTAG_WriteMask (ULONG) - Bit Mask for writing
49 RPTAG_MaxPen (ULONG) - Maximum pen to render (see SetMaxPen())
52 RPTAG_FgColor (ULONG) - Primary rendering color in A8R8G8B8 format.
53 Only working on hicolor/truecolor bitmaps/screens.
54 RPTAG_BgColor (ULONG) - Secondary rendering color in A8R8G8B8 format.
55 Only working on hicolor/truecolor bitmaps/screens.
56 RPTAG_PatternOriginX (WORD) - X Origin of fill pattern.
57 RPTAG_PatternOriginY (WORD) - Y Origin of fill pattern.
58 RPTAG_ClipRectangle (struct Rectangle *) - Rectangle to clip rendering to. Rectangle will
60 RPTAG_ClipRectangleFlags (LONG) - RPCRF_RELRIGHT | RPCRF_RELBOTTOM (see <graphics/rpattr.h>)
61 RPTAG_RemapColorFonts (BOOL) - Automatically remap colorfonts to their color
62 on hicolor/truecolor screens.
67 RPTAG_ClipRectangle and RPTAG_ClipRectangleFlags must not be
68 used on manually inited or cloned rastports. Instead the rastport
69 must have been created with CreateRastPort() or CloneRastPort().
74 RPTAG_SoftStyle not supported, yet.
77 SetRPAttrsA(), GetAPen(), GetBPen(), GetOutLinePen(), graphics/rpattr.h
83 *****************************************************************************/
87 struct TagItem
*tag
, *tstate
= tags
;
89 BOOL havedriverdata
= FALSE
;
91 while ((tag
= NextTagItem ((const struct Tagitem
**)&tstate
)))
96 *((IPTR
*)tag
->ti_Data
) = (IPTR
)rp
->Font
;
100 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetAPen(rp
);
104 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetBPen(rp
);
108 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetDrMd(rp
);
111 case RPTAG_OutlinePen
:
112 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetOutlinePen(rp
);
115 case RPTAG_WriteMask
:
116 *((IPTR
*)tag
->ti_Data
) = (IPTR
)rp
->Mask
;
130 *((IPTR
*)tag
->ti_Data
) = MaxPen
;
133 case RPTAG_DrawBounds
:
134 ((struct Rectangle
*)tag
->ti_Data
)->MinX
= 0;
135 ((struct Rectangle
*)tag
->ti_Data
)->MinY
= 0;
136 ((struct Rectangle
*)tag
->ti_Data
)->MaxX
= 0;
137 ((struct Rectangle
*)tag
->ti_Data
)->MaxY
= 0;
141 *((IPTR
*)tag
->ti_Data
) = RP_FGCOLOR(rp
);
145 *((IPTR
*)tag
->ti_Data
) = RP_BGCOLOR(rp
);
148 case RPTAG_PatternOriginX
:
149 *((IPTR
*)tag
->ti_Data
) = RP_PATORIGINX(rp
);
152 case RPTAG_PatternOriginY
:
153 *((IPTR
*)tag
->ti_Data
) = RP_PATORIGINY(rp
);
156 case RPTAG_ClipRectangle
:
159 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
164 if (RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
& RPCRF_VALID
)
166 *((struct Rectangle
**)tag
->ti_Data
) = &(RP_DRIVERDATA(rp
)->dd_ClipRectangle
);
170 *((struct Rectangle
**)tag
->ti_Data
) = NULL
;
175 *((IPTR
*)tag
->ti_Data
) = 0;
179 case RPTAG_ClipRectangleFlags
:
182 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
187 *((IPTR
*)tag
->ti_Data
) = RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
;
191 *((IPTR
*)tag
->ti_Data
) = 0;
195 case RPTAG_RemapColorFonts
:
196 *((IPTR
*)tag
->ti_Data
) = (rp
->Flags
& RPF_REMAP_COLORFONTS
) ? TRUE
: FALSE
;
199 } /* switch(tag->ti_Tag) */
201 } /* while ((tag = NextTagItem ((const struct TagItem **)&tstate))) */
205 RELEASE_DRIVERDATA(rp
, GfxBase
);