1/***********************************************************************
2 *                                                                     *
3 * $Id: hpgsdevices.h 298 2006-03-05 18:18:03Z softadm $
4 *                                                                     *
5 * hpgs - HPGl Script, a hpgl/2 interpreter, which uses a Postscript   *
6 *        API for rendering a scene and thus renders to a variety of   *
7 *        devices and fileformats.                                     *
8 *                                                                     *
9 * (C) 2004-2006 ev-i Informationstechnologie GmbH  http://www.ev-i.at *
10 *                                                                     *
11 * Author: Wolfgang Glas                                               *
12 *                                                                     *
13 *  hpgs is free software; you can redistribute it and/or              *
14 * modify it under the terms of the GNU Lesser General Public          *
15 * License as published by the Free Software Foundation; either        *
16 * version 2.1 of the License, or (at your option) any later version.  *
17 *                                                                     *
18 * hpgs 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 GNU   *
21 * Lesser General Public License for more details.                     *
22 *                                                                     *
23 * You should have received a copy of the GNU Lesser General Public    *
24 * License along with this library; if not, write to the               *
25 * Free Software  Foundation, Inc., 59 Temple Place, Suite 330,        *
26 * Boston, MA  02111-1307  USA                                         *
27 *                                                                     *
28 ***********************************************************************
29 *                                                                     *
30 * The private interfaces for the basic devices                        *
31 *                                                                     *
32 ***********************************************************************/
33
34#ifndef	__HPGS_DEVICES_H
35#define	__HPGS_DEVICES_H
36
37#include<hpgs.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/*! \file hpgsdevices.h
44
45   \brief The private interfaces for basic vector devices.
46
47   A header file, which declares the structures and functions internally
48   used for implementing the very basic implementations of \c hpgs_device.
49*/
50
51/*! @addtogroup device
52 *  @{
53 */
54
55#define HPGS_PLOTSIZE_MAX_CLIP_DEPTH 16
56
57/*! \brief A vector graphics device for plotsize calculating.
58
59    This structure implements a \c hpgs_device and is used to calculate
60    the bounding box of a vector graphics scenery.
61 */
62struct hpgs_plotsize_device_st {
63  hpgs_device inherited; //!< The base device structure.
64
65  hpgs_bool ignore_ps; //!< Do we ignore a PS command?
66  int clip_depth;      //!< The depth of the current clip path stack.
67
68  hpgs_point moveto;   //!< The position of the last moveto.
69  int deferred_moveto; //!< Do we have an unregistered moveto pending?
70
71  hpgs_bool do_linewidth; //!< Do we account for the current linewidth?
72  double linewidth;       //!< Current linewidth.
73
74  hpgs_bbox clip_bbs[HPGS_PLOTSIZE_MAX_CLIP_DEPTH]; /*! The bounding boxes of the clip paths. */
75
76  hpgs_bbox path_bb; /*! The bounding box of the current path. */
77  hpgs_bbox page_bb; /*! The bounding box of the current page. */
78  hpgs_bbox global_bb; /*! The currently calculated overall bounding box. */
79
80  /*@{ */
81  /*! A stack of page bounding boxes.
82   */
83  hpgs_bbox *page_bbs; /*! The currently calculated overall bounding box. */
84  int n_page_bbs;
85  int page_bbs_alloc_size;
86  /*@} */
87};
88
89typedef struct hpgs_ps_media_size_st hpgs_ps_media_size;
90
91/*! \brief A structure for storing a paper size.
92
93    This structure stores a PostScipt paper size.
94 */
95struct hpgs_ps_media_size_st
96{
97  int width;  //!< The width of the paper in pt.
98  int height; //!< The height of the paper in pt.
99
100  const char *name; //!< The name of this paper size, if it is a std paper size.
101  size_t usage; //!< The usage count of this paper size.
102
103  size_t hash; //!< A hash value for storing media sizes in a sorted vector.
104};
105
106/*! \brief A vector graphics device for drawing to an eps file.
107
108    This structure implements a \c hpgs_device and is used to write
109    a scenery to an eps file.
110 */
111struct hpgs_eps_device_st {
112  hpgs_device inherited; //!< The base device structure.
113
114  hpgs_bbox doc_bb;
115  /*! The document bounding box used for multipage postscript files. */
116
117  hpgs_bbox page_bb;
118  /*! The bounding box of the current page. */
119
120  int n_pages;
121  /*! The number of pages. -1...we are writing individual eps files. */
122
123  char *filename; //!< The output filename.
124
125  hpgs_ostream *out; //!< The current page stream.
126  hpgs_bool page_setup; //!< Is the current page set up?
127
128  /*@{ */
129  /*! A stack of media sizes for multipage PostScript files.
130      The media sizes are sorted by their hash value.
131   */
132  hpgs_ps_media_size *media_sizes; /*! The currently calculated overall bounding box. */
133  int n_media_sizes;
134  int media_sizes_alloc_size;
135  /*@} */
136
137  hpgs_xrop3_func_t rop3; //!< The ROP3 transfer raster operation.
138  hpgs_palette_color pattern_color; //!< The color of the ROP3 pattern.
139
140  hpgs_color color; //!< The current output color.
141};
142
143HPGS_INTERNAL_API void hpgs_cleanup_plugin_devices();
144
145/*! @} */ /* end of group device */
146
147#ifdef __cplusplus
148} // end of extern "C"
149#endif
150
151#endif /* ! __HPGS_DEVICES_H */
152