HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_TileFile.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: IMG_TileFile (C++)
7  *
8  * COMMENTS: This class actually writes out to a file. No if's ands or
9  * buts.
10  *
11  */
12 
13 #ifndef __IMG_TileFile_H__
14 #define __IMG_TileFile_H__
15 
16 #include "IMG_API.h"
17 #include "IMG_File.h"
18 #include "IMG_Stat.h"
19 #include "IMG_TileDevice.h"
20 #include <UT/UT_Array.h>
21 #include <UT/UT_NonCopyable.h>
22 #include <UT/UT_UniquePtr.h>
23 
24 class IMG_File;
25 
27 {
28 public:
29  // When opening multiple files, we get a list of plane definitions
30  // Each plane may be written to a "shared" file, or it might be written to
31  // aunique file.
32  // This class keeps track of the mappings of each input channel to the
33  // output file/channel.
34  // For each source channel, we store
35  // int SourceOffset; // Offset into source data
36  // int SourceSize; // Bytes per pixel
37  // int DestFile; // Destination file index
38  // int DestPlane; // Destination plane index
40 
41  int getSourceOffset() const { return mySourceOffset; }
42  int getSourceSize() const { return mySourceSize; }
43  int getDestFileIndex() const { return myDestFileIndex; }
44  int getPlaneIndex() const { return myDestPlane; }
45  IMG_File *getFile() const { return myDestFile; }
46  void setupMap(int off, int size,
47  const IMG_FilePtr &fp, int findex, int plane)
48  {
49  mySourceOffset = off;
50  mySourceSize = size;
51  myDestFile = fp.get();
52  myDestFileIndex = findex;
53  myDestPlane = plane;
54  }
55 
56 private:
57  IMG_File *myDestFile;
58  int mySourceOffset;
59  int mySourceSize;
60  int myDestFileIndex;
61  int myDestPlane;
62 };
64 
66  : public IMG_TileDevice
67 {
68 public:
69  IMG_TileFile();
70  ~IMG_TileFile() override;
71 
73 
74  const char *className() const override;
75  void getDescription(UT_WorkBuffer &wbuf) const override;
76 //
77 // Virtual method to open a picture. Returns 0 on failure
78  int open(const IMG_TileOptions &finfo,
79  int xres, int yres,
80  int twidth, int theight,
81  fpreal aspect) override;
82  int openMulti(IMG_TileOptionList &flist,
83  int xres, int yres,
84  int twidth, int theight,
85  fpreal aspect) override;
86 
87 // Method to actually write a tile to the file. The data to write is passed
88 // relative to the dataWindow() on the IMG_TileDevice.
89  int writeTile(const void *data,
90  unsigned x0, unsigned x1,
91  unsigned y0, unsigned y1) override;
92  void checkpoint() override;
93  int close(bool keep_alive=false) override;
94 
95 protected:
96  void writeCustomTag(const char *tagname, int size,
97  const char *const *values) override;
98 private:
99  void prepData();
100 
101  UT_Array<IMG_FilePtr> myFiles;
102  UT_StringArray myFilenames;
104  int myBPP;
105 };
106 
107 #endif
IMG_TileFileMapEntry()
Definition: IMG_TileFile.h:39
virtual void writeCustomTag(const char *tagname, int size, const char *const *values)
virtual void getDescription(UT_WorkBuffer &wbuf) const
int getDestFileIndex() const
Definition: IMG_TileFile.h:43
virtual void checkpoint()
virtual int openMulti(IMG_TileOptionList &flist, int xres, int yres, int tile_width, int tile_height, fpreal aspect)
UT_UniquePtr< IMG_TileFileMapEntry > IMG_TileFileMapEntryPtr
Definition: IMG_TileFile.h:63
Definition: IMG_TileFile.h:26
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
IMG_File * getFile() const
Definition: IMG_TileFile.h:45
#define IMG_API
Definition: IMG_API.h:10
int getSourceSize() const
Definition: IMG_TileFile.h:42
virtual const char * className() const =0
virtual int open(const IMG_TileOptions &info, int xres, int yres, int tile_device, int tile_height, fpreal aspect)=0
Open the device.
virtual int close(bool keep_alive=false)=0
GLdouble y1
Definition: glad.h:2349
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
int getPlaneIndex() const
Definition: IMG_TileFile.h:44
virtual int writeTile(const void *data, unsigned x0, unsigned x1, unsigned y0, unsigned y1)=0
GLsizeiptr size
Definition: glcorearb.h:664
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
fpreal64 fpreal
Definition: SYS_Types.h:277
int getSourceOffset() const
Definition: IMG_TileFile.h:41
void setupMap(int off, int size, const IMG_FilePtr &fp, int findex, int plane)
Definition: IMG_TileFile.h:46
UT_UniquePtr< IMG_File > IMG_FilePtr
Definition: IMG_File.h:54
Definition: format.h:895