Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 2011-05-20 |
2 | // Created by: Anton POLETAEV | |
973c2be1 | 3 | // Copyright (c) 2011-2014 OPEN CASCADE SAS |
b311480e | 4 | // |
973c2be1 | 5 | // This file is part of Open CASCADE Technology software library. |
b311480e | 6 | // |
973c2be1 | 7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public version 2.1 as published | |
9 | // by the Free Software Foundation, with special exception defined in the file | |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
11 | // distribution for complete text of the license and disclaimer of any warranty. | |
b311480e | 12 | // |
973c2be1 | 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. | |
b311480e | 15 | |
7edf74fd A |
16 | #ifndef _OPENGL_PRINTERCONTEXT_H |
17 | #define _OPENGL_PRINTERCONTEXT_H | |
18 | ||
7edf74fd | 19 | #include <Standard_DefineHandle.hxx> |
7edf74fd | 20 | #include <TColStd_Array2OfReal.hxx> |
a174a3c5 | 21 | #include <Handle_Standard_Transient.hxx> |
7edf74fd A |
22 | |
23 | //! Class provides specific information for redrawing view to offscreen buffer | |
24 | //! on printing. The information is: projection matrixes for tiling, | |
25 | //! scaling factors for text/markers and layer viewport dimensions. | |
a174a3c5 | 26 | class OpenGl_PrinterContext : public Standard_Transient |
7edf74fd A |
27 | { |
28 | ||
29 | public: | |
30 | ||
a174a3c5 | 31 | //! Constructor |
32 | OpenGl_PrinterContext(); | |
33 | ||
34 | //! Destructor | |
35 | virtual ~OpenGl_PrinterContext(); | |
7edf74fd A |
36 | |
37 | //! Get view projection transformation matrix. | |
a174a3c5 | 38 | inline const TColStd_Array2OfReal& GetProjTransformation() const |
7edf74fd A |
39 | { |
40 | return myProjTransform; | |
41 | } | |
42 | ||
a174a3c5 | 43 | //! Set view projection transformation matrix for printing/tiling purposes |
44 | //! theProjTransform parameter should be an 4x4 array. | |
45 | bool SetProjTransformation (const TColStd_Array2OfReal& theProjTransform); | |
46 | ||
47 | //! Setup view projection transformation matrix (glLoadMatrixf). | |
48 | void LoadProjTransformation(); | |
7edf74fd A |
49 | |
50 | //! Get text/markers scale factor | |
a174a3c5 | 51 | inline void GetScale (Standard_ShortReal& theScaleX, |
52 | Standard_ShortReal& theScaleY) const | |
7edf74fd A |
53 | { |
54 | theScaleX = myScaleX; | |
55 | theScaleY = myScaleY; | |
56 | } | |
57 | ||
a174a3c5 | 58 | //! Set text scale factor |
59 | void SetScale (const Standard_ShortReal theScaleX, | |
60 | const Standard_ShortReal theScaleY); | |
61 | ||
7edf74fd | 62 | //! Get layer viewport dimensions |
a174a3c5 | 63 | inline void GetLayerViewport (Standard_Integer& theViewportX, |
64 | Standard_Integer& theViewportY) const | |
7edf74fd A |
65 | { |
66 | theViewportX = myLayerViewportX; | |
67 | theViewportY = myLayerViewportY; | |
68 | } | |
69 | ||
7edf74fd | 70 | //! Set layer viewport dimensions |
a174a3c5 | 71 | void SetLayerViewport (const Standard_Integer theViewportX, |
72 | const Standard_Integer theViewportY); | |
7edf74fd A |
73 | |
74 | private: | |
75 | ||
7edf74fd | 76 | TColStd_Array2OfReal myProjTransform; |
a174a3c5 | 77 | Standard_ShortReal myProjMatrixGl[16]; |
78 | Standard_ShortReal myScaleX; | |
79 | Standard_ShortReal myScaleY; | |
80 | Standard_Integer myLayerViewportX; | |
81 | Standard_Integer myLayerViewportY; | |
82 | ||
83 | public: | |
84 | ||
85 | DEFINE_STANDARD_RTTI(OpenGl_PrinterContext) // Type definition | |
86 | ||
7edf74fd A |
87 | }; |
88 | ||
a174a3c5 | 89 | DEFINE_STANDARD_HANDLE(OpenGl_PrinterContext, Standard_Transient) |
90 | ||
7edf74fd | 91 | #endif |