50 virtual bool isValid()
const = 0;
52 virtual size_t getMemoryUsage(
bool inclusive)
const = 0;
64 UT_SMALLOBJECT_CLEANPAGES_OFF, 250,
65 UT_SMALLOBJECT_THREADSAFE_ON>
78 virtual int64 getMemoryUsage(
bool inclusive)
const;
98 void setBWPoints(
float black,
float white);
109 fpreal custom_gamma = 0.0);
117 void init(
bool do_alloc =
true);
121 void setRaster(
void *
r,
bool give_ownership =
true,
122 bool use_offset =
false);
131 void fetchIfNeeded()
const;
135 return (myRaster || (myRasterFetcher && myRasterFetcher->isValid())) ? 1 : 0;
145 void getBWPoints(
float &black,
float &white)
const;
155 exint getCorrectedXres()
const;
156 exint getCorrectedYres()
const;
170 void setDataWindow(
const UT_DimRect &new_rect);
172 {
return myDataWindow; }
174 {
return !myDataWindow.isEmpty(); }
180 void getRange(
float &
min,
float &
max,
181 float black = 0.0f,
float white = 1.0f,
183 bool ignore_farthest =
false)
const;
186 void *
getPixels() { fetchIfNeeded();
return (
unsigned char *)myRaster+myRasterOffset; }
188 const void *
getPixels()
const { fetchIfNeeded();
return (
unsigned char *)myRaster+myRasterOffset; }
191 const void *
getRawPixels(
bool fetch =
true)
const {
if (fetch) fetchIfNeeded();
return myRaster; }
197 void setPixelValue(
exint x,
exint y,
const float *vals);
199 void getPixelValue(
exint x,
exint y,
float *vals)
const;
202 bool isInterleaved()
const;
205 int areComponentsRenderable()
const;
208 int64 getNonInterleavedSize()
const;
215 void clear(
const void *
color = 0);
216 void clearNormal(
const float *
color,
232 void writeToColumn(
exint x,
const void *
data);
236 virtual void reset(
int full = 0);
255 exint comp,
float lstart,
float lend);
260 void convert8Bit(
unsigned b,
unsigned w);
262 void adjustSaturation(
float sat);
268 int save(std::ostream &os,
int binary = 1)
const;
273 { myWriteFlag = written; }
277 void *getTextureID()
const;
278 void clearTextureID();
280 { myManagesOwnTextureID = manages_own; }
282 {
return myManagesOwnTextureID; }
290 bool premultiply(
const PXL_Raster *other =
nullptr);
291 bool unpremultiply(
const PXL_Raster *other =
nullptr);
293 bool hasAlpha()
const;
297 void addInterest(
void *callerData,
299 void removeInterest();
302 { myRasterFetcher = extra; }
305 {
return myRasterFetcher; }
307 bool allocRaster(
bool alloc_mem =
true);
314 exint comp,
float lscale,
float lshift,
317 exint comp,
float lscale,
float lshift,
353 template<
typename T,
int NCOMPONENTS,
bool INTERLEAVED,
bool READ_ONLY>
416 offset = x*
sizeof(
T) + y * stride;
417 else if (INTERLEAVED)
418 offset = (comp+x*NCOMPONENTS)*
sizeof(
T) + y *
stride;
420 offset = x *
sizeof(
T) + (y + comp*yres) *
stride;
431 offset = x*
sizeof(
T) + y * stride;
432 else if (INTERLEAVED)
433 offset = (x*NCOMPONENTS)*
sizeof(
T) + y *
stride;
435 offset = x *
sizeof(
T) + (y ) *
stride;
443 if (INTERLEAVED || NCOMPONENTS==1)
445 for (
int i = 0; i < NCOMPONENTS; ++i)
450 vals[i] =
float(data[i]);
456 for (
int i = 0; i < NCOMPONENTS; ++i,
457 data = (
const DataType *)(((
const unsigned char *)data) + yres_stride))
462 vals[i] =
float(*data);
472 if (INTERLEAVED || NCOMPONENTS==1)
474 for (
int i = 0; i < NCOMPONENTS; ++i)
480 for (
int i = 0; i < NCOMPONENTS; ++i,
501 if (INTERLEAVED || NCOMPONENTS==1)
503 for (
int i = 0; i < NCOMPONENTS; ++i)
509 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)
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
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