TFT.image()

名称

TFT.image()

説明

スクリーン上の指定した位置に、SDカードに格納されているイメージを描く。

書式

void Adafruit_GFX::image(PImage & img, uint16_t x, uint16_t y);

引数

img PImageのインスタンス。
x 描画位置のX座標。
y 描画位置のY座標。

戻り値

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

使用例

 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
30
31
32
33
34
35
36
37
38
39
// this example looks for a file named "logo.bmp"
//  on the SD card, and renders it to the screen
#include <Esplora.h>
#include <SPI.h>
#include <SD.h>
#include <TFT.h>            // Arduino TFT library

#define SD_CS    8  // Chip select line for SD card in Esplora

PImage logo;

void setup() {
  // initialize the screen
  EsploraTFT.begin();
  // initialize the SD card
  SD.begin(SD_CS);
  // set the background the black
  EsploraTFT.background(0, 0, 0);

  // load the image into the named instance of PImage
  logo = EsploraTFT.loadImage("arduino.bmp");

  // if it is a valid image file, turn the Esplora's LED green
   if (logo.isValid()) {
       Esplora.writeGreen(255);
  }
  else{
  // if it is not valid, turn the LED red
    Esplora.writeRed(255);
  }

  // draw the image on the screen starting at the top left corner
  EsploraTFT.image(logo, 0, 0);

}

void loop() {

}

オリジナルのページ

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

最終更新日

January 8, 2024

inserted by FC2 system