Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
vul_psfile Class Reference

Write a PostScript file. More...

#include <vul_psfile.h>

Inheritance diagram for vul_psfile:
Inheritance graph
[legend]

Public Types

enum  paper_type {
  US_NORMAL, A4, B5, A3,
  US_LEGAL, ELEVEN_BY_SEVENTEEN, FOUR_BY_FIVE, THIRTY_FIVE_mm
}
 
enum  paper_orientation { PORTRAIT, LANDSCAPE }
 
enum  paper_layout { CENTER, MAX }
 

Public Member Functions

 vul_psfile (char const *filename, bool debug_output=false)
 Default constructor. More...
 
 ~vul_psfile () override
 Destructor. More...
 
 operator bool ()
 
void set_paper_type (vul_psfile::paper_type type)
 
void set_paper_layout (vul_psfile::paper_layout layout)
 
void set_paper_orientation (vul_psfile::paper_orientation o)
 
void set_reduction_factor (int rf)
 
void set_scale_x (float sx)
 set the horizontal scaling (in percent); no scaling is 100. More...
 
void set_scale_y (float sy)
 set the vertical scaling (in percent); no scaling is 100. More...
 
void set_fg_color (float r, float g, float b)
 
void set_bg_color (float r, float g, float b)
 
void set_line_width (float f_width)
 
float line_width () const
 
void print_greyscale_image (const unsigned char *data, int sizex, int sizey)
 Write 8 bit grey scale image. More...
 
void print_color_image (const unsigned char *data, int sizex, int sizey)
 Write 24 bit colour image. More...
 
void line (float x1, float y1, float x2, float y2)
 Add a line between the given points to the Postscript file. More...
 
void point (float x, float y, float point_size=0)
 Add a point at the given coordinates to the Postscript file. More...
 
void ellipse (float x, float y, float a_axis, float b_axis, int angle=0)
 Add an ellipse to the Postscript file. More...
 
void circle (float x, float y, float radius)
 Add a circle with the given centre point and radius to the Postscript file. More...
 
void reset_bounding_box ()
 Rewrite output bounding box parameters. More...
 

Protected Member Functions

void set_min_max_xy (float x, float y)
 Set Bounding Box Min and Max x, y. More...
 
void set_min_max_xy (int x, int y)
 Set Bounding Box Min and Max x, y. More...
 
bool set_parameters (int sizex, int sizey)
 Set ox, oy , iw, ih, iwf, ihf parameters for PostScript file use. More...
 
void postscript_header ()
 PostScript file header. Automatically called by the constructor. More...
 
void graphic_header ()
 Set graphic coordinate (translate and rotate to local coordinate). More...
 
void sobj_rgb_params (char const *str, bool filled)
 Utility program used in point(), line(), ellipse() and circle(). More...
 
void print_graphics_prolog ()
 the defined procedure for PostScript script use. More...
 

Private Member Functions

void compute_bounding_box ()
 Recalculate bounding box and scale x and y (if necessary). More...
 
void reset_postscript_header ()
 Reset PostScript header file. More...
 
void image_translate_and_scale ()
 Set Image translate and scale. More...
 
void object_translate_and_scale ()
 Set object translate and scale. More...
 
void done ()
 

Private Attributes

std::ofstream output_filestream
 
float fg_r
 
float fg_g
 
float fg_b
 
float bg_r
 
float bg_g
 
float bg_b
 
float line_width_
 
float scale_x
 
float scale_y
 
int ox
 
int oy
 
int iw
 
int ih
 
double iwf
 
double ihf
 
double psizex
 
double psizey
 
double pos_inx
 
double pos_iny
 
int width
 
int height
 
std::string filename
 
paper_type printer_paper_type
 
paper_orientation printer_paper_orientation
 
paper_layout printer_paper_layout
 
int reduction_factor
 
bool doneps
 
int min_x
 
int min_y
 
int max_x
 
int max_y
 
int box_width
 
int box_height
 
std::streampos translate_pos
 
std::streampos sobj_t_pos
 
std::streampos header_pos
 
bool graphics_prolog_exists
 
bool exist_image
 
bool exist_objs
 

Detailed Description

Write a PostScript file.

Definition at line 22 of file vul_psfile.h.

Member Enumeration Documentation

◆ paper_layout

Enumerator
CENTER 
MAX 

Definition at line 37 of file vul_psfile.h.

◆ paper_orientation

Enumerator
PORTRAIT 
LANDSCAPE 

Definition at line 34 of file vul_psfile.h.

◆ paper_type

Enumerator
US_NORMAL 
A4 
B5 
A3 
US_LEGAL 
ELEVEN_BY_SEVENTEEN 
FOUR_BY_FIVE 
THIRTY_FIVE_mm 

Definition at line 25 of file vul_psfile.h.

Constructor & Destructor Documentation

◆ vul_psfile()

vul_psfile::vul_psfile ( char const *  filename,
bool  debug_output = false 
)

Default constructor.

Definition at line 54 of file vul_psfile.cxx.

◆ ~vul_psfile()

vul_psfile::~vul_psfile ( )
override

Destructor.

Definition at line 88 of file vul_psfile.cxx.

Member Function Documentation

◆ circle()

void vul_psfile::circle ( float  x,
float  y,
float  radius 
)

Add a circle with the given centre point and radius to the Postscript file.

Definition at line 661 of file vul_psfile.cxx.

◆ compute_bounding_box()

void vul_psfile::compute_bounding_box ( )
private

Recalculate bounding box and scale x and y (if necessary).

Definition at line 125 of file vul_psfile.cxx.

◆ done()

void vul_psfile::done ( )
private

Definition at line 1021 of file vul_psfile.cxx.

◆ ellipse()

void vul_psfile::ellipse ( float  x,
float  y,
float  a_axis,
float  b_axis,
int  angle = 0 
)

Add an ellipse to the Postscript file.

Definition at line 635 of file vul_psfile.cxx.

◆ graphic_header()

void vul_psfile::graphic_header ( )
protected

Set graphic coordinate (translate and rotate to local coordinate).

Definition at line 485 of file vul_psfile.cxx.

◆ image_translate_and_scale()

void vul_psfile::image_translate_and_scale ( )
private

Set Image translate and scale.

Definition at line 500 of file vul_psfile.cxx.

◆ line()

void vul_psfile::line ( float  x1,
float  y1,
float  x2,
float  y2 
)

Add a line between the given points to the Postscript file.

Definition at line 605 of file vul_psfile.cxx.

◆ line_width()

float vul_psfile::line_width ( ) const
inline

Definition at line 56 of file vul_psfile.h.

◆ object_translate_and_scale()

void vul_psfile::object_translate_and_scale ( )
private

Set object translate and scale.

Definition at line 520 of file vul_psfile.cxx.

◆ operator bool()

vul_psfile::operator bool ( )
inline

Definition at line 43 of file vul_psfile.h.

◆ point()

void vul_psfile::point ( float  x,
float  y,
float  point_size = 0 
)

Add a point at the given coordinates to the Postscript file.

Definition at line 621 of file vul_psfile.cxx.

◆ postscript_header()

void vul_psfile::postscript_header ( )
protected

PostScript file header. Automatically called by the constructor.

PostScript file header.

Definition at line 554 of file vul_psfile.cxx.

◆ print_color_image()

void vul_psfile::print_color_image ( const unsigned char *  data,
int  sizex,
int  sizey 
)

Write 24 bit colour image.

Definition at line 323 of file vul_psfile.cxx.

◆ print_graphics_prolog()

void vul_psfile::print_graphics_prolog ( )
protected

the defined procedure for PostScript script use.

Definition at line 678 of file vul_psfile.cxx.

◆ print_greyscale_image()

void vul_psfile::print_greyscale_image ( const unsigned char *  data,
int  sizex,
int  sizey 
)

Write 8 bit grey scale image.

Definition at line 225 of file vul_psfile.cxx.

◆ reset_bounding_box()

void vul_psfile::reset_bounding_box ( )

Rewrite output bounding box parameters.

Definition at line 99 of file vul_psfile.cxx.

◆ reset_postscript_header()

void vul_psfile::reset_postscript_header ( )
private

Reset PostScript header file.

Definition at line 573 of file vul_psfile.cxx.

◆ set_bg_color()

void vul_psfile::set_bg_color ( float  r,
float  g,
float  b 
)
inline

Definition at line 54 of file vul_psfile.h.

◆ set_fg_color()

void vul_psfile::set_fg_color ( float  r,
float  g,
float  b 
)
inline

Definition at line 53 of file vul_psfile.h.

◆ set_line_width()

void vul_psfile::set_line_width ( float  f_width)
inline

Definition at line 55 of file vul_psfile.h.

◆ set_min_max_xy() [1/2]

void vul_psfile::set_min_max_xy ( float  x,
float  y 
)
protected

Set Bounding Box Min and Max x, y.

Definition at line 203 of file vul_psfile.cxx.

◆ set_min_max_xy() [2/2]

void vul_psfile::set_min_max_xy ( int  x,
int  y 
)
protected

Set Bounding Box Min and Max x, y.

Definition at line 215 of file vul_psfile.cxx.

◆ set_paper_layout()

void vul_psfile::set_paper_layout ( vul_psfile::paper_layout  layout)
inline

Definition at line 46 of file vul_psfile.h.

◆ set_paper_orientation()

void vul_psfile::set_paper_orientation ( vul_psfile::paper_orientation  o)
inline

Definition at line 47 of file vul_psfile.h.

◆ set_paper_type()

void vul_psfile::set_paper_type ( vul_psfile::paper_type  type)
inline

Definition at line 45 of file vul_psfile.h.

◆ set_parameters()

bool vul_psfile::set_parameters ( int  sizex,
int  sizey 
)
protected

Set ox, oy , iw, ih, iwf, ihf parameters for PostScript file use.

Definition at line 538 of file vul_psfile.cxx.

◆ set_reduction_factor()

void vul_psfile::set_reduction_factor ( int  rf)
inline

Definition at line 48 of file vul_psfile.h.

◆ set_scale_x()

void vul_psfile::set_scale_x ( float  sx)
inline

set the horizontal scaling (in percent); no scaling is 100.

Definition at line 50 of file vul_psfile.h.

◆ set_scale_y()

void vul_psfile::set_scale_y ( float  sy)
inline

set the vertical scaling (in percent); no scaling is 100.

Definition at line 52 of file vul_psfile.h.

◆ sobj_rgb_params()

void vul_psfile::sobj_rgb_params ( char const *  str,
bool  filled 
)
protected

Utility program used in point(), line(), ellipse() and circle().

Definition at line 592 of file vul_psfile.cxx.

Member Data Documentation

◆ bg_b

float vul_psfile::bg_b
private

Definition at line 100 of file vul_psfile.h.

◆ bg_g

float vul_psfile::bg_g
private

Definition at line 100 of file vul_psfile.h.

◆ bg_r

float vul_psfile::bg_r
private

Definition at line 100 of file vul_psfile.h.

◆ box_height

int vul_psfile::box_height
private

Definition at line 116 of file vul_psfile.h.

◆ box_width

int vul_psfile::box_width
private

Definition at line 116 of file vul_psfile.h.

◆ doneps

bool vul_psfile::doneps
private

Definition at line 113 of file vul_psfile.h.

◆ exist_image

bool vul_psfile::exist_image
private

Definition at line 125 of file vul_psfile.h.

◆ exist_objs

bool vul_psfile::exist_objs
private

Definition at line 126 of file vul_psfile.h.

◆ fg_b

float vul_psfile::fg_b
private

Definition at line 99 of file vul_psfile.h.

◆ fg_g

float vul_psfile::fg_g
private

Definition at line 99 of file vul_psfile.h.

◆ fg_r

float vul_psfile::fg_r
private

Definition at line 99 of file vul_psfile.h.

◆ filename

std::string vul_psfile::filename
private

Definition at line 108 of file vul_psfile.h.

◆ graphics_prolog_exists

bool vul_psfile::graphics_prolog_exists
private

Definition at line 124 of file vul_psfile.h.

◆ header_pos

std::streampos vul_psfile::header_pos
private

Definition at line 122 of file vul_psfile.h.

◆ height

int vul_psfile::height
private

Definition at line 107 of file vul_psfile.h.

◆ ih

int vul_psfile::ih
private

Definition at line 103 of file vul_psfile.h.

◆ ihf

double vul_psfile::ihf
private

Definition at line 104 of file vul_psfile.h.

◆ iw

int vul_psfile::iw
private

Definition at line 103 of file vul_psfile.h.

◆ iwf

double vul_psfile::iwf
private

Definition at line 104 of file vul_psfile.h.

◆ line_width_

float vul_psfile::line_width_
private

Definition at line 101 of file vul_psfile.h.

◆ max_x

int vul_psfile::max_x
private

Definition at line 115 of file vul_psfile.h.

◆ max_y

int vul_psfile::max_y
private

Definition at line 115 of file vul_psfile.h.

◆ min_x

int vul_psfile::min_x
private

Definition at line 114 of file vul_psfile.h.

◆ min_y

int vul_psfile::min_y
private

Definition at line 114 of file vul_psfile.h.

◆ output_filestream

std::ofstream vul_psfile::output_filestream
private

Definition at line 97 of file vul_psfile.h.

◆ ox

int vul_psfile::ox
private

Definition at line 103 of file vul_psfile.h.

◆ oy

int vul_psfile::oy
private

Definition at line 103 of file vul_psfile.h.

◆ pos_inx

double vul_psfile::pos_inx
private

Definition at line 106 of file vul_psfile.h.

◆ pos_iny

double vul_psfile::pos_iny
private

Definition at line 106 of file vul_psfile.h.

◆ printer_paper_layout

paper_layout vul_psfile::printer_paper_layout
private

Definition at line 111 of file vul_psfile.h.

◆ printer_paper_orientation

paper_orientation vul_psfile::printer_paper_orientation
private

Definition at line 110 of file vul_psfile.h.

◆ printer_paper_type

paper_type vul_psfile::printer_paper_type
private

Definition at line 109 of file vul_psfile.h.

◆ psizex

double vul_psfile::psizex
private

Definition at line 105 of file vul_psfile.h.

◆ psizey

double vul_psfile::psizey
private

Definition at line 105 of file vul_psfile.h.

◆ reduction_factor

int vul_psfile::reduction_factor
private

Definition at line 112 of file vul_psfile.h.

◆ scale_x

float vul_psfile::scale_x
private

Definition at line 102 of file vul_psfile.h.

◆ scale_y

float vul_psfile::scale_y
private

Definition at line 102 of file vul_psfile.h.

◆ sobj_t_pos

std::streampos vul_psfile::sobj_t_pos
private

Definition at line 121 of file vul_psfile.h.

◆ translate_pos

std::streampos vul_psfile::translate_pos
private

Definition at line 120 of file vul_psfile.h.

◆ width

int vul_psfile::width
private

Definition at line 107 of file vul_psfile.h.


The documentation for this class was generated from the following files: