2 Copyright © 1995-2005, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
6 AROS fillrectclass implementation.
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>
33 #include <aros/asmcall.h>
34 #include <proto/alib.h>
35 #include "intuition_intern.h"
36 #endif /* !__MORPHOS__ */
42 #define IntuitionBase ((struct IntuitionBase *)(cl->cl_UserData))
44 /****************************************************************************/
46 IPTR
fillrect_set(Class
*cl
, Object
*obj
, struct opSet
*msg
)
48 const struct TagItem
*tstate
= msg
->ops_AttrList
;
50 struct FillRectData
*data
= INST_DATA(cl
, obj
);
54 while((tag
= NextTagItem(&tstate
)))
59 ((struct Image
*)obj
)->ImageData
= (APTR
)tag
->ti_Data
;
64 data
->apatsize
= (WORD
)tag
->ti_Data
;
69 data
->mode
= (WORD
)tag
->ti_Data
;
78 /****************************************************************************/
80 IPTR
FillRectClass__IM_DRAW(Class
*cl
, Object
*obj
, struct impDraw
*msg
)
82 struct FillRectData
*data
= INST_DATA(cl
, obj
);
86 if (!((struct impDraw
*)msg
)->imp_RPort
) return 0;
88 memcpy(&rp
,((struct impDraw
*)msg
)->imp_RPort
,sizeof (struct RastPort
));
90 SetABPenDrMd(&rp
, IM_FGPEN((struct Image
*)obj
),
91 IM_BGPEN((struct Image
*)obj
),
94 SetAfPt(&rp
, (APTR
)((struct Image
*)obj
)->ImageData
, data
->apatsize
);
96 x1
= ((struct Image
*)obj
)->LeftEdge
+ ((struct impDraw
*)msg
)->imp_Offset
.X
;
97 y1
= ((struct Image
*)obj
)->TopEdge
+ ((struct impDraw
*)msg
)->imp_Offset
.Y
;
99 if (msg
->MethodID
== IM_DRAW
)
101 x2
= x1
+ ((struct Image
*)obj
)->Width
- 1;
102 y2
= y1
+ ((struct Image
*)obj
)->Height
- 1;
106 x2
= x1
+ msg
->imp_Dimensions
.Width
- 1;
107 y2
= y1
+ msg
->imp_Dimensions
.Height
- 1;
110 RectFill(&rp
, x1
, y1
, x2
, y2
);
115 /****************************************************************************/
117 IPTR
FillRectClass__OM_NEW(Class
*cl
, Object
*obj
, struct opSet
*msg
)
119 obj
= (Object
*)DoSuperMethodA(cl
, obj
, (Msg
)msg
);
121 fillrect_set(cl
, obj
, msg
);
126 /****************************************************************************/
128 IPTR
FillRectClass__OM_SET(Class
*cl
, Object
*obj
, struct opSet
*msg
)
130 return fillrect_set(cl
, obj
, msg
) + DoSuperMethodA(cl
, obj
, (Msg
)msg
);
133 /****************************************************************************/