系列文章
①:安装及基本概念
②:EasyX函数-设备相关
③:EasyX函数-颜色模型
④:EasyX函数-图形样式
⑤:EasyX函数-绘图相关〔1〕
⑥:EasyX函数-绘图相关〔2〕
文章目录
前言
作者也是个小白,本【教程】充其量算个学习笔记,若有写的不正确的地方还请指教。
五、图像对象 - IMAGE
- 类定义:
class IMAGE(int _width = 0, int _height = 0);
- 类原型:
//IMAGE在easyx.h中的定义 class IMAGE { public: int getwidth() const; // 获取对象的宽度 int getheight() const; // 获取对象的高度 private: ... public: IMAGE(int _width = 0, int _height = 0); // 创建图像 IMAGE(const IMAGE &img); // 拷贝构造函数 IMAGE& operator = (const IMAGE &img); // 赋值运算符重载函数 virtual ~IMAGE(); virtual void Resize(int _width, int _height); // 调整尺寸 };
- 公有成员:
- i n t g e t w i d t h ( ) ; int\space getwidth(); int getwidth(); - 获取 IMAGE 对象的宽度,以像素为单位:
public : int IMAGE::getwidth() const
- i n t g e t h e i g h t ( ) ; int\space getheight(); int getheight(); - 获取 IMAGE 对象的高度,以像素为单位:
public : int IMAGE::getheight() const
- o p e r a t o r = operator= operator= :重载运算符=,实现IMAGE赋值。该操作仅拷贝源图像的内容,不拷贝源图像的绘图窗口:
public : IMAGE & IMAGE::operator=(const IMAGE img)
六、填充样式对象 - FILLSTYLE
-
类定义:
class FILLSTYLE();
-
类原型:
//FILLSTYLE在easyx.h中的定义 class FILLSTYLE { public: FILLSTYLE(); FILLSTYLE(const FILLSTYLE &style); FILLSTYLE& operator = (const FILLSTYLE &style); // 赋值运算符重载函数 virtual ~FILLSTYLE(); int style; // 填充形式 long hatch; // 填充图案样式 IMAGE* ppattern; // 填充图像 };
-
公有成员:
int
s t y l e style style - 填充形式。long
h a t c h hatch hatch - 填充图案样式。仅当 s t y l e style style=BS_HATCHED
时有效。IMAGE*
p p a t t e r n ppattern ppatte