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

📄 imshort.h

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

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

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

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

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

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

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

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

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