46 template <
typename T>
class UT_Array;
70 virtual int64 getMemoryUsage(
bool inclusive)
const;
115 int steal_stream = 0,
116 bool streamIsSeekable =
true);
148 int steal_stream = 0,
149 bool streamIsSeekable =
true);
155 static bool saveRasterAsFile(
const char *filename,
158 static bool saveRasterAsFile(
const char *filename,
168 static bool saveRastersAsFiles(
const char *filename,
176 static bool copyToFile(
const char *sourcename,
177 const char *destname,
180 static bool copyToFileFormat(
const char *sourcename,
181 const char *formatname,
190 static bool copyToStream(
const char *sourcename,
191 std::ostream &deststream,
214 static const char *getAutoTextureSaveFileExtention();
216 virtual const char *className()
const {
return "IMG_File"; }
224 int getReadMode()
const;
234 const IMG_Format *getFormat()
const {
return myFormat; }
245 const IMG_Stat &unfilteredStat()
const
246 {
return getUnfilteredFile()->myStat; }
252 virtual void getAdditionalInfo(
UT_String &text);
272 const IMG_Metadata &metadata()
const {
return unfilteredStat().metadata(); }
277 {
return metadata().
begin(); }
279 {
return metadata().end(); }
286 return unfilteredStat().findMetadata(name, value);
291 bool importMetadata(
const UT_StringRef &name,
bool &value)
const
292 {
return unfilteredStat().importMetadata(name, value); }
294 {
return unfilteredStat().importMetadata(name, value); }
296 {
return unfilteredStat().importMetadata(name, value); }
298 {
return unfilteredStat().importMetadata(name, value); }
300 {
return unfilteredStat().importMetadata(name, value); }
302 {
return unfilteredStat().importMetadata(name, value); }
304 {
return unfilteredStat().importMetadata(name, m); }
306 {
return unfilteredStat().importMetadata(name, m); }
315 bool pretty_print =
true)
const
317 return unfilteredStat().metadataAsString(name, value, pretty_print);
323 const void *read(
int scan,
const IMG_Plane *from_plane =
nullptr);
329 bool readIntoBuffer(
int scan,
void *
buffer,
338 bool write(
int scan,
const void *
data,
344 void * allocScanlineBuffer()
const;
347 exint getScanlineBufferSizeB()
const;
355 bool readImage(
void *data,
int flip=0,
int scaninc=0);
357 bool writeImage(
void *data,
int flip=0,
int scaninc=0);
370 const char *scope =
nullptr);
381 bool freerasters =
false);
388 virtual bool jumpToFrame(
int frame);
392 virtual void abortWrite();
400 virtual int isTopFirst()
const;
402 virtual int isLeftFirst()
const;
407 virtual void randomReadAccessRequired();
411 bool randomReadsForced()
const {
return myForceRandomReads; }
436 virtual void checkpoint();
451 static IMG_DataType mapStorageOption(
const char *option,
452 bool *denormalize_flag =
nullptr);
459 static int doErrors(
int newDoErrors);
461 const char *msg =
nullptr);
463 const char *msg =
nullptr);
465 bool hasError()
const
466 {
return getBaseFile() ? (getBaseFile()->hasError() ||
467 myErrorFlag) :myErrorFlag; }
475 IMG_File *getUnfilteredFile();
476 const IMG_File *getUnfilteredFile()
const;
477 virtual IMG_File *getBaseFile()
const {
return 0; }
480 bool copyImageTextureOptions(
const IMG_File &
src,
481 bool clear_existing);
493 virtual void clearImageTextureOptions();
497 virtual bool setImageTextureOptions(
const UT_Options &options);
502 virtual void setWriteTag(
const char *tagname,
504 const char *
const *
values);
519 bool getCameraToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
528 bool getWorldToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
539 virtual int getDeepPixelSamples(
int x,
int y);
547 virtual bool getDeepPixelPlaneData(
int x,
int y,
558 virtual bool getDeepPixelData(
int x,
int y,
float *
const *data);
561 virtual bool readDeepPixelData(
int x,
int y,
572 virtual bool writeDeepPixelData(
int x,
int y,
582 void selectPlanesToRead();
583 bool isPlaneSelected(
const IMG_Plane &plane)
const;
586 static void setFileCreateCB(
599 virtual int openPostMagic();
600 virtual int openFile(
const char *filename);
602 virtual int readScanline(
int scanline,
void *data) = 0;
603 virtual const void *readPlaneScanline(
int y,
const IMG_Plane &
pi);
606 virtual int createFile(
const char *filename,
const IMG_Stat &stat);
607 virtual int create(
const IMG_Stat &stat);
609 virtual int writeScanline(
int scanline,
const void *data) = 0;
610 virtual int writePlaneScanline(
const void *data,
int y,
613 virtual int closeFile() = 0;
617 virtual void postCloseAction();
622 virtual bool isPassThrough()
const {
return false; }
625 virtual void computeCommonData();
627 void *getScanlineBuffer(
int y);
628 void *getPlaneBuffer(
int y,
const IMG_Plane &pi);
630 virtual void finishedScanline(
int scan);
642 {
return setOption(option, (
int64)value); }
654 bool canWriteStatWithoutConversion()
const;
667 int readSomeBytes(
void *buffer,
int size);
668 int writeSomeBytes(
const void *buffer,
int size);
671 bool readBytes(
void *buffer,
int size)
672 {
return readSomeBytes(buffer, size) ==
size; }
673 bool writeBytes(
const void *buffer,
int size)
674 {
return writeSomeBytes(buffer, size) ==
size; }
684 bool seekFromCurrent(
int64 offset);
685 bool seekFromEnd(
int64 offset);
686 int64 tellCurrentPosition();
689 void copyInputToStream(std::ostream &os);
696 UT_IStream *getUTIStream() {
return myIStream; }
697 void setIStream(
UT_IStream *is) { myIStream = is; }
704 int64 myStreamStartPos;
705 int64 myStreamLength;
706 unsigned myCreateIStream:1,
708 myForceRandomReads:1,
712 myContinueOnErrorFlag:1,
717 class img_ScanProgress
725 int64 getMemoryUsage(
bool inclusive)
const;
726 void processed(
int scan,
const IMG_Plane *plane);
727 void processAll(
int scan);
728 bool isComplete(
int scan,
const IMG_Plane *plane)
const;
729 bool isComplete(
int scan)
const;
730 int remaining(
int scan)
const;
731 int numScans()
const {
return myCounts.entries(); }
733 int bitIndex(
int scan,
int plane)
const;
741 void initializeTags();
742 void makeScanlineBuffers();
743 void deallocScanlineBuffer(
int scan);
744 const void *returnErrorScan(
int scan,
const IMG_Plane &pi);
745 const char *metadataKey()
const;
760 void *myScanlineBuffer;
761 int myCurrentImageScanline;
763 img_ScanProgress myScanProgress;
774 friend class IMG_GZip;
775 friend class IMG_FileBuffer;
776 friend class IMG_MemoryFileBuffer;
777 friend class MV_ReadPRISMS;
781 class IMG_API IMG_AutoFileError
784 IMG_AutoFileError(
bool report_errors =
false)
785 { myReport = IMG_File::doErrors(report_errors?1:0); }
787 { IMG_File::doErrors(myReport); }
GT_API const UT_StringHolder filename
#define SYS_DEPRECATED(__V__)
IMG_ImageType
Type of image we want to create or have opened.
UT_Functor1< void, UT_IStream * > IMG_FileCloseHook
GLenum GLenum GLsizei void * image
Describes the format and layout of a single plane in an image The plane specifies the format and name...
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
GLint GLint GLsizei GLint GLenum format
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
HUSD_API const char * raster()
GLuint const GLchar * name
UT_Functor1< UT_IStream *, const UT_StringRef & > IMG_FileOpenHook
ImageBuf OIIO_API flip(const ImageBuf &src, ROI roi={}, int nthreads=0)
A map of string to various well defined value types.
GLenum GLsizei GLsizei GLint * values
Base Integer Rectangle class.
__hostdev__ constexpr T pi()
Pi constant taken from Boost to match old behaviour.
File options for manipulating image data on load or save. This class allows you to modify the incomin...
Class to store JSON objects as C++ objects.
Contains the details of a specific image file, used by IMG_File. This class contains all the high-lev...
Parameters for the saveRaster[s]AsFile[s]() methods of IMG_File.
UT_UniquePtr< IMG_File > IMG_FilePtr