⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imdouble.h

📁 3D Game Engine Design Source Code非常棒
💻 H
字号:
#ifndef IMDOUBLE_H
#define IMDOUBLE_H

#include "imagbase.h"
#include "imagfile.h"

class mgcImageDouble : public mgcImage
{
// object information
public:
	// image creation
	mgcImageDouble ();
	mgcImageDouble (int _dimensions, const int* initial);
	mgcImageDouble (int _dimensions, int initial_all);
	mgcImageDouble (int _dimensions, int initial0, int initial1, ...);
	mgcImageDouble (const mgcImage& image);
	mgcImageDouble (const mgcLattice& lattice);

	// image file access
	mgcImageDouble (char* fname);
	mgcImage& Load (char* fname, int trgt = -1);
	mgcImage& Save (char* fname, int trgt = -1);
	mgcImage& SaveAs (char* fname, int ff, int trgt = -1);

	// element access
	double* operator() () { return (double*)data; }
	double& operator[] (int i) const
		{ return *(double*)(data+size*i); }
	double& operator() (int x) const
		{ return *(double*)(data+size*x); }
	double& operator() (int x, int y) const
		{ return *(double*)(data+size*Index(x,y)); }
	double& operator() (int x, int y, int z) const
		{ return *(double*)(data+size*Index(x,y,z)); }
	double& operator() (int x, int y, int z, int w) const
		{ return *(double*)(data+size*Index(x,y,z,w)); }
	double& operator() (const mgcCoordinate& coordinate) const
		{ return *(double*)(data+size*Index(coordinate)); }

	// assignments and comparisons
    mgcImageDouble& operator= (const mgcImageDouble& image);
	mgcImageDouble& operator= (const mgcImage& image);
	mgcImageDouble& operator= (double value);
	int operator== (const mgcImage& image);
	int operator== (double value);
	int operator!= (const mgcImage& image)  { return !( *this == image ); }
	int operator!= (double value)  { return !( *this == value ); }

	// arithmetic updates
	static double zero_divide_result;
	mgcImageDouble& operator+= (const mgcImageDouble &image);
	mgcImageDouble& operator-= (const mgcImageDouble &image);
	mgcImageDouble& operator*= (const mgcImageDouble &image);
	mgcImageDouble& operator/= (const mgcImageDouble &image);
	mgcImageDouble& operator+= (double value);
	mgcImageDouble& operator-= (double value);
	mgcImageDouble& operator*= (double value);
	mgcImageDouble& operator/= (double value);

	// arithmetic operations
	mgcImageDouble operator- ();
	mgcImageDouble operator+ (const mgcImageDouble &image);
	mgcImageDouble operator- (const mgcImageDouble &image);
	mgcImageDouble operator* (const mgcImageDouble &image);
	mgcImageDouble operator/ (const mgcImageDouble &image);
	mgcImageDouble operator+ (double value);
	mgcImageDouble operator- (double value);
	mgcImageDouble operator* (double value);
	mgcImageDouble operator/ (double value);
	friend mgcImageDouble operator+ (double value, mgcImageDouble &image);
	friend mgcImageDouble operator- (double value, mgcImageDouble &image);
	friend mgcImageDouble operator* (double value, mgcImageDouble &image);
	friend mgcImageDouble operator/ (double value, mgcImageDouble &image);

	// pixel statistics
	double Min () const { return minimum; }
	double Max () const { return maximum; }
	void Min (double value)  { minimum = value; }
	void Max (double value)  { maximum = value; }
	void ComputeMaxMin ();

protected:
	double minimum, maximum;

// error handling
public:
	static int verbose;
	static unsigned error;
	static void Report (ostream& ostr);
private:
	static const unsigned zero_dimension;
	static const unsigned invalid_dimension;
	static const unsigned null_pixel_pointer;
	static const unsigned incompatible_images;
	static const unsigned get_data_failed;
	static const unsigned put_data_failed;
	static const unsigned load_failed;
	static const unsigned save_failed;
	static const char* message[8];
	static int Number (unsigned single_error);
	static void Report (unsigned single_error);
};

#endif


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -