49 virtual bool isValid()
const = 0;
51 virtual size_t getMemoryUsage(
bool inclusive)
const = 0;
73 virtual int64 getMemoryUsage(
bool inclusive)
const;
93 void setBWPoints(
float black,
float white);
104 fpreal custom_gamma = 0.0);
112 void init(
bool do_alloc =
true);
116 void setRaster(
void *
r,
bool give_ownership =
true,
117 bool use_offset =
false);
126 void fetchIfNeeded()
const;
130 return (myRaster || (myRasterFetcher && myRasterFetcher->isValid())) ? 1 : 0;
140 void getBWPoints(
float &black,
float &white)
const;
150 exint getCorrectedXres()
const;
151 exint getCorrectedYres()
const;
165 void setDataWindow(
const UT_DimRect &new_rect);
167 {
return myDataWindow; }
169 {
return !myDataWindow.isEmpty(); }
175 void getRange(
float &
min,
float &
max,
176 float black = 0.0f,
float white = 1.0f,
178 bool ignore_farthest =
false)
const;
181 void *
getPixels() { fetchIfNeeded();
return (
unsigned char *)myRaster+myRasterOffset; }
183 const void *
getPixels()
const { fetchIfNeeded();
return (
unsigned char *)myRaster+myRasterOffset; }
186 const void *
getRawPixels(
bool fetch =
true)
const {
if (fetch) fetchIfNeeded();
return myRaster; }
192 void setPixelValue(
exint x,
exint y,
const float *vals);
194 void getPixelValue(
exint x,
exint y,
float *vals)
const;
197 bool isInterleaved()
const;
200 int areComponentsRenderable()
const;
203 int64 getNonInterleavedSize()
const;
210 void clear(
const void *
color = 0);
211 void clearNormal(
const float *
color,
227 void writeToColumn(
exint x,
const void *
data);
231 virtual void reset(
int full = 0);
250 exint comp,
float lstart,
float lend);
255 void convert8Bit(
unsigned b,
unsigned w);
256 void convert16Bit(
unsigned b,
unsigned w);
257 void convert32Bit(
unsigned b,
unsigned w);
259 void adjustSaturation(
float sat);
265 int save(std::ostream &os,
int binary = 1)
const;
270 { myWriteFlag = written; }
274 void *getTextureID()
const;
275 void clearTextureID();
277 { myManagesOwnTextureID = manages_own; }
279 {
return myManagesOwnTextureID; }
287 bool premultiply(
const PXL_Raster *other =
nullptr);
288 bool unpremultiply(
const PXL_Raster *other =
nullptr);
290 bool hasAlpha()
const;
294 void addInterest(
void *callerData,
296 void removeInterest();
299 { myRasterFetcher = extra; }
302 {
return myRasterFetcher; }
304 bool allocRaster(
bool alloc_mem =
true);
311 exint comp,
float lscale,
float lshift,
314 exint comp,
float lscale,
float lshift,
350 template<
typename T,
int NCOMPONENTS,
bool INTERLEAVED,
bool READ_ONLY>
413 offset = x*
sizeof(
T) + y * stride;
414 else if (INTERLEAVED)
415 offset = (comp+x*NCOMPONENTS)*
sizeof(
T) + y *
stride;
417 offset = x *
sizeof(
T) + (y + comp*yres) *
stride;
428 offset = x*
sizeof(
T) + y * stride;
429 else if (INTERLEAVED)
430 offset = (x*NCOMPONENTS)*
sizeof(
T) + y *
stride;
432 offset = x *
sizeof(
T) + (y ) *
stride;
440 if (INTERLEAVED || NCOMPONENTS==1)
442 for (
int i = 0; i < NCOMPONENTS; ++i)
447 vals[i] =
float(data[i]);
453 for (
int i = 0; i < NCOMPONENTS; ++i,
454 data = (
const DataType *)(((
const unsigned char *)data) + yres_stride))
459 vals[i] =
float(*data);
469 if (INTERLEAVED || NCOMPONENTS==1)
471 for (
int i = 0; i < NCOMPONENTS; ++i)
477 for (
int i = 0; i < NCOMPONENTS; ++i,
498 if (INTERLEAVED || NCOMPONENTS==1)
500 for (
int i = 0; i < NCOMPONENTS; ++i)
506 for (
int i = 0; i < NCOMPONENTS; ++i,
SYS_FORCE_INLINE DataType * getPixelFast(void *pixels, exint x, exint y) const
SYS_FORCE_INLINE void getPixelValueFast(const void *pixels, exint x, exint y, float *vals) const
void setRasterFetcher(UT_SharedPtr< PXL_RasterFetcher > extra)
int PXLpackingComponents(PXL_Packing p)
UT_ASSERT_COMPILETIME(BRAY_EVENT_MAXFLAGS<=32)
SYS_FORCE_INLINE exint getYres() const
const UT_SharedPtr< PXL_RasterFetcher > & getRasterFetcher() const
bool_constant< is_integral< T >::value &&!std::is_same< T, bool >::value &&!std::is_same< T, char >::value &&!std::is_same< T, wchar_t >::value > is_integer
bool myManagesOwnTextureID
int getNumChannels() const
void setTextureID(void *id)
const GLuint GLenum const void * binary
UT_StringHolder myColorSpaceName
PXL_ColorSpace getColorSpace() const
Colorspace this raster requires for correct display.
fpreal getColorSpaceGamma() const
const UT_StringHolder & getOCIODisplay() const
const UT_StringHolder & getOCIOView() const
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
OIIO_FORCEINLINE vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
bool getDataWritten() const
SYS_FORCE_INLINE PXL_RasterWrapper< T, NCOMPONENTS, INTERLEAVED, true > makeConstant() const
PXL_DataFormat getFormat() const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
#define UT_ASSERT_MSG(ZZ,...)
OIIO_FORCEINLINE bool extract(const vbool4 &a)
PXL_Visualization Visualization
SYS_FORCE_INLINE exint getXres() const
PXL_ColorSpace myColorSpace
PXL_Packing getPacking() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
exint getNumPixels() const
SYS_FORCE_INLINE void setRaster(RasterType *raster)
GLint GLenum GLboolean GLsizei stride
SYS_ConstType< T, READ_ONLY >::type DataType
bool isInterleaved() const
HUSD_API const char * raster()
UT_StringHolder myOCIOView
bool managesOwnTextureID() const
GLfloat GLfloat GLfloat alpha
SIM_API const UT_StringHolder rotation
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
bool hasDataWindow() const
static SYS_FORCE_INLINE T convertFromFloat(const float val)
GLboolean GLboolean GLboolean b
const UT_DimRect & getDataWindow() const
const void * getPixels() const
SYS_FORCE_INLINE RasterType * getRaster() const
const UT_StringHolder & getColorSpaceName() const
OCIO colorspace name, valid for PXL_CS_OCIO.
std::integral_constant< bool, std::numeric_limits< T >::is_signed||std::is_same< T, int128_opt >::value > is_signed
IMATH_NAMESPACE::V2f IMATH_NAMESPACE::Box2i std::string this attribute is obsolete as of OpenEXR v3 float
Visualization getVisualization() const
const void * getRawPixels(bool fetch=true) const
LeafData & operator=(const LeafData &)=delete
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int PXLformatDepth(PXL_DataFormat d)
void setVisualization(Visualization vis)
GLubyte GLubyte GLubyte GLubyte w
int getProxyIndex() const
void setDataWritten(bool written=true)
GLdouble GLdouble GLdouble y2
void setManagesOwnTextureID(bool manages_own)
ImageBuf OIIO_API crop(const ImageBuf &src, ROI roi={}, int nthreads=0)
SYS_ConstType< PXL_Raster, READ_ONLY >::type RasterType
SYS_FORCE_INLINE void zeroPixelValueFast(void *pixels, exint x, exint y) const
DataType * getPixel(exint x, exint y, exint comp=0) const
SYS_FORCE_INLINE PXL_RasterWrapper(RasterType *raster=nullptr)
UT_StringHolder myOCIODisplay
SYS_FORCE_INLINE void setPixelValueFast(void *pixels, exint x, exint y, const T *vals) const
UT_SharedPtr< PXL_RasterFetcher > myRasterFetcher