MrSID Decode SDK for Raster Reference Manual  9.5.4.4709
lti_pixel.h
Go to the documentation of this file.
1 /* $Id$ */
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 // //
11 /* PUBLIC */
12 
13 #ifndef LTI_PIXEL_H
14 #define LTI_PIXEL_H
15 
16 // lt_lib_mrsid_core
17 #include "lti_sample.h"
18 
19 
21 
22 
23 
36 class LTIPixel
37 {
38 public:
45  LTIPixel(void);
46 
58  LTIPixel(LTIColorSpace colorSpace,
59  lt_uint16 numBands,
60  LTIDataType dataType,
61  const LTISample* samples = NULL);
62 
73  LTIPixel(const LTIPixel &pixel,
74  const lt_uint16 *bandSelection,
75  lt_uint16 numBands);
76 
87  LTIPixel(const LTIPixel &pixel,
88  const lt_uint16 *bandSelection,
89  lt_uint16 numBands,
90  LTIColorSpace colorSpace);
91 
92 
106  LTIPixel(const LTISample* samples,
107  lt_uint16 numBands,
109 
113  LTIPixel(const LTIPixel&);
114 
118  virtual ~LTIPixel();
119 
123  LTIPixel& operator=(const LTIPixel&);
124 
128  bool operator==(const LTIPixel&) const;
129 
133  bool operator!=(const LTIPixel&) const;
134 
143  lt_uint16 getNumBands() const;
144 
153  lt_uint16 getNumBandsWithoutAlpha() const;
154 
164  LTIDataType getDataType() const;
165  bool isSignedData() const;
166 
174  LTIColorSpace getColorSpace() const;
175 
183  LTIColorSpace getColorSpaceWithoutAlpha() const;
184 
190  bool hasAlphaBand() const;
191 
197  bool hasPreMultipliedAlphaBand() const;
198 
202  bool isMultiSpectral() const;
203 
214  lt_uint32 getNumBytes() const;
215 
226  lt_uint32 getNumBytesWithoutAlpha() const;
227 
236  lt_uint32 getMaxBytesPerSample() const;
237 
247  LT_STATUS checkImpedance(const LTIPixel& pixel,
248  bool enforceColorSpace = true) const;
249  LT_STATUS checkImpedanceWithoutAlpha(const LTIPixel& pixel) const;
250 
251  LTISample *getSamples() const;
252  LTISample &getSample(lt_uint16) const;
253 
254 //#define DEPRECATE_PIXEL_HELPERS
255 #ifndef DEPRECATE_PIXEL_HELPERS
256 
260 
270  const void* getSampleValueAddr(lt_uint16 band) const;
271 
281  lt_uint8 getSampleValueUint8(lt_uint16 band) const;
282 
292  lt_int8 getSampleValueSint8(lt_uint16 band) const;
293 
303  lt_uint16 getSampleValueUint16(lt_uint16 band) const;
304 
314  lt_int16 getSampleValueSint16(lt_uint16 band) const;
315 
325  lt_uint32 getSampleValueUint32(lt_uint16 band) const;
326 
336  lt_int32 getSampleValueSint32(lt_uint16 band) const;
337 
347  float getSampleValueFloat32(lt_uint16 band) const;
348 
358  double getSampleValueFloat64(lt_uint16 band) const;
359 #endif
360 
366  bool areSampleValuesMin() const;
367 
373  bool areSampleValuesMax() const;
374 
375 
382 
388  void setSampleValuesToMin();
389 
395  void setSampleValuesToMax();
396 
397 #ifndef DEPRECATE_PIXEL_HELPERS
398 
406  void setSampleValueAddr(lt_uint16 band, const void* data) const;
407 
416  void setSampleValuesUint8(lt_uint8 value);
417 
426  void setSampleValuesSint8(lt_int8 value);
427 
436  void setSampleValuesUint16(lt_uint16 value);
437 
446  void setSampleValuesSint16(lt_int16 value);
447 
456  void setSampleValuesUint32(lt_uint32 value);
457 
466  void setSampleValuesSint32(lt_int32 value);
467 
476  void setSampleValuesFloat32(float value);
477 
486  void setSampleValuesFloat64(double value);
487 #endif
488 
495  void setSampleValuesFromDouble(double value);
496  void setNonAlphaSampleValuesFromDouble(double value);
497  void setSampleValuesFromPixel(const LTIPixel &src);
498  void setNonAlphaSampleValuesFromPixel(const LTIPixel &src);
499 
500 #ifndef DEPRECATE_PIXEL_HELPERS
501 
510  void setSampleValueUint8(lt_uint16 band, lt_uint8 value);
511 
521  void setSampleValueSint8(lt_uint16 band, lt_int8 value);
522 
532  void setSampleValueUint16(lt_uint16 band, lt_uint16 value);
533 
543  void setSampleValueSint16(lt_uint16 band, lt_int16 value);
544 
554  void setSampleValueUint32(lt_uint16 band, lt_uint32 value);
555 
565  void setSampleValueSint32(lt_uint16 band, lt_int32 value);
566 
576  void setSampleValueFloat32(lt_uint16 band, float value);
577 
587  void setSampleValueFloat64(lt_uint16 band, double value);
588 
597  void setSampleValuesUint8(const lt_uint8 values[]);
598 
607  void setSampleValuesSint8(const lt_int8 values[]);
608 
617  void setSampleValuesUint16(const lt_uint16 values[]);
618 
627  void setSampleValuesSint16(const lt_int16 values[]);
628 
637  void setSampleValuesUint32(const lt_uint32 values[]);
638 
647  void setSampleValuesSint32(const lt_int32 values[]);
648 
657  void setSampleValuesFloat32(const float values[]);
658 
667  void setSampleValuesFloat64(const double values[]);
669 #endif
670 
671  LT_STATUS getBandSelection(lt_uint16 *&bandSelection) const;
681  static LT_STATUS checkCompatible(const LTIPixel &dstPixelProps,
682  const LTIPixel &srcPixelProps);
683 
684 private:
685  void createSamples(LTIDataType dt, lt_uint16 numSamples);
686 
687  void copySamples(const LTISample *samples, lt_uint16 numSamples,
688  const lt_uint16 *bandSelection, lt_uint16 numBands);
689 
690  LTISample* m_samples;
691  lt_uint16 m_numBands;
692  LTIColorSpace m_colorSpace;
693 };
694 
695 
697 
698 
699 #endif // LTI_PIXEL_H
signed short lt_int16
signed 16-bit integer
Definition: lt_types.h:48
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:39
LTIColorSpace
colorspaces
Definition: lti_types.h:38
signed char lt_int8
signed 8-bit integer
Definition: lt_types.h:44
#define LT_BEGIN_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:84
unsigned int lt_uint32
unsigned 32-bit integer
Definition: lt_types.h:54
unsigned short lt_uint16
unsigned 16-bit integer
Definition: lt_types.h:50
basic properties of a sample
Definition: lti_sample.h:28
unsigned char lt_uint8
unsigned 8-bit integer
Definition: lt_types.h:46
LTIDataType
datatypes
Definition: lti_types.h:105
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:52
basic properties of a pixel
Definition: lti_pixel.h:36
#define LT_END_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:85

LizardTech