「App:Library:FabGL:Class:Canvas」の版間の差分
提供: robot-jp wiki
ナビゲーションに移動検索に移動158行目: | 158行目: | ||
:Fills a single pixel with the specified color. | :Fills a single pixel with the specified color. | ||
|- | |- | ||
− | |void setPixel (Point const &pos, RGB888 const &color) | + | |void [http://www.fabglib.org/classfabgl_1_1_canvas_abc71718c88a2d72c9c59a4f9b3c0aa8c.html#abc71718c88a2d72c9c59a4f9b3c0aa8c '''setPixel'''] ([http://www.fabglib.org/structfabgl_1_1_point.html '''Point'''] const &pos, [http://www.fabglib.org/structfabgl_1_1_r_g_b888.html '''RGB888'''] const &color) |
:Fills a single pixel with the specified color. | :Fills a single pixel with the specified color. | ||
|- | |- | ||
− | |void setScrollingRegion (int X1, int Y1, int X2, int Y2) | + | |void [http://www.fabglib.org/classfabgl_1_1_canvas_a0c8606755ffb5321f7bfc7e5867d605f.html#a0c8606755ffb5321f7bfc7e5867d605f '''setScrollingRegion'''] (int [http://www.fabglib.org/fabutils_8h_a0dd601bb81c34d0e0e1c71e445d8c9ed.html#a0dd601bb81c34d0e0e1c71e445d8c9ed '''X1'''], int [http://www.fabglib.org/fabutils_8h_aefe36b84395404eaeb2fb7bc8dfa9266.html#aefe36b84395404eaeb2fb7bc8dfa9266 '''Y1'''], int [http://www.fabglib.org/fabutils_8h_aacc253365e856de8781b525223af3c52.html#aacc253365e856de8781b525223af3c52 '''X2'''], int [http://www.fabglib.org/fabutils_8h_a3e43b2629ffdaba77fe72f8f70818f07.html#a3e43b2629ffdaba77fe72f8f70818f07 '''Y2''']) |
:Defines the scrolling region. | :Defines the scrolling region. | ||
|- | |- | ||
− | |void swapBuffers () | + | |void [http://www.fabglib.org/classfabgl_1_1_canvas_a31a9db7752f187501af260615027c5bd.html#a31a9db7752f187501af260615027c5bd '''swapBuffers'''] () |
:Swaps screen buffer when double buffering is enabled. | :Swaps screen buffer when double buffering is enabled. | ||
|- | |- | ||
− | |void swapRectangle (int X1, int Y1, int X2, int Y2) | + | |void [http://www.fabglib.org/classfabgl_1_1_canvas_a213a1f95153dba2e00962ff0ca27aaf3.html#a213a1f95153dba2e00962ff0ca27aaf3 '''swapRectangle'''] (int [http://www.fabglib.org/fabutils_8h_a0dd601bb81c34d0e0e1c71e445d8c9ed.html#a0dd601bb81c34d0e0e1c71e445d8c9ed '''X1'''], int [http://www.fabglib.org/fabutils_8h_aefe36b84395404eaeb2fb7bc8dfa9266.html#aefe36b84395404eaeb2fb7bc8dfa9266 '''Y1'''], int [http://www.fabglib.org/fabutils_8h_aacc253365e856de8781b525223af3c52.html#aacc253365e856de8781b525223af3c52 '''X2'''], int [http://www.fabglib.org/fabutils_8h_a3e43b2629ffdaba77fe72f8f70818f07.html#a3e43b2629ffdaba77fe72f8f70818f07 '''Y2''']) |
:Swaps pen and brush colors of the specified rectangle. | :Swaps pen and brush colors of the specified rectangle. | ||
|- | |- | ||
− | |int textExtent (FontInfo const *fontInfo, char const *text) | + | |int [http://www.fabglib.org/classfabgl_1_1_canvas_a982dd49e90e0e7ac03bc9358d0ebf589.html#a982dd49e90e0e7ac03bc9358d0ebf589 '''textExtent'''] (FontInfo const *fontInfo, char const *text) |
:Calculates text extension in pixels. | :Calculates text extension in pixels. | ||
|- | |- | ||
− | |int textExtent (char const *text) | + | |int [http://www.fabglib.org/classfabgl_1_1_canvas_ac8819a7b44fcc761e52b539d11dcca3e.html#ac8819a7b44fcc761e52b539d11dcca3e '''textExtent'''] (char const *text) |
:Calculates text extension in pixels. | :Calculates text extension in pixels. | ||
|- | |- | ||
− | |void waitCompletion (bool waitVSync=true) | + | |void [http://www.fabglib.org/classfabgl_1_1_canvas_a0b366edca7302c95aa628529545453ea.html#a0b366edca7302c95aa628529545453ea '''waitCompletion'''] (bool waitVSync=true) |
:Waits for drawing queue to become empty. | :Waits for drawing queue to become empty. | ||
|} | |} | ||
182行目: | 182行目: | ||
== Detailed Description == | == Detailed Description == | ||
− | + | 一連の描画メソッドを持つクラス。 | |
− | + | このクラスは、ディスプレイコントローラに直接接続し、線や円などをペイントしたり、領域をスクロールしたり、長方形をコピーしたり、グリフを描画したりするための一連のプリミティブを提供します。 | |
− | + | ||
+ | デフォルトの原点は左上にあり、 (0, 0) から ([http://www.fabglib.org/classfabgl_1_1_canvas.html '''Canvas'''] Width-1, [http://www.fabglib.org/classfabgl_1_1_canvas.html '''Canvas'''] Height-1) までです。 | ||
Example: | Example: |
2022年3月22日 (火) 23:41時点における版
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 ()
|
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 ()
|
FontInfo const * getFontInfo ()
|
int getHeight ()
|
Point getOrigin ()
|
RGB888 getPixel (int X, int Y)
|
int getWidth ()
|
void invertRectangle (int X1, int Y1, int X2, int Y2)
|
void invertRectangle (Rect const &rect)
|
void lineTo (int X, int Y)
|
void moveTo (int X, int Y)
|
void reset ()
|
void resetGlyphOptions ()
|
void resetPaintOptions ()
|
void scroll (int offsetX, int offsetY)
|
void selectFont (FontInfo const *fontInfo)
|
void setBrushColor (uint8_t red, uint8_t green, uint8_t blue)
|
void setBrushColor (Color color)
|
void setBrushColor (RGB888 const &color)
|
void setClippingRect (Rect const &rect)
|
void setGlyphOptions (GlyphOptions options)
|
void setLineEnds (LineEnds value)
|
void setOrigin (int X, int Y)
|
void setOrigin (Point const &origin)
|
void setPaintOptions (PaintOptions options)
|
void setPenColor (uint8_t red, uint8_t green, uint8_t blue)
|
void setPenColor (Color color)
|
void setPenColor (RGB888 const &color)
|
void setPenWidth (int value)
|
void setPixel (int X, int Y)
|
void setPixel (int X, int Y, RGB888 const &color)
|
void setPixel (Point const &pos, RGB888 const &color)
|
void setScrollingRegion (int X1, int Y1, int X2, int Y2)
|
void swapBuffers ()
|
void swapRectangle (int X1, int Y1, int X2, int Y2)
|
int textExtent (FontInfo const *fontInfo, char const *text)
|
int textExtent (char const *text)
|
void waitCompletion (bool waitVSync=true)
|
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);
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.
このクラスのドキュメントは、次のファイルから生成されました。