跳至主要內容

Line


Line

函数原型

void Line(int x0, int y0, int x1, int y1, int type);

功能

画直线

说明

(x0, y0) 和 (x1, y1) 指定直线的两个端点坐标。type 决定画图方式,其值含义如下:

  • type = 0: 2色模式下画白线,16色和256色模式下用背景色画线
  • type = 1: 2色模式下画黑线,16色和256色模式下用前景色画线
  • type = 2: 线的所有点取反
  • type 的 bit6 = 1 时向图形缓冲区作图,否则直接在屏幕作图

示例

void main()
{
    Box(20, 10, 100, 40, 1, 1);
    Line(1, 1, 111, 47, 1); // from top left to bottom right
    Line(1, 47, 111, 1, 0); // from bottom left to top right
    Line(112/2, 1, 112/2, 47, 2); // line vertically at the middle of the LCD
    getchar();
}