FLTK 1.4.0
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
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
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:
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,
108 int start_job(int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
110 return begin_job(pagecount, format, layout);
111 }
122 int begin_job(FILE *ps_output, int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
126 int start_job(FILE *ps_output, int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
128 return begin_job(ps_output, pagecount, format, layout);
129 }
130
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);
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;
211 int close();
212};
213
214#endif // Fl_PostScript_H
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1044
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition Enumerations.H:1101
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1073
declaration of class Fl_Paged_Device.
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
Encapsulated PostScript drawing surface.
Definition Fl_PostScript.H:172
void translate(int x, int y) FL_OVERRIDE
Translates the current graphics origin accounting for the current rotation.
void untranslate() FL_OVERRIDE
Undoes the effect of a previous translate() call.
Fl_PostScript_Graphics_Driver * driver()
Returns the PostScript driver of this drawing surface.
Definition Fl_PostScript.H:175
Fl_EPS_File_Surface(int width, int height, FILE *eps_output, Fl_Color background=FL_WHITE, Fl_PostScript_Close_Command closef=NULL)
Constructor.
FILE * file()
Returns the underlying FILE pointer.
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()
Destructor.
void origin(int *px, int *py) FL_OVERRIDE
Computes the coordinates of the current origin of graphics functions.
int printable_rect(int *w, int *h) FL_OVERRIDE
Computes the width and height of the drawable area of the drawing surface.
Represents page-structured drawing surfaces.
Definition Fl_Paged_Device.H:36
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
Page_Layout
Possible page layouts.
Definition Fl_Paged_Device.H:81
@ PORTRAIT
Portrait orientation.
Definition Fl_Paged_Device.H:82
Page_Format
Possible page formats.
Definition Fl_Paged_Device.H:45
@ A4
A4 format.
Definition Fl_Paged_Device.H:50
To send graphical output to a PostScript file.
Definition Fl_PostScript.H:78
Fl_PostScript_File_Device()
The constructor.
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()
The destructor.
void origin(int x, int y) FL_OVERRIDE
Sets the position of the origin of graphics in the drawable part of the drawing surface.
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.
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.
int begin_job(int pagecount, int *from, int *to, char **perr_message) FL_OVERRIDE
Don't use with this class.
Fl_PostScript_Graphics_Driver * driver()
Returns the PostScript driver of this drawing surface.
Definition Fl_PostScript.H:87
void scale(float scale_x, float scale_y=0.) FL_OVERRIDE
Changes the scaling of page coordinates.
int begin_page(void) FL_OVERRIDE
Begins a new printed page.
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
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.
void origin(int *x, int *y) FL_OVERRIDE
Computes the coordinates of the current origin of graphics functions.
int printable_rect(int *w, int *h) FL_OVERRIDE
Computes the width and height of the drawable area of the drawing surface.
Fl_Graphics_Driver * driver()
Returns the graphics driver of this drawing surface.
Definition Fl_Device.H:85
A surface on which any FLTK widget can be drawn.
Definition Fl_Widget_Surface.H:25
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
utility header to pull drawing functions together