root/OpenSceneGraph/trunk/include/osgDB/ImageOptions @ 13041

Revision 13041, 4.4 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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 OSGDB_IMAGEOPTIONS
15#define OSGDB_IMAGEOPTIONS 1
16
17#include <osgDB/Options>
18
19namespace osgDB {
20
21class OSGDB_EXPORT ImageOptions : public osgDB::Options
22{
23    public:
24
25        ImageOptions();
26
27        ImageOptions(const std::string& str);
28
29        ImageOptions(const ImageOptions& options,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
30            osgDB::Options(options,copyop),
31            _sourceImageSamplingMode(options._sourceImageSamplingMode),
32            _sourceImageWindowMode(options._sourceImageWindowMode),
33            _sourceRatioWindow(options._sourceRatioWindow),
34            _sourcePixelWindow(options._sourcePixelWindow),
35            _destinationImage(options._destinationImage),
36            _destinationImageWindowMode(options._destinationImageWindowMode),
37            _destinationRatioWindow(options._destinationRatioWindow),
38            _destinationPixelWindow(options._destinationPixelWindow),
39            _destinationDataType(options._destinationDataType),
40            _destinationPixelFormat(options._destinationPixelFormat) {}
41
42
43        META_Object(osgDB,ImageOptions);
44
45        /** RatioWindow stores the window (as ratios of 0.0 to 1.0) from the overall imagery from which to extract the osg::Image*/
46        struct RatioWindow
47        {
48            RatioWindow():
49                windowX(0.0),
50                windowY(0.0),
51                windowWidth(1.0),
52                windowHeight(1.0) {}
53
54            void set(double x, double y, double w, double h)
55            {
56                windowX = x;
57                windowY = y;
58                windowWidth = w;
59                windowHeight = h;
60            }
61
62            double windowX;
63            double windowY;
64            double windowWidth;
65            double windowHeight;
66        };
67
68        /** PixelWindow stores the window (in exact pixels) from the overall imagery from which to extract the osg::Image*/
69        struct PixelWindow
70        {
71            PixelWindow():
72                windowX(0),
73                windowY(0),
74                windowWidth(0),
75                windowHeight(0) {}
76
77            void set(unsigned int x, unsigned int y, unsigned int w, unsigned int h)
78            {
79                windowX = x;
80                windowY = y;
81                windowWidth = w;
82                windowHeight = h;
83            }
84
85            unsigned int windowX;
86            unsigned int windowY;
87            unsigned int windowWidth;
88            unsigned int windowHeight;
89        };
90
91        enum ImageWindowMode
92        {
93            ALL_IMAGE,
94            RATIO_WINDOW,
95            PIXEL_WINDOW
96        };
97
98        enum ImageSamplingMode
99        {
100            NEAREST,
101            LINEAR,
102            CUBIC
103        };
104
105        /** Used as UserData attached to generated osg::Image's*/
106        struct TexCoordRange : public osg::Referenced
107        {
108            TexCoordRange():
109                _x(0.0),
110                _y(0.0),
111                _w(1.0),
112                _h(1.0) {}
113
114            void set(double x,double y, double w, double h)
115            {
116                _x = x;
117                _y = y;
118                _w = w;
119                _h = h;
120            }
121
122            double _x,_y,_w,_h;
123        };
124
125
126        // source
127        ImageSamplingMode   _sourceImageSamplingMode;
128        ImageWindowMode     _sourceImageWindowMode;
129        RatioWindow         _sourceRatioWindow;
130        PixelWindow         _sourcePixelWindow;
131
132        // destination
133        osg::ref_ptr<osg::Image> _destinationImage;
134
135        ImageWindowMode     _destinationImageWindowMode;
136        RatioWindow         _destinationRatioWindow;
137        PixelWindow         _destinationPixelWindow;
138
139        GLenum              _destinationDataType;
140        GLenum              _destinationPixelFormat;
141
142        void init();
143
144};
145
146
147}
148
149#endif // OSGDB_IMAGEOPTIONS
Note: See TracBrowser for help on using the browser.