Re: semicircle

Search this archive.

From: Emilian URSU (emilian@lspvs.sorosis.ro)
Date: Tue 30 Nov 1999 - 08:36:19 IST


What you said draws a semicircle and it's good
but I need to fill it with another color than background...
what can you tell me about that ?


On Mon, 29 Nov 1999, Jay Link wrote:

:
:> does anyone knows how do I fill a semicircle ?
:
:Easy way: draw a complete circle with gl_circle(), and then erase half of
:it with gl_fillbox(). Use gl's framebuffer if you don't want to erase your
:background, i.e., draw to the framebuffer, and then transfer to the
:physical screen.
:
:Harder (but better) way: copy the gl_circle() function from the line.c
:source file in SVGAlib's gl subdirectory. You will also need the
:gl_setcirclepixels() function, which is called by gl_circle(). You will
:notice that gl_setcirclepixels() has eight drawing commands to speed up
:the process. They look like this:
:
:    setpixel(sx + x, sy + y, c);
:    setpixel(sx - x, sy + y, c);
:    setpixel(sx + x, sy - y, c);
:    setpixel(sx - x, sy - y, c);
:    setpixel(sx + y, sy + x, c);
:    setpixel(sx - y, sy + x, c);
:    setpixel(sx + y, sy - x, c);
:    setpixel(sx - y, sy - x, c);
:
:Remove the four that you don't need. (This assumes that your semicircle is
:exactly 1/2 of a full circle).
:
:HTH,
:
:-Jay Link
:


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:22 IST