pcb 4.1.1
An interactive printed circuit board layout editor.

extents.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "global.h"
#include "data.h"
#include "hid.h"
#include "hid_draw.h"
#include "../hidint.h"
#include "hid/common/draw_helpers.h"
Include dependency graph for extents.c:

Go to the source code of this file.

Data Structures

struct  hid_gc_struct

Defines

#define PEX(x, w)
#define PEY(y, w)

Typedefs

typedef struct hid_gc_struct hid_gc_struct

Functions

static int extents_set_layer (const char *name, int group, int empty)
static hidGC extents_make_gc (void)
static void extents_destroy_gc (hidGC gc)
static void extents_use_mask (enum mask_mode mode)
static void extents_set_color (hidGC gc, const char *name)
static void extents_set_line_cap (hidGC gc, EndCapStyle style)
static void extents_set_line_width (hidGC gc, Coord width)
static void extents_set_draw_xor (hidGC gc, int xor_)
static void extents_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void extents_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle end_angle)
static void extents_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void extents_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius)
static void extents_fill_polygon (hidGC gc, int n_coords, Coord *x, Coord *y)
static void extents_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
void hid_extents_init (void)
BoxTypehid_get_extents (void *item)
 Convenience function that calls the expose callback for the item, and returns the extents of what was drawn.

Variables

static BoxType box
static HID extents_hid
static HID_DRAW extents_graphics

Define Documentation

#define PEX (   x,
 
)
Value:
if (box.X1 > (x)-(w)) box.X1 = (x)-(w); \
        if (box.X2 < (x)+(w)) box.X2 = (x)+(w)

Definition at line 96 of file extents.c.

Referenced by extents_draw_arc(), extents_draw_line(), extents_draw_rect(), extents_fill_circle(), extents_fill_polygon(), and extents_fill_rect().

#define PEY (   y,
 
)
Value:
if (box.Y1 > (y)-(w)) box.Y1 = (y)-(w); \
        if (box.Y2 < (y)+(w)) box.Y2 = (y)+(w)

Definition at line 98 of file extents.c.

Referenced by extents_draw_arc(), extents_draw_line(), extents_draw_rect(), extents_fill_circle(), extents_fill_polygon(), and extents_fill_rect().


Typedef Documentation

typedef struct hid_gc_struct hid_gc_struct

Function Documentation

static void extents_destroy_gc ( hidGC  gc) [static]

Definition at line 65 of file extents.c.

Referenced by hid_extents_init().

static void extents_draw_arc ( hidGC  gc,
Coord  cx,
Coord  cy,
Coord  width,
Coord  height,
Angle  start_angle,
Angle  end_angle 
) [static]

Definition at line 111 of file extents.c.

References PEX, PEY, and hid_gc_struct::width.

Referenced by hid_extents_init().

static void extents_draw_line ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 102 of file extents.c.

References PEX, PEY, and hid_gc_struct::width.

Referenced by hid_extents_init().

static void extents_draw_rect ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 120 of file extents.c.

References PEX, PEY, and hid_gc_struct::width.

Referenced by hid_extents_init().

static void extents_fill_circle ( hidGC  gc,
Coord  cx,
Coord  cy,
Coord  radius 
) [static]

Definition at line 129 of file extents.c.

References PEX, and PEY.

Referenced by hid_extents_init().

static void extents_fill_polygon ( hidGC  gc,
int  n_coords,
Coord x,
Coord y 
) [static]

Definition at line 136 of file extents.c.

References PEX, and PEY.

Referenced by hid_extents_init().

static void extents_fill_rect ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 147 of file extents.c.

References PEX, and PEY.

Referenced by hid_extents_init().

static hidGC extents_make_gc ( void  ) [static]

Definition at line 57 of file extents.c.

References malloc().

Referenced by hid_extents_init().

Here is the call graph for this function:

static void extents_set_color ( hidGC  gc,
const char *  name 
) [static]

Definition at line 76 of file extents.c.

Referenced by hid_extents_init().

static void extents_set_draw_xor ( hidGC  gc,
int  xor_ 
) [static]

Definition at line 92 of file extents.c.

Referenced by hid_extents_init().

static int extents_set_layer ( const char *  name,
int  group,
int  empty 
) [static]
static void extents_set_line_cap ( hidGC  gc,
EndCapStyle  style 
) [static]

Definition at line 81 of file extents.c.

Referenced by hid_extents_init().

static void extents_set_line_width ( hidGC  gc,
Coord  width 
) [static]

Definition at line 86 of file extents.c.

References hid_gc_struct::width.

Referenced by hid_extents_init().

static void extents_use_mask ( enum mask_mode  mode) [static]

Definition at line 71 of file extents.c.

Referenced by hid_extents_init().

BoxType* hid_get_extents ( void *  item)

Convenience function that calls the expose callback for the item, and returns the extents of what was drawn.

Definition at line 199 of file extents.c.

References box, hid_expose_callback(), hid_extents_init(), region, BoxType::X1, BoxType::X2, BoxType::Y1, and BoxType::Y2.

Referenced by lesstif_show_item().

Here is the call graph for this function:


Variable Documentation

Definition at line 156 of file extents.c.

Referenced by hid_extents_init().

HID extents_hid [static]

Definition at line 155 of file extents.c.