wzpixmap.hxx
来自「有限元学习研究用源代码(老外的),供科研人员参考」· HXX 代码 · 共 65 行
HXX
65 行
#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 + =
减小字号Ctrl + -
显示快捷键?