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 <UT/UT_ValArray.h>
18 #include <UT/UT_IntArray.h>
19 #include "IMG_TileDevice.h"
20 #include "IMG_Stat.h"
21 
22 class IMG_File;
23 
25 {
26 public:
27  // When opening multiple files, we get a list of plane definitions
28  // Each plane may be written to a "shared" file, or it might be written to
29  // aunique file.
30  // This class keeps track of the mappings of each input channel to the
31  // output file/channel.
32  // For each source channel, we store
33  // int SourceOffset; // Offset into source data
34  // int SourceSize; // Bytes per pixel
35  // int DestFile; // Destination file index
36  // int DestPlane; // Destination plane index
39 
40  int getSourceOffset() const { return mySourceOffset; }
41  int getSourceSize() const { return mySourceSize; }
42  int getDestFileIndex() const { return myDestFileIndex; }
43  int getPlaneIndex() const { return myDestPlane; }
44  IMG_File *getFile() const { return myDestFile; }
45  void setupMap(int off, int size,
46  IMG_File *fp, int findex, int plane)
47  {
48  mySourceOffset = off;
49  mySourceSize = size;
50  myDestFile = fp;
51  myDestFileIndex = findex;
52  myDestPlane = plane;
53  }
54 
55 private:
56  IMG_File *myDestFile;
57  int mySourceOffset;
58  int mySourceSize;
59  int myDestFileIndex;
60  int myDestPlane;
61 };
62 
64 {
65 public:
66  IMG_TileFile();
67  ~IMG_TileFile() override;
68 
69  const char *className() const override;
70  void getDescription(UT_WorkBuffer &wbuf) const override;
71 //
72 // Virtual method to open a picture. Returns 0 on failure
73  int open(const IMG_TileOptions &finfo,
74  int xres, int yres,
75  int twidth, int theight,
76  fpreal aspect) override;
77  int openMulti(IMG_TileOptionList &flist,
78  int xres, int yres,
79  int twidth, int theight,
80  fpreal aspect) override;
81 
82 // Method to actually write a tile to the file. The data to write is passed
83 // relative to the dataWindow() on the IMG_TileDevice.
84  int writeTile(const void *data,
85  unsigned x0, unsigned x1,
86  unsigned y0, unsigned y1) override;
87  void checkpoint() override;
88  int close(bool keep_alive=false) override;
89 
90 protected:
91  void writeCustomTag(const char *tagname, int size,
92  const char *const *values) override;
93 private:
94 
95  void prepData();
96 
98  UT_StringArray myFilenames;
100  int myBPP;
101 };
102 
103 #endif
IMG_TileFileMapEntry()
Definition: IMG_TileFile.h:37
GLsizeiptr size
Definition: glew.h:1681
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:42
virtual void checkpoint()
virtual int openMulti(IMG_TileOptionList &flist, int xres, int yres, int tile_width, int tile_height, fpreal aspect)
GLint GLsizei const GLuint64 * values
Definition: glew.h:3612
GLuint GLfloat GLfloat GLfloat x1
Definition: glew.h:12681
void setupMap(int off, int size, IMG_File *fp, int findex, int plane)
Definition: IMG_TileFile.h:45
Definition: IMG_TileFile.h:24
IMG_File * getFile() const
Definition: IMG_TileFile.h:44
#define IMG_API
Definition: IMG_API.h:10
int getSourceSize() const
Definition: IMG_TileFile.h:41
virtual const char * className() const =0
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
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
GLuint GLfloat GLfloat y0
Definition: glew.h:12681
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:55
~IMG_TileFileMapEntry()
Definition: IMG_TileFile.h:38
int getPlaneIndex() const
Definition: IMG_TileFile.h:43
GLuint GLfloat x0
Definition: glew.h:12681
virtual int writeTile(const void *data, unsigned x0, unsigned x1, unsigned y0, unsigned y1)=0
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint GLfloat GLfloat GLfloat GLfloat y1
Definition: glew.h:12681
int getSourceOffset() const
Definition: IMG_TileFile.h:40