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  virtual ~IMG_TileFile();
68 
69  virtual const char *className() const;
70  virtual void getDescription(UT_WorkBuffer &wbuf) const;
71 //
72 // Virtual method to open a picture. Returns 0 on failure
73  virtual int open(const IMG_TileOptions &finfo,
74  int xres, int yres,
75  int twidth, int theight,
76  fpreal aspect);
77  virtual int openMulti(IMG_TileOptionList &flist,
78  int xres, int yres,
79  int twidth, int theight,
80  fpreal aspect);
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  virtual int writeTile(const void *data,
85  unsigned x0, unsigned x1,
86  unsigned y0, unsigned y1);
87  virtual void checkpoint();
88  virtual int close(bool keep_alive=false);
89 
90 protected:
91  virtual void writeCustomTag(const char *tagname, int size,
92  const char *const *values);
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
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)
void setupMap(int off, int size, IMG_File *fp, int findex, int plane)
Definition: IMG_TileFile.h:45
GLsizeiptr size
Definition: glcorearb.h:663
Definition: IMG_TileFile.h:24
IMG_File * getFile() const
Definition: IMG_TileFile.h:44
#define IMG_API
Definition: IMG_API.h:10
png_FILE_p fp
Definition: png.h:2028
int getSourceSize() const
Definition: IMG_TileFile.h:41
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
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
Generic interface for reading and writing image files. This class handles the reading and writing of ...
Definition: IMG_File.h:54
GLboolean * data
Definition: glcorearb.h:130
~IMG_TileFileMapEntry()
Definition: IMG_TileFile.h:38
int getPlaneIndex() const
Definition: IMG_TileFile.h:43
virtual int writeTile(const void *data, unsigned x0, unsigned x1, unsigned y0, unsigned y1)=0
double fpreal
Definition: SYS_Types.h:270
int getSourceOffset() const
Definition: IMG_TileFile.h:40