grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / graphics / drawellipse.c
blob1e3cbfde338fc9d4754a41b35f6589f76f9e6957
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$ $Log
5 Desc: Graphics function DrawEllipse
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include <clib/macros.h>
11 #include <graphics/rastport.h>
13 #include "graphics_intern.h"
14 #include "gfxfuncsupport.h"
15 #include "intregions.h"
17 /****************************************************************************************/
19 struct ellipse_render_data
21 struct render_special_info rsi;
22 WORD a, b;
25 static ULONG ellipse_render(APTR ellipse_rd, WORD srcx, WORD srcy,
26 OOP_Object *dstbm_obj, OOP_Object *dst_gc,
27 struct Rectangle *rect, struct GfxBase *GfxBase)
29 struct ellipse_render_data *erd = ellipse_rd;
32 * This is a quick way to install ClipRect on a GC. Just set one pointer.
33 * This is why we have a struct Rectangle * in the GC.
35 GC_DOCLIP(dst_gc) = rect;
37 HIDD_BM_DrawEllipse(dstbm_obj, dst_gc, erd->a + rect->MinX - srcx, erd->b + rect->MinY - srcy,
38 erd->a, erd->b);
41 * After we exit this routine, 'rect' will be not valid any more.
42 * So do not forget to reset the pointer!
44 GC_DOCLIP(dst_gc) = NULL;
46 return 0;
49 /*****************************************************************************
51 NAME */
52 #include <graphics/rastport.h>
53 #include <proto/graphics.h>
55 AROS_LH5(void, DrawEllipse,
57 /* SYNOPSIS */
58 AROS_LHA(struct RastPort *, rp, A1),
59 AROS_LHA(WORD , xCenter, D0),
60 AROS_LHA(WORD , yCenter, D1),
61 AROS_LHA(WORD , a, D2),
62 AROS_LHA(WORD , b, D3),
64 /* LOCATION */
65 struct GfxBase *, GfxBase, 30, Graphics)
67 /* FUNCTION
68 Draw an ellipse
70 INPUTS
71 rp - destination RastPort
72 xCenter,yCenter - coordinate of centerpoint
73 a - radius in x direction
74 b - radius in y direction
76 RESULT
78 NOTES
80 EXAMPLE
82 BUGS
84 SEE ALSO
86 INTERNALS
88 HISTORY
89 29-10-95 digulla automatically created from
90 graphics_lib.fd and clib/graphics_protos.h
92 *****************************************************************************/
94 AROS_LIBFUNC_INIT
96 struct Rectangle rr;
97 struct ellipse_render_data erd;
99 FIX_GFXCOORD(xCenter);
100 FIX_GFXCOORD(yCenter);
101 FIX_GFXCOORD(a);
102 FIX_GFXCOORD(b);
104 /* bug("driver_DrawEllipse(%d %d %d %d)\n", xCenter, yCenter, a, b);
106 rr.MinX = xCenter - a;
107 rr.MinY = yCenter - b;
108 rr.MaxX = xCenter + a;
109 rr.MaxY = yCenter + b;
111 erd.a = a;
112 erd.b = b;
114 do_render_func(rp, NULL, &rr, ellipse_render, &erd, TRUE, TRUE, GfxBase);
116 AROS_LIBFUNC_EXIT
118 } /* DrawEllipse */