[AD] Additional graphics primitives API

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


Hello everyone,

Here's a little set of functions I propose to add to
allegro5, all are meant to be harware accelerated and
all have implementations mostly done (in OpenGL only
though, no DirectX and no software(yet)).

Here are the equivalents for old allegro functions.
The flags in all of these are the ALLEGRO_OUTLINED and
ALLEGRO_FILLED. Filled arcs look like pizza slices.
Parameters for these should be self-explanatory.

void al_draw_polygon(float* vertices, int
number_vertices, ALLEGRO_COLOR color, int flags);
void al_draw_ellipse(float x, float y, float r1, float
r2, ALLEGRO_COLOR color, int flags);
void al_draw_arc(float x, float y, float r, float
theta1, float theta2, ALLEGRO_COLOR color, int flags);
void al_draw_line(float fx, float fy, float tx, float
ty, ALLEGRO_COLOR color);
void al_draw_rectangle(float l, float r, float t,
float b, ALLEGRO_COLOR color, int flags);
void al_draw_triangle(float x1, float y1, float x2,
float y2, float x3, float y3, ALLEGRO_COLOR color, int
flags);
void al_calc_spline(float points[8], float* vertices,
int num_vertices);
void al_draw_spline(float points[8], ALLEGRO_COLOR
color);
void al_put_pixel(float x, float y, ALLEGRO_COLOR
color);

Some notes on the above. al_draw_polygon only accepts
convex polygons now. al_draw_arc when called with the
filled flag has no obvious implementation for memory
bitmaps. The al_calc_spline are almost identical to
the versions in the old allegro, but with different
parameters. I draw elipses and arcs using a polygonal
approximation... which sometimes has pixel differences
from the allegro's version. There is no al_draw_circle
since the code is exactly the same as the
al_draw_ellipse... so that should be called instead.
There is no al_get_pixel since I am unsure how such
things are handled... Also there are no do_*
functions, since they do not need to be accelerated.
There are these functions however:

void al_calc_ellipse(float x, float y, float r1, float
r2, float* vertices, int num_vertices);
void al_calc_line(float fx, float fy, float tx, float
ty, float* vertices, int num_vertices);
void al_calc_arc(float x, float y, float r, float
theta1, float theta2, float* vertices, int
num_vertices);
void al_calc_ellipse(float x, float y, float r1, float
r2, float* vertices, int num_vertices);

They are identical in operation to al_calc_spline. I
figured that they might be useful.

There are also a bunch of other functions I made...
but I guess they could be put in a completely separate
addon:

void al_draw_polyline(float* vertices, int
number_vertices, ALLEGRO_COLOR color);
void al_set_polygon_stipple(const uint8_t * mask, int
enable);
void al_set_line_stipple(int factor, unsigned short
pattern, int enable);
void al_set_line_width(float width);
void al_set_point_width(float width);

Aside from draw_polyline (this just draws a line
strip) there are no obvious memory bitmap
implementations of the other 4 functions.

My guess that assuming that these are fine, the next
step would be for me to add the implementations into
the actual source code and test them there? Or would
it be better if I just sent the implementations to
someone with greater knowledge of allegro5's
internals?

-SiegeLord


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 





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