MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
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 
20 LT_BEGIN_NAMESPACE(LizardTech)
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 
90  LTIPixel(const LTISample* samples,
91  lt_uint16 numBands,
93 
97  LTIPixel(const LTIPixel&);
98 
102  virtual ~LTIPixel();
103 
107  LTIPixel& operator=(const LTIPixel&);
108 
112  bool operator==(const LTIPixel&) const;
113 
117  bool operator!=(const LTIPixel&) const;
118 
127  lt_uint16 getNumBands() const;
128 
137  lt_uint16 getNumBandsWithoutAlpha() const;
138 
148  LTIDataType getDataType() const;
149  bool isSignedData() const;
150 
158  LTIColorSpace getColorSpace() const;
159 
167  LTIColorSpace getColorSpaceWithoutAlpha() const;
168 
174  bool hasAlphaBand() const;
175 
181  bool hasPreMultipliedAlphaBand() const;
182 
193  lt_uint32 getNumBytes() const;
194 
205  lt_uint32 getNumBytesWithoutAlpha() const;
206 
215  lt_uint32 getMaxBytesPerSample() const;
216 
226  LT_STATUS checkImpedance(const LTIPixel& pixel,
227  bool enforceColorSpace = true) const;
228  LT_STATUS checkImpedanceWithoutAlpha(const LTIPixel& pixel) const;
229 
230  LTISample *getSamples() const;
231  LTISample &getSample(lt_uint16) const;
232 
233 //#define DEPRECATE_PIXEL_HELPERS
234 #ifndef DEPRECATE_PIXEL_HELPERS
235 
239 
249  const void* getSampleValueAddr(lt_uint16 band) const;
250 
260  lt_uint8 getSampleValueUint8(lt_uint16 band) const;
261 
271  lt_int8 getSampleValueSint8(lt_uint16 band) const;
272 
282  lt_uint16 getSampleValueUint16(lt_uint16 band) const;
283 
293  lt_int16 getSampleValueSint16(lt_uint16 band) const;
294 
304  lt_uint32 getSampleValueUint32(lt_uint16 band) const;
305 
315  lt_int32 getSampleValueSint32(lt_uint16 band) const;
316 
326  float getSampleValueFloat32(lt_uint16 band) const;
327 
337  double getSampleValueFloat64(lt_uint16 band) const;
338 #endif
339 
345  bool areSampleValuesMin() const;
346 
352  bool areSampleValuesMax() const;
353 
354 
361 
367  void setSampleValuesToMin();
368 
374  void setSampleValuesToMax();
375 
376 #ifndef DEPRECATE_PIXEL_HELPERS
377 
385  void setSampleValueAddr(lt_uint16 band, const void* data) const;
386 
395  void setSampleValuesUint8(lt_uint8 value);
396 
405  void setSampleValuesSint8(lt_int8 value);
406 
415  void setSampleValuesUint16(lt_uint16 value);
416 
425  void setSampleValuesSint16(lt_int16 value);
426 
435  void setSampleValuesUint32(lt_uint32 value);
436 
445  void setSampleValuesSint32(lt_int32 value);
446 
455  void setSampleValuesFloat32(float value);
456 
465  void setSampleValuesFloat64(double value);
466 #endif
467 
474  void setSampleValuesFromDouble(double value);
475 
476 #ifndef DEPRECATE_PIXEL_HELPERS
477 
486  void setSampleValueUint8(lt_uint16 band, lt_uint8 value);
487 
497  void setSampleValueSint8(lt_uint16 band, lt_int8 value);
498 
508  void setSampleValueUint16(lt_uint16 band, lt_uint16 value);
509 
519  void setSampleValueSint16(lt_uint16 band, lt_int16 value);
520 
530  void setSampleValueUint32(lt_uint16 band, lt_uint32 value);
531 
541  void setSampleValueSint32(lt_uint16 band, lt_int32 value);
542 
552  void setSampleValueFloat32(lt_uint16 band, float value);
553 
563  void setSampleValueFloat64(lt_uint16 band, double value);
564 
573  void setSampleValuesUint8(const lt_uint8 values[]);
574 
583  void setSampleValuesSint8(const lt_int8 values[]);
584 
593  void setSampleValuesUint16(const lt_uint16 values[]);
594 
603  void setSampleValuesSint16(const lt_int16 values[]);
604 
613  void setSampleValuesUint32(const lt_uint32 values[]);
614 
623  void setSampleValuesSint32(const lt_int32 values[]);
624 
633  void setSampleValuesFloat32(const float values[]);
634 
643  void setSampleValuesFloat64(const double values[]);
645 #endif
646 
647  LT_STATUS getBandSelection(lt_uint16 *&bandSelection) const;
648 
649  static LT_STATUS checkCompatible(const LTIPixel &dstPixelProps,
650  const LTIPixel &srcPixelProps);
651 
652 private:
653  void createSamples(LTIDataType dt, lt_uint16 numSamples);
654 
655  void copySamples(const LTISample *samples, lt_uint16 numSamples,
656  const lt_uint16 *bandSelection, lt_uint16 numBands);
657 
658  LTISample* m_samples;
659  lt_uint16 m_numBands;
660  LTIColorSpace m_colorSpace;
661 };
662 
663 
664 LT_END_NAMESPACE(LizardTech)
665 
666 
667 #endif // LTI_PIXEL_H
LTIDataType
datatypes
Definition: lti_types.h:105
#define LT_END_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:85
basic properties of a sample
Definition: lti_sample.h:28
signed char lt_int8
signed 8-bit integer
Definition: lt_types.h:44
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:52
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:39
basic properties of a pixel
Definition: lti_pixel.h:36
unsigned short lt_uint16
unsigned 16-bit integer
Definition: lt_types.h:50
LTIColorSpace
colorspaces
Definition: lti_types.h:38
signed short lt_int16
signed 16-bit integer
Definition: lt_types.h:48
#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 char lt_uint8
unsigned 8-bit integer
Definition: lt_types.h:46

LizardTech