svn-gvsig-desktop / trunk / libraries / libjni-mrsid-macosx / include / filters / lti_multiresFilter.h @ 9099
History | View | Annotate | Download (4.22 KB)
1 |
/* $Id: lti_multiresFilter.h 9099 2006-11-29 12:16:22Z mija $ */
|
---|---|
2 |
/* //////////////////////////////////////////////////////////////////////////
|
3 |
// //
|
4 |
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
|
5 |
// Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
|
6 |
// prohibited. Access to and use of this code is permitted only under //
|
7 |
// license from LizardTech, Inc. Portions of the code are protected by //
|
8 |
// US and foreign patents and other filings. All Rights Reserved. //
|
9 |
// //
|
10 |
////////////////////////////////////////////////////////////////////////// */
|
11 |
/* PUBLIC */
|
12 |
|
13 |
#ifndef LTI_MULTIRESFILTER_H
|
14 |
#define LTI_MULTIRESFILTER_H
|
15 |
|
16 |
// lt_lib_mrsid_core
|
17 |
#include "lti_imageFilter.h" |
18 |
|
19 |
|
20 |
LT_BEGIN_NAMESPACE(LizardTech) |
21 |
|
22 |
#if defined(LT_COMPILER_MS)
|
23 |
#pragma warning(push,4) |
24 |
#endif
|
25 |
|
26 |
|
27 |
/**
|
28 |
* add resolutions to the image
|
29 |
*
|
30 |
* Extends the magnification range of an image, to allow decodes at different
|
31 |
* resolutions than the image stage would normally allow.
|
32 |
*
|
33 |
* Note that this class is not the same as at the LTIStaticZoomFilter class,
|
34 |
* which scales the magnification statically for the pipeline when initially
|
35 |
* constructed. This class allows for the zoom level to be extended for an
|
36 |
* individual decode operation.
|
37 |
*/
|
38 |
class LTIMultiResFilter : public LTIImageFilter |
39 |
{ |
40 |
public:
|
41 |
/**
|
42 |
* constructor
|
43 |
*
|
44 |
* Creates an image stage which can be decoded at arbitrary magnifications.
|
45 |
*
|
46 |
* Normally image stages will only support a limited set of magnification
|
47 |
* values for the LTIScene passed to LTIImageStage::read() -- often, only
|
48 |
* 1.0. This class will perform any needed resampling on the fly so that
|
49 |
* arbitrary (power-of-two) magnifications are supported.
|
50 |
*
|
51 |
* @param sourceImage the base image
|
52 |
* @param takeOwnership set to true to have the filter delete the \a sourceImage
|
53 |
*/
|
54 |
LTIMultiResFilter(LTIImageStage* sourceImage, bool takeOwnership);
|
55 |
LTIMultiResFilter(LTIImageStage* sourceImage, |
56 |
double minMag,
|
57 |
double maxMag,
|
58 |
bool takeOwnership);
|
59 |
|
60 |
virtual ~LTIMultiResFilter(); |
61 |
virtual LT_STATUS initialize(); |
62 |
|
63 |
LT_STATUS projectPointAtMag(double upperLeft,
|
64 |
double mag,
|
65 |
double& newUpperLeft) const; |
66 |
|
67 |
LT_STATUS projectDimAtMag(double dim,
|
68 |
double mag,
|
69 |
double& newDim) const; |
70 |
|
71 |
LT_STATUS getDimsAtMag(double mag,
|
72 |
lt_uint32& width, |
73 |
lt_uint32& height) const;
|
74 |
|
75 |
|
76 |
bool getReaderScene(const LTIScene &decodeScene, |
77 |
LTIScene &readerScene) const;
|
78 |
|
79 |
protected:
|
80 |
LT_STATUS decodeBegin(const LTIScene& scene);
|
81 |
LT_STATUS decodeStrip(LTISceneBuffer& stripBuffer, |
82 |
const LTIScene& stripScene);
|
83 |
LT_STATUS decodeEnd(); |
84 |
|
85 |
|
86 |
enum Mode
|
87 |
{ |
88 |
MODE_INVALID, |
89 |
MODE_PASSTHROUGH, |
90 |
MODE_DOWNSAMPLE, |
91 |
MODE_DOWNSAMPLE_FULLREAD, |
92 |
MODE_UPSAMPLE, |
93 |
}; |
94 |
|
95 |
void getModeAndScale(const LTIScene &scene, |
96 |
Mode &mode, |
97 |
double &scale) const; |
98 |
|
99 |
bool getChildScene(const LTIScene &scene, |
100 |
LTIScene &childScene) const;
|
101 |
|
102 |
struct StripCache;
|
103 |
|
104 |
enum
|
105 |
{ |
106 |
// The largest possible mag is based on the 2gb
|
107 |
// scene limitation. Thus the largest scene we
|
108 |
// should ever expect is approximately the square
|
109 |
// root of (2gb / 3) pixels on a side. If we
|
110 |
// assume the smallest image we'll ever encounter
|
111 |
// is 32x32 then the largest magnification can
|
112 |
// be calculated. It's big, but we need a real number!
|
113 |
kMaxMagnification = 512 // 51200% zoom! |
114 |
}; |
115 |
|
116 |
private:
|
117 |
double m_mrMinMag;
|
118 |
double m_mrMaxMag;
|
119 |
|
120 |
Mode m_mode; |
121 |
double m_scale;
|
122 |
double m_curX;
|
123 |
double m_curY;
|
124 |
lt_int32 m_curStrip; |
125 |
lt_int32 m_numStrips; |
126 |
|
127 |
StripCache *m_stripCache; |
128 |
|
129 |
// nope
|
130 |
LTIMultiResFilter(const LTIMultiResFilter&);
|
131 |
LTIMultiResFilter& operator=(const LTIMultiResFilter&);
|
132 |
}; |
133 |
|
134 |
|
135 |
LT_END_NAMESPACE(LizardTech) |
136 |
|
137 |
#if defined(LT_COMPILER_MS)
|
138 |
#pragma warning(pop)
|
139 |
#endif
|
140 |
|
141 |
#endif // LTI_MULTIRESFILTER_H |