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!
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 pen to render (see SetMaxPen())
46 RPTAG_DrawBounds Determine the area that will be rendered
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 *****************************************************************************/
97 struct TagItem
*tag
, *tstate
= tags
;
99 BOOL havedriverdata
= FALSE
;
101 while ((tag
= NextTagItem ((const struct Tagitem
**)&tstate
)))
106 *((IPTR
*)tag
->ti_Data
) = (IPTR
)rp
->Font
;
110 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetAPen(rp
);
114 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetBPen(rp
);
118 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetDrMd(rp
);
121 case RPTAG_OutlinePen
:
122 *((IPTR
*)tag
->ti_Data
) = (IPTR
)GetOutlinePen(rp
);
125 case RPTAG_WriteMask
:
126 *((IPTR
*)tag
->ti_Data
) = (IPTR
)rp
->Mask
;
140 *((IPTR
*)tag
->ti_Data
) = MaxPen
;
143 case RPTAG_DrawBounds
:
144 ((struct Rectangle
*)tag
->ti_Data
)->MinX
= 0;
145 ((struct Rectangle
*)tag
->ti_Data
)->MinY
= 0;
146 ((struct Rectangle
*)tag
->ti_Data
)->MaxX
= 0;
147 ((struct Rectangle
*)tag
->ti_Data
)->MaxY
= 0;
151 *((IPTR
*)tag
->ti_Data
) = RP_FGCOLOR(rp
);
155 *((IPTR
*)tag
->ti_Data
) = RP_BGCOLOR(rp
);
158 case RPTAG_PatternOriginX
:
159 *((IPTR
*)tag
->ti_Data
) = RP_PATORIGINX(rp
);
162 case RPTAG_PatternOriginY
:
163 *((IPTR
*)tag
->ti_Data
) = RP_PATORIGINY(rp
);
166 case RPTAG_ClipRectangle
:
169 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
174 if (RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
& RPCRF_VALID
)
176 *((struct Rectangle
**)tag
->ti_Data
) = &(RP_DRIVERDATA(rp
)->dd_ClipRectangle
);
180 *((struct Rectangle
**)tag
->ti_Data
) = NULL
;
185 *((IPTR
*)tag
->ti_Data
) = 0;
189 case RPTAG_ClipRectangleFlags
:
192 havedriverdata
= OBTAIN_DRIVERDATA(rp
, GfxBase
);
197 *((IPTR
*)tag
->ti_Data
) = RP_DRIVERDATA(rp
)->dd_ClipRectangleFlags
;
201 *((IPTR
*)tag
->ti_Data
) = 0;
205 case RPTAG_RemapColorFonts
:
206 *((IPTR
*)tag
->ti_Data
) = (rp
->Flags
& RPF_REMAP_COLORFONTS
) ? TRUE
: FALSE
;
209 } /* switch(tag->ti_Tag) */
211 } /* while ((tag = NextTagItem ((const struct TagItem **)&tstate))) */
215 RELEASE_DRIVERDATA(rp
, GfxBase
);