MrSID Decode SDK for Raster Reference Manual  9.5.5.5244
lti_pixel.h
Go to the documentation of this file.
1 //
2 // This code is property of Celartem, Inc dba Extensis.
3 // Copyright (c) 1995-2023. All rights reserved.
4 // Use permitted only under license from Extensis.
5 //
6 /* PUBLIC */
7 
8 #ifndef LTI_PIXEL_H
9 #define LTI_PIXEL_H
10 
11 // lt_lib_mrsid_core
12 #include "lti_sample.h"
13 
14 
15 LT_BEGIN_LIZARDTECH_NAMESPACE
16 
17 
31 class LTIPixel
32 {
33 public:
34 #if __cplusplus >= 201103L
35  LTIPixel(LTIPixel &&other) noexcept;
36  LTIPixel &operator=(LTIPixel &&other) noexcept;
37 #endif
38 
39 
46  LTIPixel(void);
47 
59  LTIPixel(LTIColorSpace colorSpace,
60  lt_uint16 numBands,
61  LTIDataType dataType,
62  const LTISample* samples = nullptr);
63 
74  LTIPixel(const LTIPixel &pixel,
75  const lt_uint16 *bandSelection,
76  lt_uint16 numBands);
77 
88  LTIPixel(const LTIPixel &pixel,
89  const lt_uint16 *bandSelection,
90  lt_uint16 numBands,
91  LTIColorSpace colorSpace);
92 
93 
107  LTIPixel(const LTISample* samples,
108  lt_uint16 numBands,
110 
115 
119  virtual ~LTIPixel();
120 
125 
129  bool operator==(const LTIPixel&) const;
130 
134  bool operator!=(const LTIPixel&) const;
135 
145 
155 
166  bool isSignedData() const;
167 
176 
185 
191  bool hasAlphaBand() const;
192 
199 
203  bool isMultiSpectral() const;
204 
216 
228 
238 
249  bool enforceColorSpace = true) const;
251 
254 
255 //#define DEPRECATE_PIXEL_HELPERS
256 #ifndef DEPRECATE_PIXEL_HELPERS
261 
271  const void* getSampleValueAddr(lt_uint16 band) const;
272 
283 
294 
305 
316 
327 
338 
348  float getSampleValueFloat32(lt_uint16 band) const;
349 
359  double getSampleValueFloat64(lt_uint16 band) const;
360 #endif
361 
367  bool areSampleValuesMin() const;
368 
374  bool areSampleValuesMax() const;
375 
376 
383 
390 
397 
398 #ifndef DEPRECATE_PIXEL_HELPERS
407  void setSampleValueAddr(lt_uint16 band, const void* data) const;
408 
418 
428 
438 
448 
458 
468 
477  void setSampleValuesFloat32(float value);
478 
487  void setSampleValuesFloat64(double value);
488 #endif
489 
496  void setSampleValuesFromDouble(double value);
500 
501 #ifndef DEPRECATE_PIXEL_HELPERS
512 
523 
534 
545 
556 
567 
577  void setSampleValueFloat32(lt_uint16 band, float value);
578 
588  void setSampleValueFloat64(lt_uint16 band, double value);
589 
598  void setSampleValuesUint8(const lt_uint8 values[]);
599 
608  void setSampleValuesSint8(const lt_int8 values[]);
609 
618  void setSampleValuesUint16(const lt_uint16 values[]);
619 
628  void setSampleValuesSint16(const lt_int16 values[]);
629 
638  void setSampleValuesUint32(const lt_uint32 values[]);
639 
648  void setSampleValuesSint32(const lt_int32 values[]);
649 
658  void setSampleValuesFloat32(const float values[]);
659 
668  void setSampleValuesFloat64(const double values[]);
670 #endif
671 
672  LT_STATUS getBandSelection(lt_uint16 *&bandSelection) const;
682  static LT_STATUS checkCompatible(const LTIPixel &dstPixelProps,
683  const LTIPixel &srcPixelProps);
684 
686 
687 private:
688  void createSamples(LTIDataType dt, lt_uint16 numSamples);
689 
690  void copySamples(const LTISample *samples, lt_uint16 numSamples,
691  const lt_uint16 *bandSelection, lt_uint16 numBands);
692 
693  LTISample* m_samples;
694  lt_uint16 m_numBands;
695  LTIColorSpace m_colorSpace;
696 };
697 
698 
699 LT_END_LIZARDTECH_NAMESPACE
700 
701 
702 #endif // LTI_PIXEL_H
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:30
unsigned short lt_uint16
unsigned 16-bit integer
Definition: lt_types.h:40
signed char lt_int8
signed 8-bit integer
Definition: lt_types.h:34
unsigned char lt_uint8
unsigned 8-bit integer
Definition: lt_types.h:36
signed short lt_int16
signed 16-bit integer
Definition: lt_types.h:38
unsigned int lt_uint32
unsigned 32-bit integer
Definition: lt_types.h:44
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:42
LTIDataType
datatypes
Definition: lti_types.h:101
LTIColorSpace
colorspaces
Definition: lti_types.h:34
@ LTI_COLORSPACE_INVALID
Definition: lti_types.h:35
basic properties of a pixel
Definition: lti_pixel.h:32
void setSampleValuesUint32(const lt_uint32 values[])
sets all samples to the given values
void setSampleValueFloat64(lt_uint16 band, double value)
sets the given sample to the given value
void setSampleValuesFromPixel(const LTIPixel &src)
sets all samples to minimum
lt_uint16 getSampleValueUint16(lt_uint16 band) const
returns the specified sample's value
bool hasAlphaBand() const
returns true if colorspace has alpha channel flags
lt_uint16 getNumBandsWithoutAlpha() const
get the number of bands not counting alpha
bool operator!=(const LTIPixel &) const
equality operator
virtual ~LTIPixel()
destructor
void setSampleValuesSint32(lt_int32 value)
sets all samples to the given value
void setSampleValueSint32(lt_uint16 band, lt_int32 value)
sets the given sample to the given value
LT_STATUS checkImpedanceWithoutAlpha(const LTIPixel &pixel) const
void setSampleValueAddr(lt_uint16 band, const void *data) const
sets sample value by address
void setSampleValueUint16(lt_uint16 band, lt_uint16 value)
sets the given sample to the given value
LTIPixel(const LTISample *samples, lt_uint16 numBands, LTIColorSpace colorSpace=LTI_COLORSPACE_INVALID)
constructor
LTIPixel(const LTIPixel &pixel, const lt_uint16 *bandSelection, lt_uint16 numBands)
constructor
void setSampleValuesFloat32(float value)
sets all samples to the given value
lt_int8 getSampleValueSint8(lt_uint16 band) const
returns the specified sample's value
void setSampleValuesFloat32(const float values[])
sets all samples to the given values
float getSampleValueFloat32(lt_uint16 band) const
returns the specified sample's value
LTISample * getSamples() const
void setSampleValuesFloat64(const double values[])
sets all samples to the given values
void setSampleValuesUint16(lt_uint16 value)
sets all samples to the given value
void setSampleValueSint16(lt_uint16 band, lt_int16 value)
sets the given sample to the given value
void setSampleValuesToMax()
sets all samples to maximum
bool areSampleValuesMax() const
are all samples equal to the maximum value
lt_int16 getSampleValueSint16(lt_uint16 band) const
returns the specified sample's value
void setSampleValuesSint16(lt_int16 value)
sets all samples to the given value
void setSampleValuesUint16(const lt_uint16 values[])
sets all samples to the given values
void setSampleValueFloat32(lt_uint16 band, float value)
sets the given sample to the given value
void setSampleValueSint8(lt_uint16 band, lt_int8 value)
sets the given sample to the given value
LT_STATUS checkImpedance(const LTIPixel &pixel, bool enforceColorSpace=true) const
returns status code comparing two pixels
void setSampleValuesUint32(lt_uint32 value)
sets all samples to the given value
bool isSignedData() const
lt_uint32 getMaxBytesPerSample() const
returns the largest size of any sample
LTIColorSpace getColorSpace() const
get the colorspace
lt_uint32 getNumBytesWithoutAlpha() const
get the size of a pixel not counting the alpha band
void setSampleValuesUint8(const lt_uint8 values[])
sets all samples to the given values
LTIDataType getDataType() const
get the sample datatype
bool areSampleValuesMin() const
are all samples equal to the minimum value
LTIPixel(void)
constructor
void setNonAlphaSampleValuesFromPixel(const LTIPixel &src)
sets all samples to minimum
bool operator==(const LTIPixel &) const
equality operator
lt_uint8 getSampleValueUint8(lt_uint16 band) const
returns the specified sample's value
bool hasPreMultipliedAlphaBand() const
returns true if colorspace has the pre-multiplied alpha channel flag
LT_STATUS getBandSelection(lt_uint16 *&bandSelection) const
sets all samples to minimum
void setSampleValuesToMin()
sets all samples to minimum
LTIPixel(const LTIPixel &pixel, const lt_uint16 *bandSelection, lt_uint16 numBands, LTIColorSpace colorSpace)
constructor
void setSampleValuesSint8(lt_int8 value)
sets all samples to the given value
lt_uint32 getSampleValueUint32(lt_uint16 band) const
returns the specified sample's value
void setNonAlphaSampleValuesFromDouble(double value)
sets all samples to minimum
void setSampleValuesSint8(const lt_int8 values[])
sets all samples to the given values
void setSampleValuesFloat64(double value)
sets all samples to the given value
void setSampleValuesSint32(const lt_int32 values[])
sets all samples to the given values
bool isMultiSpectral() const
returns true if the pixel has multi-spectral bands
double getSampleValueFloat64(lt_uint16 band) const
returns the specified sample's value
void setSampleValueUint32(lt_uint16 band, lt_uint32 value)
sets the given sample to the given value
LTIPixel & operator=(const LTIPixel &)
assignment operator
void setSampleValuesFromDouble(double value)
sets all samples to the given value
LTIPixel(LTIColorSpace colorSpace, lt_uint16 numBands, LTIDataType dataType, const LTISample *samples=nullptr)
constructor
LTIColorSpace getColorSpaceWithoutAlpha() const
get the colorspace without alpha
void setSampleValueUint8(lt_uint16 band, lt_uint8 value)
sets the given sample to the given value
static LT_STATUS checkCompatible(const LTIPixel &dstPixelProps, const LTIPixel &srcPixelProps)
checks to ensure band mapping is valid
lt_uint32 getNumBytes() const
get the size of a pixel
const void * getSampleValueAddr(lt_uint16 band) const
returns the address of the specified sample's value
LTIPixel(const LTIPixel &)
copy constructor
lt_uint16 getNumBands() const
get the number of bands
void setSampleValuesUint8(lt_uint8 value)
sets all samples to the given value
LTISample & getSample(lt_uint16) const
lt_int32 getSampleValueSint32(lt_uint16 band) const
returns the specified sample's value
LT_STATUS overrideColorSpace(LTIColorSpace colorspace)
sets all samples to minimum
void setSampleValuesSint16(const lt_int16 values[])
sets all samples to the given values
basic properties of a sample
Definition: lti_sample.h:24

Extensis