some fixes to accented characters
[tangerine.git] / rom / intuition / fillrectclass.c
blobc8a89c7b43b0274e514cc0c1084ea2f4e963633b
1 /*
2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 AROS fillrectclass implementation.
7 */
9 #include <exec/types.h>
11 #include <intuition/intuition.h>
12 #include <intuition/intuitionbase.h>
13 #include <intuition/classes.h>
14 #include <intuition/classusr.h>
15 #include <intuition/imageclass.h>
17 #include <graphics/gfxbase.h>
18 #include <graphics/gfxmacros.h>
20 #include <utility/tagitem.h>
21 #include <utility/hooks.h>
23 #include <clib/macros.h>
25 #include <proto/exec.h>
26 #include <proto/intuition.h>
27 #include <proto/graphics.h>
28 #include <proto/utility.h>
30 #include <string.h>
32 #ifndef __MORPHOS__
33 #include <aros/asmcall.h>
34 #include <proto/alib.h>
35 #include "intuition_intern.h"
36 #endif /* !__MORPHOS__ */
38 #ifdef IntuitionBase
39 # undef IntuitionBase
40 #endif
42 #define IntuitionBase ((struct IntuitionBase *)(cl->cl_UserData))
44 /****************************************************************************/
46 IPTR fillrect_set(Class *cl, Object *obj, struct opSet *msg)
48 struct TagItem *tag, *tstate = msg->ops_AttrList;
49 struct FillRectData *data = INST_DATA(cl, obj);
51 IPTR retval = 0;
53 while((tag = NextTagItem(&tstate)))
55 switch(tag->ti_Tag)
57 case IA_APattern:
58 ((struct Image *)obj)->ImageData = (APTR)tag->ti_Data;
59 retval = 1;
60 break;
62 case IA_APatSize:
63 data->apatsize = (WORD)tag->ti_Data;
64 retval = 1;
65 break;
67 case IA_Mode:
68 data->mode = (WORD)tag->ti_Data;
69 retval = 1;
70 break;
74 return retval;
77 /****************************************************************************/
79 IPTR FillRectClass__IM_DRAW(Class *cl, Object *obj, struct impDraw *msg)
81 struct FillRectData *data = INST_DATA(cl, obj);
82 struct RastPort rp;
83 WORD x1, y1, x2, y2;
85 if (!((struct impDraw *)msg)->imp_RPort) return 0;
87 memcpy(&rp,((struct impDraw *)msg)->imp_RPort,sizeof (struct RastPort));
89 SetABPenDrMd(&rp, IM_FGPEN((struct Image *)obj),
90 IM_BGPEN((struct Image *)obj),
91 data->mode);
93 SetAfPt(&rp, (APTR)((struct Image *)obj)->ImageData, data->apatsize);
95 x1 = ((struct Image *)obj)->LeftEdge + ((struct impDraw *)msg)->imp_Offset.X;
96 y1 = ((struct Image *)obj)->TopEdge + ((struct impDraw *)msg)->imp_Offset.Y;
98 if (msg->MethodID == IM_DRAW)
100 x2 = x1 + ((struct Image *)obj)->Width - 1;
101 y2 = y1 + ((struct Image *)obj)->Height - 1;
103 else
105 x2 = x1 + msg->imp_Dimensions.Width - 1;
106 y2 = y1 + msg->imp_Dimensions.Height - 1;
109 RectFill(&rp, x1, y1, x2, y2);
111 return 0;
114 /****************************************************************************/
116 IPTR FillRectClass__OM_NEW(Class *cl, Object *obj, struct opSet *msg)
118 obj = (Object *)DoSuperMethodA(cl, obj, (Msg)msg);
119 if (obj)
120 fillrect_set(cl, obj, msg);
122 return (IPTR)obj;
125 /****************************************************************************/
127 IPTR FillRectClass__OM_SET(Class *cl, Object *obj, struct opSet *msg)
129 return fillrect_set(cl, obj, msg) + DoSuperMethodA(cl, obj, (Msg)msg);
132 /****************************************************************************/