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,
211 virtual const char *className()
const {
return "IMG_File"; }
219 int getReadMode()
const;
229 const IMG_Format *getFormat()
const {
return myFormat; }
240 const IMG_Stat &unfilteredStat()
const
241 {
return getUnfilteredFile()->myStat; }
247 virtual void getAdditionalInfo(
UT_String &text);
267 const IMG_Metadata &metadata()
const {
return unfilteredStat().metadata(); }
272 {
return metadata().
begin(); }
274 {
return metadata().end(); }
281 return unfilteredStat().findMetadata(name, value);
286 bool importMetadata(
const UT_StringRef &name,
bool &value)
const
287 {
return unfilteredStat().importMetadata(name, value); }
289 {
return unfilteredStat().importMetadata(name, value); }
291 {
return unfilteredStat().importMetadata(name, value); }
293 {
return unfilteredStat().importMetadata(name, value); }
295 {
return unfilteredStat().importMetadata(name, value); }
297 {
return unfilteredStat().importMetadata(name, value); }
299 {
return unfilteredStat().importMetadata(name, m); }
301 {
return unfilteredStat().importMetadata(name, m); }
310 bool pretty_print =
true)
const
312 return unfilteredStat().metadataAsString(name, value, pretty_print);
318 const void *
read(
int scan,
const IMG_Plane *from_plane =
nullptr);
324 bool readIntoBuffer(
int scan,
void *
buffer,
339 void * allocScanlineBuffer()
const;
342 exint getScanlineBufferSizeB()
const;
350 bool readImage(
void *data,
int flip=0,
int scaninc=0);
352 bool writeImage(
void *data,
int flip=0,
int scaninc=0);
365 const char *scope =
nullptr);
376 bool freerasters =
false);
383 virtual bool jumpToFrame(
int frame);
387 virtual void abortWrite();
395 virtual int isTopFirst()
const;
397 virtual int isLeftFirst()
const;
402 virtual void randomReadAccessRequired();
406 bool randomReadsForced()
const {
return myForceRandomReads; }
431 virtual void checkpoint();
446 static IMG_DataType mapStorageOption(
const char *option,
447 bool *denormalize_flag =
nullptr);
454 static int doErrors(
int newDoErrors);
456 const char *msg =
nullptr);
458 const char *msg =
nullptr);
460 bool hasError()
const
461 {
return getBaseFile() ? (getBaseFile()->hasError() ||
462 myErrorFlag) :myErrorFlag; }
470 IMG_File *getUnfilteredFile();
471 const IMG_File *getUnfilteredFile()
const;
472 virtual IMG_File *getBaseFile()
const {
return 0; }
475 bool copyImageTextureOptions(
const IMG_File &
src,
476 bool clear_existing);
488 virtual void clearImageTextureOptions();
492 virtual bool setImageTextureOptions(
const UT_Options &options);
497 virtual void setWriteTag(
const char *tagname,
499 const char *
const *
values);
514 bool getCameraToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
523 bool getWorldToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
534 virtual int getDeepPixelSamples(
int x,
int y);
542 virtual bool getDeepPixelPlaneData(
int x,
int y,
553 virtual bool getDeepPixelData(
int x,
int y,
float *
const *data);
556 virtual bool readDeepPixelData(
int x,
int y,
567 virtual bool writeDeepPixelData(
int x,
int y,
577 void selectPlanesToRead();
578 bool isPlaneSelected(
const IMG_Plane &plane)
const;
581 static void setFileCreateCB(
594 virtual int openPostMagic();
595 virtual int openFile(
const char *filename);
597 virtual int readScanline(
int scanline,
void *data) = 0;
598 virtual const void *readPlaneScanline(
int y,
const IMG_Plane &
pi);
601 virtual int createFile(
const char *filename,
const IMG_Stat &stat);
602 virtual int create(
const IMG_Stat &stat);
604 virtual int writeScanline(
int scanline,
const void *data) = 0;
605 virtual int writePlaneScanline(
const void *data,
int y,
608 virtual int closeFile() = 0;
612 virtual void postCloseAction();
617 virtual bool isPassThrough()
const {
return false; }
620 virtual void computeCommonData();
622 void *getScanlineBuffer(
int y);
623 void *getPlaneBuffer(
int y,
const IMG_Plane &pi);
625 virtual void finishedScanline(
int scan);
637 {
return setOption(option, (
int64)value); }
649 bool canWriteStatWithoutConversion()
const;
662 int readSomeBytes(
void *buffer,
int size);
663 int writeSomeBytes(
const void *buffer,
int size);
666 bool readBytes(
void *buffer,
int size)
667 {
return readSomeBytes(buffer, size) ==
size; }
668 bool writeBytes(
const void *buffer,
int size)
669 {
return writeSomeBytes(buffer, size) ==
size; }
679 bool seekFromCurrent(
int64 offset);
680 bool seekFromEnd(
int64 offset);
681 int64 tellCurrentPosition();
684 void copyInputToStream(std::ostream &os);
691 UT_IStream *getUTIStream() {
return myIStream; }
692 void setIStream(
UT_IStream *is) { myIStream = is; }
699 int64 myStreamStartPos;
700 int64 myStreamLength;
701 unsigned myCreateIStream:1,
703 myForceRandomReads:1,
707 myContinueOnErrorFlag:1,
712 class img_ScanProgress
720 int64 getMemoryUsage(
bool inclusive)
const;
721 void processed(
int scan,
const IMG_Plane *plane);
722 void processAll(
int scan);
723 bool isComplete(
int scan,
const IMG_Plane *plane)
const;
724 bool isComplete(
int scan)
const;
725 int remaining(
int scan)
const;
726 int numScans()
const {
return myCounts.entries(); }
728 int bitIndex(
int scan,
int plane)
const;
736 void initializeTags();
737 void makeScanlineBuffers();
738 void deallocScanlineBuffer(
int scan);
739 const void *returnErrorScan(
int scan,
const IMG_Plane &pi);
740 const char *metadataKey()
const;
755 void *myScanlineBuffer;
756 int myCurrentImageScanline;
758 img_ScanProgress myScanProgress;
769 friend class IMG_GZip;
770 friend class IMG_FileBuffer;
771 friend class IMG_MemoryFileBuffer;
772 friend class MV_ReadPRISMS;
776 class IMG_API IMG_AutoFileError
779 IMG_AutoFileError(
bool report_errors =
false)
780 { myReport = IMG_File::doErrors(report_errors?1:0); }
782 { 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...
void read(T &in, bool &v)
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.
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...
constexpr T pi()
Pi constant taken from Boost to match old behaviour.
Parameters for the saveRaster[s]AsFile[s]() methods of IMG_File.
UT_UniquePtr< IMG_File > IMG_FilePtr
void write(T &out, bool v)