File: gtkplotpc.h

package info (click to toggle)
genius 1.0.24-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 27,952 kB
  • sloc: ansic: 105,597; xml: 67,672; sh: 4,537; makefile: 2,089; lex: 499; yacc: 298; perl: 54; python: 22
file content (305 lines) | stat: -rw-r--r-- 9,462 bytes parent folder | download | duplicates (8)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/* gtkplotpc - gtkplot print context - a renderer for printing functions
 * Copyright 1999-2001  Adrian E. Feiguin <feiguin@ifir.edu.ar>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GTK_PLOT_PC_H__
#define __GTK_PLOT_PC_H__

#include <stdio.h>
#include "gtkpsfont.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */


#define GTK_PLOT_PC(obj)        G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_plot_pc_get_type (), GtkPlotPC)
#define GTK_TYPE_PLOT_PC   (gtk_plot_pc_get_type ())

#define GTK_PLOT_PC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_plot_pc_get_type(), GtkPlotPCClass)
#define GTK_IS_PLOT_PC(obj)     G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_plot_pc_get_type ())


/* Page size */

typedef enum{
     GTK_PLOT_LETTER	,
     GTK_PLOT_LEGAL	,
     GTK_PLOT_A4	,
     GTK_PLOT_EXECUTIVE	,
     GTK_PLOT_CUSTOM	
} GtkPlotPageSize;

#define GTK_PLOT_LETTER_W 	612   /* Width and Height in ps points */
#define GTK_PLOT_LETTER_H 	792

#define GTK_PLOT_LEGAL_W	612
#define GTK_PLOT_LEGAL_H	1008

#define GTK_PLOT_A4_W		595
#define GTK_PLOT_A4_H		842

#define GTK_PLOT_EXECUTIVE_W	540
#define GTK_PLOT_EXECUTIVE_H	720


/* Page orientation */
typedef enum{
     GTK_PLOT_PORTRAIT	,
     GTK_PLOT_LANDSCAPE	
} GtkPlotPageOrientation;

/* Size units */
typedef enum{
     GTK_PLOT_PSPOINTS	,
     GTK_PLOT_MM	,
     GTK_PLOT_CM	,
     GTK_PLOT_INCHES	
} GtkPlotUnits;


typedef struct _GtkPlotPC GtkPlotPC;
typedef struct _GtkPlotPCClass GtkPlotPCClass;
typedef struct _GtkPlotPoint         GtkPlotPoint;

/**
 * GtkPlotPoint:
 *
 * The GtkPlotPoint struct contains only private data.
 * It should only be accessed through the functions described below.
 */
struct _GtkPlotPoint
{
    /*< private >*/
  gdouble x, y;
};

struct _GtkPlotPC
{
   GtkObject object;

   gdouble width, height; /* viewport */
   GdkColor color;

   gint init_count;
   gboolean use_pixmap;
};


struct _GtkPlotPCClass
{
   GtkObjectClass parent_class;

   gboolean  (* init)					(GtkPlotPC *pc);

   void  (* leave)					(GtkPlotPC *pc);

   void  (* set_viewport)				(GtkPlotPC *pc,
							 gdouble w, gdouble h);

   void  (* gsave)					(GtkPlotPC *pc);

   void  (* grestore)					(GtkPlotPC *pc);

   void  (* clip)					(GtkPlotPC *pc,
							 const GdkRectangle *area);
   void  (* clip_mask)					(GtkPlotPC *pc,
							 gdouble x,
							 gdouble y,
							 const GdkBitmap *mask);

   void  (* set_color)                     		(GtkPlotPC *pc,
                                                 	const GdkColor *color);

   void  (* set_lineattr)			(GtkPlotPC *pc,
						 gfloat line_width,
                                                 GdkLineStyle line_style,
                                                 GdkCapStyle cap_style,
                                                 GdkJoinStyle join_style);

   void  (* set_dash)					(GtkPlotPC *pc,
							 gdouble offset_,	
							 gdouble *values,
							 gint num_values);

   void  (* draw_point)					(GtkPlotPC *pc,
							 gdouble x, gdouble y);

   void  (* draw_line)					(GtkPlotPC *pc,
							 gdouble x1, gdouble y1,
							 gdouble x2, gdouble y2);

   void  (* draw_lines)					(GtkPlotPC *pc,
							 GtkPlotPoint *points,
							 gint numpoints);

   void  (* draw_rectangle)	                        (GtkPlotPC *pc,
							 gboolean filled,
							 gdouble x, gdouble y,
							 gdouble width,
							 gdouble height);

   void  (* draw_polygon)	                        (GtkPlotPC *pc,
							 gboolean filled,
                                	                 GtkPlotPoint *points,
                                        	         gint numpoints);

   void  (* draw_circle) 	                        (GtkPlotPC *pc,
							 gboolean filled,
                                                 	 gdouble x, gdouble y,
                                                 	 gdouble size); 

   void  (* draw_ellipse) 	                        (GtkPlotPC *pc,
							 gboolean filled,
                                                 	 gdouble x, gdouble y,
                                                 	 gdouble width, 
                                                 	 gdouble height); 

   void  (* set_font)					(GtkPlotPC *pc,
							 GtkPSFont *psfont,
							 gint height);

   void  (* draw_string)   	                        (GtkPlotPC *pc,
                                   	             	 gint x, gint y,
                                               		 gint angle,
							 const GdkColor *fg,
							 const GdkColor *bg,
							 gboolean transparent,
							 gint border,
							 gint border_space,
							 gint border_width,
							 gint shadow_width,
							 const gchar *font,
							 gint height,
							 GtkJustification just,
							 const gchar *text);

   void  (* draw_pixmap)   	                        (GtkPlotPC *pc,
							 GdkPixmap *pixmap,
							 GdkBitmap *mask,
                                   	             	 gint xsrc, gint ysrc,
                                   	             	 gint xdest, gint ydest,
                                   	             	 gint width, 
                                                         gint height, 
                                   	             	 gdouble scale_x, 
                                                         gdouble scale_y); 
};

GType     gtk_plot_pc_get_type				(void);
GtkObject *gtk_plot_pc_new				(void);
							 
gboolean gtk_plot_pc_init				(GtkPlotPC *pc);

void gtk_plot_pc_leave					(GtkPlotPC *pc);
void gtk_plot_pc_set_viewport				(GtkPlotPC *pc,
							 gdouble w, gdouble h);

void gtk_plot_pc_gsave					(GtkPlotPC *pc);

void gtk_plot_pc_grestore				(GtkPlotPC *pc);

void gtk_plot_pc_clip					(GtkPlotPC *pc,
							 GdkRectangle *area);
void gtk_plot_pc_clip_mask				(GtkPlotPC *pc,
							 gdouble x, 
							 gdouble y, 
							 GdkBitmap *mask);

void gtk_plot_pc_set_color                     		(GtkPlotPC *pc,
                                                   	 GdkColor *color);

void gtk_plot_pc_set_lineattr			  (GtkPlotPC *pc,
		                                   gfloat line_width,
                                                   GdkLineStyle line_style,
                                                   GdkCapStyle cap_style,
                                                   GdkJoinStyle join_style);

void gtk_plot_pc_set_dash				(GtkPlotPC *pc,
							 gdouble offset_,
							 gdouble *values,
							 gint num_values);

void gtk_plot_pc_draw_point				(GtkPlotPC *pc,
							 gdouble x, gdouble y);

void gtk_plot_pc_draw_line				(GtkPlotPC *pc,
							 gdouble x1, gdouble y1,
							 gdouble x2, gdouble y2);

void gtk_plot_pc_draw_lines				(GtkPlotPC *pc,
							 GtkPlotPoint *points,
							 gint numpoints);

void gtk_plot_pc_draw_rectangle	                        (GtkPlotPC *pc,
							 gboolean filled,
							 gdouble x, gdouble y,
							 gdouble width,
							 gdouble height);

void gtk_plot_pc_draw_polygon	                        (GtkPlotPC *pc,
                                                	 gint filled,
                                	                 GtkPlotPoint *points,
                                        	         gint numpoints);

void gtk_plot_pc_draw_ellipse	                        (GtkPlotPC *pc,
							 gboolean filled,
							 gdouble x, gdouble y,
							 gdouble width,
							 gdouble height);

void gtk_plot_pc_draw_circle 	                        (GtkPlotPC *pc,
							 gint filled,
                                                 	 gdouble x, gdouble y,
                                                 	 gdouble size); 

void gtk_plot_pc_set_font				(GtkPlotPC *pc,
							 GtkPSFont *psfont,
							 gint height);

void gtk_plot_pc_draw_string   	                	(GtkPlotPC *pc,
                                   	         	 gint x, gint y,
                                               		 gint angle,
							 const GdkColor *fg,
							 const GdkColor *bg,
							 gboolean transparent,
							 gint border,
							 gint border_space,
							 gint border_width,
							 gint shadow_width,
							 const gchar *font,
							 gint height,
							 GtkJustification just,
							 const gchar *text);

void  gtk_plot_pc_draw_pixmap   	                (GtkPlotPC *pc,
							 GdkPixmap *pixmap,
							 GdkBitmap *mask,
                                   	             	 gint xsrc, gint ysrc,
                                   	             	 gint xdest, gint ydest,
                                   	             	 gint width,
                                   	             	 gint height, 
                                   	             	 gdouble scale_x,
                                   	             	 gdouble scale_y); 

#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* __GTK_PLOT_PC_H__ */