App:Library:LVGL:docs:Widgets:Canvas (lv canvas)

提供: robot-jp wiki
ナビゲーションに移動検索に移動

https://docs.lvgl.io/8.2/widgets/core/arc.html

Canvas (lv_canvas)

Overview

英文 自動翻訳

A Canvas inherits from Image where the user can draw anything. Rectangles, texts, images, lines, arcs can be drawn here using lvgl's drawing engine. Additionally "effects" can be applied, such as rotation, zoom and blur.

Canvasは、ユーザーが何でも描画できるImageから継承します。長方形、テキスト、画像、線、円弧は、lvglの描画エンジンを使用してここに描画できます。さらに、回転、ズーム、ぼかしなどの「効果」を適用できます。
戻る : Previous


Parts and Styles

英文 自動翻訳

LV_PART_MAIN Uses the typical rectangle style properties and image style properties.

LV_PART_MAIN一般的な長方形スタイルのプロパティと画像スタイルのプロパティを使用します。
戻る : Previous


Usage

Buffer

英文 自動翻訳

The Canvas needs a buffer in which stores the drawn image.

To assign a buffer to a Canvas, use lv_canvas_set_buffer(canvas, buffer, width, height, LV_IMG_CF_...).

Where buffer is a static buffer (not just a local variable) to hold the image of the canvas.

For example, static lv_color_t buffer[LV_CANVAS_BUF_SIZE_TRUE_COLOR(width, height)].


LV_CANVAS_BUF_SIZE_... macros help to determine the size of the buffer with different color formats.


The canvas supports all the built-in color formats like LV_IMG_CF_TRUE_COLOR or LV_IMG_CF_INDEXED_2BIT.

See the full list in the Color formats section.

Canvasには、描画された画像を格納するバッファが必要です。

Canvasにバッファを割り当てるには、lv_canvas_set_buffer(canvas, buffer, width, height, LV_IMG_CF_...)を使用します。

bufferは静的バッファ(ローカル変数だけでなく)であるため、キャンバスの画像を保持します。

たとえば、static lv_color_t buffer[LV_CANVAS_BUF_SIZE_TRUE_COLOR(width, height)]


LV_CANVAS_BUF_SIZE_...マクロは、さまざまなカラー形式でバッファのサイズを決定するのに役立ちます。


キャンバスは、LV_IMG_CF_TRUE_COLORまたはLV_IMG_CF_INDEXED_2BITのような、すべての組み込みカラーフォーマットをサポートします。

「カラーフォーマット」セクションの完全なリストを参照してください。

戻る : Previous


Indexed colors

英文 自動翻訳

For LV_IMG_CF_INDEXED_1/2/4/8 color formats a palette needs to be initialized with lv_canvas_set_palette(canvas, 3, LV_COLOR_RED).

It sets pixels with index=3 to red.

LV_IMG_CF_INDEXED_1/2/4/8のカラーフォーマットのためには、パレットはlv_canvas_set_palette(canvas, 3, LV_COLOR_RED)で初期化する必要があります。

index=3でピクセルを赤に設定します。

戻る : Previous


Drawing

英文 自動翻訳

To set a pixel's color on the canvas, use lv_canvas_set_px_color(canvas, x, y, LV_COLOR_RED). With LV_IMG_CF_INDEXED_... the index of the color needs to be passed as color. E.g. lv_color_t cc.full = 3;


To set a pixel's opacity with LV_IMG_CF_TRUE_COLOR_ALPHA or LV_IMG_CF_ALPHA_... format on the canvas, use lv_canvas_set_px_opa(canvas, x, y, opa).

lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50) fills the whole canvas to blue with 50% opacity.


Note that if the current color format doesn't support colors (e.g. LV_IMG_CF_ALPHA_2BIT) the color will be ignored.


Similarly, if opacity is not supported (e.g. LV_IMG_CF_TRUE_COLOR) it will be ignored.

An array of pixels can be copied to the canvas with lv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height). The color format of the buffer and the canvas need to match.


To draw something to the canvas use

  • lv_canvas_draw_rect(canvas, x, y, width, heigth, &draw_dsc)
  • lv_canvas_draw_text(canvas, x, y, max_width, &draw_dsc, txt)
  • lv_canvas_draw_img(canvas, x, y, &img_src, &draw_dsc)
  • lv_canvas_draw_line(canvas, point_array, point_cnt, &draw_dsc)
  • lv_canvas_draw_polygon(canvas, points_array, point_cnt, &draw_dsc)
  • lv_canvas_draw_arc(canvas, x, y, radius, start_angle, end_angle, &draw_dsc)


draw_dsc is a lv_draw_rect/label/img/line/arc_dsc_t variable which should be first initialized with one of lv_draw_rect/label/img/line/arc_dsc_init() and then modified with the desired colors and other values.


The draw function can draw to any color format.

For example, it's possible to draw a text to an LV_IMG_VF_ALPHA_8BIT canvas and use the result image as a draw mask later.

キャンバスにピクセルの色を設定するには、lv_canvas_set_px_color(canvas, x, y, LV_COLOR_RED)を使用します。

色のインデックスでLV_IMG_CF_INDEXED_...色として渡す必要があります。

例えばlv_color_t cc.full = 3;

キャンバス上でピクセルの不透明度LV_IMG_CF_TRUE_COLOR_ALPHAまたはフォーマットを設定するには、を使用します。 LV_IMG_CF_ALPHA_...lv_canvas_set_px_opa(canvas, x, y, opa)

lv_canvas_fill_bg(canvas, LV_COLOR_BLUE, LV_OPA_50)キャンバス全体を50%の不透明度で青に塗りつぶします。現在のカラーフォーマットがカラーをサポートしていない場合(例LV_IMG_CF_ALPHA_2BIT)、カラーは無視されることに注意してください。同様に、不透明度がサポートされていない場合(たとえばLV_IMG_CF_TRUE_COLOR)、不透明度は無視されます。

ピクセルの配列は、を使用してキャンバスにコピーできますlv_canvas_copy_buf(canvas, buffer_to_copy, x, y, width, height)。バッファとキャンバスのカラーフォーマットは一致している必要があります。

キャンバスに何かを描くには、

  • lv_canvas_draw_rect(canvas, x, y, width, heigth, &draw_dsc)
  • lv_canvas_draw_text(canvas, x, y, max_width, &draw_dsc, txt)
  • lv_canvas_draw_img(canvas, x, y, &img_src, &draw_dsc)
  • lv_canvas_draw_line(canvas, point_array, point_cnt, &draw_dsc)
  • lv_canvas_draw_polygon(canvas, points_array, point_cnt, &draw_dsc)
  • lv_canvas_draw_arc(canvas, x, y, radius, start_angle, end_angle, &draw_dsc)


draw_dscは、最初にlv_draw_rect/label/img/line/arc_dsc_init()のいずれかで初期化すべき変数 lv_draw_rect/label/img/line/arc_dsc_tであり、その後、任意の色や他の値に変更できます。


描画機能はどんなカラーフォーマットに対してでも描画できます。

例えば、LV_IMG_VF_ALPHA_8BITキャンバスにテキストを描画し、後でその結果の画像を描画マスクとして使用することができます。

戻る : Previous


Transformations

英文 自動翻訳

lv_canvas_transform() can be used to rotate and/or scale the image of an image and store the result on the canvas. The function needs the following parameters:

  • canvas pointer to a canvas object to store the result of the transformation.
  • img pointer to an image descriptor to transform. Can be the image descriptor of another canvas too (lv_canvas_get_img()).
  • angle the angle of rotation (0..3600), 0.1 deg resolution
  • zoom zoom factor (256: no zoom, 512: double size, 128: half size);
  • offset_x offset X to tell where to put the result data on destination canvas
  • offset_y offset X to tell where to put the result data on destination canvas
  • pivot_x pivot X of rotation. Relative to the source canvas. Set to source width / 2 to rotate around the center
  • pivot_y pivot Y of rotation. Relative to the source canvas. Set to source height / 2 to rotate around the center
  • antialias true: apply anti-aliasing during the transformation. Looks better but slower.

Note that a canvas can't be rotated on itself. You need a source and destination canvas or image.

lv_canvas_transform()画像の画像を回転および/または拡大縮小し、結果をキャンバスに保存するために使用できます。この関数には次のパラメーターが必要です。
  • canvas変換の結果を格納するためのキャンバスオブジェクトへのポインタ。
  • img pointer変換する画像記述子に。別のキャンバスの画像記述子にすることもできます(lv_canvas_get_img())。
  • angle回転角(0..3600)、0.1度の分解能
  • zoomズーム率(256:ズームなし、512:ダブルサイズ、128:ハーフサイズ);
  • offset_x結果データを宛先キャンバスのどこに配置するかを示すオフセットX
  • offset_y結果データを宛先キャンバスのどこに配置するかを示すオフセットX
  • pivot_x回転のピボットX。ソースキャンバスを基準にしています。source width / 2中心を中心に回転するように設定
  • pivot_y回転のピボットY。ソースキャンバスを基準にしています。source height / 2中心を中心に回転するように設定
  • antialiastrue:変換中にアンチエイリアシングを適用します。見た目は良くなりますが遅くなります。

キャンバス自体は回転できないことに注意してください。ソースと宛先のキャンバスまたは画像が必要です。

戻る : Previous


Blur

英文 自動翻訳

A given area of the canvas can be blurred horizontally with lv_canvas_blur_hor(canvas, &area, r) or vertically with lv_canvas_blur_ver(canvas, &area, r).

r is the radius of the blur (greater value means more intensive burring).

area is the area where the blur should be applied (interpreted relative to the canvas).

キャンバスの特定の領域は、lv_canvas_blur_hor(canvas, &area, r)で水平方向に、またはlv_canvas_blur_ver(canvas, &area, r)で垂直方向にぼかすことができます。

rはブラーの半径です(値が大きいほど、より集中的なバーリングを意味します)。

areaはぼかしを適用する領域です(キャンバスを基準にして解釈されます)。

戻る : Previous


Events

英文 自動翻訳

No special events are sent by canvas objects. The same events are sent as for the

See the events of the Images too.

Learn more about Events.

キャンバスオブジェクトから特別なイベントが送信されることはありません。と同じイベントが送信されます

画像のイベントもご覧ください。

イベントの詳細をご覧ください。

戻る : Previous


Keys

英文 自動翻訳

No Keys are processed by the object type.

Learn more about Keys.

オブジェクトタイプによって処理される キーはありません。

キーの詳細をご覧ください。

戻る : Previous


Example

英文 自動翻訳

Drawing on the Canvas and rotate

LVGL docs example 059.png

Transparent Canvas with chroma keying

LVGL docs example 060.png

戻る : Previous


API

英文 自動翻訳

Functions

lv_obj_t *lv_canvas_create(lv_obj_t *parent)

Create a canvas object
Parameters
parent -- pointer to an object, it will be the parent of the new canvas
Returns
pointer to the created canvas

void lv_canvas_set_buffer(lv_obj_t *canvas, void *buf, lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)

Set a buffer for the canvas.
Parameters
  • buf -- a buffer where the content of the canvas will be. The required size is (lv_img_color_format_get_px_size(cf) * w) / 8 * h) It can be allocated with lv_mem_alloc() or it can be statically allocated array (e.g. static lv_color_t buf[100*50]) or it can be an address in RAM or external SRAM
  • canvas -- pointer to a canvas object
  • w -- width of the canvas
  • h -- height of the canvas
  • cf -- color format. LV_IMG_CF_...

void lv_canvas_set_px_color(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, lv_color_t c)

Set the color of a pixel on the canvas
Parameters
  • canvas --
  • x -- x coordinate of the point to set
  • y -- x coordinate of the point to set
  • c -- color of the pixel

static inline void lv_canvas_set_px(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, lv_color_t c)

DEPRECATED: added only for backward compatibility

void lv_canvas_set_px_opa(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, lv_opa_t opa)

Set the opacity of a pixel on the canvas
Parameters
  • canvas --
  • x -- x coordinate of the point to set
  • y -- x coordinate of the point to set
  • opa -- opacity of the pixel (0..255)

void lv_canvas_set_palette(lv_obj_t *canvas, uint8_t id, lv_color_t c)

Set the palette color of a canvas with index format. Valid only for LV_IMG_CF_INDEXED1/2/4/8
Parameters
  • canvas -- pointer to canvas object
  • id -- the palette color to set:
    • for LV_IMG_CF_INDEXED1: 0..1
    • for LV_IMG_CF_INDEXED2: 0..3
    • for LV_IMG_CF_INDEXED4: 0..15
    • for LV_IMG_CF_INDEXED8: 0..255
  • c -- the color to set

lv_color_t lv_canvas_get_px(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y)

Get the color of a pixel on the canvas
Parameters
  • canvas --
  • x -- x coordinate of the point to set
  • y -- x coordinate of the point to set
Returns
color of the point

lv_img_dsc_t *lv_canvas_get_img(lv_obj_t *canvas)

Get the image of the canvas as a pointer to an lv_img_dsc_t variable.
Parameters
canvas -- pointer to a canvas object
Returns
pointer to the image descriptor.

void lv_canvas_copy_buf(lv_obj_t *canvas, const void *to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h)

Copy a buffer to the canvas
Parameters
  • canvas -- pointer to a canvas object
  • to_copy -- buffer to copy. The color format has to match with the canvas's buffer color format
  • x -- left side of the destination position
  • y -- top side of the destination position
  • w -- width of the buffer to copy
  • h -- height of the buffer to copy

void lv_canvas_transform(lv_obj_t *canvas, lv_img_dsc_t *img, int16_t angle, uint16_t zoom, lv_coord_t offset_x, lv_coord_t offset_y, int32_t pivot_x, int32_t pivot_y, bool antialias)

Transform and image and store the result on a canvas.
Parameters
  • canvas -- pointer to a canvas object to store the result of the transformation.
  • img -- pointer to an image descriptor to transform. Can be the image descriptor of an other canvas too (lv_canvas_get_img()).
  • angle -- the angle of rotation (0..3600), 0.1 deg resolution
  • zoom -- zoom factor (256 no zoom);
  • offset_x -- offset X to tell where to put the result data on destination canvas
  • offset_y -- offset X to tell where to put the result data on destination canvas
  • pivot_x -- pivot X of rotation. Relative to the source canvas Set to source width / 2 to rotate around the center
  • pivot_y -- pivot Y of rotation. Relative to the source canvas Set to source height / 2 to rotate around the center
  • antialias -- apply anti-aliasing during the transformation. Looks better but slower.

void lv_canvas_blur_hor(lv_obj_t *canvas, const lv_area_t *area, uint16_t r)

Apply horizontal blur on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • area -- the area to blur. If NULL the whole canvas will be blurred.
  • r -- radius of the blur

void lv_canvas_blur_ver(lv_obj_t *canvas, const lv_area_t *area, uint16_t r)

Apply vertical blur on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • area -- the area to blur. If NULL the whole canvas will be blurred.
  • r -- radius of the blur

void lv_canvas_fill_bg(lv_obj_t *canvas, lv_color_t color, lv_opa_t opa)

Fill the canvas with color
Parameters
  • canvas -- pointer to a canvas
  • color -- the background color
  • opa -- the desired opacity

void lv_canvas_draw_rect(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h, const lv_draw_rect_dsc_t *draw_dsc)

Draw a rectangle on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • x -- left coordinate of the rectangle
  • y -- top coordinate of the rectangle
  • w -- width of the rectangle
  • h -- height of the rectangle
  • draw_dsc -- descriptor of the rectangle

void lv_canvas_draw_text(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, lv_coord_t max_w, lv_draw_label_dsc_t *draw_dsc, const char *txt)

Draw a text on the canvas.
Parameters
  • canvas -- pointer to a canvas object
  • x -- left coordinate of the text
  • y -- top coordinate of the text
  • max_w -- max width of the text. The text will be wrapped to fit into this size
  • draw_dsc -- pointer to a valid label descriptor lv_draw_label_dsc_t
  • txt -- text to display

void lv_canvas_draw_img(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, const void *src, const lv_draw_img_dsc_t *draw_dsc)

Draw an image on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • x -- left coordinate of the image
  • y -- top coordinate of the image
  • src -- image source. Can be a pointer an lv_img_dsc_t variable or a path an image.
  • draw_dsc -- pointer to a valid label descriptor lv_draw_img_dsc_t

void lv_canvas_draw_line(lv_obj_t *canvas, const lv_point_t points[], uint32_t point_cnt, const lv_draw_line_dsc_t *draw_dsc)

Draw a line on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • points -- point of the line
  • point_cnt -- number of points
  • draw_dsc -- pointer to an initialized lv_draw_line_dsc_t variable

void lv_canvas_draw_polygon(lv_obj_t *canvas, const lv_point_t points[], uint32_t point_cnt, const lv_draw_rect_dsc_t *draw_dsc)

Draw a polygon on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • points -- point of the polygon
  • point_cnt -- number of points
  • draw_dsc -- pointer to an initialized lv_draw_rect_dsc_t variable

void lv_canvas_draw_arc(lv_obj_t *canvas, lv_coord_t x, lv_coord_t y, lv_coord_t r, int32_t start_angle, int32_t end_angle, const lv_draw_arc_dsc_t *draw_dsc)

Draw an arc on the canvas
Parameters
  • canvas -- pointer to a canvas object
  • x -- origo x of the arc
  • y -- origo y of the arc
  • r -- radius of the arc
  • start_angle -- start angle in degrees
  • end_angle -- end angle in degrees
  • draw_dsc -- pointer to an initialized lv_draw_line_dsc_t variable

Variables

const lv_obj_class_t lv_canvas_class

struct lv_canvas_t

Public Members
lv_img_t img
lv_img_dsc_t dsc


機能

lv_obj_t * lv_canvas_create(lv_obj_t * parent)

キャンバスオブジェクトを作成する
パラメーター
parent-オブジェクトへのポインタ。新しいキャンバスの親になります
戻り値
作成されたキャンバスへのポインタ

void lv_canvas_set_buffer(lv_obj_t * canvas、void * buf、lv_coord_t w、lv_coord_t h、lv_img_cf_t cf)

キャンバスのバッファを設定します。
パラメーター
  • buf--キャンバスのコンテンツが配置されるバッファ。必要なサイズは(lv_img_color_format_get_px_size(cf)* w)/ 8 * h)は、lv_mem_alloc()で割り当てるか、静的に割り当てられる配列(たとえば、static lv_color_t buf [100 * 50])にするか、RAMまたは外部のアドレスにすることができます。 SRAM
  • キャンバス-キャンバスオブジェクトへのポインタ
  • w-キャンバスの幅
  • h-キャンバスの高さ
  • cf--カラーフォーマット。LV_IMG_CF_...

void lv_canvas_set_px_color(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、lv_color_t c)

キャンバス上のピクセルの色を設定します
パラメーター
  • キャンバス-
  • x-設定するポイントのx座標
  • y-設定するポイントのx座標
  • c-ピクセルの色

static inline void lv_canvas_set_px(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、lv_color_t c)

非推奨:下位互換性のためにのみ追加されました

void lv_canvas_set_px_opa(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、lv_opa_t opa)

キャンバス上のピクセルの不透明度を設定します
パラメーター
  • キャンバス -
  • x-設定するポイントのx座標
  • y-設定するポイントのx座標
  • opa-ピクセルの不透明度(0..255)

void lv_canvas_set_palette(lv_obj_t * canvas、uint8_t id、lv_color_t c)

キャンバスのパレットカラーをインデックス形式で設定します。のみ有効LV_IMG_CF_INDEXED1/2/4/8
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • id-設定するパレットの色:
    • の場合LV_IMG_CF_INDEXED1:0..1
    • の場合LV_IMG_CF_INDEXED2:0..3
    • の場合LV_IMG_CF_INDEXED4:0..15
    • の場合LV_IMG_CF_INDEXED8:0..255
  • c-設定する色

lv_color_t lv_canvas_get_px(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y)

キャンバス上のピクセルの色を取得します
パラメーター
  • キャンバス-
  • x-設定するポイントのx座標
  • y-設定するポイントのx座標
戻り値
ポイントの色

lv_img_dsc_t * lv_canvas_get_img(lv_obj_t * canvas)

Canvasは、ユーザーが何でも描画できるImageから継承します。lv_img_dsc_t変数へのポインタとしてキャンバスの画像を取得します。
パラメーター
キャンバス-キャンバスオブジェクトへのポインタ
戻り値
画像記述子へのポインタ。

void lv_canvas_copy_buf(lv_obj_t * canvas、const void * to_copy、lv_coord_t x、lv_coord_t y、lv_coord_t w、lv_coord_t h)

バッファをキャンバスにコピーします
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • to_copy-コピーするバッファ。カラーフォーマットは、キャンバスのバッファカラーフォーマットと一致する必要があります
  • x-宛先位置の左側
  • y-宛先位置の上面
  • w-コピーするバッファの幅
  • h-コピーするバッファの高さ

void lv_canvas_transform(lv_obj_t * canvas、lv_img_dsc_t * img、int16_t angle、uint16_t zoom、lv_coord_t offset_x、lv_coord_t offset_y、int32_tピボット_x、int32_tピボット_y、boolアンチエイリアス)

変換して画像化し、結果をキャンバスに保存します。
パラメーター
  • canvas-変換の結果を格納するためのcanvasオブジェクトへのポインタ。
  • img--変換する画像記述子へのポインタ。他のキャンバスの画像記述子にすることもできます(lv_canvas_get_img())。
  • 角度-回転角(0..3600)、0.1度の解像度
  • ズーム-ズーム係数(256ズームなし);
  • offset_x-結果データを宛先キャンバスのどこに配置するかを示すオフセットX
  • offset_y-結果データを宛先キャンバスのどこに配置するかを示すオフセットX
  • ivot_x-回転のピボットX。ソースキャンバスを基準にsource width / 2して、中心を中心に回転するように設定します
  • ivot_y-回転のピボットY。ソースキャンバスを基準にsource height / 2して、中心を中心に回転するように設定します
  • アンチエイリアス-変換中にアンチエイリアスを適用します。見た目は良くなりますが遅くなります。

void lv_canvas_blur_hor(lv_obj_t * canvas、const lv_area_t * area、uint16_t r)

キャンバスに水平方向のぼかしを適用します
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • area-ぼかす領域仮にNULLだと、キャンバス全体がぼやける。
  • r-ぼかしの半径

void lv_canvas_blur_ver(lv_obj_t * canvas、const lv_area_t * area、uint16_t r)

キャンバスに垂直方向のぼかしを適用します
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • area-ぼかす領域仮にNULLだと、キャンバス全体がぼやける。
  • r-ぼかしの半径

void lv_canvas_fill_bg(lv_obj_t * canvas、lv_color_t color、lv_opa_t opa)

キャンバスを色で塗りつぶします
パラメーター
  • キャンバス-キャンバスへのポインタ
  • -背景色
  • opa-目的の不透明度

void lv_canvas_draw_rect(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、lv_coord_t w、lv_coord_t h、const lv_draw_rect_dsc_t * draw_dsc)

キャンバスに長方形を描く
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • x-長方形の左座標
  • y-長方形の上部座標
  • w-長方形の幅
  • h-長方形の高さ
  • draw_dsc--長方形の記述子

void lv_canvas_draw_text(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、lv_coord_t max_w、lv_draw_label_dsc_t * draw_dsc、const char * txt)

キャンバスにテキストを描画します。
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • x-テキストの左座標
  • y-テキストの上部座標
  • max_w-テキストの最大幅。テキストはこのサイズに収まるように折り返されます
  • draw_dsc--有効なラベル記述子lv_draw_label_dsc_tへのポインタ
  • txt-表示するテキスト

void lv_canvas_draw_img(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、const void * src、const lv_draw_img_dsc_t * draw_dsc)

キャンバスに画像を描く
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • x-画像の左座標
  • y-画像の上部座標
  • src-画像ソース。ポインタ、変数lv_img_dsc_t、または画像のパスにすることができます。
  • draw_dsc--有効なラベル記述子lv_draw_img_dsc_tへのポインタ

void lv_canvas_draw_line(lv_obj_t * canvas、const lv_point_t points []、uint32_t point_cnt、const lv_draw_line_dsc_t * draw_dsc)

キャンバスに線を引く
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • ポイント-線のポイント
  • point_cnt-ポイント数
  • draw_dsc--Canvasは、ユーザーが何でも描画できるImageから継承します。初期化された変数lv_draw_line_dsc_tへのポインタ

void lv_canvas_draw_polygon(lv_obj_t * canvas、const lv_point_t points []、uint32_t point_cnt、const lv_draw_rect_dsc_t * draw_dsc)

キャンバスにポリゴンを描画します
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • ポイント-ポリゴンのポイント
  • point_cnt-ポイント数
  • draw_dsc--Canvasは、ユーザーが何でも描画できるImageから継承します。初期化された変数lv_draw_rect_dsc_tへのポインタ

void lv_canvas_draw_arc(lv_obj_t * canvas、lv_coord_t x、lv_coord_t y、lv_coord_t r、int32_t start_angle、int32_t end_angle、const lv_draw_arc_dsc_t * draw_dsc)

キャンバスに円弧を描く
パラメーター
  • キャンバス-キャンバスオブジェクトへのポインタ
  • x-弧のオリゴx
  • y-アークのオリゴy
  • r-円弧の半径
  • start_angle-開始角度(度単位)
  • end_angle-度単位の終了角度
  • draw_dsc--Canvasは、ユーザーが何でも描画できるImageから継承します。初期化された変数lv_draw_line_dsc_tへのポインタ

変数

const lv_obj_class_t lv_canvas_class

struct lv_canvas_t

パブリックメンバー
lv_img_t img
lv_img_dsc_t dsc


戻る : Previous