Support doing coordinate transforms on the CPU
[ipdf/code.git] / src / view.h
1 #ifndef _VIEW_H
2 #define _VIEW_H
3
4 #include "ipdf.h"
5 #include "document.h"
6
7 namespace IPDF
8 {
9         class View
10         {
11                 public:
12                         View(Document & document, const Rect & bounds = Rect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f)) 
13                                 : m_document(document), m_bounds(bounds), m_colour(colour), m_use_gpu_transform(false) {}
14                         virtual ~View() {}
15
16                         void Render();
17                         
18                         void Translate(Real x, Real y);
19                         void ScaleAroundPoint(Real x, Real y, Real scaleAmt);
20                         
21                         Rect TransformToViewCoords(const Rect& inp) const;
22                         
23                         const Rect& GetBounds() const { return m_bounds; }
24                         
25                         const bool UsingGPUTransform() const { return m_use_gpu_transform; }
26                         void ToggleGPUTransform() { m_use_gpu_transform = (!m_use_gpu_transform); }
27                 
28                 private:
29                         void DrawGrid();
30                         bool m_use_gpu_transform;
31                         Document & m_document;
32                         Rect m_bounds;
33                         Colour m_colour;
34         };
35 }
36
37 #endif //_VIEW_H

UCC git Repository :: git.ucc.asn.au