Functions | |
void | Define_Glyph (const char *name, int data_size, const char *data) |
void | UnDefine_Glyph (char const *name) |
void Define_Glyph | ( | const char * | name, |
int | data_size, | ||
const char * | data | ||
) |
Describes a set of simple geometries which can be later used to define a custom marker, edge or line style.
name | Name of the custom marker, edge, or line style. |
data_size | Size of data |
data | Glyph definition described below. |
Define_Glyph allows users to define a simple set of geometries that can be used to create a custom marker, edge or line style. The data consists of a general header and then specific information about each single piece of geometry in the glyph. A glyph definition is local to a segment and is inherited like any other attribute. Each glyph works off a 256*256 canvas with the defining geometry being located at the center of the canvas at (0,0). When defining the geometry, users should define each location (x, y) such that x and y are in the range of (-127, 128). The colors of the geometry can be either set within the glyph definition or by using the marker, edge and line color and contrast color defined within the containing segment.
The data block header consists of three char values. The first is the nominal radius that defines the radius of the glyph for the purpose of sizing and selection while the second two numbers are the x and y offsets respectively. These offsets allow users to position the glyph relative to the actual insertion point.
The second block in the data block consists of a series of codes which may have optional arguments. Both the codes and their arguments are chars. The various codes and their associated arguments are:
------------------------------------------------------------ "n" where n is a signed char "n>1" A polyline consisting of n points. This code is then followed by a list of n (x, y) pairs which define the polyline within the glyph canvas. "1" A dot. This code is followed by the (x,y) location of the object within the glyph canvas. "0" Termination of glyph definition. This must be at the end of all glyph definitions. "-1" Start fill. Closed geometry subsequent to this will be filled. "-2" Restart fill. "-3" End fill. "-4" Ellipse. This code is followed by 2 (x,y) which define the lower left and upper right corner of the rectangle which contains the ellipse within the glyph canvas. "-5" Circular arc. This code is followed by 3 (x,y) pairs which define the start, an intermediary, and the end point of a circular arc on the glyph canvas. "-6" Infinite line. This code is followed by 2 (x,y) pairs which are located on the line segment within the glyph canvas. "-7" Infinite ray. This code is followed by 2 (x,y) pairs the first of which defines the start point of the ray and the second of which is located which are located on the ray on the glyph canvas. "-8" Start contrast color. The geometry subsequent to this will be colored according to the owning geometries contrast color setting. "-9" Start normal color. The geometry subsequent to this will be colored according to the owning geometries' color setting. "-10" Start RGB color. The geometry subsequent to this will be colored with the rgb value that is defined in the (r,g,b) triplet which is defined in the values immediately following this code. "-11" Start indexed color. The color of the geometry subsequent to this is the index which is defined in the value immediately following this code. ------------------------------------------------------------
A simple examples:
const char crosshairs[] = {10, 0, 0, 2, -10, 0, 10, 0, 2, 0, -10, 0, 10, 0} HC_Open_Segment("?Picture"); HC_Define_Glyph ("crosshairs", sizeof(crosshairs), crosshairs); HC_Set_Marker_Symbol("crosshairs"); HC_Insert_Marker(-0.5, 0.0, 0.0); HC_Close_Segment();
To ensure optimal performance in the drawing of these objects, users should try and minimize the amount of color attributes that are set within a glyph. This is best done by organizing the different geometries according to their colors.
void UnDefine_Glyph | ( | char const * | name | ) |
Removes the glyph definintion established in a previous call to Define_Glyph().
name | Name of the custom marker, edge, or line style. |
No additional details. See Define_Glyph().