File: xpaint.h

package info (click to toggle)
xpaint 2.9.1.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,712 kB
  • sloc: ansic: 73,018; sh: 492; yacc: 249; lex: 128; sed: 43; makefile: 13
file content (159 lines) | stat: -rw-r--r-- 4,490 bytes parent folder | download | duplicates (7)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* +-------------------------------------------------------------------+ */
/* | Copyright 1992, 1993, David Koblas (koblas@netcom.com)            | */
/* | Copyright 1995, 1996 Torsten Martinsen (bullestock@dk-online.dk)  | */
/* |                                                                   | */
/* | Permission to use, copy, modify, and to distribute this software  | */
/* | and its documentation for any purpose is hereby granted without   | */
/* | fee, provided that the above copyright notice appear in all       | */
/* | copies and that both that copyright notice and this permission    | */
/* | notice appear in supporting documentation.  There is no           | */
/* | representations about the suitability of this software for        | */
/* | any purpose.  this software is provided "as is" without express   | */
/* | or implied warranty.                                              | */
/* |                                                                   | */
/* +-------------------------------------------------------------------+ */

/* $Id: xpaint.h,v 1.17 2005/03/20 20:15:32 demailly Exp $ */

#if defined(HAVE_PARAM_H)
#include <sys/param.h>
#endif

#ifndef MIN
#define MIN(a,b)	(((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b)	(((a) > (b)) ? (a) : (b))
#endif
#ifndef ABS
#define ABS(a)		((a > 0) ? (a) : 0 - (a))
#endif
#ifndef SIGN
#define SIGN(a)		((a > 0) ? 1 : -1)
#endif

#ifdef __STDC__
#define CONCAT(a,b)	a##b
#else
#define CONCAT(a,b)	a/**/b
#endif

#ifdef AIXV3
#ifdef NULL
#undef NULL
#endif				/* NULL */
#define NULL 0
#endif				/* AIXV3 */

enum {BROWSER_READ=0, BROWSER_MULTIREAD, BROWSER_LOADED, 
      BROWSER_SAVE, BROWSER_SIMPLEREAD, BROWSER_SIMPLESAVE};

extern char *routine;

typedef struct {
    unsigned int s1;
    unsigned int s2;
} CRCdata;

typedef struct {
    int x, y;
    Pixmap pix, mask;
    unsigned char *alpha;
    CRCdata crcdata;
} RegionData;

extern struct Global_s {
    struct {
	void *image;
	Colormap cmap;
	int width, height;
	Pixmap pix, mask;
        unsigned char *alpha;
    } clipboard;
    Display *display;
    Visual *visual;
    XtAppContext appContext;
    int depth;
    Boolean timeToDie;
    Boolean explore;
    Boolean transparent;
    Boolean astext;
    Time currentTime;
    XVisualInfo vis;
    char * xft_name;   /* name of Xft font */
    char * xft_text;
    void * xft_font;
    double xft_size;   /* size of font */
    double xft_height; /* height of font */
    double xft_ascent, xft_descent, xft_maxadv; 
                       /* ascent, descent, max advance */
    double xft_rotation;     /* angle of rotation of font */
    double xft_inclination;  /* inclination */
    double xft_dilation;     /* dilation */
    double xft_linespacing;  /* linespacing factor */
    unsigned int alpha_threshold, alpha_bg, alpha_fg;
    unsigned int default_width, default_height;
    int operation;
    int default_zoom;
    int numpage;
    int cap, join, escape;  /* line caps and joins */
    int dashnumber, dashoffset; /* dash parameters */
    char dashlist[72];
    unsigned char bg[8];
    double dpi;
    Widget toplevel, bar, back, canvas, curpaint, 
           patternshell, brushpopup, popped_up, popped_parent;
    Pixmap brushpix;
    int nbrushes;
    void ** brushes;
    void * patterninfo;
    int numfiles;
    char ** loadedfiles;
    int numregions;
    RegionData * regiondata;
} Global;

typedef void *(*OperationFunc) (Widget,...);

typedef void *(*OperationAddProc) (Widget);
typedef void (*OperationRemoveProc) (Widget, void *);
typedef OperationFunc Operation_t;
#ifdef remove	/* remove is a macro in sco 3.2v4 */
#undef remove
#endif
typedef struct {
    OperationAddProc add;
    OperationRemoveProc remove;
} OperationPair;

#ifdef DEFINE_GLOBAL
#define EXTERN(var, val)	var = val ;
#else
#define EXTERN(var, val)	extern var ;
#endif

EXTERN(OperationPair * CurrentOp, NULL)
#ifdef DEFINE_GLOBAL
struct Global_s Global;
#endif

#define AllButtonsMask \
	(Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)

/* gradient fill modes */
#define GFILL_RADIAL 0
#define GFILL_LINEAR 1
#define GFILL_CONE   2
#define GFILL_SQUARE 3

/*
**  Value at which zoom starts putting in "white" lines
**    between pixels
 */
#define ZOOM_THRESH 5

#define XYtoRECT(x1,y1,x2,y2,rect)					\
			(rect)->x = MIN(x1,x2); 			\
			(rect)->y = MIN(y1,y2);				\
			(rect)->width = MAX(x1,x2) - (rect)->x + 1;	\
			(rect)->height = MAX(y1,y2) - (rect)->y + 1;