imagfile.h
来自「《3D游戏引擎设计》的源码」· C头文件 代码 · 共 64 行
H
64 行
#ifndef IMAGFILE_H
#define IMAGFILE_H
#include <iostream.h>
#include "element.h"
#include "fileform.h"
// pre-register file formats
#include "magic1.h"
#include "magic2.h"
#include "usrimage.h"
class mgcImageFile
{
protected:
char* io_name;
int io_dims;
int* io_dim;
int io_quantity;
int io_file_order;
int io_file_type;
mgcFileFormat::RegisteredFileFormat io_rff;
public:
// open existing file and read header
mgcImageFile (char* fname, int* dims, int** dim, int* eltype);
// create new file and write header and element block
mgcImageFile (char* fname, int dims, const int* dim, int eltype,
int fformat = -1);
~mgcImageFile ();
int ElementCount () { return io_quantity; }
// data access
int Get (int eltype, void* ptr, long offset = 0, int quantity = -1);
int Put (int eltype, void* ptr, long offset = 0, int quantity = -1);
// message access
int Get (void* message);
int Put (void* message);
// error handling
public:
static int verbose;
static unsigned error;
static void Report (ostream& ostr);
private:
static const unsigned file_open_failed;
static const unsigned format_not_recognized;
static const unsigned get_head_failed;
static const unsigned put_head_failed;
static const unsigned invalid_data_access;
static const unsigned get_data_failed;
static const unsigned put_data_failed;
static const unsigned incompatible_types;
static const char* message[8];
static int Number (unsigned single_error);
static void Report (unsigned single_error);
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?