TFT.fill()

名称

TFT.fill()

説明

スクリーンにオブジェクトを描画する前に呼び出し、図形や文字の色を設定する。

fill()は、赤と緑、青のそれぞれを8ビットの値で指定できるが、指定した色を忠実に再現できるわけではない。赤と青は5ビット(32段階)に、緑は6ビット(64段階)に変換される。

書式

void Adafruit_GFX::fill(uint8_t red, uint8_t green, uint8_t blue);

引数

red 0-255。
green0-255。
blue0-255。

戻り値

なし。

使用例

 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
#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.fill(255,255,255);

  // draw a white box in the screen center
  screen.rect(screen.width()/2+10,screen.height()/2+10,screen.width()/2-10,screen.height()/2-10);
}

void loop() {

}

オリジナルのページ

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

最終更新日

January 8, 2024

inserted by FC2 system