Check for SYS/GL during library init. Reason is that
[AROS.git] / rom / intuition / eraseimage.c
blobfcf151fe6d079b9904f40fad9588a236cde716c5
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/graphics.h>
8 #include <proto/layers.h>
9 #include "intuition_intern.h"
10 #include <intuition/classusr.h>
11 #ifdef __MORPHOS__
12 #include <clib/alib_protos.h>
13 #else
14 #include <proto/alib.h>
15 #endif
17 /*****************************************************************************
19 NAME */
20 #include <graphics/rastport.h>
21 #include <graphics/rpattr.h>
22 #include <intuition/intuition.h>
23 #include <intuition/imageclass.h>
24 #include <proto/intuition.h>
26 AROS_LH4(void, EraseImage,
28 /* SYNOPSIS */
29 AROS_LHA(struct RastPort *, rp, A0),
30 AROS_LHA(struct Image *, image, A1),
31 AROS_LHA(LONG , leftOffset, D0),
32 AROS_LHA(LONG , topOffset, D1),
34 /* LOCATION */
35 struct IntuitionBase *, IntuitionBase, 105, Intuition)
37 /* FUNCTION
38 Erase an image on the screen.
40 INPUTS
41 rp - Render in this RastPort
42 image - Erase this image
43 leftOffset, topOffset - Add this offset the the position in the
44 image.
46 RESULT
47 None.
49 NOTES
51 EXAMPLE
53 BUGS
55 SEE ALSO
56 DrawImage(), DrawImageState()
58 INTERNALS
60 *****************************************************************************/
62 AROS_LIBFUNC_INIT
64 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
65 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
66 EXTENDWORD(leftOffset);
67 EXTENDWORD(topOffset);
69 SANITY_CHECK(rp)
70 SANITY_CHECK(image)
72 if (rp->Layer) LockLayer(0,rp->Layer);
74 if (image != NULL)
76 if (image->Depth == CUSTOMIMAGEDEPTH)
78 struct impErase method;
80 #ifdef __MORPHOS__
81 IPTR penmode;
83 GetRPAttrs(rp,RPTAG_PenMode,(ULONG)&penmode,TAG_DONE);
84 #endif
86 method.MethodID = IM_ERASE;
87 method.imp_RPort = rp;
88 method.imp_Offset.X = leftOffset;
89 method.imp_Offset.Y = topOffset;
91 DoMethodA ((Object *)image, (Msg)&method);
93 #ifdef __MORPHOS__
94 SetRPAttrs(rp,RPTAG_PenMode,penmode,TAG_DONE);
95 #endif
97 else
99 EraseRect (rp,
100 leftOffset + image->LeftEdge,
101 topOffset + image->TopEdge,
102 leftOffset + image->LeftEdge + image->Width,
103 topOffset + image->TopEdge + image->Height
108 if (rp->Layer) UnlockLayer(rp->Layer);
110 AROS_LIBFUNC_EXIT
111 } /* EraseImage */