1 //  ------------------------------------------------------------------------------------------------
2 //
3 //                     IMAGE OUTPUT PAGE MANAGEMENT
4 //
5 //  This source code is the property of FITS Imaging inc.
6 //
7 //  MODULE    : PageIVUE
8 //  LANGUAGE  : C++
9 //  AUTHOR    : Philippe BOSSUT
10 //  DATE    : Thursday, December 16th 1993
11 //  DESCRIPTION :
12 //  COMMENT   : This package is a part of the IVUE Toolkit I/O and the FlashPix Baseline I/O Toolkit
13 //  SCCSID      : @(#)ri_page.h 1.2 15:08:08 14 Apr 1997
14 //  ----------------------------------------------------------------------------
15 //  Copyright (c) 1999 Digital Imaging Group, Inc.
16 //  For conditions of distribution and use, see copyright notice
17 //  in Flashpix.h
18 //  ----------------------------------------------------------------------------
19 //  ------------------------------------------------------------------------------------------------
20   #ifndef PageIVUE_h
21   #define PageIVUE_h
22 #ifndef Commun_h
23   #include  "common.h"
24 #endif
25 
26 //  ------------------------------------------------------------------------------------------------
27 
28 //  Includes
29 //  --------
30 #ifndef Geometrie_h
31   #include "geometry.h"
32 #endif
33 
34 #ifndef SystemIVUE_h
35   #include "ri_sys.h"
36 #endif
37 
38 #ifndef AdvancedIVUE_h
39   #include "viewimg.h"
40 #endif
41 
42 #ifndef FPXBaselineIO_h
43   #include "fpxlibio.h"
44 #endif
45 
46 //  Constants
47 //  ---------
48 
49 //  Class Declarations
50 //  ------------------
51 
52   class PageImage;
53 
54   // For compatibility with already existing LivePicture code
55   typedef PageImage* ptr_PageIvue;
56   typedef PageImage& ref_PageIvue;
57 
58 //  Class Definitions
59 //  -----------------
60 
61   // Output Page Handle
62   // This is used only in the Standard Toolkit to produce formatted output page
63   // See AdvancedIVUE.h for more complex and versatile output possibilities
64 
65   class PageImage : public PToolkitObject {
66 
67   public:
68                 PageImage (PRIImage* rawImage, long width, long height, float rotation);
69                 PageImage (PRIImage* rawImage,      // Image file
70                       long width, long height,    // Size of the page in pixels
71                       float resolution,       // Page's resolution in pixels/mm
72                       float x, float y,       // Page's origin in the World (mm)
73                       TransfoPerspective transfo);  // Image position within the page
74                 PageImage (ViewImage* image, long width, long height, float rotation);
75                 PageImage (ViewImage* image,      // Image file
76                       long width, long height,    // Size of the page in pixels
77                       float resolution,       // Page's resolution in pixels/mm
78                       float x, float y,       // Page's origin in the World (mm)
79                       TransfoPerspective transfo);  // Image position within the page
80         virtual     ~PageImage ();
81 
82         // Read the all page
83         FPXStatus     ReadPage (Pixel* image);
84         // Read a line of the page
85         FPXStatus   ReadPageLine (long lineNumber, Pixel* line);
86         // Read a rectangle inside the page
87         // PTCH_105 - added 'reportProgress' argument to ReadRectangle()
88         FPXStatus   ReadRectangle(long x0, long y0,     // Rectangle in pixels inside the page
89                         long x1, long y1,
90                         Pixel* bufPix,      // Out buffer
91                         long bufWidth,      // Size of a buffer's line
92                         Boolean withAntialias = false,  // if true use the antialiasing
93                         Boolean reportProgress = true); // if true call progress function
94         // Get page's parameters
95         void      GetPixelSize(long* w, long* h);
96         void      GetResolution(float* r);
97         PRIImage*   GetImage();
98 
99         // Change the page's Image file
100         void      SetImage(ViewImage* theImage);
101 
102   private:
103 
104         void      ComputeRotationMatrix (TransfoPerspective* position, float rotation);
105 
106         // Read without interleaving and give a pointer on the line
107         Pixel*      ReadLine (long lineNumber, FPXStatus* status);  // read a line in the page
108 
109         long      pixHeight, pixWidth;    // Size of the page in pixels
110 
111         ViewImage*    image;            // Used Image View
112         PRIImage*   rawImage;         // Used Image Object
113         float     xOrigin, yOrigin;     // Origin of the page
114         float     resolution;         // Resolution in pixels by mm
115 
116         // buffers and variables used to read the lines 4 by 4 and to not read the same line twice
117         long      numLine;          // Number of the first line of the line buffer
118         long      lineSize;         // Length of the 4 lines
119         Pixel*      buffer;           // Buffers of the 4 lines
120         Pixel*      line[4];          // Pointers of the 4 lines in buffer
121   };
122 
123 //  'inline' Functions
124 //  ------------------
125 
GetPixelSize(long * w,long * h)126 inline void PageImage::GetPixelSize(long* w, long* h)
127 
128 {
129   *w = pixWidth;
130   *h = pixHeight;
131 }
132 
GetResolution(float * r)133 inline void PageImage::GetResolution(float* r)
134 
135 {
136   *r = resolution;
137 }
138 
GetImage()139 inline PRIImage* PageImage::GetImage()
140 
141 {
142   return image->GetImage();
143 }
144 
SetImage(ViewImage * theImage)145 inline void PageImage::SetImage(ViewImage* theImage)
146 
147 {
148   image = theImage;
149 }
150 
151 // 'extern' Functions
152 //  -----------------
153 
154 // 'extern' Variables
155 //  -----------------
156 
157 //  ------------------------------------------------------------------------------------------------
158   #endif // PageIVUE_h
159 //  ------------------------------------------------------------------------------------------------
160