g2: graphical output

- Main Page
- Modules
- Files
- Related Pages

# graphical output
[g2 User Interface]

## Modules

| splines

## Functions

void | g2_move (int dev, double x, double y)
void | g2_move_r (int dev, double dx, double dy)
void | g2_plot (int dev, double x, double y)
void | g2_plot_r (int dev, double rx, double ry)
void | g2_line (int dev, double x1, double y1, double x2, double y2)
void | g2_line_r (int dev, double dx, double dy)
void | g2_line_to (int dev, double x, double y)
void | g2_poly_line (int dev, int N_pt, double *points)
void | g2_triangle (int dev, double x1, double y1, double x2, double y2, double x3, double y3)
void | g2_filled_triangle (int dev, double x1, double y1, double x2, double y2, double x3, double y3)
void | g2_rectangle (int dev, double x1, double y1, double x2, double y2)
void | g2_filled_rectangle (int dev, double x1, double y1, double x2, double y2)
void | g2_polygon (int dev, int N_pt, double *points)
void | g2_filled_polygon (int dev, int N_pt, double *points)
void | g2_ellipse (int dev, double x, double y, double r1, double r2)
void | g2_filled_ellipse (int dev, double x, double y, double r1, double r2)
void | g2_circle (int dev, double x, double y, double r)
void | g2_filled_circle (int dev, double x, double y, double r)
void | g2_arc (int dev, double x, double y, double r1, double r2, double a1, double a2)
void | g2_filled_arc (int dev, double x, double y, double r1, double r2, double a1, double a2)
void | g2_string (int dev, double x, double y, const char *text)
void | g2_image (int dev, double x, double y, int x_size, int y_size, int *pens)
void | g2_plot_QP (int dev, double x, double y)

## Function Documentation

void g2_arc | ( | int | dev,
|  | double | x,
|  | double | y,
|  | double | r1,
|  | double | r2,
|  | double | a1,
|  | double | a2
| ) |

Draw an arc.

Parameters:

  | dev | device
  | x | x coordinate of the center
  | y | y coordinate of the center
  | r1 | x radius
  | r2 | y radius
  | a1 | starting angle (in deg. 0-360)
  | a2 | ending angle (in deg. 0-360)

void g2_circle | ( | int | dev,
|  | double | x,
|  | double | y,
|  | double | r
| ) |

Draw a circle.

Parameters:

  | dev | device
  | x | x coordinate of the center
  | y | y coordinate of the center
  | r | radius

void g2_ellipse | ( | int | dev,
|  | double | x,
|  | double | y,
|  | double | r1,
|  | double | r2
| ) |

Draw an ellipse.

Parameters:

  | dev | device
  | x | x coordinate of the center
  | y | y coordinate of the center
  | r1 | x radius
  | r2 | y radius

void g2_filled_arc | ( | int | dev,
|  | double | x,
|  | double | y,
|  | double | r1,
|  | double | r2,
|  | double | a1,
|  | double | a2
| ) |

Draw a filled arc.

Parameters:

  | dev | device
  | x | x coordinate of the center
  | y | y coordinate of the center
  | r1 | x radius
  | r2 | y radius
  | a1 | starting angle (in deg. 0-360)
  | a2 | ending angle (in deg. 0-360)

void g2_filled_circle | ( | int | dev,
|  | double | x,
|  | double | y,
|  | double | r
| ) |

Draw a filled circle.

Parameters:

  | dev | device
  | x | x coordinate of the center
  | y | y coordinate of the center
  | r | radius

void g2_filled_ellipse | ( | int | dev,
|  | double | x,
|  | double | y,
|  | double | r1,
|  | double | r2
| ) |

Draw a filled ellipse.

Parameters:

  | dev | device
  | x | x coordinate of the center
  | y | y coordinate of the center
  | r1 | x radius
  | r2 | y radius

void g2_filled_polygon | ( | int | dev,
|  | int | N_pt,
|  | double * | points
| ) |

Draw a filled polygon.

Parameters:

  | dev | device
  | N_pt | number of points (Note: It is not size of points vector!)
  | points | vector of coordinates: x1, y1, x2, y2, ...

void g2_filled_rectangle | ( | int | dev,
|  | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2
| ) |

Draw a filled rectangle specified by the two opposite corner points.

Parameters:

  | dev | device
  | x1 | x coordinate of the 1st corner
  | y1 | y coordinate of the 1st corner
  | x2 | x coordinate of the 3rd corner
  | y2 | y coordinate of the 3rd corner

void g2_filled_triangle | ( | int | dev,
|  | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | double | x3,
|  | double | y3
| ) |

Draw a filled triangle specified by the 3 corner points.

Parameters:

  | dev | device
  | x1 | x coordinate of the 1st corner
  | y1 | y coordinate of the 1st corner
  | x2 | x coordinate of the 2nd corner
  | y2 | y coordinate of the 2nd corner
  | x3 | x coordinate of the 3rd corner
  | y3 | y coordinate of the 3rd corner

void g2_image | ( | int | dev,
|  | double | x,
|  | double | y,
|  | int | x_size,
|  | int | y_size,
|  | int * | pens
| ) |

Draw a pen image

Parameters:

  | dev | device
  | x | x coordinate
  | y | y coordinate
  | x_size | x size
  | y_size | y size
  | pens | vector of x_size*y_size pens: p11, p21, ... pxy, ...

void g2_line | ( | int | dev,
|  | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2
| ) |

Draw a line from `x1`, `y1` to `x2`, `y2`.

Parameters:

  | dev | device
  | x1 | see above
  | y1 | see above
  | x2 | see above
  | y2 | see above

void g2_line_r | ( | int | dev,
|  | double | dx,
|  | double | dy
| ) |

Draw line relative to the graphic cursor.

Parameters:

  | dev | device
  | dx | relative x coordinate
  | dy | relative y coordinate

void g2_line_to | ( | int | dev,
|  | double | x,
|  | double | y
| ) |

Draw line from graphic cursor to the point x, y

Parameters:

  | dev | device
  | x | x coordinate
  | y | y coordinate

void g2_move | ( | int | dev,
|  | double | x,
|  | double | y
| ) |

Move graphic cursor.

Parameters:

  | dev | device
  | x | x coordinate
  | y | y coordinate

void g2_move_r | ( | int | dev,
|  | double | dx,
|  | double | dy
| ) |

Move graphic cursor relative to the currner graphical cursor position.

Parameters:

  | dev | device
  | dx | x coordinate increment
  | dy | y coordinate increment

void g2_plot | ( | int | dev,
|  | double | x,
|  | double | y
| ) |

Plot a point

Parameters:

  | dev | device
  | x | x coordinate
  | y | y coordinate

void g2_plot_QP | ( | int | dev,
|  | double | x,
|  | double | y
| ) |

Quasi Pixel fake. Quasi pixel is introduced to make easier plotting of cellular automata and related pictures. QP is simple a big pixel as specified by g2_set_QP(). Coordinates are skaled accordingly, so no recalculation is needed on client side.

Parameters:

  | dev | device
  | x | x coordinate
  | y | y coordinate

void g2_plot_r | ( | int | dev,
|  | double | rx,
|  | double | ry
| ) |

Plot a point relative to graphical cursor.

Parameters:

  | dev | device
  | rx | relative x coordinate
  | ry | relative y coordinate

void g2_poly_line | ( | int | dev,
|  | int | N_pt,
|  | double * | points
| ) |

Draw a poly line.

Parameters:

  | dev | device
  | N_pt | number of points (Note: It is not size of points vector!)
  | points | vector of coordinates: x1, y1, x2, y2, ...

void g2_polygon | ( | int | dev,
|  | int | N_pt,
|  | double * | points
| ) |

Draw a polygon.

Parameters:

  | dev | device
  | N_pt | number of points (Note: It is not size of points vector!)
  | points | vector of coordinates: x1, y1, x2, y2, ...

void g2_rectangle | ( | int | dev,
|  | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2
| ) |

Draw a rectangle specified by the two opposite corner points.

Parameters:

  | dev | device
  | x1 | x coordinate of the 1st corner
  | y1 | y coordinate of the 1st corner
  | x2 | x coordinate of the 3rd corner
  | y2 | y coordinate of the 3rd corner

void g2_string | ( | int | dev,
|  | double | x,
|  | double | y,
|  | const char * | text
| ) |

Draw string, see also g2_set_font_size().

Parameters:

  | dev | device
  | x | x coordinate
  | y | y coordinate
  | text | null terminated string

void g2_triangle | ( | int | dev,
|  | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | double | x3,
|  | double | y3
| ) |

Draw a triangle described by 3 corner points.

Parameters:

  | dev | device
  | x1 | x coordinate of the 1st corner
  | y1 | y coordinate of the 1st corner
  | x2 | x coordinate of the 2nd corner
  | y2 | y coordinate of the 2nd corner
  | x3 | x coordinate of the 3rd corner
  | y3 | y coordinate of the 3rd corner