TFT.line()

名称

TFT.line()

説明

2点間に直線を描く。line()で描く線の色を変えるには、TFT.stroke()を使う。

書式

void Adafruit_GFX::line(int16_t x1, int16_t y1, int16_t x2, int16_t y2);

引数

x1直線を開始する水平位置。
y1直線を開始する垂直位置。
x2直線を終了する水平位置。
y2直線を終了する垂直位置。

戻り値

なし。

使用例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <SPI.h>
#include <TFT.h>            // Arduino TFT library

#define cs   10
#define dc   9
#define rst  8

TFT screen = TFT(cs, dc, rst);

void setup() {
  // initialize the screen
  screen.begin();

  // make the background black
  screen.background(0,0,0);

  // set the stroke color to white
  screen.stroke(255,255,255);

  // draw a diagonal line across the screen's center
  screen.line(0, 0, 160, 124);
}

void loop() {

}

オリジナルのページ

https://www.arduino.cc/reference/en/libraries/tft/line/

最終更新日

January 8, 2024

inserted by FC2 system