FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_PDF_File_Surface.H
1//
2// Declaration of class Fl_PDF_File_Surface for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 2024 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
17#ifndef PDF_FILE_SURFACE_H
18#define PDF_FILE_SURFACE_H
19
20#include <FL/Fl_Paged_Device.H>
21
31 class FL_EXPORT Fl_PDF_File_Surface : public Fl_Paged_Device {
32 private:
33 const char **out_filename_;
34 Fl_Paged_Device *platform_surface_;
35 static Fl_Paged_Device *new_platform_pdf_surface_(const char ***);
36 public:
40 static const char * format_dialog_title;
41 static const char * format_dialog_page_size;
42 static const char * format_dialog_orientation;
43 static const char * format_dialog_default;
45 Fl_PDF_File_Surface();
46 ~Fl_PDF_File_Surface();
55 int begin_job(const char* defaultfilename, char **perr = NULL);
57 int begin_job(int, int *, int *, char **) FL_OVERRIDE {return 1;}
66 int begin_document(const char* pathname,
67 enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
68 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT,
69 char **perr = NULL);
70 int printable_rect(int *w, int *h) FL_OVERRIDE { return platform_surface_->printable_rect(w,h); }
71 void margins(int *left, int *top, int *right, int *bottom) FL_OVERRIDE {
72 platform_surface_->margins(left,top,right,bottom);
73 }
74 void origin(int x, int y) FL_OVERRIDE {platform_surface_->origin(x, y);}
75 void origin(int *x, int *y) FL_OVERRIDE {platform_surface_->origin(x, y);}
76 void scale(float s_x, float s_y = 0) FL_OVERRIDE {platform_surface_->scale(s_x, s_y);}
77 void rotate(float angle) FL_OVERRIDE {platform_surface_->rotate(angle);}
78 void translate(int x, int y) FL_OVERRIDE {platform_surface_->translate(x, y);}
79 void untranslate() FL_OVERRIDE {platform_surface_->untranslate();};
80 int begin_page(void) FL_OVERRIDE {return platform_surface_->begin_page();}
81 int end_page(void) FL_OVERRIDE {return platform_surface_->end_page();}
82 void end_job(void) FL_OVERRIDE {return platform_surface_->end_job();}
84 inline const char *pdf_filename() { return *out_filename_; }
85 void set_current() FL_OVERRIDE { if (platform_surface_) platform_surface_->set_current(); }
86 bool is_current() FL_OVERRIDE { return surface() == platform_surface_; }
87};
88
89#endif // PDF_FILE_SURFACE_H
Fl_Paged_Device.H
declaration of class Fl_Paged_Device.
Fl_PDF_File_Surface::set_current
void set_current() FL_OVERRIDE
Make this surface the current drawing surface.
Definition Fl_PDF_File_Surface.H:85
Fl_PDF_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.
Definition Fl_PDF_File_Surface.H:74
Fl_PDF_File_Surface::end_job
void end_job(void) FL_OVERRIDE
To be called at the end of a print job.
Definition Fl_PDF_File_Surface.H:82
Fl_PDF_File_Surface::format_dialog_orientation
static const char * format_dialog_orientation
Localizable text of the "PDF document settings" dialog.
Definition Fl_PDF_File_Surface.H:42
Fl_PDF_File_Surface::pdf_filename
const char * pdf_filename()
Returns the name of the PDF document.
Definition Fl_PDF_File_Surface.H:84
Fl_PDF_File_Surface::rotate
void rotate(float angle) FL_OVERRIDE
Rotates the graphics operations relatively to paper.
Definition Fl_PDF_File_Surface.H:77
Fl_PDF_File_Surface::begin_job
int begin_job(int, int *, int *, char **) FL_OVERRIDE
Don't use for this class.
Definition Fl_PDF_File_Surface.H:57
Fl_PDF_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.
Definition Fl_PDF_File_Surface.H:70
Fl_PDF_File_Surface::format_dialog_default
static const char * format_dialog_default
Localizable text of the "PDF document settings" dialog.
Definition Fl_PDF_File_Surface.H:43
Fl_PDF_File_Surface::format_dialog_title
static const char * format_dialog_title
Localizable text of the "PDF document settings" dialog.
Definition Fl_PDF_File_Surface.H:40
Fl_PDF_File_Surface::begin_page
int begin_page(void) FL_OVERRIDE
Begins a new printed page.
Definition Fl_PDF_File_Surface.H:80
Fl_PDF_File_Surface::is_current
bool is_current() FL_OVERRIDE
Is this surface the current drawing surface?
Definition Fl_PDF_File_Surface.H:86
Fl_PDF_File_Surface::origin
void origin(int *x, int *y) FL_OVERRIDE
Computes the coordinates of the current origin of graphics functions.
Definition Fl_PDF_File_Surface.H:75
Fl_PDF_File_Surface::end_page
int end_page(void) FL_OVERRIDE
To be called at the end of each page.
Definition Fl_PDF_File_Surface.H:81
Fl_PDF_File_Surface::translate
void translate(int x, int y) FL_OVERRIDE
Translates the current graphics origin accounting for the current rotation.
Definition Fl_PDF_File_Surface.H:78
Fl_PDF_File_Surface::begin_document
int begin_document(const char *pathname, enum Fl_Paged_Device::Page_Format format=Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout=Fl_Paged_Device::PORTRAIT, char **perr=NULL)
Prepare to draw to a PDF document identified by its pathname.
Fl_PDF_File_Surface::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.
Definition Fl_PDF_File_Surface.H:71
Fl_PDF_File_Surface::untranslate
void untranslate() FL_OVERRIDE
Undoes the effect of a previous translate() call.
Definition Fl_PDF_File_Surface.H:79
Fl_PDF_File_Surface::format_dialog_page_size
static const char * format_dialog_page_size
Localizable text of the "PDF document settings" dialog.
Definition Fl_PDF_File_Surface.H:41
Fl_PDF_File_Surface::begin_job
int begin_job(const char *defaultfilename, char **perr=NULL)
Prepare to draw to a PDF document identified with a file chooser.
Fl_PDF_File_Surface::scale
void scale(float s_x, float s_y=0) FL_OVERRIDE
Changes the scaling of page coordinates.
Definition Fl_PDF_File_Surface.H:76
Fl_Paged_Device::Fl_Paged_Device
Fl_Paged_Device()
The constructor.
Definition Fl_Paged_Device.H:39
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_Surface_Device::surface
static Fl_Surface_Device * surface()
The current drawing surface.
Definition Fl_Device.H:81
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