OpenSceneGraph 3.6.5
PdfReader
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGWIDGET_PDFREADER
15#define OSGWIDGET_PDFREADER
16
17#include <osg/Image>
18#include <osg/Geode>
19
20#include <osgWidget/Export>
21
22namespace osgWidget {
23
24
27{
34
36 position(0.0f,0.0f,0.0f),
37 widthVec(1.0f,0.0f,0.0f),
38 heightVec(0.0f,1.0f,0.0f),
39 backgroundColor(1.0f,1.0f,1.0f,1.0f),
41 widthResolution(1024),
42 heightResolution(1024) {}
43
45 const osg::Vec3& wVec,
46 const osg::Vec3& hVec,
47 const osg::Vec4& bColor,
49 unsigned int wRes=1024,
50 unsigned int hRes=1024):
51 position(pos),
52 widthVec(wVec),
53 heightVec(hVec),
54 backgroundColor(bColor),
56 widthResolution(wRes),
57 heightResolution(hRes) {}
58
62
64
66
67 unsigned int widthResolution;
68 unsigned int heightResolution;
69
70};
71
73class PdfImage : public osg::Image
74{
75 public:
76
78 _backgroundColor(1.0f,1.0f,1.0f,1.0f),
79 _pageNum(0),
82
83 void setBackgroundColor(const osg::Vec4& backgroundColor) { _backgroundColor = backgroundColor; }
85
86 int getPageNum() const { return _pageNum; }
87
88 virtual int getNumOfPages() = 0;
89
90 virtual bool page(int pageNum) = 0;
91
92 bool previous()
93 {
94 return page(_pageNum-1);
95 }
96
97 bool next()
98 {
99 return page(_pageNum+1);
100 }
101
102 void setNextPageKeyEvent(int key) { _nextPageKeyEvent = key; }
104
107
108 protected:
109
110 virtual ~PdfImage() {}
111
113
117
118};
119
120
123{
124 public:
125
127
128 PdfReader(const std::string& filename, const GeometryHints& hints = GeometryHints());
129
130 bool assign(PdfImage* pdfImage, const GeometryHints& hints = GeometryHints());
131
132 bool open(const std::string& filename, const GeometryHints& hints = GeometryHints());
133
134 bool page(int pageNum);
135
136 bool previous();
137
138 bool next();
139
140 protected:
141
143};
144
145}
146
147#endif
Vec3f Vec3
Definition Vec3:21
Vec4f Vec4
Definition Vec4:21
The osgWidget library is a NodeKit that extends the core scene graph to support a 2D (and eventually ...
Definition Box:21
A Geode is a "geometry node", that is, a leaf node on the scene graph that can have "renderable thing...
Definition Geode:29
Image class for encapsulating the storage texture image data.
Definition Image:179
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Hints structure that can be passed to PdfReader and VncClient classes to help guide them on what geom...
Definition PdfReader:27
AspectRatioPolicy
Definition PdfReader:29
@ RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO
Definition PdfReader:30
@ IGNORE_DOCUMENT_ASPECT_RATIO
Definition PdfReader:32
@ RESIZE_WIDTH_TO_MAINTAINCE_ASPECT_RATIO
Definition PdfReader:31
unsigned int heightResolution
Definition PdfReader:68
AspectRatioPolicy aspectRatioPolicy
Definition PdfReader:65
GeometryHints()
Definition PdfReader:35
GeometryHints(const osg::Vec3 &pos, const osg::Vec3 &wVec, const osg::Vec3 &hVec, const osg::Vec4 &bColor, AspectRatioPolicy asp=RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO, unsigned int wRes=1024, unsigned int hRes=1024)
Definition PdfReader:44
osg::Vec3 widthVec
Definition PdfReader:60
unsigned int widthResolution
Definition PdfReader:67
osg::Vec4 backgroundColor
Definition PdfReader:63
osg::Vec3 heightVec
Definition PdfReader:61
osg::Vec3 position
Definition PdfReader:59
Pure virtual base class for interfacing with implementation of PDF reader.
Definition PdfReader:74
PdfImage()
Definition PdfReader:77
virtual bool page(int pageNum)=0
int _pageNum
Definition PdfReader:114
void setBackgroundColor(const osg::Vec4 &backgroundColor)
Definition PdfReader:83
void setNextPageKeyEvent(int key)
Definition PdfReader:102
bool next()
Definition PdfReader:97
const osg::Vec4 & getBackgroundColor() const
Definition PdfReader:84
void setPreviousPageKeyEvent(int key)
Definition PdfReader:105
int getPageNum() const
Definition PdfReader:86
int _nextPageKeyEvent
Definition PdfReader:115
virtual int getNumOfPages()=0
int getPreviousPageKeyEvent() const
Definition PdfReader:106
virtual ~PdfImage()
Definition PdfReader:110
bool previous()
Definition PdfReader:92
int getNextPageKeyEvent() const
Definition PdfReader:103
osg::Vec4 _backgroundColor
Definition PdfReader:112
int _previousPageKeyEvent
Definition PdfReader:116
PdfReader()
Definition PdfReader:126
osg::ref_ptr< PdfImage > _pdfImage
Definition PdfReader:142
PdfReader(const std::string &filename, const GeometryHints &hints=GeometryHints())
bool page(int pageNum)
bool open(const std::string &filename, const GeometryHints &hints=GeometryHints())
bool assign(PdfImage *pdfImage, const GeometryHints &hints=GeometryHints())
#define OSGWIDGET_EXPORT
Definition Export:42

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.