1 // Created on: 2011-05-20
2 // Created by: Anton POLETAEV
3 // Copyright (c) 2011-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #ifndef _OPENGL_PRINTERCONTEXT_H
21 #define _OPENGL_PRINTERCONTEXT_H
23 #include <Standard_DefineHandle.hxx>
24 #include <TColStd_Array2OfReal.hxx>
25 #include <Handle_Standard_Transient.hxx>
27 //! Class provides specific information for redrawing view to offscreen buffer
28 //! on printing. The information is: projection matrixes for tiling,
29 //! scaling factors for text/markers and layer viewport dimensions.
30 class OpenGl_PrinterContext : public Standard_Transient
36 OpenGl_PrinterContext();
39 virtual ~OpenGl_PrinterContext();
41 //! Get view projection transformation matrix.
42 inline const TColStd_Array2OfReal& GetProjTransformation() const
44 return myProjTransform;
47 //! Set view projection transformation matrix for printing/tiling purposes
48 //! theProjTransform parameter should be an 4x4 array.
49 bool SetProjTransformation (const TColStd_Array2OfReal& theProjTransform);
51 //! Setup view projection transformation matrix (glLoadMatrixf).
52 void LoadProjTransformation();
54 //! Get text/markers scale factor
55 inline void GetScale (Standard_ShortReal& theScaleX,
56 Standard_ShortReal& theScaleY) const
62 //! Set text scale factor
63 void SetScale (const Standard_ShortReal theScaleX,
64 const Standard_ShortReal theScaleY);
66 //! Get layer viewport dimensions
67 inline void GetLayerViewport (Standard_Integer& theViewportX,
68 Standard_Integer& theViewportY) const
70 theViewportX = myLayerViewportX;
71 theViewportY = myLayerViewportY;
74 //! Set layer viewport dimensions
75 void SetLayerViewport (const Standard_Integer theViewportX,
76 const Standard_Integer theViewportY);
80 TColStd_Array2OfReal myProjTransform;
81 Standard_ShortReal myProjMatrixGl[16];
82 Standard_ShortReal myScaleX;
83 Standard_ShortReal myScaleY;
84 Standard_Integer myLayerViewportX;
85 Standard_Integer myLayerViewportY;
89 DEFINE_STANDARD_RTTI(OpenGl_PrinterContext) // Type definition
93 DEFINE_STANDARD_HANDLE(OpenGl_PrinterContext, Standard_Transient)