Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / filters / lti_embeddedImage.h @ 3539

History | View | Annotate | Download (4.78 KB)

1
/* $Id: lti_embeddedImage.h 3539 2006-01-09 12:23:20Z nacho $ */
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_EMBEDDEDIMAGE_H
14
#define LTI_EMBEDDEDIMAGE_H
15

    
16
// lt_lib_mrsid_core
17
#include "lti_imageFilter.h"
18
#include "lti_scene.h"
19

    
20

    
21
LT_BEGIN_NAMESPACE(LizardTech)
22

    
23
#if defined(LT_COMPILER_MS)
24
   #pragma warning(push,4)
25
#endif
26

    
27
class LTIReusableBSQBuffer;
28

    
29
/**
30
 * create a larger frame for the image
31
 *
32
 * Creates a new image stage of the given size, containing the input image
33
 * stage within it.
34
 *
35
 * This class is used to make an image stage "larger", e.g. to place an image
36
 * on a larger "canvas" for more flexible decoding.  This class is used
37
 * by the LTIMosaicFilter class to simplify certain computations by making
38
 * all the input images map to the same underlying grid shape and size.
39
 *
40
 * The embedding process honors the background and nodata pixel settings.
41
 *
42
 * The LTIGeoCoord information for the image stage is updated appropriately.
43
 */
44
class LTIEmbeddedImage : public LTIImageFilter
45
{
46
public:
47
   /**
48
    * constructor
49
    *
50
    * Creates an image stage whose input image is placed within a much larger
51
    * empty canvas.
52
    *
53
    * @param  sourceImage      the base image
54
    * @param  newWidth         the width of the new image stage
55
    * @param  newHeight        the height of the new image stage
56
    * @param  xOffset          pixel x-position of the input image in the new image
57
    * @param  yOffset          pixel y-position of the input image in the new image
58
    * @param  backgroundPixel  background pixel color to use for the new image
59
    *                          (may be NULL, in which case the input image's
60
    *                          background is used)
61
    * @param  nodataPixel      nodata pixel color to use for the new image
62
    *                          (may be NULL, in which case the input image's
63
    *                          nodata is used)
64
    * @param takeOwnership    set to true to have the filter delete the \a sourceImage
65
    */
66
   LTIEmbeddedImage(LTIImageStage* sourceImage,
67
                    lt_int32 newWidth,
68
                    lt_int32 newHeight,
69
                    double xOffset,
70
                    double yOffset,
71
                    const LTIPixel* backgroundPixel,
72
                    const LTIPixel* nodataPixel,
73
                    bool takeOwnership);
74

    
75
   virtual ~LTIEmbeddedImage();
76
   virtual LT_STATUS initialize();
77

    
78
   virtual lt_int64 getEncodingCost(const LTIScene& scene) const;
79

    
80
   LT_STATUS setFillingBackground(bool fill);
81
   bool getFillingBackground(void) const;
82
   
83
   LT_STATUS setUsingFuzzyNoData(bool fuzzy);
84
   bool getUsingFuzzyNoData(void) const;
85

    
86
   LT_STATUS projectPointAtMag(double upperLeft,
87
                               double mag,
88
                               double& newUpperLeft) const;
89
   
90
   LT_STATUS projectDimAtMag(double dim,
91
                             double mag,
92
                             double& newDim) const;
93

    
94
   LT_STATUS getDimsAtMag(double mag,
95
                          lt_uint32& width,
96
                          lt_uint32& height) const;
97

    
98

    
99
   bool getReaderScene(const LTIScene &decodeScene, LTIScene &readerScene) const;
100

    
101
protected:
102
   virtual LT_STATUS decodeBegin(const LTIScene& scene);
103
   virtual LT_STATUS decodeStrip(LTISceneBuffer& stripBuffer,
104
                                 const LTIScene& stripScene);
105
   virtual LT_STATUS decodeEnd();
106

    
107
   double getChildXPosAtMag(double mag) const;
108
   double getChildYPosAtMag(double mag) const;
109
   bool getChildScene(const LTIScene &parentScene, LTIScene &childScene) const;
110

    
111
private:
112
   typedef LTIImageFilter Super;
113

    
114
   LTIGeoCoord* m_fullGeoCoord;
115
   lt_int32 m_fullWidth;
116
   lt_int32 m_fullHeight;
117
   double m_childXPos_P;
118
   double m_childYPos_P;
119
   
120
   LTIScene m_parentScene;
121
   LTIScene m_childScene;
122
   bool m_haveAnything;
123
   lt_int32 m_firstStrip;
124
   lt_int32 m_lastStrip;
125

    
126
   LTIPixel* m_userBackgroundPixel;
127
   LTIPixel* m_userNodataPixel;
128

    
129
   LTIReusableBSQBuffer* m_buffer;
130
   bool m_fillingBackground;
131
   bool m_usingFuzzyNoData;
132

    
133
   // nope
134
   LTIEmbeddedImage(const LTIEmbeddedImage&);
135
   LTIEmbeddedImage& operator=(const LTIEmbeddedImage&);
136
};
137

    
138

    
139
LT_END_NAMESPACE(LizardTech)
140

    
141
#if defined(LT_COMPILER_MS)
142
        #pragma warning(pop)
143
#endif
144

    
145
#endif // LTI_EMBEDDEDIMAGE_H