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();
219 virtual const char *className()
const {
return "IMG_File"; }
227 int getReadMode()
const;
237 const IMG_Format *getFormat()
const {
return myFormat; }
248 const IMG_Stat &unfilteredStat()
const
249 {
return getUnfilteredFile()->myStat; }
255 virtual void getAdditionalInfo(
UT_String &text);
275 const IMG_Metadata &metadata()
const {
return unfilteredStat().metadata(); }
280 {
return metadata().
begin(); }
282 {
return metadata().end(); }
289 return unfilteredStat().findMetadata(name, value);
294 bool importMetadata(
const UT_StringRef &name,
bool &value)
const
295 {
return unfilteredStat().importMetadata(name, value); }
297 {
return unfilteredStat().importMetadata(name, value); }
299 {
return unfilteredStat().importMetadata(name, value); }
301 {
return unfilteredStat().importMetadata(name, value); }
303 {
return unfilteredStat().importMetadata(name, value); }
305 {
return unfilteredStat().importMetadata(name, value); }
307 {
return unfilteredStat().importMetadata(name, m); }
309 {
return unfilteredStat().importMetadata(name, m); }
318 bool pretty_print =
true)
const
320 return unfilteredStat().metadataAsString(name, value, pretty_print);
326 const void *read(
int scan,
const IMG_Plane *from_plane =
nullptr);
332 bool readIntoBuffer(
int scan,
void *
buffer,
341 bool write(
int scan,
const void *
data,
347 void * allocScanlineBuffer()
const;
350 exint getScanlineBufferSizeB()
const;
358 bool readImage(
void *data,
int flip=0,
int scaninc=0);
360 bool writeImage(
void *data,
int flip=0,
int scaninc=0);
373 const char *scope =
nullptr);
392 virtual bool jumpToFrame(
int frame);
396 virtual void abortWrite();
404 virtual int isTopFirst()
const;
406 virtual int isLeftFirst()
const;
411 virtual void randomReadAccessRequired();
415 bool randomReadsForced()
const {
return myForceRandomReads; }
440 virtual void checkpoint();
455 static IMG_DataType mapStorageOption(
const char *option,
456 bool *denormalize_flag =
nullptr);
463 static int doErrors(
int newDoErrors);
465 const char *msg =
nullptr);
467 const char *msg =
nullptr);
469 bool hasError()
const
470 {
return getBaseFile() ? (getBaseFile()->hasError() ||
471 myErrorFlag) :myErrorFlag; }
479 IMG_File *getUnfilteredFile();
480 const IMG_File *getUnfilteredFile()
const;
481 virtual IMG_File *getBaseFile()
const {
return 0; }
484 bool copyImageTextureOptions(
const IMG_File &
src,
485 bool clear_existing);
497 virtual void clearImageTextureOptions();
501 virtual bool setImageTextureOptions(
const UT_Options &options);
506 virtual void setWriteTag(
const char *tagname,
508 const char *
const *
values);
523 bool getCameraToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
532 bool getWorldToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
543 virtual int getDeepPixelSamples(
int x,
int y);
551 virtual bool getDeepPixelPlaneData(
int x,
int y,
562 virtual bool getDeepPixelData(
int x,
int y,
float *
const *data);
565 virtual bool readDeepPixelData(
int x,
int y,
576 virtual bool writeDeepPixelData(
int x,
int y,
586 void selectPlanesToRead();
587 bool isPlaneSelected(
const IMG_Plane &plane)
const;
590 static void setFileCreateCB(
597 bool formatNeedsPremultiplied()
const;
605 virtual int openPostMagic();
606 virtual int openFile(
const char *filename);
608 virtual int readScanline(
int scanline,
void *data) = 0;
609 virtual const void *readPlaneScanline(
int y,
const IMG_Plane &
pi);
612 virtual int createFile(
const char *filename,
const IMG_Stat &stat);
613 virtual int create(
const IMG_Stat &stat);
615 virtual int writeScanline(
int scanline,
const void *data) = 0;
616 virtual int writePlaneScanline(
const void *data,
int y,
619 virtual int closeFile() = 0;
623 virtual void postCloseAction();
628 virtual bool isPassThrough()
const {
return false; }
631 virtual void computeCommonData();
633 void *getScanlineBuffer(
int y);
634 void *getPlaneBuffer(
int y,
const IMG_Plane &pi);
636 virtual void finishedScanline(
int scan);
648 {
return setOption(option, (
int64)value); }
660 bool canWriteStatWithoutConversion()
const;
673 int readSomeBytes(
void *buffer,
int size);
674 int writeSomeBytes(
const void *buffer,
int size);
677 bool readBytes(
void *buffer,
int size)
678 {
return readSomeBytes(buffer, size) ==
size; }
679 bool writeBytes(
const void *buffer,
int size)
680 {
return writeSomeBytes(buffer, size) ==
size; }
690 bool seekFromCurrent(
int64 offset);
691 bool seekFromEnd(
int64 offset);
692 int64 tellCurrentPosition();
695 void copyInputToStream(std::ostream &os);
702 UT_IStream *getUTIStream() {
return myIStream; }
703 void setIStream(
UT_IStream *is) { myIStream = is; }
710 int64 myStreamStartPos;
711 int64 myStreamLength;
712 unsigned myCreateIStream:1,
714 myForceRandomReads:1,
718 myContinueOnErrorFlag:1,
723 class img_ScanProgress
731 int64 getMemoryUsage(
bool inclusive)
const;
732 void processed(
int scan,
const IMG_Plane *plane);
733 void processAll(
int scan);
734 bool isComplete(
int scan,
const IMG_Plane *plane)
const;
735 bool isComplete(
int scan)
const;
736 int remaining(
int scan)
const;
737 int numScans()
const {
return myCounts.entries(); }
739 int bitIndex(
int scan,
int plane)
const;
747 void initializeTags();
748 void makeScanlineBuffers();
749 void deallocScanlineBuffer(
int scan);
750 const void *returnErrorScan(
int scan,
const IMG_Plane &pi);
751 const char *metadataKey()
const;
766 void *myScanlineBuffer;
767 int myCurrentImageScanline;
769 img_ScanProgress myScanProgress;
780 friend class IMG_GZip;
781 friend class IMG_FileBuffer;
782 friend class IMG_MemoryFileBuffer;
783 friend class MV_ReadPRISMS;
787 class IMG_API IMG_AutoFileError
790 IMG_AutoFileError(
bool report_errors =
false)
791 { myReport = IMG_File::doErrors(report_errors?1:0); }
793 { 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.
GLsizei const GLfloat * value
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.
GA_API const UT_StringHolder parms
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