App:Library:LVGL:docs:Widgets:Arc (lv arc)

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

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

Arc (lv_arc)

Overview

英文 自動翻訳

The Arc consists of a background and a foreground arc.

The foreground (indicator) can be touch-adjusted.

アークは、背景と前景のアークで構成されています。

前景(インジケーター)はタッチ調整できます。

戻る : Previous


Parts and Styles

英文 自動翻訳
  • LV_PART_MAIN Draws a background using the typical background style properties and an arc using the arc style properties. The arc's size and position will respect the padding style properties.
  • LV_PART_INDICATOR Draws another arc using the arc style properties. Its padding values are interpreted relative to the background arc.
  • LV_PART_KNOB Draws a handle on the end of the indicator using all background properties and padding values. With zero padding the knob size is the same as the indicator's width. Larger padding makes it larger, smaller padding makes it smaller.
  • LV_PART_MAIN一般的な背景スタイルのプロパティを使用して背景を描画し、円弧スタイルのプロパティを使用して円弧を描画します。円弧のサイズと位置は、パディングスタイルのプロパティを尊重します。
  • LV_PART_INDICATOR前景(インジケーター)はタッチ調整できます。アークスタイルプロパティを使用して別のアークを描画します。そのパディング値は、背景の円弧を基準にして解釈されます。
  • LV_PART_KNOBすべての背景プロパティとパディング値を使用して、インジケーターの端にハンドルを描画します。パディングがゼロの場合、ノブのサイズはインジケーターの幅と同じになります。パディングを大きくすると大きくなり、パディングを小さくすると小さくなります。
戻る : Previous


Usage

Value and range

英文 自動翻訳

A new value can be set using lv_arc_set_value(arc, new_value).

The value is interpreted in a range (minimum and maximum values) which can be modified with lv_arc_set_range(arc, min, max).

The default range is 0..100.


The indicator arc is drawn on the main part's arc. This if the value is set to maximum the indicator arc will cover the entire "background" arc. To set the start and end angle of the background arc use the lv_arc_set_bg_angles(arc, start_angle, end_angle) functions or lv_arc_set_bg_start/end_angle(arc, angle).


Zero degrees is at the middle right (3 o'clock) of the object and the degrees are increasing in clockwise direction. The angles should be in the [0;360] range.

lv_arc_set_value(arc, new_value)を使用して新しい値を設定できます。

値は、lv_arc_set_range(arc, min, max)で変更できる範囲(最小値と最大値)で解釈されます。

デフォルトの範囲は0..100です。


インジケーターアークは本体のアークに描かれています。これは、値が最大に設定されている場合、インジケーターアークが「バックグラウンド」アーク全体をカバーします。背景円弧の開始角度と終了角度を設定するには、lv_arc_set_bg_angles(arc, start_angle, end_angle)関数またはlv_arc_set_bg_start/end_angle(arc, angle)を使用します。


ゼロ度はオブジェクトの右中央(3時)にあり、度は時計回りに増加しています。

角度は[0;360]の範囲内である必要があります。

戻る : Previous


Rotation

英文 自動翻訳

An offset to the 0 degree position can be added with lv_arc_set_rotation(arc, deg).

0度の位置へのオフセットは、lv_arc_set_rotation(arc, deg)で追加できます。
戻る : Previous


Mode

英文 自動翻訳

The arc can be one of the following modes:

  • LV_ARC_MODE_NORMAL The indicator arc is drawn from the minimum value to the current.
  • LV_ARC_MODE_REVERSE The indicator arc is drawn counter-clockwise from the maximum value to the current.
  • LV_ARC_MODE_SYMMETRICAL The indicator arc is drawn from the middle point to the current value.


The mode can be set by lv_arc_set_mode(arc, LV_ARC_MODE_...) and used only if the angle is set by lv_arc_set_value() or the arc is adjusted by finger.

アークは、次のいずれかのモードになります。
  • LV_ARC_MODE_NORMALインジケータアークは、最小値から電流まで描画されます。
  • LV_ARC_MODE_REVERSEインジケータアークは、最大値から電流まで反時計回りに描画されます。
  • LV_ARC_MODE_SYMMETRICALインジケータアークは、中間点から現在の値まで描画されます。


モードはlv_arc_set_mode(arc, LV_ARC_MODE_...)、角度を設定するlv_arc_set_value()か、円弧を指で調整する場合にのみ設定および使用できます。

戻る : Previous


Change rate

英文 自動翻訳

If the arc is pressed the current value will set with a limited speed according to the set change rate.

The change rate is defined in degree/second unit and can be set with lv_arc_set_change_rage(arc, rate)

アークが押されると、現在の値は設定された変化率に従って制限された速度で設定されます。

変化率は度/秒単位で定義され、lv_arc_set_change_rage(arc, rate)で設定できます。

戻る : Previous


Setting the indicator manually

英文 自動翻訳

It's also possible to set the angles of the indicator arc directly with lv_arc_set_angles(arc, start_angle, end_angle) function or lv_arc_set_start/end_angle(arc, start_angle).

In this case the set "value" and "mode" are ignored.


In other words, the angle and value settings are independent.

You should exclusively use one or the other.

Mixing the two might result in unintended behavior.

To make the arc non-adjustable, remove the style of the knob and make the object non-clickable:

 lv_obj_remove_style(arc, NULL, LV_PART_KNOB);
 lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE);


lv_arc_set_angles(arc, start_angle, end_angle)関数またはlv_arc_set_start/end_angle(arc, start_angle)を使用して、インジケータアークの角度を直接設定することもできます。

この場合、設定された「値」と「モード」は無視されます。


つまり、角度と値の設定は独立しています。

どちらか一方だけを使用する必要があります。

2つを混合すると、意図しない動作が発生する可能性があります。

円弧を調整できないようにするには、ノブのスタイルを削除し、オブジェクトをクリックできないようにします。

  lv_obj_remove_style arc  NULL  LV_PART_KNOB ; 
  lv_obj_clear_flag arc  LV_OBJ_FLAG_CLICKABLE ;
戻る : Previous


Advanced hit test

英文 自動翻訳

If the LV_OBJ_FLAG_ADV_HITTEST flag is enabled the arc can be clicked through in the middle. Clicks are recognized only on the ring of the background arc. lv_obj_set_ext_click_size() makes the sensitive area larger inside and outside with the given number of pixels.

フラグが有効になっている場合LV_OBJ_FLAG_ADV_HITTEST、アークは中央でクリックスルーできます。クリックは、背景の弧のリングでのみ認識されます。lv_obj_set_ext_click_size()与えられたピクセル数で、敏感な領域を内側と外側に大きくします。
戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED sent when the arc is pressed/dragged to set a new value.
  • LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END are sent with the following types:
    • LV_ARC_DRAW_PART_BACKGROUND The background arc.
      • part: LV_PART_MAIN
      • p1: center of the arc
      • radius: radius of the arc
      • arc_dsc
    • LV_ARC_DRAW_PART_FOREGROUND The foreground arc.
      • part: LV_PART_INDICATOR
      • p1: center of the arc
      • radius: radius of the arc
      • arc_dsc
    • LV_ARC_DRAW_PART_KNOB The knob
      • part: LV_PART_KNOB
      • draw_area: the area of the knob
      • rect_dsc:

See the events of the Base object too.

Learn more about Events.

  • LV_EVENT_VALUE_CHANGED新しい値を設定するためにアークが押された/ドラッグされたときに送信されます。
  • LV_EVENT_DRAW_PART_BEGINおよびLV_EVENT_DRAW_PART_ENDは、次のタイプで送信されます。
    • LV_ARC_DRAW_PART_BACKGROUND背景の弧。
      • part: LV_PART_MAIN
      • p1:弧の中心
      • radius:円弧の半径
      • arc_dsc
    • LV_ARC_DRAW_PART_FOREGROUND前景の弧。
      • part:LV_PART_INDICATOR
      • p1:弧の中心
      • radius:円弧の半径
      • arc_dsc
    • LV_ARC_DRAW_PART_KNOBノブ
      • part:LV_PART_KNOB
      • draw_area:ノブの面積
      • rect_dsc:

Baseオブジェクトのイベントも参照してください。

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

戻る : Previous


Keys

英文 自動翻訳
  • LV_KEY_RIGHT/UP Increases the value by one.
  • LV_KEY_LEFT/DOWN Decreases the value by one.

Learn more about Keys.

  • LV_KEY_RIGHT/UP値を1つ増やします。
  • LV_KEY_LEFT/DOWN値を1つ減らします。

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

戻る : Previous


Example

Simple Arc

英文 自動翻訳

LVGL docs example 044.png

Loader with Arc

LVGL docs example 045.png

戻る : Previous


API

英文 自動翻訳

Typedefs

typedef uint8_t lv_arc_mode_t

Enums

enum [anonymous]

Values:
enumerator LV_ARC_MODE_NORMAL
enumerator LV_ARC_MODE_SYMMETRICAL
enumerator LV_ARC_MODE_REVERSE

enum lv_arc_draw_part_type_t

type field in lv_obj_draw_part_dsc_t if class_p = lv_arc_class Used in LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END Values:
enumerator LV_ARC_DRAW_PART_BACKGROUND
The background arc
enumerator LV_ARC_DRAW_PART_FOREGROUND
The foreground arc
enumerator LV_ARC_DRAW_PART_KNOB
The knob

Functions

lv_obj_t *lv_arc_create(lv_obj_t *parent)

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

void lv_arc_set_start_angle(lv_obj_t *arc, uint16_t start)

Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
Parameters
  • arc -- pointer to an arc object
  • start -- the start angle

void lv_arc_set_end_angle(lv_obj_t *arc, uint16_t end)

Set the end angle of an arc. 0 deg: right, 90 bottom, etc.
Parameters
  • arc -- pointer to an arc object
  • end -- the end angle

void lv_arc_set_angles(lv_obj_t *arc, uint16_t start, uint16_t end)

Set the start and end angles
Parameters
  • arc -- pointer to an arc object
  • start -- the start angle
  • end -- the end angle

void lv_arc_set_bg_start_angle(lv_obj_t *arc, uint16_t start)

Set the start angle of an arc background. 0 deg: right, 90 bottom, etc.
Parameters
  • arc -- pointer to an arc object
  • start -- the start angle

void lv_arc_set_bg_end_angle(lv_obj_t *arc, uint16_t end)

Set the start angle of an arc background. 0 deg: right, 90 bottom etc.
Parameters
  • arc -- pointer to an arc object
  • end -- the end angle

void lv_arc_set_bg_angles(lv_obj_t *arc, uint16_t start, uint16_t end)

Set the start and end angles of the arc background
Parameters
  • arc -- pointer to an arc object
  • start -- the start angle
  • end -- the end angle

void lv_arc_set_rotation(lv_obj_t *arc, uint16_t rotation)

Set the rotation for the whole arc
Parameters
  • arc -- pointer to an arc object
  • rotation -- rotation angle

void lv_arc_set_mode(lv_obj_t *arc, lv_arc_mode_t type)

Set the type of arc.
Parameters
  • arc -- pointer to arc object
  • mode -- arc's mode

void lv_arc_set_value(lv_obj_t *arc, int16_t value)

Set a new value on the arc
Parameters
  • arc -- pointer to an arc object
  • value -- new value

void lv_arc_set_range(lv_obj_t *arc, int16_t min, int16_t max)

Set minimum and the maximum values of an arc
Parameters
  • arc -- pointer to the arc object
  • min -- minimum value
  • max -- maximum value

void lv_arc_set_change_rate(lv_obj_t *arc, uint16_t rate)

Set a change rate to limit the speed how fast the arc should reach the pressed point.
Parameters
  • arc -- pointer to an arc object
  • rate -- the change rate

uint16_t lv_arc_get_angle_start(lv_obj_t *obj)

Get the start angle of an arc.
Parameters
arc -- pointer to an arc object
Returns
the start angle [0..360]

uint16_t lv_arc_get_angle_end(lv_obj_t *obj)

Get the end angle of an arc.
Parameters
arc -- pointer to an arc object
Returns
the end angle [0..360]

uint16_t lv_arc_get_bg_angle_start(lv_obj_t *obj)

Get the start angle of an arc background.
Parameters
arc -- pointer to an arc object
Returns
the start angle [0..360]

uint16_t lv_arc_get_bg_angle_end(lv_obj_t *obj)

Get the end angle of an arc background.
Parameters
arc -- pointer to an arc object
Returns
the end angle [0..360]

int16_t lv_arc_get_value(const lv_obj_t *obj)

Get the value of an arc
Parameters
arc -- pointer to an arc object
Returns
the value of the arc

int16_t lv_arc_get_min_value(const lv_obj_t *obj)

Get the minimum value of an arc
Parameters
arc -- pointer to an arc object
Returns
the minimum value of the arc

int16_t lv_arc_get_max_value(const lv_obj_t *obj)

Get the maximum value of an arc
Parameters
arc -- pointer to an arc object
Returns
the maximum value of the arc

lv_arc_mode_t lv_arc_get_mode(const lv_obj_t *obj)

Get whether the arc is type or not.
Parameters
arc -- pointer to an arc object
Returns
arc's mode

Variables

const lv_obj_class_t lv_arc_class

struct lv_arc_t

Public Members
lv_obj_t obj
uint16_t rotation
uint16_t indic_angle_start
uint16_t indic_angle_end
uint16_t bg_angle_start
uint16_t bg_angle_end
int16_t value
int16_t min_value
int16_t max_value
uint16_t dragging
uint16_t type
uint16_t min_close
uint16_t chg_rate
uint32_t last_tick
int16_t last_angle


Typedef

typedef uint8_t lv_arc_mode_t

列挙型

列挙型[匿名]

値:
列挙子LV_ARC_MODE_NORMAL
列挙子LV_ARC_MODE_SYMMETRICAL
列挙子LV_ARC_MODE_REVERSE

列挙型lv_arc_draw_part_type_t

type使用されるlv_obj_draw_part_dsc_t場合のフィールドと値:class_p = lv_arc_class関数またはを使用して、インジケータアークの角度を直接設定することもできLV_EVENT_DRAW_PART_BEGIN関数またはを使用して、インジケータアークの角度を直接設定することもできLV_EVENT_DRAW_PART_END
列挙子LV_ARC_DRAW_PART_BACKGROUND
背景アーク
列挙子LV_ARC_DRAW_PART_FOREGROUND
前景の弧
列挙子LV_ARC_DRAW_PART_KNOB
つまみ

機能

lv_obj_t * lv_arc_create(lv_obj_t * parent)

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

void lv_arc_set_start_angle(lv_obj_t * arc、uint16_t start)

円弧の開始角度を設定します。0度:右、下90など。
パラメーター
  • arc-アークオブジェクトへのポインタ
  • start-開始角度

void lv_arc_set_end_angle(lv_obj_t * arc、uint16_t end)

円弧の終了角度を設定します。0度:右、下90など。
パラメーター
  • arc-アークオブジェクトへのポインタ
  • end-終了角度

void lv_arc_set_angles(lv_obj_t * arc、uint16_t start、uint16_t end)

開始角度と終了角度を設定します
パラメーター
  • arc-アークオブジェクトへのポインタ
  • start-開始角度
  • end-終了角度

void lv_arc_set_bg_start_angle(lv_obj_t * arc、uint16_t start)

円弧の背景の開始角度を設定します。0度:右、下90など。
パラメーター
  • arc-アークオブジェクトへのポインタ
  • start-開始角度

void lv_arc_set_bg_end_angle(lv_obj_t * arc、uint16_t end)

円弧の背景の開始角度を設定します。0度:右、90下など。
パラメーター
  • arc-アークオブジェクトへのポインタ
  • end-終了角度

void lv_arc_set_bg_angles(lv_obj_t * arc、uint16_t start、uint16_t end)

円弧の背景の開始角度と終了角度を設定します
パラメーター
  • arc-アークオブジェクトへのポインタ
  • start-開始角度
  • end-終了角度

void lv_arc_set_rotation(lv_obj_t * arc、uint16_trotation)

円弧全体の回転を設定します
パラメーター
  • arc-アークオブジェクトへのポインタ
  • 回転-回転角

void lv_arc_set_mode(lv_obj_t * arc、lv_arc_mode_t type)

アークのタイプを設定します。
パラメーター
  • arc-アークオブジェクトへのポインタ
  • モード-アークのモード

void lv_arc_set_value(lv_obj_t * arc、int16_t value)

アークに新しい値を設定します
パラメーター
  • arc-アークオブジェクトへのポインタ
  • -新しい値

void lv_arc_set_range(lv_obj_t * arc、int16_t min、int16_t max)

円弧の最小値と最大値を設定します
パラメーター
  • arc-アークオブジェクトへのポインタ
  • min-最小
  • max-最大値

void lv_arc_set_change_rate(lv_obj_t * arc、uint16_t rate)

変更率を設定して、アークが押されたポイントに到達する速度を制限します。
パラメーター
  • arc-アークオブジェクトへのポインタ
  • レート-変更レート

uint16_t lv_arc_get_angle_start(lv_obj_t * obj)

円弧の開始角度を取得します。
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
開始角度[0..360]

uint16_t lv_arc_get_angle_end(lv_obj_t * obj)

円弧の終了角度を取得します。
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
終了角度[0..360]

uint16_t lv_arc_get_bg_angle_start(lv_obj_t * obj)

円弧の背景の開始角度を取得します。
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
開始角度[0..360]

uint16_t lv_arc_get_bg_angle_end(lv_obj_t * obj)

円弧の背景の終了角度を取得します。
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
終了角度[0..360]

int16_t lv_arc_get_value(const lv_obj_t * obj)

アークの値を取得する
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
アークの値

int16_t lv_arc_get_min_value(const lv_obj_t * obj)

円弧の最小値を取得します
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
アークの最小値

int16_t lv_arc_get_max_value(const lv_obj_t * obj)

円弧の最大値を取得する
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
アークの最大値

lv_arc_mode_t lv_arc_get_mode(const lv_obj_t * obj)

アークがタイプかどうかを取得します。
パラメーター
arc-アークオブジェクトへのポインタ
戻り値
アークのモード

変数

const lv_obj_class_t lv_arc_class

struct lv_arc_t

パブリックメンバー
lv_obj_t obj
uint16_tローテーション
uint16_t indic_angle_start
uint16_t indic_angle_end
uint16_t bg_angle_start
uint16_t bg_angle_end
int16_t値
int16_t min_value
int16_t max_value
uint16_tドラッグ
uint16_tタイプ
uint16_t min_close
uint16_t chg_rate
uint32_t last_tick
int16_t last_angle


戻る : Previous