44 class img_ScanProgress;
60 virtual int64 getMemoryUsage(
bool inclusive)
const;
94 bool streamIsSeekable =
true);
104 static IMG_File *create(
const char *filename,
122 static IMG_File *create(std::ostream &os,
126 int steal_stream = 0,
127 bool streamIsSeekable =
true);
133 static bool saveRasterAsFile(
const char *filename,
136 static bool saveRasterAsFile(
const char *filename,
146 static bool saveRastersAsFiles(
const char *filename,
154 static bool copyToFile(
const char *sourcename,
155 const char *destname,
158 static bool copyToFileFormat(
const char *sourcename,
159 const char *formatname,
168 static bool copyToStream(
const char *sourcename,
169 std::ostream &deststream,
173 virtual const char *
className()
const {
return "IMG_File"; }
181 int getReadMode()
const;
206 virtual void getAdditionalInfo(
UT_String &text);
211 const char *getOption(
const char *
name)
const;
215 int getNumOptions()
const;
216 const char *getOptionName(
int i)
const;
217 const char *getOptionValue(
int i)
const;
223 const void *
read(
int scan,
const IMG_Plane *from_plane =
nullptr);
229 bool readIntoBuffer(
int scan,
void *
buffer,
244 void * allocScanlineBuffer()
const;
252 bool readImage(
void *
data,
int flip=0,
int scaninc=0);
254 bool writeImage(
void *
data,
int flip=0,
int scaninc=0);
263 const char *scope =
nullptr);
274 bool freerasters =
false);
281 virtual bool jumpToFrame(
int frame);
285 virtual void abortWrite();
293 virtual int isTopFirst()
const;
295 virtual int isLeftFirst()
const;
300 virtual void randomReadAccessRequired();
302 bool randomReadsForced()
const
303 {
return myForceRandomReads; }
327 virtual void checkpoint();
343 bool *denormalize_flag =
nullptr);
350 static int doErrors(
int newDoErrors );
351 static void imgError(
int code,
const char *msg =
nullptr );
352 static void imgWarning(
int code,
const char *msg =
nullptr );
355 {
return getBaseFile() ? (getBaseFile()->hasError() ||
356 myErrorFlag) :myErrorFlag; }
365 const IMG_File *getUnfilteredFile()
const;
370 bool clear_existing);
382 virtual
void clearImageTextureOptions();
386 virtual
bool setImageTextureOptions(const
UT_Options &options);
391 virtual
void setWriteTag(const
char *tagname,
393 const
char *const *
values);
408 bool getCameraToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
417 bool getWorldToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
428 virtual
int getDeepPixelSamples(
int x,
int y);
436 virtual
bool getDeepPixelPlaneData(
int x,
int y,
447 virtual
bool getDeepPixelData(
int x,
int y,
float * const *data);
450 virtual
bool readDeepPixelData(
int x,
int y,
461 virtual
bool writeDeepPixelData(
int x,
int y,
471 void selectPlanesToRead();
472 bool isPlaneSelected(const
IMG_Plane &plane) const;
483 virtual
int openPostMagic();
484 virtual
int openFile(const
char *filename);
486 virtual
int readScanline(
int scanline,
void *data) = 0;
487 virtual const
void *readPlaneScanline(
int y, const
IMG_Plane &
pi);
490 virtual
int createFile(const
char *filename,const
IMG_Stat &stat);
491 virtual
int create(const
IMG_Stat &stat);
493 virtual
int writeScanline(
int scanline, const
void *data) = 0;
494 virtual
int writePlaneScanline(const
void *data,
int y,
497 virtual
int closeFile() = 0;
501 virtual
void postCloseAction();
506 virtual
bool isPassThrough()
const {
return false; }
513 virtual void computeCommonData();
515 void *getScanlineBuffer(
int y);
518 virtual void finishedScanline(
int scan);
526 int setOption(
const char *token,
const char *
value);
528 int setOption(
const char *token,
int64 val);
530 {
return setOption(option, (
int64)value); }
533 bool canWriteStatWithoutConversion()
const;
547 int writeSomeBytes(
const void *
buffer,
int size);
551 {
return readSomeBytes(buffer, size) ==
size; }
553 {
return writeSomeBytes(buffer, size) ==
size; }
565 int64 tellCurrentPosition();
568 void copyInputToStream(std::ostream &os);
585 unsigned myCreateIStream:1,
587 myForceRandomReads:1,
591 myContinueOnErrorFlag:1;
594 class img_ScanProgress
602 int64 getMemoryUsage(
bool inclusive)
const;
603 void processed(
int scan,
const IMG_Plane *plane);
604 void processAll(
int scan);
605 bool isComplete(
int scan,
const IMG_Plane *plane)
const;
606 bool isComplete(
int scan)
const;
607 int remaining(
int scan)
const;
608 int numScans()
const {
return myCounts.entries(); }
610 int bitIndex(
int scan,
int plane)
const;
619 void initializeTags();
620 void makeScanlineBuffers();
621 void deallocScanlineBuffer(
int scan);
622 const void *returnErrorScan(
int scan,
const IMG_Plane &
pi);
632 void *myScanlineBuffer;
633 int myCurrentImageScanline;
635 img_ScanProgress myScanProgress;
647 friend class IMG_GZip;
648 friend class IMG_FileBuffer;
649 friend class MV_ReadPRISMS;
const IMG_Format * getFormat() const
GT_API const UT_StringHolder filename
int setOption(const char *option, int value)
#define SYS_DEPRECATED(__V__)
GLuint const GLchar * name
bool writeBytes(const void *buffer, int size)
IMG_ImageType
Type of image we want to create or have opened.
GLuint const GLfloat * val
GLint GLsizei const GLuint64 * values
virtual IMG_File * getBaseFile() const
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Describes the format and layout of a single plane in an image The plane specifies the format and name...
void read(T &in, bool &v)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
virtual const char * className() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
GLint GLenum GLsizei GLint GLsizei const void * data
UT_IStream * getUTIStream()
void setIStream(UT_IStream *is)
Generic interface for reading and writing image files. This class handles the reading and writing of ...
A map of string to various well defined value types.
Base Integer Rectangle class.
ImageBuf OIIO_API flip(const ImageBuf &src, ROI roi={}, int nthreads=0)
bool readBytes(void *buffer, int size)
void setFormat(const IMG_Format *f)
File options for manipulating image data on load or save. This class allows you to modify the incomin...
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Parameters for the saveRaster[s]AsFile[s]() methods of IMG_File.
void write(T &out, bool v)
virtual IMG_FileAlphaInfo getAlphaInfo(float &) const
GLsizei const GLfloat * value