Re: [AD] Additional graphics primitives API

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Feb 7, 2008 10:16 PM, Paul Suntsov <siegelords_abode@xxxxxxxxxx> wrote:
>
> In this case, I shall propose the following. Allegro
> proper should have the following functions:
>
> al_draw_polygon
> al_draw_line//a special case of al_draw_polygon
> al_draw_triangle//same as above
> al_draw_rectangle//same as above
> al_set_pixel

al_draw_pixel would be a better name - especially as we already have a
function al_put_pixel to directly modify a pixel (bypassing blending).
(There was some argument for keeping it that way in the last hack day,
but I forgot it.)

> My reasoning behind these is that these primitives are
> as basic as things go, and (unless I am mistaken) can
> be used to draw every other primitive there is,
> sometimes by using al_set_pixel in extreme cases.

Sounds like good reasoning to me.

> In the addon category we'd have these things:
>
> al_draw_circle//using the do circle approach - i.e.
> directly porting the software drawing functions
> al_draw_ellipse//same as above
> al_draw_arc//same as above
> And all of the al_do_* functions
>
> al_draw_poly_circle
> al_draw_poly_ellipse
> al_draw_poly_arc
> al_draw_poly_spline
> And the al_calc_* routines for each of those.
>
> All of these functions are drawn using the primitive
> functions from allegro. We also would have two
> versions of the curve primitives. This way, the users
> can either choose the very accurate but sometimes slow
> routines when they want to, but also have the option
> to use the faster approximations. Additional benefit
> of these latter functions is that they anti-alias well
> (even if this is not supported by allegro proper).

I'm not really convinced by the poly_ versions. If I want to draw a
polygon following a circle or spline, then I can easily do so myself,
without a function. And then I also get to control where exactly the
vertices are. Well, maybe it's not completely trivial, but still, I
think instead of:

al_draw_poly_circle(x, y, radius, subdivisions, color)

I would be better to have:

al_draw_regular_polygon(x, y, radius, angle, subdivisions, color)

As that more clearly tells what it does. The angle would control the
position of the first vertex, e.g. 0 to have it at the top.

Also, before thinking too long about all the features this would still
be missing, we should definitely include examples showing how you can
just as easy do these things with OpenGL and then also get
anti-aliasing and texturing. And if possible also include a simple
addon which allows drawing with libart or cairo (likely they allow
drawing with OpenGL, so just needs some driver-dependent integration
in the addon).




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/