1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/* This code is ripped from Autotrace-0.29, but modified by pts. */
/* bitmap.h: definition for a bitmap type. No packing is done by
default; each pixel is represented by an entire byte. Among other
things, this means the type can be used for both grayscale and binary
images. */
#ifndef AT_BITMAP_H
#define AT_BITMAP_H
#ifdef __GNUC__
#ifndef __clang__
#pragma interface
#endif
#endif
#define PTS_SAM2P 1
#define FATALP(m) Error::sev(Error::EERROR) << m << (Error*)0;
#define WARNINGP(m) Error::sev(Error::WARNING) << m << (Error*)0;
#define FATALP1(m,a) Error::sev(Error::EERROR) << m << a << (Error*)0;
#define WARNINGP1(m,a) Error::sev(Error::WARNING) << m << a << (Error*)0;
#define FATALP3(m,a,n,b,o,c,p) Error::sev(Error::EERROR) << m << a << n << b << o << c << p << (Error*)0;
#define WARNINGP3(m,a,n,b,o,c,p) Error::sev(Error::WARNING) << m << n << b << o << c << p << (Error*)0;
#define XMALLOCT(var,typep,size) var=(typep)new char[size]
#define XFREE(p) delete [] (char*)(p)
/* ^^^ Imp: arrays?? */
typedef unsigned at_dimen_t; /**** pts ****/
/* #include "autotrace.h" */
typedef char *at_string;
typedef struct _at_bitmap_type {
at_dimen_t height;
at_dimen_t width;
unsigned char *bitmap;
unsigned int np;
} at_bitmap_type;
#include <stdio.h>
#define xfclose(fd,dummy) fclose(fd)
/* The basic structure and macros to access it. */
typedef at_bitmap_type bitmap_type;
/* The number of color planes of each pixel */
#define BITMAP_PLANES(b) ((b).np)
/* The pixels, represented as an array of bytes (in contiguous storage).
Each pixel is represented by np bytes. */
#define BITMAP_BITS(b) ((b).bitmap)
/* These are convenient abbreviations for geting inside the members. */
#define BITMAP_WIDTH(b) ((b).width)
#define BITMAP_HEIGHT(b) ((b).height)
/* This is the pixel at [ROW,COL]. */
#define BITMAP_PIXEL(b, row, col) \
((BITMAP_BITS (b) + (row) * BITMAP_PLANES (b) * BITMAP_WIDTH (b) \
+ (col) * BITMAP_PLANES(b)))
#define BITMAP_VALID_PIXEL(b, row, col) \
((row) < BITMAP_HEIGHT (b) && (col) < BITMAP_WIDTH (b))
/* Allocate storage for the bits, set them all to white, and return an
initialized structure. */
extern bitmap_type new_bitmap (at_dimen_t, at_dimen_t);
/* Free that storage. */
extern void free_bitmap (bitmap_type *);
#endif /* not AT_BITMAP_H */
|