libgeda

m_hatch.c File Reference

#include <config.h>
#include <math.h>
#include <string.h>
#include <libgeda_priv.h>
Include dependency graph for m_hatch.c:

Go to the source code of this file.

Data Structures

struct  st_sweep_status
struct  st_sweep_event

Typedefs

typedef struct st_sweep_event SWEEP_EVENT
typedef struct st_sweep_status SWEEP_STATUS

Functions

static gint calculate_initial_sweep (gint pitch, gint min_y, gint max_y)
 Calculate the initial y cooridinate of the hatch sweep line.
static gint compare_events (gconstpointer a, gconstpointer b)
 Compares two sweep events.
static gint compare_status (gconstpointer a, gconstpointer b)
 Compares two sweep status structs.
void m_hatch_box (BOX *box, gint angle, gint pitch, GArray *lines)
 Calculates line segments to hatch a box shape.
void m_hatch_circle (CIRCLE *circle, gint angle, gint pitch, GArray *lines)
 Calculates line segments to hatch a circle.
void m_hatch_path (PATH *path, gint angle, gint pitch, GArray *lines)
 Calculates line segments to hatch a path.
void m_hatch_polygon (GArray *points, gint angle, gint pitch, GArray *lines)
 Calculates line segments to hatch an arbitrary polygon.

Typedef Documentation

typedef struct st_sweep_event SWEEP_EVENT

Definition at line 25 of file m_hatch.c.

typedef struct st_sweep_status SWEEP_STATUS

Definition at line 26 of file m_hatch.c.


Function Documentation

static gint calculate_initial_sweep ( gint  pitch,
gint  min_y,
gint  max_y 
) [static]

This function centers the hatch lines across the extents of the shape being hatched. This caclulation provides symmetrical hatch lines inside symmetrical shapes, such as circles and squares. This mechanism may not provide as nice of an appearance in asymmetrical shapes.

Parameters:
pitch[in] The perpendicular distance between hatch lines.
min_y[in] The minimum y coordinate of the object being hatched.
max_y[in] The maximum y coordinate of the object being hatched.
Returns:
The initital y coordinate of the sweep line.

Definition at line 56 of file m_hatch.c.

static gint compare_events ( gconstpointer  a,
gconstpointer  b 
) [static]

Compares two sweep events for ordering the event queue. The prototype and behavior are consistant with GCompareFunc.

Parameters:
a[in] The first sweep event.
b[in] The second sweep event.
Returns:
A negative value if the first is less than the second, zero if the first equals the second, and a positive value if the first is greater than the second.

Definition at line 74 of file m_hatch.c.

static gint compare_status ( gconstpointer  a,
gconstpointer  b 
) [static]

Compares two sweep status for ordering the sweep status. The prototype and behavior are consistant with GCompareFunc.

Parameters:
a[in] The first sweep status.
b[in] The second sweep status.
Returns:
A negative value if the first is less than the second, zero if the first equals the second, and a positive value if the first is greater than the second.

Definition at line 93 of file m_hatch.c.

void m_hatch_box ( BOX box,
gint  angle,
gint  pitch,
GArray *  lines 
)

This function appends new line segments to the lines GArray. For creating a hatch pattern, the GArray must be cleared before calling this function. For creating cross hatch patterns, this function can be called multiple times with a different angle or pitch while passing the same lines GArray.

Parameters:
box[in] The box shape to hatch.
angle[in] The angle of the hatch lines with respect to the x axis.
pitch[in] The distance between hatch lines
lines[inout] A GArray of LINE to contain the new hatch line segments. This function appends new line segments to the GArray and leaves existing GArray contents unchanged.

Definition at line 115 of file m_hatch.c.

Here is the call graph for this function:

void m_hatch_circle ( CIRCLE circle,
gint  angle,
gint  pitch,
GArray *  lines 
)

This function appends new line segments to the lines GArray. For creating a hatch pattern, the GArray must be cleared before calling this function. For creating cross hatch patterns, this function can be called multiple times with a different angle or pitch while passing the same lines GArray.

Parameters:
circle[in] The circle shape to hatch.
angle[in] The angle of the hatch lines with respect to the x axis.
pitch[in] The distance between hatch lines
lines[inout] A GArray of LINE to contain the new hatch line segments. This function appends new line segments to the GArray and leaves existing GArray contents unchanged.

Definition at line 160 of file m_hatch.c.

Here is the call graph for this function:

void m_hatch_path ( PATH path,
gint  angle,
gint  pitch,
GArray *  lines 
)

This function appends new line segments to the lines GArray. For creating a hatch pattern, the GArray must be cleared before calling this function. For creating cross hatch patterns, this function can be called multiple times with a different angle or pitch while passing the same lines GArray.

Parameters:
path[in] The path shape to hatch.
angle[in] The angle of the hatch lines with respect to the x axis.
pitch[in] The distance between hatch lines
lines[inout] A GArray of LINE to contain the new hatch line segments. This function appends new line segments to the GArray and leaves existing GArray contents unchanged.

Definition at line 207 of file m_hatch.c.

Here is the call graph for this function:

void m_hatch_polygon ( GArray *  points,
gint  angle,
gint  pitch,
GArray *  lines 
)

This function appends new line segments to the lines GArray. For creating a hatch pattern, the GArray must be cleared before calling this function. For creating cross hatch patterns, this function can be called multiple times with a different angle or pitch while passing the same lines GArray.

Parameters:
points[in] The endpoints of the arbitrary closed polygon to hatch.
angle[in] The angle of the hatch lines with respect to the x axis.
pitch[in] The distance between hatch lines. This value must be greater than zero.
lines[inout] A GArray of LINE to contain the new hatch line segments. This function appends new line segments to the GArray and leaves existing GArray contents unchanged.

Definition at line 237 of file m_hatch.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines