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

📄 imlong.h

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

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

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

	// image file access
	mgcImageLong (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
	long* operator() () { return (long*)data; }
	long& operator[] (int i) const
		{ return *(long*)(data+size*i); }
	long& operator() (int x) const
		{ return *(long*)(data+size*x); }
	long& operator() (int x, int y) const
		{ return *(long*)(data+size*Index(x,y)); }
	long& operator() (int x, int y, int z) const
		{ return *(long*)(data+size*Index(x,y,z)); }
	long& operator() (int x, int y, int z, int w) const
		{ return *(long*)(data+size*Index(x,y,z,w)); }
	long& operator() (const mgcCoordinate& coordinate) const
		{ return *(long*)(data+size*Index(coordinate)); }

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

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

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

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

protected:
	long 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 + -