2 Copyright © 1995-2001, 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!
39 RPTAG_Font Font for Text()
40 RPTAG_APen Primary rendering pen
41 RPTAG_BPen Secondary rendering pen
42 RPTAG_DrMd Drawing mode (graphics/rastport.h)
43 RPTAG_OutlinePen Area Outline pen
44 RPTAG_WriteMask Bit Mask for writing
45 RPTAG_MaxPen Maximum oen to render (see SetMaxPen())
46 RPTAG_DrawBounds Determine the area that will be redered
47 into by rendering commands. Can be used
48 to optimize window refresh. Pass a pointer
49 to a rectangle in the ti_Data field. On
50 return the rectangle's MinX will be
51 greater than its MaxX if there are no
53 RPTAG_FgColor Primary rendering color in A8R8G8B8 format.
54 Only working on hicolor/truecolor bitmaps/
55 screens. (MorphOS extension)
56 RPTAG_BgColor Secondary rendering color in A8R8G8B8 format.
57 Only working on hicolor/truecolor bitmaps/
58 screens. (MorphOS extension)
59 RPTAG_PatternOriginX X Origin of fill pattern. (AROS extension)
60 RPTAG_PatternOriginY Y Origin of fill pattern. (AROS extension)
61 RPTAG_ClipRectangle Rectangle to clip rendering to. Rectangle will
62 be cloned. (AROS extension)
63 RPTAG_ClipRectangleFlags See <graphics/rpattr.h> (AROS extension)
64 RPTAG_RemapColorFonts Automatically remap colorfonts to their color
65 on hicolor/truecolor screens.
69 rp = pointer to a RastPort structure
70 tags = pointer to a taglist specifying the attributes to read and
71 the addresses to store the results
76 RPTAG_ClipRectangle and RPTAG_ClipRectangleFlags must not be
77 used on manually inited or cloned rastports. Instead the rastport
78 must have been created with CreateRastPort() or CloneRastPort().
83 RPTAG_SoftStyle not supported, yet.
86 SetRPAttrsA() GetAPen() GetBPen() GetOutLinePen() GetWriteMask()
93 *****************************************************************************/
96 AROS_LIBBASE_EXT_DECL(struct GfxBase
*,GfxBase
)
98 struct TagItem
*tag
, *tstate
= tags
;
100 BOOL havedriverdata
= FALSE
;
102 while ((tag
= NextTagItem ((const struct Tagitem
**)&tstate
)))
107 *((IPTR
*)tag
->ti_Data
) = (IPTR
)rp
->Font
;
111 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetAPen(rp
);
115 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetBPen(rp
);
119 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetDrMd(rp
);
122 case RPTAG_OutlinePen
:
123 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetOutlinePen(rp
);
126 case RPTAG_WriteMask
:
127 *((IPTR
*)tag
->ti_Data
) = (IPTR
)rp
->Mask
;
141 *((IPTR
*)tag
->ti_Data
) = MaxPen
;
144 case RPTAG_DrawBounds
:
145 ((struct Rectangle
*)tag
->ti_Data
)->MinX
= 0;
146 ((struct Rectangle
*)tag
->ti_Data
)->MinY
= 0;
147 ((struct Rectangle
*)tag
->ti_Data
)->MaxX
= 0;
148 ((struct Rectangle
*)tag
->ti_Data
)->MaxY
= 0;
152 *((IPTR
*)tag
->ti_Data
) = RP_FGCOLOR(rp
);
156 *((IPTR
*)tag
->ti_Data
) = RP_BGCOLOR(rp
);
159 case RPTAG_PatternOriginX
:
160 *((IPTR
*)tag
->ti_Data
) = RP_PATORIGINX(rp
);
163 case RPTAG_PatternOriginY
:
164 *((IPTR
*)tag
->ti_Data
) = RP_PATORIGINY(rp
);
167 case RPTAG_ClipRectangle
:
170 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
175 if (RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
& RPCRF_VALID
)
177 *((struct Rectangle
**)tag
->ti_Data
) = &(RP_DRIVERDATA(rp
)->dd_ClipRectangle
);
181 *((struct Rectangle
**)tag
->ti_Data
) = NULL
;
186 *((IPTR
*)tag
->ti_Data
) = 0;
190 case RPTAG_ClipRectangleFlags
:
193 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
198 *((IPTR
*)tag
->ti_Data
) = RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
;
202 *((IPTR
*)tag
->ti_Data
) = 0;
206 case RPTAG_RemapColorFonts
:
207 *((IPTR
*)tag
->ti_Data
) = (rp
->Flags
& RPF_REMAP_COLORFONTS
) ? TRUE
: FALSE
;
210 } /* switch(tag->ti_Tag) */
212 } /* while ((tag = NextTagItem ((const struct TagItem **)&tstate))) */
216 RELEASE_DRIVERDATA(rp
, GfxBase
);