Agar provides a set of basic rendering operations designed for rendering GUI
elements efficiently (as opposed to general-purpose graphics, as would be
handled by libraries such as OpenGL or
VG(3)). It is illegal to invoke these routines outside of the
draw() method of an
AG_Widget(3) (what we refer to as
rendering context). |
The x and y coordinates for the AG_Draw*() routines are given in pixels in the widget argument's local coordinate system.
AG_PutPixel() sets the pixel at x, y to the native display color that most closely matches the given AG_Color(3). The AG_PutPixelRGB(), AG_PutPixelRGB_8(), and AG_PutPixelRGB_16() forms accept component values as separate arguments.
The AG_PutPixel32() form accept an 8- to 32-bit wide pixel already in native display format. Under AG_LARGE, the AG_PutPixel64() form also allows 48- and 64-bit wide pixel values.
The AG_BlendPixel() function blends an existing pixel against a given AG_Color(3), overwriting the pixel with the best native-display approximation of the result.
AG_BlendPixel32() and AG_BlendPixel64() accept a 32- and 64-bit pixel value.
Coordinates to AG_PutPixel*() and AG_BlendPixel*() are checked, and intersected against active clipping rectangles (see AG_Widget(3)).
AG_DrawFrame() draws a 3D-style frame. AG_DrawFrameBlended() draws a frame with alpha-blending, with the color c specified as an array of RGBA components, and the given blending mode.
AG_DrawCircle() draws a circle with the origin at x, y and a radius of radius pixels.
AG_DrawLine() scan-converts a line segment going from point x1, y1 to point x2, y2. The variants AG_DrawLineH() and AG_DrawLineV() render horizontal and vertical line segments, respectively. AG_DrawLine2() renders two line segments for a 3D-style effect.
AG_DrawLineBlended() renders an alpha-blended line, where the RGBA components are passed as the c array, and the blending function is specified in blendFn.
The AG_DrawRect() function fills a destination rectangle with the specified color. If the color is non-opaque, blending is performed.
AG_DrawRectOutline() draws the outline of a rectangle.
AG_DrawRectFilled() fills an opaque rectangle with the specified color, ignoring any alpha component.
AG_DrawRectBlended() draws a blended rectangle of the color c, specified as an array or RGBA components. AG_DrawRectBlended() differs from AG_DrawRect() in that it accepts an explicit blending mode blendFn (see AG_AlphaFn(3) for details).
SIMPLE GRAPHICAL ELEMENTS
The AG_DrawPlus() and AG_DrawMinus() routines render plus ("+") or minus ("-") signs spanning rectangle r using the specified color and blending function.
AG_DrawTriangle() renders a triangle of color c given three unordered vertices v1, v2, and v3.
AG_DrawArrowUp(), AG_DrawArrowDown(), AG_DrawArrowLeft() and AG_DrawArrowRight() draw an arrow at the specified coordinates. h and w specify the size of the arrow in pixels.
|AG_AlphaFn(3), AG_Color(3), AG_Intro(3), AG_Widget(3), RG(3), VG(3)|
|Simple widget primitives first appeared in Agar 1.0. The basic rendering system was redesigned in Agar 1.4. 64-bit pixel access routines were added in Agar 1.6.|