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(
600 virtual int openPostMagic();
601 virtual int openFile(
const char *filename);
603 virtual int readScanline(
int scanline,
void *data) = 0;
604 virtual const void *readPlaneScanline(
int y,
const IMG_Plane &
pi);
607 virtual int createFile(
const char *filename,
const IMG_Stat &stat);
608 virtual int create(
const IMG_Stat &stat);
610 virtual int writeScanline(
int scanline,
const void *data) = 0;
611 virtual int writePlaneScanline(
const void *data,
int y,
614 virtual int closeFile() = 0;
618 virtual void postCloseAction();
623 virtual bool isPassThrough()
const {
return false; }
626 virtual void computeCommonData();
628 void *getScanlineBuffer(
int y);
629 void *getPlaneBuffer(
int y,
const IMG_Plane &pi);
631 virtual void finishedScanline(
int scan);
643 {
return setOption(option, (
int64)value); }
655 bool canWriteStatWithoutConversion()
const;
668 int readSomeBytes(
void *buffer,
int size);
669 int writeSomeBytes(
const void *buffer,
int size);
672 bool readBytes(
void *buffer,
int size)
673 {
return readSomeBytes(buffer, size) ==
size; }
674 bool writeBytes(
const void *buffer,
int size)
675 {
return writeSomeBytes(buffer, size) ==
size; }
685 bool seekFromCurrent(
int64 offset);
686 bool seekFromEnd(
int64 offset);
687 int64 tellCurrentPosition();
690 void copyInputToStream(std::ostream &os);
697 UT_IStream *getUTIStream() {
return myIStream; }
698 void setIStream(
UT_IStream *is) { myIStream = is; }
705 int64 myStreamStartPos;
706 int64 myStreamLength;
707 unsigned myCreateIStream:1,
709 myForceRandomReads:1,
713 myContinueOnErrorFlag:1,
718 class img_ScanProgress
726 int64 getMemoryUsage(
bool inclusive)
const;
727 void processed(
int scan,
const IMG_Plane *plane);
728 void processAll(
int scan);
729 bool isComplete(
int scan,
const IMG_Plane *plane)
const;
730 bool isComplete(
int scan)
const;
731 int remaining(
int scan)
const;
732 int numScans()
const {
return myCounts.entries(); }
734 int bitIndex(
int scan,
int plane)
const;
742 void initializeTags();
743 void makeScanlineBuffers();
744 void deallocScanlineBuffer(
int scan);
745 const void *returnErrorScan(
int scan,
const IMG_Plane &pi);
746 const char *metadataKey()
const;
761 void *myScanlineBuffer;
762 int myCurrentImageScanline;
764 img_ScanProgress myScanProgress;
775 friend class IMG_GZip;
776 friend class IMG_FileBuffer;
777 friend class IMG_MemoryFileBuffer;
778 friend class MV_ReadPRISMS;
782 class IMG_API IMG_AutoFileError
785 IMG_AutoFileError(
bool report_errors =
false)
786 { myReport = IMG_File::doErrors(report_errors?1:0); }
788 { 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