TFT.circle()

名称

TFT.circle()

説明

スクリーンに円を描く。

円は、その中心を指定して描かれる。このため、直径は常に奇数になる。

書式

void Adafruit_GFX::circle(int16_t x, int16_t y, int16_t r);

引数

x 円の中心のX座標。
y 円の中心のY座標。
r 円の半径。

戻り値

スクリーンの高さ(ピクセル)。

使用例

 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
27
28
29
#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);

  // set the fill color to grey
  screen.fill(127,127,127);

  // draw a circle in the center of screen
  screen.circle(screen.width()/2, screen.height()/2, 10);
}

void loop() {

}

オリジナルのページ

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

最終更新日

January 8, 2024

inserted by FC2 system