G-Octave Manual: Drawing Functions

When complete, Goctave will include a very versatile set of drawing functions, known as the Goctave Drawing Toolkit. These are intended to work in conjunction with the image manipulation functions included with Octave, to provide a set of drawing primitives that you can use in your programs to create simple charts and line drawings.

All functions in this packages are prefaced with "gd_". They have the general form: image = gd_function(image, color, arg_1, ..., arg_n), where image is a bitmap contained in a matrix, and color is an index in the current color map.

The images returned can be displayed with octaves image() function, or further manipulated. In the future I would like to write and improved display engine for Octave images.

PROBLEMS/BUGS: Most of these functions are currently implemented as interpreted Octave files, ergo are quite slow. This is because I wanted to get the system prototyped and test the algorithms. Once I have everything working, I will rewrite them in C and we'll see some serious speed improvements. Of course, help would be appreciated.

Function File : image = gd_bezier ( image, color, x0, y0, x1, y1, x2, y2, x3, y3)
Draws a bezier curve on the image in color. Bezier curves are parametric curves defined by a start point, (x0, y0), an end point, (x3, y3), and two control points (x1, y1) and (x2, y2).

Inputs:

image
The image to draw upon.
color
The color to use. An index in the current colormap.
x0...x3, y0...y3
The x and y coordinates of four points. See above.

Outputs:

image
The new image (with the curve drawn on it).

Function File : image = gd_bezier ( image, color, x0, y0, x1, y1, x2, y2, x3, y3)
Draws a bezier curve on the image in color. Bezier curves are parametric curves defined by a start point, (x0, y0), an end point, (x3, y3), and two control points (x1, y1) and (x2, y2).

Inputs:

image
The image to draw upon.
color
The color to use. An index in the current colormap.
x0...x3, y0...y3
The x and y coordinates of four points. See above.

Outputs:

image
The new image (with the curve drawn on it).

Function File : image = gd_segment ( image, color, x0, y0, x1, y1)
Draws a line segment on the image.

Inputs:

image
The image to draw upon.
color
The color to use. An index in the current colormap.
(x0, y0), (x1, y1)
The x and y coordinates of the end points.

Outputs:

image
The new image (with the line-segment drawn on it).



This Document is Copyright 2000 By Kevin Straight. Permission is hereby granted to make verbatim copies for non-profit purposes.