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

📄 wzpixmap.hxx

📁 有限元学习研究用源代码(老外的),供科研人员参考
💻 HXX
字号:
#ifndef WZPIXMAP_HXX
#define WZPIXMAP_HXX

#include "wzcolor.hxx"
#include "wzarray.hxx"

const int wzColorTableLength = 256;

class wzTrueColorPixmap{
	wzArray<wzColor>	c;
	int Lx;
	int Ly;
public:
	int      lx() const {return Lx;}
	int      ly() const {return Ly;}
        wzColor  operator()(int x, int y) const {return c[x+Lx*y];}
	wzColor& operator()(int x, int y)       {return c[x+Lx*y];}
	wzTrueColorPixmap(int lx, int ly);
	wzTrueColorPixmap(wzString file);
	void    save(wzString fname) const;
	int     print() const;
};

class wzColorTablePixmap{
  	wzArray<wzByte>	map;	// one byte per pixel	
	int	Lx;		// pixel in x-direction	
	int	Ly;		// pixel in y-direction
	int	Lc;		// number of colors
	wzColor C[wzColorTableLength];
	wzByte  P[wzColorTableLength];
	wzByte  last;
	void    getTrueColorPixmap(const wzTrueColorPixmap& tmap, int max);
public:
	int     lx() const {return Lx;}
	int     ly() const {return Ly;}
	int     colors() const {return Lc;}
	wzColor color(int i) const {return C[i];}
	wzByte  operator()(int x, int y) const {return map[x+Lx*y];}
	wzByte& operator()(int x, int y)       {return map[x+Lx*y];}
	wzColorTablePixmap(int lx, int ly);
	wzColorTablePixmap(wzString fname, int max);
	wzColorTablePixmap(const wzTrueColorPixmap& tmap, int max);
	int     getColor(wzByte r, wzByte g, wzByte b);
	void    save(wzString fname) const;
	int     print() const;
	void	fitColorList(wzIndex length, wzColor* colors, int* reg);
};

class wzElevationMap{
  	wzArray<wzShort>	map;	// one short integer per pixel	
	int	Lx;		// pixel in x-direction	
	int	Ly;		// pixel in y-direction
public:
	int     lx() const {return Lx;}
	int     ly() const {return Ly;}
	wzElevationMap(int lx, int ly);
	wzElevationMap(wzString fname);
	wzElevationMap(const wzTrueColorPixmap& tmap);
	void    getTrueColorPixmap(const wzTrueColorPixmap& tmap);
	void	save(wzString fname) const;
	wzShort  operator()(int x, int y) const {return map[x+Lx*y];}
	wzShort& operator()(int x, int y)       {return map[x+Lx*y];}
};
#endif

⌨️ 快捷键说明

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