FLTK 1.4.4: Fl_PostScript.H Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_PostScript.H
Go to the documentation of this file.
1//
2// Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 2010-2020 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
20
21#ifndef Fl_PostScript_H
22#define Fl_PostScript_H
23
24#include <FL/Fl_Paged_Device.H>
25#include <FL/fl_draw.H>
26#include <stdarg.h>
27
32extern "C" {
33 typedef int (*Fl_PostScript_Close_Command)(FILE *);
34}
35
36class Fl_PostScript_Graphics_Driver;
37
78 class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
79private:
80 // memorize the display's current font to restore it when the object ceases being current
81 Fl_Font display_font_;
82 Fl_Fontsize display_size_;
83protected:
87 inline Fl_PostScript_Graphics_Driver *driver() { return (Fl_PostScript_Graphics_Driver*)Fl_Surface_Device::driver(); }
88public:
90 Fl_PostScript_File_Device();
92 ~Fl_PostScript_File_Device();
94 int begin_job(int pagecount, int* from, int* to, char **perr_message) FL_OVERRIDE;
104 int begin_job(int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
105 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
108 int start_job(int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
109 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT) {
110 return begin_job(pagecount, format, layout);
111 }
112
122 int begin_job(FILE *ps_output, int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
123 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
126 int start_job(FILE *ps_output, int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
127 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT) {
128 return begin_job(ps_output, pagecount, format, layout);
129 }
130
131 int begin_page (void) FL_OVERRIDE;
132 int printable_rect(int *w, int *h) FL_OVERRIDE;
133 void margins(int *left, int *top, int *right, int *bottom) FL_OVERRIDE;
134 void origin(int *x, int *y) FL_OVERRIDE;
135 void origin(int x, int y) FL_OVERRIDE;
136 void scale (float scale_x, float scale_y = 0.) FL_OVERRIDE;
137 void rotate(float angle) FL_OVERRIDE;
138 void translate(int x, int y) FL_OVERRIDE;
139 void untranslate(void) FL_OVERRIDE;
140 int end_page (void) FL_OVERRIDE;
144 void end_job(void) FL_OVERRIDE;
146 static const char *file_chooser_title;
148 FILE *file();
150 void close_command(Fl_PostScript_Close_Command cmd);
151 void set_current() FL_OVERRIDE;
152 void end_current() FL_OVERRIDE;
153};
154
172class FL_EXPORT Fl_EPS_File_Surface : public Fl_Widget_Surface {
173protected:
175 inline Fl_PostScript_Graphics_Driver *driver() { return (Fl_PostScript_Graphics_Driver*)Fl_Surface_Device::driver(); }
176public:
191 Fl_EPS_File_Surface(int width, int height, FILE *eps_output,
192 Fl_Color background = FL_WHITE, Fl_PostScript_Close_Command closef = NULL);
200 ~Fl_EPS_File_Surface();
201 int printable_rect(int *w, int *h) FL_OVERRIDE;
203 FILE *file();
204 void origin(int x, int y) FL_OVERRIDE;
205 void origin(int *px, int *py) FL_OVERRIDE;
206 void translate(int x, int y) FL_OVERRIDE;
207 void untranslate() FL_OVERRIDE;
211 int close();
212};
213
214#endif // Fl_PostScript_H
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1063
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1092
Fl_Paged_Device.H
declaration of class Fl_Paged_Device.
Fl_PostScript_Close_Command
int(* Fl_PostScript_Close_Command)(FILE *)
Signature of functions FLTK may use to close FILE variables after PostScript/EPS output.
Definition Fl_PostScript.H:33
Fl_EPS_File_Surface::translate
void translate(int x, int y) FL_OVERRIDE
Translates the current graphics origin accounting for the current rotation.
Fl_EPS_File_Surface::untranslate
void untranslate() FL_OVERRIDE
Undoes the effect of a previous translate() call.
Fl_EPS_File_Surface::close
int close()
Completes all EPS output.
Fl_EPS_File_Surface::driver
Fl_PostScript_Graphics_Driver * driver()
Returns the PostScript driver of this drawing surface.
Definition Fl_PostScript.H:175
Fl_EPS_File_Surface::Fl_EPS_File_Surface
Fl_EPS_File_Surface(int width, int height, FILE *eps_output, Fl_Color background=FL_WHITE, Fl_PostScript_Close_Command closef=NULL)
Constructor.
Fl_EPS_File_Surface::file
FILE * file()
Returns the underlying FILE pointer.
Fl_EPS_File_Surface::origin
void origin(int x, int y) FL_OVERRIDE
Sets the position of the origin of graphics in the drawable part of the drawing surface.
Fl_EPS_File_Surface::~Fl_EPS_File_Surface
~Fl_EPS_File_Surface()
Destructor.
Fl_EPS_File_Surface::origin
void origin(int *px, int *py) FL_OVERRIDE
Computes the coordinates of the current origin of graphics functions.
Fl_EPS_File_Surface::printable_rect
int printable_rect(int *w, int *h) FL_OVERRIDE
Computes the width and height of the drawable area of the drawing surface.
Fl_Paged_Device::Fl_Paged_Device
Fl_Paged_Device()
The constructor.
Definition Fl_Paged_Device.H:39
Fl_Paged_Device::begin_job
virtual int begin_job(int pagecount=0, int *frompage=NULL, int *topage=NULL, char **perr_message=NULL)
Begins a print job.
Definition Fl_Paged_Device.cxx:36
Fl_Paged_Device::Page_Layout
Page_Layout
Possible page layouts.
Definition Fl_Paged_Device.H:81
Fl_Paged_Device::PORTRAIT
@ PORTRAIT
Portrait orientation.
Definition Fl_Paged_Device.H:82
Fl_Paged_Device::Page_Format
Page_Format
Possible page formats.
Definition Fl_Paged_Device.H:45
Fl_Paged_Device::A4
@ A4
A4 format.
Definition Fl_Paged_Device.H:50
Fl_PostScript_File_Device::Fl_PostScript_File_Device
Fl_PostScript_File_Device()
The constructor.
Fl_PostScript_File_Device::start_job
int start_job(FILE *ps_output, int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT)
Synonym of begin_job().
Definition Fl_PostScript.H:126
Fl_PostScript_File_Device::~Fl_PostScript_File_Device
~Fl_PostScript_File_Device()
The destructor.
Fl_PostScript_File_Device::origin
void origin(int x, int y) FL_OVERRIDE
Sets the position of the origin of graphics in the drawable part of the drawing surface.
Fl_PostScript_File_Device::begin_job
int begin_job(int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT)
Begins the session where all graphics requests will go to a local PostScript file.
Fl_PostScript_File_Device::file_chooser_title
static const char * file_chooser_title
Label of the PostScript file chooser window.
Definition Fl_PostScript.H:146
Fl_PostScript_File_Device::margins
void margins(int *left, int *top, int *right, int *bottom) FL_OVERRIDE
Computes the dimensions of margins that lie between the printable page area and the full page.
Fl_PostScript_File_Device::begin_job
int begin_job(int pagecount, int *from, int *to, char **perr_message) FL_OVERRIDE
Don't use with this class.
Fl_PostScript_File_Device::file
FILE * file()
Returns the underlying FILE* receiving all PostScript data.
Fl_PostScript_File_Device::driver
Fl_PostScript_Graphics_Driver * driver()
Returns the PostScript driver of this drawing surface.
Definition Fl_PostScript.H:87
Fl_PostScript_File_Device::translate
void translate(int x, int y) FL_OVERRIDE
Translates the current graphics origin accounting for the current rotation.
Fl_PostScript_File_Device::scale
void scale(float scale_x, float scale_y=0.) FL_OVERRIDE
Changes the scaling of page coordinates.
Fl_PostScript_File_Device::begin_page
int begin_page(void) FL_OVERRIDE
Begins a new printed page.
Fl_PostScript_File_Device::rotate
void rotate(float angle) FL_OVERRIDE
Rotates the graphics operations relatively to paper.
Fl_PostScript_File_Device::untranslate
void untranslate(void) FL_OVERRIDE
Undoes the effect of a previous translate() call.
Fl_PostScript_File_Device::start_job
int start_job(int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT)
Synonym of begin_job().
Definition Fl_PostScript.H:108
Fl_PostScript_File_Device::end_job
void end_job(void) FL_OVERRIDE
Completes all PostScript output.
Fl_PostScript_File_Device::end_page
int end_page(void) FL_OVERRIDE
To be called at the end of each page.
Fl_PostScript_File_Device::begin_job
int begin_job(FILE *ps_output, int pagecount=0, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT)
Begins the session where all graphics requests will go to FILE pointer.
Fl_PostScript_File_Device::origin
void origin(int *x, int *y) FL_OVERRIDE
Computes the coordinates of the current origin of graphics functions.
Fl_PostScript_File_Device::printable_rect
int printable_rect(int *w, int *h) FL_OVERRIDE
Computes the width and height of the drawable area of the drawing surface.
Fl_PostScript_File_Device::end_current
void end_current() FL_OVERRIDE
FLTK calls this each time a surface ceases to be the current drawing surface.
Fl_PostScript_File_Device::close_command
void close_command(Fl_PostScript_Close_Command cmd)
Sets the function end_job() calls to close the file().
Fl_PostScript_File_Device::set_current
void set_current() FL_OVERRIDE
Make this surface the current drawing surface.
Fl_Surface_Device::driver
Fl_Graphics_Driver * driver()
Returns the graphics driver of this drawing surface.
Definition Fl_Device.H:76
Fl_Widget_Surface::Fl_Widget_Surface
Fl_Widget_Surface(Fl_Graphics_Driver *d)
The constructor.
Definition Fl_Widget_Surface.cxx:28
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
fl_draw.H
utility header to pull drawing functions together