[Primitives widgets]
Object Functions
Image object. Users can design and add images to the image file resource and call them up.

To use the Image object, you need to add the required image file to the image file resource and select the image file you want to use from the ImageSource in the property grid.
注意:
Since the image files are not directly zoomed in or out on 86HMI. Users need to edit the image files beforehand to meet the required size for displaying on the HMI screen.
Image Properties.

Identifier:
- ID: Unique number that identifies the object.
- Name: User-definable name for the object. It can be used with 86HMI API.
Content:
- ImageSource: Image file source selection. For a description of the image source, see Image File Resource.
Geometry:
- X: Object X coordinate.
- Y: Object Y coordinate.
- Width: Object width. It cannot be adjusted by default.
- Height: Object height. It cannot be adjusted by default.
Options:
- Hidden: By default, the image is hidden or displayed during boot-up. The 86HMI API can set this.
- Opacity: Image object opacity ratio.
- Order: Object order. It can adjust the object order by up/down, which can be viewed on the Object List.
API Functions
setImageHidden()
描述
Set Image Hidden Parameters.
語法
void setImageHidden(lv_obj_t* id, bool hidden);
void setImageHidden(char* name, bool hidden);
參數
[in] id
Object ID.[in] name
Object Name.[in] hidden
Bool. Image Hidden Parameters.
Return
無
範例
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setImageHidden(p1img1, 100); } void loop() { // ... }
setImageRotate()
描述
Set Image Rotate Parameters.
語法
void setImageRotate(lv_obj_t* id, double v);
void setImageRotate(char* name, double v);
參數
[in] id
Object ID.[in] name
Object Name.[in] v
Image Rotate Parameters.
Return
無
範例
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setImageRotate(p1img1, 180); } void loop() { // ... }
setImageZoom()
描述
Set Image Zoom Parameters.
語法
void setImageZoom(lv_obj_t* id, double v);
void setImageZoom(char* name, double v);
參數
[in] id
Object ID.[in] name
Object Name.[in] v
Image Zoom Parameters.
Return
無
範例
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setImageZoom(p1img1, 1.5); } void loop() { // ... }
setImagePos()
描述
Set Image Position Parameters.
語法
void setImagePos(lv_obj_t* id, int32_t x, int32_t y);
void setImagePos(char* name, int32_t x, int32_t y);
參數
[in] id
Object ID.[in] name
Object Name.[in] x
Image X coordinate.[in] y
Image Y coordinate.
Return
無
範例
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setImagePos(p1img1, 0, 0); } void loop() { // ... }
setImageX()
描述
Set Image X coordinate Parameters.
語法
void setImageX(lv_obj_t* id, int32_t x);
void setImageX(char* name, int32_t x);
參數
[in] id
Object ID.[in] name
Object Name.[in] x
Image X coordinate.
Return
無
範例
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setImageX(p1img1, 0); } void loop() { // ... }
setImageY()
描述
Set Image Y coordinate Parameters.
語法
void setImageY(lv_obj_t* id, int32_t y);
void setImageY(char* name, int32_t y);
參數
[in] id
Object ID.[in] name
Object Name.[in] y
Image Y coordinate.
Return
無
範例
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setImageY(p1img1, 0); } void loop() { // ... }
get images()
描述
Get Image X coordinate.
語法
int32_t getImageX(lv_obj_t* id);
int32_t getImageX(char* name);
參數
[in] id
Object ID.[in] name
Object Name.
Return
Image X coordinate.
範例
#include "myhmi.h" void setup() { Serial.begin(115200); while (!Serial); Hmi.begin(); // put your setup code here, to run once: Serial.print("Image X: "); Serial.println(Hmi.getImageX(p1img1)); } void loop() { // ... }
getImageY()
描述
Get Image Y coordinate.
語法
int32_t getImageY(lv_obj_t* id);
int32_t getImageY(char* name);
參數
[in] id
Object ID.[in] name
Object Name.
Return
Image Y coordinate.
範例
#include "myhmi.h" void setup() { Serial.begin(115200); while (!Serial); Hmi.begin(); // put your setup code here, to run once: Serial.print("Image Y: "); Serial.println(Hmi.getImageY(p1img1)); } void loop() { // ... }
Please see the 86HMI 編輯器使用手冊 for more instructions on 86HMI widgets and API usage.