pgutil.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2008 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Util/pgutil/pgutil.h
10 
11 #ifndef __pgutil_H
12 #define __pgutil_H
13 
14 #include <iostream>
15 
16 namespace pgplot {
17 
18  /* UNITS: 0 => answer in normalized device coordinates
19  1 => answer in inches
20  2 => answer in mm
21  3 => answer in absolute device coordinates (dots)
22  4 => answer in world coordinates
23  5 => answer as a fraction of the current viewport size
24  */
25 
27  enum Units
28  {
30  Device = 0,
32  Inches = 1,
34  Millimetres = 2,
36  Pixels = 3,
38  World = 4,
40  Viewport = 5,
41  };
42 
44  std::ostream& operator << (std::ostream&, Units);
45 
47  std::istream& operator >> (std::istream&, Units&);
48 
50  float get_aspect_ratio ();
51 
53  float get_viewport_aspect_ratio ();
54 
56  void get_scale (Units from, Units to, float& width, float& height);
57 
59  void set_paper_size (float width_cm, float aspect_ratio);
60 
62  void set_dimensions (unsigned width_pixels, unsigned height_pixels);
63 
64 }
65 
66 #endif
double get_scale(size_t nfft, type t)

Generated using doxygen 1.8.17