pcb 4.1.1
An interactive printed circuit board layout editor.
|
This header file collects some general-purpose macros (and static inline functions) that are used in various places. More...
Go to the source code of this file.
Defines | |
#define | BM_WORDSIZE ((int)sizeof(potrace_word)) |
The bitmap type is defined in potracelib.h. | |
#define | BM_WORDBITS (8*BM_WORDSIZE) |
#define | BM_HIBIT (((potrace_word)1)<<(BM_WORDBITS-1)) |
#define | BM_ALLBITS (~(potrace_word)0) |
#define | bm_scanline(bm, y) ((bm)->map + (y)*(bm)->dy) |
#define | bm_index(bm, x, y) (&bm_scanline(bm, y)[(x)/BM_WORDBITS]) |
#define | bm_mask(x) (BM_HIBIT >> ((x) & (BM_WORDBITS-1))) |
#define | bm_range(x, a) ((int)(x) >= 0 && (int)(x) < (a)) |
#define | bm_safe(bm, x, y) (bm_range(x, (bm)->w) && bm_range(y, (bm)->h)) |
#define | BM_UGET(bm, x, y) ((*bm_index(bm, x, y) & bm_mask(x)) != 0) |
#define | BM_USET(bm, x, y) (*bm_index(bm, x, y) |= bm_mask(x)) |
#define | BM_UCLR(bm, x, y) (*bm_index(bm, x, y) &= ~bm_mask(x)) |
#define | BM_UINV(bm, x, y) (*bm_index(bm, x, y) ^= bm_mask(x)) |
#define | BM_UPUT(bm, x, y, b) ((b) ? BM_USET(bm, x, y) : BM_UCLR(bm, x, y)) |
#define | BM_GET(bm, x, y) (bm_safe(bm, x, y) ? BM_UGET(bm, x, y) : 0) |
#define | BM_SET(bm, x, y) (bm_safe(bm, x, y) ? BM_USET(bm, x, y) : 0) |
#define | BM_CLR(bm, x, y) (bm_safe(bm, x, y) ? BM_UCLR(bm, x, y) : 0) |
#define | BM_INV(bm, x, y) (bm_safe(bm, x, y) ? BM_UINV(bm, x, y) : 0) |
#define | BM_PUT(bm, x, y, b) (bm_safe(bm, x, y) ? BM_UPUT(bm, x, y, b) : 0) |
Functions | |
static void | bm_free (potrace_bitmap_t *bm) |
Free the given bitmap. Leaves errno untouched. | |
static potrace_bitmap_t * | bm_new (int w, int h) |
Create a new bitmap. | |
static void | bm_clear (potrace_bitmap_t *bm, int c) |
Clear the given bitmap. | |
static potrace_bitmap_t * | bm_dup (const potrace_bitmap_t *bm) |
Duplicate the given bitmap. | |
static void | bm_invert (potrace_bitmap_t *bm) |
Invert the given bitmap. |
This header file collects some general-purpose macros (and static inline functions) that are used in various places.
PCB, interactive printed circuit board design
Copyright (C) 2001-2007 Peter Selinger.
This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details.
Definition in file bitmap.h.
#define BM_ALLBITS (~(potrace_word)0) |
Definition at line 45 of file bitmap.h.
Referenced by bm_clearexcess(), bm_invert(), and xor_to_ref().
Definition at line 60 of file bitmap.h.
Referenced by bm_to_pathlist(), findnext(), findpath(), majority(), and pathlist_to_tree().
#define BM_HIBIT (((potrace_word)1)<<(BM_WORDBITS-1)) |
Definition at line 51 of file bitmap.h.
Referenced by bm_clearexcess(), findnext(), and xor_to_ref().
Definition at line 64 of file bitmap.h.
Referenced by gcode_do_export().
Definition at line 50 of file bitmap.h.
Referenced by clear_bm_with_bbox().
#define BM_WORDBITS (8*BM_WORDSIZE) |
Definition at line 43 of file bitmap.h.
Referenced by bm_clearexcess(), bm_new(), clear_bm_with_bbox(), findnext(), xor_path(), and xor_to_ref().
#define BM_WORDSIZE ((int)sizeof(potrace_word)) |
The bitmap type is defined in potracelib.h.
Definition at line 42 of file bitmap.h.
Referenced by bm_clear(), bm_dup(), and bm_new().
static void bm_clear | ( | potrace_bitmap_t * | bm, |
int | c | ||
) | [inline, static] |
Clear the given bitmap.
Set all bits to c.
Definition at line 113 of file bitmap.h.
References BM_WORDSIZE, potrace_bitmap_s::dy, potrace_bitmap_s::h, and potrace_bitmap_s::map.
Referenced by pathlist_to_tree().
static potrace_bitmap_t* bm_dup | ( | const potrace_bitmap_t * | bm | ) | [inline, static] |
Duplicate the given bitmap.
Definition at line 124 of file bitmap.h.
References bm_new(), BM_WORDSIZE, potrace_bitmap_s::dy, potrace_bitmap_s::h, potrace_bitmap_s::map, and potrace_bitmap_s::w.
Referenced by bm_to_pathlist().
static void bm_free | ( | potrace_bitmap_t * | bm | ) | [inline, static] |
Free the given bitmap. Leaves errno untouched.
Definition at line 70 of file bitmap.h.
References potrace_bitmap_s::map.
Referenced by bm_to_pathlist(), and gcode_do_export().
static void bm_invert | ( | potrace_bitmap_t * | bm | ) | [inline, static] |
Invert the given bitmap.
Definition at line 139 of file bitmap.h.
References BM_ALLBITS, potrace_bitmap_s::dy, potrace_bitmap_s::h, and potrace_bitmap_s::map.
static potrace_bitmap_t* bm_new | ( | int | w, |
int | h | ||
) | [inline, static] |
Create a new bitmap.
Definition at line 85 of file bitmap.h.
References BM_WORDBITS, BM_WORDSIZE, potrace_bitmap_s::dy, potrace_bitmap_s::h, malloc(), potrace_bitmap_s::map, and potrace_bitmap_s::w.
Referenced by bm_dup(), and gcode_do_export().