Next Previous Contents

2. Functions to manipulate the current graphics context

2.1 General

The default values of an visual are:

void ggiResetVisual(ggi_dc dc);

Reset the visual to the default values (as listed above).

2.2 Clipping

void ggiSetClip(ggi_visual vis, int x1, int y1, int x2, int y2);

Set the clipping rectangle to the intersection of ((x1,y1),(x2,y2)) and the current clipping rectangle. A pixel (x,y) lies inside the clipping rectangle if (x >= x1 && y >= y2 && x < x2 && y < y2). ggiSetClip(dc, x, y, x, y) disables all drawing.

void ggiResetClip(ggi_visual vis);

Reset the clipping rectangle to default values.

ggi_bool ggiPointVisible(ggi_visual vis, int x, int y);

Returns true if the point (x,y) lies inside the clipping rectangle.

ggi_bool ggiRectVisible(ggi_visual vis, int x1, int y1, int x2, int y2);

Returns true if the rectangle ((x1,y1),(x2,y2)) intersects the clipping rectangle.

2.3 Drawing modes

void ggiSetArcMode(ggi_visual vis, ggi_arcmode mode);

ggi_arcmode ggiGetArcMode(ggi_visual vis);

Set/Get the current arc mode:

 typedef enum { 
 GGI_ARC_PIE, 
 GGI_ARC_CHORD
 } ggi_arcmode;
 

void ggiSetPolyMode(ggi_visual vis, ggi_polymode mode);

ggi_polymode ggiGetPolyMode(ggi_visual vis);

Set/Get the current polygon mode:

 typedef enum { 
 GGI_POLY_ALTERNATE, 
 /* alternate rule */
 GGI_POLY_WINDING 
 /* winding rule */
 } ggi_polymode;
 

void ggiSetLineStipple(ggi_visual vis, uint stipple, uint count);

void ggiGetLineStipple(ggi_visual vis, uint *stipple, uint *count);

Set/Get the current line stipple.

void ggiSetAntialias(ggi_visual vis, ggi_bool antialias);

ggi_bool ggiGetAntialias(ggi_visual vis);

Set/Get the antialiasing mode.

2.4 Color and texture

void ggiSetDrawColor(ggi_visual vis, ggi_col color);

ggi_col ggiGetDrawColor(ggi_visual vis);

Set/Get the current drawing color.

void ggiSetFillColor(ggi_visual vis, ggi_col color);

ggi_col ggiGetFillColor(ggi_visual vis);

Set/Get the current filling color.

void ggiSetFillTexture(ggi_visual vis, int refx, int refy, ggi_visual texture);

Set the texture and the reference point (refx,refy). The color of a drawn pixel at (x,y) is now the texel at (abs(refx-x) mod texture.width, abs(refy-y) mod texture.height).

ggi_visual ggiGetFillTexture(ggi_visual vis, int *refx, int *refy);

Get the current texture and reference point. Returns NULL and (0,0) if no texture is set.

2.5 Drawing style

void ggiSetOperator(ggi_visual vis, ggi_operator operator);

ggi_operator ggiGetOperator(ggi_visual vis);

Set/Get the current operator.

 typedef enum { 
 GGI_NOOP, /* dest = dest */
 GGI_INVERT, /* dest = ~dest */
 GGI_SET, /* dest = src */
 GGI_SET_INVERTED, /* dest = ~src */
 GGI_AND, /* dest = (dest & src) */
 GGI_NAND, /* dest = ~(dest & src) */
 GGI_AND_REVERSE, /* dest = ~dest & src */
 GGI_AND_INVERTED, /* dest = dest & ~src */
 GGI_OR, /* dest = (dest | src) */
 GGI_NOR, /* dest = ~(dest | src) */
 GGI_OR_REVERSE, /* dest = ~dest & src */
 GGI_OR_INVERTED, /* dest = dest & ~src */
 GGI_XOR, /* dest = (dest ^ src) */
 GGI_EQUIV, /* dest = ~(dest ^ src) */
 GGI_ADD, /* dest = dest + src */
 GGI_SUB /* dest = dest - src */
 } ggi_operator;
 

void ggiSetAlpha(ggi_visual vis, ggi_alpha alpha);

ggi_alpha ggiGetAlpha(ggi_visual vis);

Set/Get the current alpha value.


Next Previous Contents