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);
389 virtual bool jumpToFrame(
int frame);
393 virtual void abortWrite();
401 virtual int isTopFirst()
const;
403 virtual int isLeftFirst()
const;
408 virtual void randomReadAccessRequired();
412 bool randomReadsForced()
const {
return myForceRandomReads; }
437 virtual void checkpoint();
452 static IMG_DataType mapStorageOption(
const char *option,
453 bool *denormalize_flag =
nullptr);
460 static int doErrors(
int newDoErrors);
462 const char *msg =
nullptr);
464 const char *msg =
nullptr);
466 bool hasError()
const
467 {
return getBaseFile() ? (getBaseFile()->hasError() ||
468 myErrorFlag) :myErrorFlag; }
476 IMG_File *getUnfilteredFile();
477 const IMG_File *getUnfilteredFile()
const;
478 virtual IMG_File *getBaseFile()
const {
return 0; }
481 bool copyImageTextureOptions(
const IMG_File &
src,
482 bool clear_existing);
494 virtual void clearImageTextureOptions();
498 virtual bool setImageTextureOptions(
const UT_Options &options);
503 virtual void setWriteTag(
const char *tagname,
505 const char *
const *
values);
520 bool getCameraToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
529 bool getWorldToNDC(
UT_Matrix4D &xform,
int xres,
int yres,
bool
540 virtual int getDeepPixelSamples(
int x,
int y);
548 virtual bool getDeepPixelPlaneData(
int x,
int y,
559 virtual bool getDeepPixelData(
int x,
int y,
float *
const *data);
562 virtual bool readDeepPixelData(
int x,
int y,
573 virtual bool writeDeepPixelData(
int x,
int y,
583 void selectPlanesToRead();
584 bool isPlaneSelected(
const IMG_Plane &plane)
const;
587 static void setFileCreateCB(
594 bool formatNeedsPremultiplied()
const;
602 virtual int openPostMagic();
603 virtual int openFile(
const char *filename);
605 virtual int readScanline(
int scanline,
void *data) = 0;
606 virtual const void *readPlaneScanline(
int y,
const IMG_Plane &
pi);
609 virtual int createFile(
const char *filename,
const IMG_Stat &stat);
610 virtual int create(
const IMG_Stat &stat);
612 virtual int writeScanline(
int scanline,
const void *data) = 0;
613 virtual int writePlaneScanline(
const void *data,
int y,
616 virtual int closeFile() = 0;
620 virtual void postCloseAction();
625 virtual bool isPassThrough()
const {
return false; }
628 virtual void computeCommonData();
630 void *getScanlineBuffer(
int y);
631 void *getPlaneBuffer(
int y,
const IMG_Plane &pi);
633 virtual void finishedScanline(
int scan);
645 {
return setOption(option, (
int64)value); }
657 bool canWriteStatWithoutConversion()
const;
670 int readSomeBytes(
void *buffer,
int size);
671 int writeSomeBytes(
const void *buffer,
int size);
674 bool readBytes(
void *buffer,
int size)
675 {
return readSomeBytes(buffer, size) ==
size; }
676 bool writeBytes(
const void *buffer,
int size)
677 {
return writeSomeBytes(buffer, size) ==
size; }
687 bool seekFromCurrent(
int64 offset);
688 bool seekFromEnd(
int64 offset);
689 int64 tellCurrentPosition();
692 void copyInputToStream(std::ostream &os);
699 UT_IStream *getUTIStream() {
return myIStream; }
700 void setIStream(
UT_IStream *is) { myIStream = is; }
707 int64 myStreamStartPos;
708 int64 myStreamLength;
709 unsigned myCreateIStream:1,
711 myForceRandomReads:1,
715 myContinueOnErrorFlag:1,
720 class img_ScanProgress
728 int64 getMemoryUsage(
bool inclusive)
const;
729 void processed(
int scan,
const IMG_Plane *plane);
730 void processAll(
int scan);
731 bool isComplete(
int scan,
const IMG_Plane *plane)
const;
732 bool isComplete(
int scan)
const;
733 int remaining(
int scan)
const;
734 int numScans()
const {
return myCounts.entries(); }
736 int bitIndex(
int scan,
int plane)
const;
744 void initializeTags();
745 void makeScanlineBuffers();
746 void deallocScanlineBuffer(
int scan);
747 const void *returnErrorScan(
int scan,
const IMG_Plane &pi);
748 const char *metadataKey()
const;
763 void *myScanlineBuffer;
764 int myCurrentImageScanline;
766 img_ScanProgress myScanProgress;
777 friend class IMG_GZip;
778 friend class IMG_FileBuffer;
779 friend class IMG_MemoryFileBuffer;
780 friend class MV_ReadPRISMS;
784 class IMG_API IMG_AutoFileError
787 IMG_AutoFileError(
bool report_errors =
false)
788 { myReport = IMG_File::doErrors(report_errors?1:0); }
790 { 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