2 Copyright © 1995-2011, 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__ */
38 /****************************************************************************/
40 IPTR
fillrect_set(Class
*cl
, Object
*obj
, struct opSet
*msg
)
42 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
43 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
44 struct TagItem
*tag
, *tstate
= msg
->ops_AttrList
;
45 struct FillRectData
*data
= INST_DATA(cl
, obj
);
49 while((tag
= NextTagItem(&tstate
)))
54 ((struct Image
*)obj
)->ImageData
= (APTR
)tag
->ti_Data
;
59 data
->apatsize
= (WORD
)tag
->ti_Data
;
64 data
->mode
= (WORD
)tag
->ti_Data
;
73 /****************************************************************************/
75 IPTR
FillRectClass__IM_DRAW(Class
*cl
, Object
*obj
, struct impDraw
*msg
)
77 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
78 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
79 struct FillRectData
*data
= INST_DATA(cl
, obj
);
83 if (!((struct impDraw
*)msg
)->imp_RPort
) return 0;
85 memcpy(&rp
,((struct impDraw
*)msg
)->imp_RPort
,sizeof (struct RastPort
));
87 SetABPenDrMd(&rp
, IM_FGPEN((struct Image
*)obj
),
88 IM_BGPEN((struct Image
*)obj
),
91 SetAfPt(&rp
, (APTR
)((struct Image
*)obj
)->ImageData
, data
->apatsize
);
93 x1
= ((struct Image
*)obj
)->LeftEdge
+ ((struct impDraw
*)msg
)->imp_Offset
.X
;
94 y1
= ((struct Image
*)obj
)->TopEdge
+ ((struct impDraw
*)msg
)->imp_Offset
.Y
;
96 if (msg
->MethodID
== IM_DRAW
)
98 x2
= x1
+ ((struct Image
*)obj
)->Width
- 1;
99 y2
= y1
+ ((struct Image
*)obj
)->Height
- 1;
103 x2
= x1
+ msg
->imp_Dimensions
.Width
- 1;
104 y2
= y1
+ msg
->imp_Dimensions
.Height
- 1;
107 RectFill(&rp
, x1
, y1
, x2
, y2
);
112 /****************************************************************************/
114 IPTR
FillRectClass__OM_NEW(Class
*cl
, Object
*obj
, struct opSet
*msg
)
116 obj
= (Object
*)DoSuperMethodA(cl
, obj
, (Msg
)msg
);
118 fillrect_set(cl
, obj
, msg
);
123 /****************************************************************************/
125 IPTR
FillRectClass__OM_SET(Class
*cl
, Object
*obj
, struct opSet
*msg
)
127 return fillrect_set(cl
, obj
, msg
) + DoSuperMethodA(cl
, obj
, (Msg
)msg
);
130 /****************************************************************************/