App:Library:FabGL:Class:Canvas

提供: robot-jp wiki
2022年3月22日 (火) 23:57時点におけるTakashi (トーク | 投稿記録)による版 (→‎Public Member Functions)
ナビゲーションに移動検索に移動

class Canvas

一連の描画メソッドを持つクラス。

#include <canvas.h>

Public Member Functions

void beginUpdate ()
描画を一時停止する。
void clear ()
キャンバス全体をブラシの色で塗りつぶします。
void copyRect (int sourceX, int sourceY, int destX, int destY, int width, int height)
画面の長方形を 指定された位置にコピーします。
void drawBitmap (int X, int Y, Bitmap const *bitmap)
指定した位置にビットマップを描画します。
void drawChar (int X, int Y, char c)
指定した位置に文字を描画します。
void drawEllipse (int X, int Y, int width, int height)
中心とサイズを指定し、現在のペンの色を使用して楕円を描画します。
void drawGlyph (int X, int Y, int width, int height, uint8_t const *data, int index=0)
指定された位置にグリフを描画します。
void drawLine (int X1, int Y1, int X2, int Y2)
初期座標と終了座標を指定する線を描画します。
void drawPath (Point const *points, int pointsCount)
連続した線を描画する。
void drawRectangle (int X1, int Y1, int X2, int Y2)
現在のペンの色を使用して長方形を描画します。
void drawRectangle (Rect const &rect)
現在のペンの色を使用して長方形を描画します。
void drawText (int X, int Y, char const *text, bool wrap=false)
指定された位置に文字列を描画します。
void drawText (FontInfo const *fontInfo, int X, int Y, char const *text, bool wrap=false)
指定された位置に文字列を描画します。
void drawTextFmt (int X, int Y, const char *format,...)
指定された位置に書式付きテキストを描画する。
void drawTextWithEllipsis (FontInfo const *fontInfo, int X, int Y, char const *text, int maxX)
指定された位置に文字列を描画します。 切り捨ての前に省略記号を追加します。
void endUpdate ()
beginUpdate() の後に図面を再開します。.
void fillEllipse (int X, int Y, int width, int height)
現在のブラシの色を使用して、中心とサイズを指定する楕円を塗りつぶします。
void fillPath (Point const *points, int pointsCount)
一連の直線で囲まれたポリゴンを塗りつぶす。
void fillRectangle (int X1, int Y1, int X2, int Y2)
現在のブラシの色を使用して長方形を塗りつぶします。
void fillRectangle (Rect const &rect)
現在のブラシの色を使用して長方形を塗りつぶします。
Rect getClippingRect ()
setClippingRect() を使用して、最後に設定されたクリッピング長方形を取得します。.
FontInfo const * getFontInfo ()
現在選択されているフォントに関する情報を取得します。
int getHeight ()
キャンバスの高さをピクセル単位で決定します。
Point getOrigin ()
setOrigin() を使用して最後の原点セットを取得します。.
RGB888 getPixel (int X, int Y)
指定された位置のピクセルを読み取ります。
int getWidth ()
キャンバスの幅をピクセル単位で決定します。
void invertRectangle (int X1, int Y1, int X2, int Y2)
長方形を反転します。
void invertRectangle (Rect const &rect)
Inverts a rectangle.
void lineTo (int X, int Y)
Draws a line starting from current pen position.
void moveTo (int X, int Y)
Moves current pen position to the spcified coordinates.
void reset ()
Resets paint state and other display controller settings.
void resetGlyphOptions ()
Resets glyph options.
void resetPaintOptions ()
Resets paint options.
void scroll (int offsetX, int offsetY)
Scrolls pixels horizontally and/or vertically.
void selectFont (FontInfo const *fontInfo)
Selects a font to use for the next text drawings.
void setBrushColor (uint8_t red, uint8_t green, uint8_t blue)
Sets brush (background) color specifying color components.
void setBrushColor (Color color)
Sets brush (background) color using a color name.
void setBrushColor (RGB888 const &color)
Sets brush (background) color specifying color components.
void setClippingRect (Rect const &rect)
Sets clipping rectangle relative to the origin.
void setGlyphOptions (GlyphOptions options)
Sets drawing options for the next glyphs.
void setLineEnds (LineEnds value)
Sets line ends shape.
void setOrigin (int X, int Y)
Sets the axes origin.
void setOrigin (Point const &origin)
Sets the axes origin.
void setPaintOptions (PaintOptions options)
Sets paint options.
void setPenColor (uint8_t red, uint8_t green, uint8_t blue)
Sets pen (foreground) color specifying color components.
void setPenColor (Color color)
Sets pen (foreground) color using a color name.
void setPenColor (RGB888 const &color)
Sets pen (foreground) color specifying color components.
void setPenWidth (int value)
Sets pen width for lines, rectangles and paths.
void setPixel (int X, int Y)
Fills a single pixel with the pen color.
void setPixel (int X, int Y, RGB888 const &color)
Fills a single pixel with the specified color.
void setPixel (Point const &pos, RGB888 const &color)
Fills a single pixel with the specified color.
void setScrollingRegion (int X1, int Y1, int X2, int Y2)
Defines the scrolling region.
void swapBuffers ()
Swaps screen buffer when double buffering is enabled.
void swapRectangle (int X1, int Y1, int X2, int Y2)
Swaps pen and brush colors of the specified rectangle.
int textExtent (FontInfo const *fontInfo, char const *text)
Calculates text extension in pixels.
int textExtent (char const *text)
Calculates text extension in pixels.
void waitCompletion (bool waitVSync=true)
Waits for drawing queue to become empty.

Detailed Description

一連の描画メソッドを持つクラス。

このクラスは、ディスプレイコントローラに直接接続し、線や円などをペイントしたり、領域をスクロールしたり、長方形をコピーしたり、グリフを描画したりするための一連のプリミティブを提供します。

デフォルトの原点は左上にあり、 (0, 0) から (Canvas Width-1, Canvas Height-1) までです。

Example:

// Setup pins and resolution (5 GPIOs hence we have up to 8 colors)

VGAController.begin(GPIO_NUM_22, GPIO_NUM_21, GPIO_NUM_19, GPIO_NUM_18, GPIO_NUM_5);

VGAController.setResolution(VGA_640x350_70Hz);


// Paint a green rectangle with red border

fabgl::Canvas cv(&VGAController);

cv.setPenColor(Color::BrightRed);

cv.setBrushColor(Color::BrightGreen);

cv.fillRectangle(0, 0, cv.getWidth() - 1, cv.getHeight() - 1);

cv.drawRectangle(0, 0, cv.getWidth() - 1, cv.getHeight() - 1);

Examples:
ST7789_TFT/240x240/DoubleBuffer/DoubleBuffer.ino, VGA/ClassicRacer/ClassicRacer.ino, VGA/DoubleBuffer/DoubleBuffer.ino, VGA/MouseOnScreen/MouseOnScreen.ino, VGA/Songs/Songs.ino, and VGA/SpaceInvaders/SpaceInvaders.ino.

Definition at line 70 of file canvas.h.


このクラスのドキュメントは、次のファイルから生成されました。




戻る