HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_Raster Class Reference

#include <PXL_Raster.h>

+ Inheritance diagram for PXL_Raster:

Public Types

enum  Visualization {
  Visualization::NONE, Visualization::SDF, Visualization::RANDOMID, Visualization::IMAGECOORD,
  Visualization::HUENML, Visualization::HUEVEL
}
 

Public Member Functions

 PXL_Raster ()
 
 PXL_Raster (const PXL_Raster &)
 
 PXL_Raster (const PXL_Raster &, exint x1, exint y1, exint x2, exint y2)
 
 PXL_Raster (PXL_Packing p, PXL_DataFormat f, exint xres=0, exint yres=0, int clear=0, int alloc=1)
 
virtual ~PXL_Raster ()
 
virtual int64 getMemoryUsage (bool inclusive) const
 
PXL_Rasteroperator= (const PXL_Raster &)=delete
 Assignment disallowed, use copy() instead. More...
 
virtual void copy (const PXL_Raster &src)
 
virtual void copyProperties (const PXL_Raster &src)
 
void setPacking (PXL_Packing p)
 
void setFormat (PXL_DataFormat f)
 
void setRes (exint x, exint y)
 
void setBWPoints (float black, float white)
 
void setVisualization (Visualization vis)
 
Visualization getVisualization () const
 
void setColorSpace (PXL_ColorSpace space, fpreal custom_gamma=0.0)
 
void setOCIOColorSpace (const UT_StringHolder &space)
 
void setOCIODisplayView (const UT_StringHolder &baked_display, const UT_StringHolder &baked_view)
 
void setOCIOParms (const UT_StringHolder &color_space, const UT_StringHolder &baked_display, const UT_StringHolder &baked_view)
 
void init ()
 
void setRaster (void *r, bool give_ownership=true, bool use_offset=false)
 
voidsteal ()
 
int isValid () const
 
exint getXres () const
 
exint getYres () const
 
exint getNumPixels () const
 
int64 getStride () const
 
int64 getSize () const
 
PXL_DataFormat getFormat () const
 
PXL_Packing getPacking () const
 
void getBWPoints (float &black, float &white) const
 
int getNumChannels () const
 
void setRotation (int rotation)
 
int getRotation () const
 
bool isRotated () const
 
exint getCorrectedXres () const
 
exint getCorrectedYres () const
 
PXL_ColorSpace getColorSpace () const
 Colorspace this raster requires for correct display. More...
 
fpreal getColorSpaceGamma () const
 
const UT_StringHoldergetColorSpaceName () const
 OCIO colorspace name, valid for PXL_CS_OCIO. More...
 
const UT_StringHoldergetOCIODisplay () const
 
const UT_StringHoldergetOCIOView () const
 
void setDataWindow (const UT_DimRect &new_rect)
 
const UT_DimRectgetDataWindow () const
 
bool hasDataWindow () const
 
void getRange (float &min, float &max, float black=0.0f, float white=1.0f, exint comp=-1, bool ignore_farthest=false) const
 
voidgetPixels ()
 
const voidgetPixels () const
 
const voidgetRawPixels () const
 
voidgetPixel (exint x, exint y, exint comp=0)
 
const voidgetPixel (exint x, exint y, exint comp=0) const
 
void setPixelValue (exint x, exint y, const float *vals)
 
void setPixelValueI (exint x, exint y, exint val)
 
void getPixelValue (exint x, exint y, float *vals) const
 
bool isInterleaved () const
 
int areComponentsRenderable () const
 
int64 getNonInterleavedSize () const
 
void clear (const void *color=0)
 
void clearNormal (const float *color, unsigned ib=0, unsigned iw=0)
 
void readFromRow (exint y, void *data) const
 
void writeToRow (exint y, const void *data)
 
void writeToColumn (exint x, const void *data)
 
virtual void reset (int full=0)
 
void extract (const PXL_Raster &from, exint x1, exint y1, exint x2, exint y2)
 
void insert (const PXL_Raster &from, exint x, exint y)
 
void promoteRGBToRGBA (fpreal alpha=1.0)
 
bool promoteRGBToRGBA (UT_UniquePtr< PXL_Raster > &dest, fpreal alpha=1.0) const
 
void applyLUT (const PXL_Raster *src, float *lptr[4], exint comp, float lstart, float lend)
 
void streakEdges (exint x1, exint y1, exint x2, exint y2, PXL_StreakComponents streak_comps=PXL_STREAK_ALL)
 
void convert8Bit (unsigned b, unsigned w)
 
void adjustSaturation (float sat)
 
void flipVertical ()
 
bool load (UT_IStream &is)
 
int save (std::ostream &os, int binary=1) const
 
int getProxyIndex () const
 
void setDataWritten (bool written=true)
 
bool getDataWritten () const
 
void setTextureID (void *id)
 
voidgetTextureID () const
 
void clearTextureID ()
 
void setManagesOwnTextureID (bool manages_own)
 
bool managesOwnTextureID () const
 
void dither (const UT_DimRect &crop)
 
void dither ()
 
bool premultiply (const PXL_Raster *other=nullptr)
 
bool unpremultiply (const PXL_Raster *other=nullptr)
 
bool hasAlpha () const
 
bool clampAlpha ()
 
void addInterest (void *callerData, void(*changeCB)(PXL_Raster *, void *))
 
void removeInterest ()
 

Protected Member Functions

virtual void initialize ()
 
bool allocRaster (int alloc_mem=1)
 
void freeRaster ()
 
void applyLUT8 (const PXL_Raster *src, float *lptr[4], exint comp, float lscale, float lshift, exint size)
 
void applyLUT16 (const PXL_Raster *src, float *lptr[4], exint comp, float lscale, float lshift, exint size)
 
virtual void attemptRealloc (int64 size)
 

Protected Attributes

PXL_DataFormat myFormat
 
PXL_Packing myPacking
 
PXL_ColorSpace myColorSpace
 
fpreal myColorSpaceGamma
 
Visualization myVis
 
UT_StringHolder myColorSpaceName
 
UT_StringHolder myOCIODisplay
 
UT_StringHolder myOCIOView
 
exint myRasterOffset
 
exint myXres
 
exint myYres
 
int64 myStride
 
int64 myRasterSize
 
float myBlack
 
float myWhite
 
int myRotation
 
voidmyRaster
 
bool myAmOwner
 
int myProxyIndex
 
bool myWriteFlag
 
bool myManagesOwnTextureID
 
voidmyTextureID
 
void(* myChangeCB )(PXL_Raster *, void *)
 
voidmyCallerData
 
UT_DimRect myDataWindow
 

Additional Inherited Members

- Static Public Member Functions inherited from UT_SmallObject< PXL_Raster, UT_SMALLOBJECT_CLEANPAGES_OFF, 250, UT_SMALLOBJECT_THREADSAFE_ON >
static voidoperator new (size_t size)
 Regular new/delete operators. More...
 
static void operator delete (void *p, size_t size)
 Regular new/delete operators. More...
 
static voidoperator new (size_t, void *p)
 
static void operator delete (void *, void *)
 

Detailed Description

Examples:
IMG/TIL_NullFilter.C, and IMG/TIL_NullFilter.h.

Definition at line 36 of file PXL_Raster.h.

Member Enumeration Documentation

Enumerator
NONE 
SDF 
RANDOMID 
IMAGECOORD 
HUENML 
HUEVEL 

Definition at line 53 of file PXL_Raster.h.

Constructor & Destructor Documentation

PXL_Raster::PXL_Raster ( )
PXL_Raster::PXL_Raster ( const PXL_Raster )
PXL_Raster::PXL_Raster ( const PXL_Raster ,
exint  x1,
exint  y1,
exint  x2,
exint  y2 
)
PXL_Raster::PXL_Raster ( PXL_Packing  p,
PXL_DataFormat  f,
exint  xres = 0,
exint  yres = 0,
int  clear = 0,
int  alloc = 1 
)
virtual PXL_Raster::~PXL_Raster ( )
virtual

Member Function Documentation

void PXL_Raster::addInterest ( void callerData,
void(*)(PXL_Raster *, void *)  changeCB 
)
void PXL_Raster::adjustSaturation ( float  sat)
bool PXL_Raster::allocRaster ( int  alloc_mem = 1)
protected
void PXL_Raster::applyLUT ( const PXL_Raster src,
float lptr[4],
exint  comp,
float  lstart,
float  lend 
)
void PXL_Raster::applyLUT16 ( const PXL_Raster src,
float lptr[4],
exint  comp,
float  lscale,
float  lshift,
exint  size 
)
protected
void PXL_Raster::applyLUT8 ( const PXL_Raster src,
float lptr[4],
exint  comp,
float  lscale,
float  lshift,
exint  size 
)
protected
int PXL_Raster::areComponentsRenderable ( ) const
virtual void PXL_Raster::attemptRealloc ( int64  size)
protectedvirtual

Reimplemented in TIL_Raster.

bool PXL_Raster::clampAlpha ( )
void PXL_Raster::clear ( const void color = 0)
void PXL_Raster::clearNormal ( const float color,
unsigned  ib = 0,
unsigned  iw = 0 
)
void PXL_Raster::clearTextureID ( )
void PXL_Raster::convert8Bit ( unsigned  b,
unsigned  w 
)
virtual void PXL_Raster::copy ( const PXL_Raster src)
virtual

Copy over all the information and data from the src. This allocates a new raster (rather than doing a shallow copy).

Reimplemented in TIL_Raster.

virtual void PXL_Raster::copyProperties ( const PXL_Raster src)
virtual

copies only the raster properties (res, type, etc), not the data, nor does this method allocate memory for a raster.

Reimplemented in TIL_Raster.

void PXL_Raster::dither ( const UT_DimRect crop)
void PXL_Raster::dither ( )
void PXL_Raster::extract ( const PXL_Raster from,
exint  x1,
exint  y1,
exint  x2,
exint  y2 
)
void PXL_Raster::flipVertical ( )
void PXL_Raster::freeRaster ( )
protected
void PXL_Raster::getBWPoints ( float black,
float white 
) const
PXL_ColorSpace PXL_Raster::getColorSpace ( ) const
inline

Colorspace this raster requires for correct display.

Definition at line 135 of file PXL_Raster.h.

fpreal PXL_Raster::getColorSpaceGamma ( ) const
inline

Gamma that must be applied to this raster to get accurate color. Only valid for PXL_CS_LINEAR, PXL_CS_GAMMA2_2, and PXL_CS_CUSTOM_GAMMA.

Definition at line 139 of file PXL_Raster.h.

const UT_StringHolder& PXL_Raster::getColorSpaceName ( ) const
inline

OCIO colorspace name, valid for PXL_CS_OCIO.

Definition at line 141 of file PXL_Raster.h.

exint PXL_Raster::getCorrectedXres ( ) const
exint PXL_Raster::getCorrectedYres ( ) const
const UT_DimRect& PXL_Raster::getDataWindow ( ) const
inline

Definition at line 147 of file PXL_Raster.h.

bool PXL_Raster::getDataWritten ( ) const
inline

Definition at line 253 of file PXL_Raster.h.

PXL_DataFormat PXL_Raster::getFormat ( ) const
inline
Examples:
IMG/TIL_NullFilter.C.

Definition at line 119 of file PXL_Raster.h.

virtual int64 PXL_Raster::getMemoryUsage ( bool  inclusive) const
virtual

Reimplemented in TIL_Raster.

int64 PXL_Raster::getNonInterleavedSize ( ) const
int PXL_Raster::getNumChannels ( ) const
inline

Definition at line 122 of file PXL_Raster.h.

exint PXL_Raster::getNumPixels ( ) const
inline

Definition at line 116 of file PXL_Raster.h.

const UT_StringHolder& PXL_Raster::getOCIODisplay ( ) const
inline

Definition at line 142 of file PXL_Raster.h.

const UT_StringHolder& PXL_Raster::getOCIOView ( ) const
inline

Definition at line 143 of file PXL_Raster.h.

PXL_Packing PXL_Raster::getPacking ( ) const
inline
Examples:
IMG/TIL_NullFilter.C.

Definition at line 120 of file PXL_Raster.h.

void* PXL_Raster::getPixel ( exint  x,
exint  y,
exint  comp = 0 
)
const void* PXL_Raster::getPixel ( exint  x,
exint  y,
exint  comp = 0 
) const
void* PXL_Raster::getPixels ( )
inline
Examples:
SOP/SOP_CopRaster.C.

Definition at line 162 of file PXL_Raster.h.

const void* PXL_Raster::getPixels ( ) const
inline

Definition at line 165 of file PXL_Raster.h.

void PXL_Raster::getPixelValue ( exint  x,
exint  y,
float vals 
) const
int PXL_Raster::getProxyIndex ( ) const
inline

Definition at line 249 of file PXL_Raster.h.

void PXL_Raster::getRange ( float min,
float max,
float  black = 0.0f,
float  white = 1.0f,
exint  comp = -1,
bool  ignore_farthest = false 
) const
const void* PXL_Raster::getRawPixels ( ) const
inline

Definition at line 169 of file PXL_Raster.h.

int PXL_Raster::getRotation ( ) const
inline

Definition at line 127 of file PXL_Raster.h.

int64 PXL_Raster::getSize ( ) const
inline
Examples:
SOP/SOP_CopRaster.C.

Definition at line 118 of file PXL_Raster.h.

int64 PXL_Raster::getStride ( ) const
inline

Definition at line 117 of file PXL_Raster.h.

void* PXL_Raster::getTextureID ( ) const
Visualization PXL_Raster::getVisualization ( ) const
inline

Definition at line 86 of file PXL_Raster.h.

exint PXL_Raster::getXres ( ) const
inline
Examples:
IMG/TIL_NullFilter.C, and SOP/SOP_CopRaster.C.

Definition at line 114 of file PXL_Raster.h.

exint PXL_Raster::getYres ( ) const
inline
Examples:
IMG/TIL_NullFilter.C, and SOP/SOP_CopRaster.C.

Definition at line 115 of file PXL_Raster.h.

bool PXL_Raster::hasAlpha ( ) const
bool PXL_Raster::hasDataWindow ( ) const
inline

Definition at line 149 of file PXL_Raster.h.

void PXL_Raster::init ( )
virtual void PXL_Raster::initialize ( )
protectedvirtual

Reimplemented in TIL_Raster.

void PXL_Raster::insert ( const PXL_Raster from,
exint  x,
exint  y 
)
bool PXL_Raster::isInterleaved ( ) const
bool PXL_Raster::isRotated ( ) const
inline

Definition at line 128 of file PXL_Raster.h.

int PXL_Raster::isValid ( ) const
inline

Definition at line 112 of file PXL_Raster.h.

bool PXL_Raster::load ( UT_IStream is)
bool PXL_Raster::managesOwnTextureID ( ) const
inline

Definition at line 260 of file PXL_Raster.h.

PXL_Raster& PXL_Raster::operator= ( const PXL_Raster )
delete

Assignment disallowed, use copy() instead.

See Also
copyProperties()
bool PXL_Raster::premultiply ( const PXL_Raster other = nullptr)
void PXL_Raster::promoteRGBToRGBA ( fpreal  alpha = 1.0)
bool PXL_Raster::promoteRGBToRGBA ( UT_UniquePtr< PXL_Raster > &  dest,
fpreal  alpha = 1.0 
) const
void PXL_Raster::readFromRow ( exint  y,
void data 
) const
void PXL_Raster::removeInterest ( )
virtual void PXL_Raster::reset ( int  full = 0)
virtual

Reimplemented in TIL_Raster.

int PXL_Raster::save ( std::ostream &  os,
int  binary = 1 
) const
void PXL_Raster::setBWPoints ( float  black,
float  white 
)
void PXL_Raster::setColorSpace ( PXL_ColorSpace  space,
fpreal  custom_gamma = 0.0 
)

Colorspace that this raster is in. Changing the color space does not affect the image values stored in this raster, only how they are interpreted. custom_gamma must be specified for PXL_CS_CUSTOM_GAMMA.

void PXL_Raster::setDataWindow ( const UT_DimRect new_rect)
void PXL_Raster::setDataWritten ( bool  written = true)
inline

Definition at line 251 of file PXL_Raster.h.

void PXL_Raster::setFormat ( PXL_DataFormat  f)
void PXL_Raster::setManagesOwnTextureID ( bool  manages_own)
inline

Definition at line 258 of file PXL_Raster.h.

void PXL_Raster::setOCIOColorSpace ( const UT_StringHolder space)
void PXL_Raster::setOCIODisplayView ( const UT_StringHolder baked_display,
const UT_StringHolder baked_view 
)
void PXL_Raster::setOCIOParms ( const UT_StringHolder color_space,
const UT_StringHolder baked_display,
const UT_StringHolder baked_view 
)
void PXL_Raster::setPacking ( PXL_Packing  p)
void PXL_Raster::setPixelValue ( exint  x,
exint  y,
const float vals 
)
void PXL_Raster::setPixelValueI ( exint  x,
exint  y,
exint  val 
)
void PXL_Raster::setRaster ( void r,
bool  give_ownership = true,
bool  use_offset = false 
)
void PXL_Raster::setRes ( exint  x,
exint  y 
)
void PXL_Raster::setRotation ( int  rotation)
void PXL_Raster::setTextureID ( void id)
inline

Definition at line 255 of file PXL_Raster.h.

void PXL_Raster::setVisualization ( Visualization  vis)
inline

Visualization of the raster, which does not affect the raster but is hint for how to display it.

Definition at line 85 of file PXL_Raster.h.

void* PXL_Raster::steal ( )
void PXL_Raster::streakEdges ( exint  x1,
exint  y1,
exint  x2,
exint  y2,
PXL_StreakComponents  streak_comps = PXL_STREAK_ALL 
)
bool PXL_Raster::unpremultiply ( const PXL_Raster other = nullptr)
void PXL_Raster::writeToColumn ( exint  x,
const void data 
)
void PXL_Raster::writeToRow ( exint  y,
const void data 
)

Member Data Documentation

bool PXL_Raster::myAmOwner
protected

Definition at line 309 of file PXL_Raster.h.

float PXL_Raster::myBlack
protected

Definition at line 306 of file PXL_Raster.h.

void* PXL_Raster::myCallerData
protected

Definition at line 315 of file PXL_Raster.h.

void(* PXL_Raster::myChangeCB)(PXL_Raster *, void *)
protected

Definition at line 314 of file PXL_Raster.h.

PXL_ColorSpace PXL_Raster::myColorSpace
protected

Definition at line 296 of file PXL_Raster.h.

fpreal PXL_Raster::myColorSpaceGamma
protected

Definition at line 297 of file PXL_Raster.h.

UT_StringHolder PXL_Raster::myColorSpaceName
protected

Definition at line 299 of file PXL_Raster.h.

UT_DimRect PXL_Raster::myDataWindow
protected

Definition at line 317 of file PXL_Raster.h.

PXL_DataFormat PXL_Raster::myFormat
protected

Definition at line 294 of file PXL_Raster.h.

bool PXL_Raster::myManagesOwnTextureID
protected

Definition at line 312 of file PXL_Raster.h.

UT_StringHolder PXL_Raster::myOCIODisplay
protected

Definition at line 300 of file PXL_Raster.h.

UT_StringHolder PXL_Raster::myOCIOView
protected

Definition at line 301 of file PXL_Raster.h.

PXL_Packing PXL_Raster::myPacking
protected

Definition at line 295 of file PXL_Raster.h.

int PXL_Raster::myProxyIndex
protected

Definition at line 310 of file PXL_Raster.h.

void* PXL_Raster::myRaster
protected

Definition at line 308 of file PXL_Raster.h.

exint PXL_Raster::myRasterOffset
protected

Definition at line 302 of file PXL_Raster.h.

int64 PXL_Raster::myRasterSize
protected

Definition at line 305 of file PXL_Raster.h.

int PXL_Raster::myRotation
protected

Definition at line 307 of file PXL_Raster.h.

int64 PXL_Raster::myStride
protected

Definition at line 304 of file PXL_Raster.h.

void* PXL_Raster::myTextureID
protected

Definition at line 313 of file PXL_Raster.h.

Visualization PXL_Raster::myVis
protected

Definition at line 298 of file PXL_Raster.h.

float PXL_Raster::myWhite
protected

Definition at line 306 of file PXL_Raster.h.

bool PXL_Raster::myWriteFlag
protected

Definition at line 311 of file PXL_Raster.h.

exint PXL_Raster::myXres
protected

Definition at line 303 of file PXL_Raster.h.

exint PXL_Raster::myYres
protected

Definition at line 303 of file PXL_Raster.h.


The documentation for this class was generated from the following file: