MrSID Decode SDK for Raster Reference Manual
9.5.4.4709
|
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 00087 LTIPixel(const LTIPixel &pixel, 00088 const lt_uint16 *bandSelection, 00089 lt_uint16 numBands, 00090 LTIColorSpace colorSpace); 00091 00092 00106 LTIPixel(const LTISample* samples, 00107 lt_uint16 numBands, 00108 LTIColorSpace colorSpace = LTI_COLORSPACE_INVALID); 00109 00113 LTIPixel(const LTIPixel&); 00114 00118 virtual ~LTIPixel(); 00119 00123 LTIPixel& operator=(const LTIPixel&); 00124 00128 bool operator==(const LTIPixel&) const; 00129 00133 bool operator!=(const LTIPixel&) const; 00134 00143 lt_uint16 getNumBands() const; 00144 00153 lt_uint16 getNumBandsWithoutAlpha() const; 00154 00164 LTIDataType getDataType() const; 00165 bool isSignedData() const; 00166 00174 LTIColorSpace getColorSpace() const; 00175 00183 LTIColorSpace getColorSpaceWithoutAlpha() const; 00184 00190 bool hasAlphaBand() const; 00191 00197 bool hasPreMultipliedAlphaBand() const; 00198 00202 bool isMultiSpectral() const; 00203 00214 lt_uint32 getNumBytes() const; 00215 00226 lt_uint32 getNumBytesWithoutAlpha() const; 00227 00236 lt_uint32 getMaxBytesPerSample() const; 00237 00247 LT_STATUS checkImpedance(const LTIPixel& pixel, 00248 bool enforceColorSpace = true) const; 00249 LT_STATUS checkImpedanceWithoutAlpha(const LTIPixel& pixel) const; 00250 00251 LTISample *getSamples() const; 00252 LTISample &getSample(lt_uint16) const; 00253 00254 //#define DEPRECATE_PIXEL_HELPERS 00255 #ifndef DEPRECATE_PIXEL_HELPERS 00256 00260 00270 const void* getSampleValueAddr(lt_uint16 band) const; 00271 00281 lt_uint8 getSampleValueUint8(lt_uint16 band) const; 00282 00292 lt_int8 getSampleValueSint8(lt_uint16 band) const; 00293 00303 lt_uint16 getSampleValueUint16(lt_uint16 band) const; 00304 00314 lt_int16 getSampleValueSint16(lt_uint16 band) const; 00315 00325 lt_uint32 getSampleValueUint32(lt_uint16 band) const; 00326 00336 lt_int32 getSampleValueSint32(lt_uint16 band) const; 00337 00347 float getSampleValueFloat32(lt_uint16 band) const; 00348 00358 double getSampleValueFloat64(lt_uint16 band) const; 00359 #endif 00360 00366 bool areSampleValuesMin() const; 00367 00373 bool areSampleValuesMax() const; 00374 00375 00382 00388 void setSampleValuesToMin(); 00389 00395 void setSampleValuesToMax(); 00396 00397 #ifndef DEPRECATE_PIXEL_HELPERS 00398 00406 void setSampleValueAddr(lt_uint16 band, const void* data) const; 00407 00416 void setSampleValuesUint8(lt_uint8 value); 00417 00426 void setSampleValuesSint8(lt_int8 value); 00427 00436 void setSampleValuesUint16(lt_uint16 value); 00437 00446 void setSampleValuesSint16(lt_int16 value); 00447 00456 void setSampleValuesUint32(lt_uint32 value); 00457 00466 void setSampleValuesSint32(lt_int32 value); 00467 00476 void setSampleValuesFloat32(float value); 00477 00486 void setSampleValuesFloat64(double value); 00487 #endif 00488 00495 void setSampleValuesFromDouble(double value); 00496 void setNonAlphaSampleValuesFromDouble(double value); 00497 void setSampleValuesFromPixel(const LTIPixel &src); 00498 void setNonAlphaSampleValuesFromPixel(const LTIPixel &src); 00499 00500 #ifndef DEPRECATE_PIXEL_HELPERS 00501 00510 void setSampleValueUint8(lt_uint16 band, lt_uint8 value); 00511 00521 void setSampleValueSint8(lt_uint16 band, lt_int8 value); 00522 00532 void setSampleValueUint16(lt_uint16 band, lt_uint16 value); 00533 00543 void setSampleValueSint16(lt_uint16 band, lt_int16 value); 00544 00554 void setSampleValueUint32(lt_uint16 band, lt_uint32 value); 00555 00565 void setSampleValueSint32(lt_uint16 band, lt_int32 value); 00566 00576 void setSampleValueFloat32(lt_uint16 band, float value); 00577 00587 void setSampleValueFloat64(lt_uint16 band, double value); 00588 00597 void setSampleValuesUint8(const lt_uint8 values[]); 00598 00607 void setSampleValuesSint8(const lt_int8 values[]); 00608 00617 void setSampleValuesUint16(const lt_uint16 values[]); 00618 00627 void setSampleValuesSint16(const lt_int16 values[]); 00628 00637 void setSampleValuesUint32(const lt_uint32 values[]); 00638 00647 void setSampleValuesSint32(const lt_int32 values[]); 00648 00657 void setSampleValuesFloat32(const float values[]); 00658 00667 void setSampleValuesFloat64(const double values[]); 00669 #endif 00670 00671 LT_STATUS getBandSelection(lt_uint16 *&bandSelection) const; 00681 static LT_STATUS checkCompatible(const LTIPixel &dstPixelProps, 00682 const LTIPixel &srcPixelProps); 00683 00684 private: 00685 void createSamples(LTIDataType dt, lt_uint16 numSamples); 00686 00687 void copySamples(const LTISample *samples, lt_uint16 numSamples, 00688 const lt_uint16 *bandSelection, lt_uint16 numBands); 00689 00690 LTISample* m_samples; 00691 lt_uint16 m_numBands; 00692 LTIColorSpace m_colorSpace; 00693 }; 00694 00695 00696 LT_END_NAMESPACE(LizardTech) 00697 00698 00699 #endif // LTI_PIXEL_H