Note: The Agar manual pages follow certain conventions, notably concerning function return values. Please read AG_Intro(3) first.
SYNOPSIS
#include <agar/core.h> #include <agar/gui.h> |
DESCRIPTION
|
Agar provides a few primitive rendering routines designed specifically for
the rendering of GUI elements, as opposed to general-purpose graphics (look
into other libraries, such as the included
VG(3) and
RG(3) for this).
It is illegal to invoke the following routines outside of AG_Widget(3) rendering context (e.g., the widget draw() operation). The coordinates for all AG_Draw*() functions are given in pixels, in the widget's local coordinate system. The AG_Color and AG_BlendFn types are commonly used to specify colors and blending modes, see AG_Color(3) and AG_BlendFn(3) for details. |
PRIMITIVES
|
AG_PutPixel() writes a single pixel at the specified coordinates. The AG_PutPixelRGB() variant accepts individual red, green and blue color arguments. The AG_PutPixel32() variant accepts a 32-bit pixel value such that no conversion is necessary when writing the pixel to the framebuffer. Conversion may be achieved using AG_MapPixelRGB with the videoFmt member of the widget's associated AG_Driver(3) structure. The AG_BlendPixel() function writes a pixel at the specified coordinates, using alpha blending with the specified blending function. The AG_BlendPixelRGBA() variant accepts an array of red, green, blue and alpha arguments. The AG_BlendPixel32() variant accepts a 32-bit packed-pixel value such that minimal conversion is necessary when writing to the framebuffer. Conversion may be achieved using AG_MapPixelRGB with the global agSurfaceFmt. Note that active clipping rectangles (see AG_Widget(3)) apply to AG_PutPixel*() and AG_BlendPixel*(). These operations are also safe to use when underlying graphics driver is not framebuffer-based. 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_BlendFn(3) for details). |
SIMPLE GRAPHICAL ELEMENTS
SYMBOLS
The AG_DrawPlus() and AG_DrawMinus() routines render plus ("+") or minus ("-") signs spanning rectangle r using the specified color and blending function. 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. |
SEE ALSO
AG_Intro(3), AG_BlendFn(3), AG_Color(3), AG_Style(3), AG_Widget(3), VG(3), RG(3) The FreeSG library - http://freesg.org/ |
HISTORY
| Simple widget primitives first appeared in Agar 1.0. The basic rendering system was redesigned in Agar 1.4. |
