MrSID Decode SDK for Raster Reference Manual
9.5.1.4427
|
00001 /* $Id$ */ 00002 /* ////////////////////////////////////////////////////////////////////////// 00003 // // 00004 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, // 00005 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution // 00006 // prohibited. Access to and use of this code is permitted only under // 00007 // license from LizardTech, Inc. Portions of the code are protected by // 00008 // US and foreign patents and other filings. All Rights Reserved. // 00009 // // 00011 /* PUBLIC */ 00012 00013 #ifndef LTI_PIXEL_H 00014 #define LTI_PIXEL_H 00015 00016 // lt_lib_mrsid_core 00017 #include "lti_sample.h" 00018 00019 00020 LT_BEGIN_NAMESPACE(LizardTech) 00021 00022 00023 00036 class LTIPixel 00037 { 00038 public: 00045 LTIPixel(void); 00046 00058 LTIPixel(LTIColorSpace colorSpace, 00059 lt_uint16 numBands, 00060 LTIDataType dataType, 00061 const LTISample* samples = NULL); 00062 00073 LTIPixel(const LTIPixel &pixel, 00074 const lt_uint16 *bandSelection, 00075 lt_uint16 numBands); 00076 00090 LTIPixel(const LTISample* samples, 00091 lt_uint16 numBands, 00092 LTIColorSpace colorSpace = LTI_COLORSPACE_INVALID); 00093 00097 LTIPixel(const LTIPixel&); 00098 00102 virtual ~LTIPixel(); 00103 00107 LTIPixel& operator=(const LTIPixel&); 00108 00112 bool operator==(const LTIPixel&) const; 00113 00117 bool operator!=(const LTIPixel&) const; 00118 00127 lt_uint16 getNumBands() const; 00128 00137 lt_uint16 getNumBandsWithoutAlpha() const; 00138 00148 LTIDataType getDataType() const; 00149 bool isSignedData() const; 00150 00158 LTIColorSpace getColorSpace() const; 00159 00167 LTIColorSpace getColorSpaceWithoutAlpha() const; 00168 00174 bool hasAlphaBand() const; 00175 00181 bool hasPreMultipliedAlphaBand() const; 00182 00186 bool isMultiSpectral() const; 00187 00198 lt_uint32 getNumBytes() const; 00199 00210 lt_uint32 getNumBytesWithoutAlpha() const; 00211 00220 lt_uint32 getMaxBytesPerSample() const; 00221 00231 LT_STATUS checkImpedance(const LTIPixel& pixel, 00232 bool enforceColorSpace = true) const; 00233 LT_STATUS checkImpedanceWithoutAlpha(const LTIPixel& pixel) const; 00234 00235 LTISample *getSamples() const; 00236 LTISample &getSample(lt_uint16) const; 00237 00238 //#define DEPRECATE_PIXEL_HELPERS 00239 #ifndef DEPRECATE_PIXEL_HELPERS 00240 00244 00254 const void* getSampleValueAddr(lt_uint16 band) const; 00255 00265 lt_uint8 getSampleValueUint8(lt_uint16 band) const; 00266 00276 lt_int8 getSampleValueSint8(lt_uint16 band) const; 00277 00287 lt_uint16 getSampleValueUint16(lt_uint16 band) const; 00288 00298 lt_int16 getSampleValueSint16(lt_uint16 band) const; 00299 00309 lt_uint32 getSampleValueUint32(lt_uint16 band) const; 00310 00320 lt_int32 getSampleValueSint32(lt_uint16 band) const; 00321 00331 float getSampleValueFloat32(lt_uint16 band) const; 00332 00342 double getSampleValueFloat64(lt_uint16 band) const; 00343 #endif 00344 00350 bool areSampleValuesMin() const; 00351 00357 bool areSampleValuesMax() const; 00358 00359 00366 00372 void setSampleValuesToMin(); 00373 00379 void setSampleValuesToMax(); 00380 00381 #ifndef DEPRECATE_PIXEL_HELPERS 00382 00390 void setSampleValueAddr(lt_uint16 band, const void* data) const; 00391 00400 void setSampleValuesUint8(lt_uint8 value); 00401 00410 void setSampleValuesSint8(lt_int8 value); 00411 00420 void setSampleValuesUint16(lt_uint16 value); 00421 00430 void setSampleValuesSint16(lt_int16 value); 00431 00440 void setSampleValuesUint32(lt_uint32 value); 00441 00450 void setSampleValuesSint32(lt_int32 value); 00451 00460 void setSampleValuesFloat32(float value); 00461 00470 void setSampleValuesFloat64(double value); 00471 #endif 00472 00479 void setSampleValuesFromDouble(double value); 00480 00481 #ifndef DEPRECATE_PIXEL_HELPERS 00482 00491 void setSampleValueUint8(lt_uint16 band, lt_uint8 value); 00492 00502 void setSampleValueSint8(lt_uint16 band, lt_int8 value); 00503 00513 void setSampleValueUint16(lt_uint16 band, lt_uint16 value); 00514 00524 void setSampleValueSint16(lt_uint16 band, lt_int16 value); 00525 00535 void setSampleValueUint32(lt_uint16 band, lt_uint32 value); 00536 00546 void setSampleValueSint32(lt_uint16 band, lt_int32 value); 00547 00557 void setSampleValueFloat32(lt_uint16 band, float value); 00558 00568 void setSampleValueFloat64(lt_uint16 band, double value); 00569 00578 void setSampleValuesUint8(const lt_uint8 values[]); 00579 00588 void setSampleValuesSint8(const lt_int8 values[]); 00589 00598 void setSampleValuesUint16(const lt_uint16 values[]); 00599 00608 void setSampleValuesSint16(const lt_int16 values[]); 00609 00618 void setSampleValuesUint32(const lt_uint32 values[]); 00619 00628 void setSampleValuesSint32(const lt_int32 values[]); 00629 00638 void setSampleValuesFloat32(const float values[]); 00639 00648 void setSampleValuesFloat64(const double values[]); 00650 #endif 00651 00652 LT_STATUS getBandSelection(lt_uint16 *&bandSelection) const; 00662 static LT_STATUS checkCompatible(const LTIPixel &dstPixelProps, 00663 const LTIPixel &srcPixelProps); 00664 00665 private: 00666 void createSamples(LTIDataType dt, lt_uint16 numSamples); 00667 00668 void copySamples(const LTISample *samples, lt_uint16 numSamples, 00669 const lt_uint16 *bandSelection, lt_uint16 numBands); 00670 00671 LTISample* m_samples; 00672 lt_uint16 m_numBands; 00673 LTIColorSpace m_colorSpace; 00674 }; 00675 00676 00677 LT_END_NAMESPACE(LizardTech) 00678 00679 00680 #endif // LTI_PIXEL_H