这个函数用于获取当前绘图前景色。
COLORREF getcolor();
参数:
(无)
返回值:
返回当前的前景颜色。
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数。
由于 Turbo C 绘图函数并未区分画线和文字颜色,因此不完全等效于 easyx.h 中的 getlinecolor 或 gettextcolor 函数。
建议根据需求使用 getlinecolor 或 gettextcolor 代替该函数。
示例:
(无)
该函数用于获取绘图窗口的物理坐标中的最大 x 坐标。
int getmaxx();
参数:
(无)
返回值:
返回绘图窗口的物理坐标中的最大 x 坐标。
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数。
getmaxx 总是返回绘图窗口的物理坐标中的最大 x 坐标,因此与缩放设置无关。数值上,等于 easyx.h 中的 getwidth() - 1。例如,初始化为 640 x 480 的绘图窗口,那么 getwidth() 返回 640,getmaxx() 返回 639。
建议使用 getwidth() - 1 代替该函数。
示例:
(无)
这个函数用于获取绘图窗口的物理坐标中的最大 y 坐标。
int getmaxy();
参数:
(无)
返回值:
返回绘图窗口的物理坐标中的最大 y 坐标。
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数。
getmaxy 总是返回绘图窗口的物理坐标中的最大 y 坐标,因此与缩放设置无关。数值上,等于 easyx.h 中的 getheight() - 1。例如,初始化为 640 x 480 的绘图窗口,那么 getheight() 返回 480,getmaxy() 返回 479。
建议使用 getheight() - 1 代替该函数。
示例:
(无)
这个函数用于设置当前绘图前景色。
void setcolor(COLORREF color);
参数:
color
要设置的前景颜色。
返回值:
(无)
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数,等效于连续执行 easyx.h 中的 setlinecolor 和 settextcolor 函数。
建议根据需求使用 setlinecolor 或 settextcolor 代替该函数。
示例:
(无)
这个函数用于设置前景的二元光栅操作模式。
void setwritemode(int mode);
参数:
mode
二元光栅操作码,详见 setrop2 函数。
返回值:
(无)
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数,等效于 easyx.h 中的 setrop2 函数。
建议使用 setrop2 替代该函数。
示例:
(无)
这个函数用于画有边框三维填充矩形。
void bar3d( int left, int top, int right, int bottom, int depth, bool topflag );
参数:
left
矩形左部 x 坐标。
top
矩形上部 y 坐标。
right
矩形右部 x 坐标。
bottom
矩形下部 y 坐标。
depth
矩形深度。
topflag
为 false 时,将不画矩形的三维顶部。该选项可用来画堆叠的三维矩形。
返回值:
(无)
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数。
该函数的具体实现如下:
void bar3d(int left, int top, int right, int bottom, int depth, bool topflag) { if (left > right) left ^= right ^= left ^= right; if (top > bottom) top ^= bottom ^= top ^= bottom; fillrectangle(left, top, right, bottom); int depthy = (depth * 3) >> 2; int curx = getx(); int cury = gety(); moveto(right, bottom); linerel(depth, -depthy); linerel(0, top - bottom); if (topflag) { moveto(left, top); linerel(depth, -depthy); linerel(right - left, 0); linerel(-depth, depthy); } moveto(curx, cury); }
不建议使用该函数。
示例:
(无)
这个函数用于画填充矩形(无边框)。
void bar( int left, int top, int right, int bottom );
参数:
left
矩形左部 x 坐标。
top
矩形上部 y 坐标。
right
矩形右部 x 坐标。
bottom
矩形下部 y 坐标。
返回值:
(无)
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数,等效于 easyx.h 中的 solidrectangle 函数。
建议使用 solidrectangle 代替该函数。
示例:
(无)
这个函数用于画多边形。
void drawpoly( int numpoints, const int *polypoints );
参数:
numpoints
多边形点的个数。
polypoints
每个点的坐标,数组元素个数为 numpoints * 2。
该函数会自动连接多边形首尾。
返回值:
(无)
说明:
该函数在 graphics.h 中声明,用于兼容 Turbo C 中的同名函数,等效于 easyx.h 中的 polygon 函数。
建议使用 polygon 代替该函数。
示例:
以下局部代码绘制一个封闭的三角形:
int points[] = {50, 200, 200, 200, 200, 50}; drawpoly(3, points);
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!