2 * Grace - GRaphing, Advanced Computation and Exploration of data
4 * Home page: http://plasma-gate.weizmann.ac.il/Grace/
6 * Copyright (c) 1996-2003 Grace Development Team
8 * Maintained by Evgeny Stambulchik
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 #include <grace/canvas.h>
41 #if defined(DEBUG_T1LIB)
42 # define T1LOGFILE LOGFILE
44 # define T1LOGFILE NO_LOGFILE
47 #define T1_DEFAULT_BITMAP_PAD 8
49 #define T1_AALEVELS_LOW 5
50 #define T1_AALEVELS_HIGH 17
52 #define fRGB2fSRGB(c) (c <= 0.0031308 ? 12.92*c:1.055*pow(c, 1.0/2.4) - 0.055)
54 /* Drawing properties */
79 typedef struct _CSGlyphCache
{
87 /* drawing properties */
90 /* page background fill */
98 unsigned int npatterns
;
102 unsigned int nlinestyles
;
122 unsigned int ndevices
;
123 Device_entry
**device_table
;
126 Device_entry
*curdevice
;
128 /* "device ready" flag */
139 /* user-supplied procedure for parsing composite strings */
140 CanvasCSParseProc csparse_proc
;
141 /* user-supplied procedure for mapping font ids */
142 CanvasFMapProc fmap_proc
;
144 /* font size scale */
146 /* line width scale */
152 /* cached values of the grayscale AA levels and validity flags */
154 unsigned long aacolors_low
[T1_AALEVELS_LOW
];
155 int aacolors_high_ok
;
156 unsigned long aacolors_high
[T1_AALEVELS_HIGH
];
159 int clip_line(const Canvas
*canvas
,
160 const VPoint
*vp1
, const VPoint
*vp2
, VPoint
*vp1c
, VPoint
*vp2c
);
161 int points_overlap(const Canvas
*canvas
, const VPoint
*vp1
, const VPoint
*vp2
);
163 void canvas_dev_drawpixel(Canvas
*canvas
, const VPoint
*vp
);
164 void canvas_dev_drawpolyline(Canvas
*canvas
,
165 const VPoint
*vps
, int n
, int mode
);
166 void canvas_dev_fillpolygon(Canvas
*canvas
, const VPoint
*vps
, int nc
);
167 void canvas_dev_drawarc(Canvas
*canvas
,
168 const VPoint
*vp1
, const VPoint
*vp2
, double a1
, double a2
);
169 void canvas_dev_fillarc(Canvas
*canvas
,
170 const VPoint
*vp1
, const VPoint
*vp2
, double a1
, double a2
, int mode
);
171 void canvas_dev_putpixmap(Canvas
*canvas
, const VPoint
*vp
, const CPixmap
*pm
);
172 void canvas_dev_puttext(Canvas
*canvas
,
173 const VPoint
*vp
, const char *s
, int len
, int font
, const TextMatrix
*tm
,
174 int underline
, int overline
, int kerning
);
176 void canvas_stats_reset(Canvas
*canvas
);
178 int initgraphics(Canvas
*canvas
, const CanvasStats
*cstats
);
179 void leavegraphics(Canvas
*canvas
, const CanvasStats
*cstats
);
181 int is_valid_bbox(const view
*v
);
183 void reset_bboxes(Canvas
*canvas
);
184 void update_bboxes(Canvas
*canvas
, const VPoint
*vp
);
185 int update_bboxes_with_view(Canvas
*canvas
, const view
*v
);
186 int update_bboxes_with_vpoints(Canvas
*canvas
,
187 const VPoint
*vps
, int n
, double lw
);
189 int is_valid_color(const RGB
*rgb
);
190 int find_color(const Canvas
*canvas
, const RGB
*rgb
);
191 int realloc_color(Canvas
*canvas
, int n
);
192 void canvas_color_trans(Canvas
*canvas
, CMap_entry
*cmap
);
193 int make_color_scale(Canvas
*canvas
,
194 unsigned int fg
, unsigned int bg
,
195 unsigned int ncolors
, unsigned long *colors
);
196 int get_colortype(const Canvas
*canvas
, unsigned int cindex
);
197 int add_color(Canvas
*canvas
, const RGB
*rgb
, int ctype
);
199 int canvas_set_pattern(Canvas
*canvas
, unsigned int n
, const Pattern
*pat
);
200 int canvas_set_linestyle(Canvas
*canvas
, unsigned int n
, const LineStyle
*ls
);
202 int init_t1(Canvas
*canvas
);
203 void initialize_patterns(Canvas
*canvas
);
204 void initialize_linestyles(Canvas
*canvas
);
206 void get_page_viewport(const Canvas
*canvas
, double *vx
, double *vy
);
208 Device_entry
*get_curdevice_props(const Canvas
*canvas
);
210 #endif /* __CANVASP_H_ */