I want to find...

Search

Shares

Table of Content

86HMI::Image

[Primitives widgets]

Object Functions

Image object. Users can design and add images to the image file resource and call them up.

86hmi-img-1

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.

Note:
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.

86hmi-img-2

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()

Description

Set Image Hidden Parameters.

Syntax

void setImageHidden(lv_obj_t* id, bool hidden);
void setImageHidden(char* name, bool hidden);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] hidden
    Bool. Image Hidden Parameters.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImageHidden(p1img1, 100);
}

void loop() {
  // ...
}

setImageRotate()

Description

Set Image Rotate Parameters.

Syntax

void setImageRotate(lv_obj_t* id, double v);
void setImageRotate(char* name, double v);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] v
    Image Rotate Parameters.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImageRotate(p1img1, 180);
}

void loop() {
  // ...
}

setImageZoom()

Description

Set Image Zoom Parameters.

Syntax

void setImageZoom(lv_obj_t* id, double v);
void setImageZoom(char* name, double v);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] v
    Image Zoom Parameters.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImageZoom(p1img1, 1.5);
}

void loop() {
  // ...
}

setImagePos()

Description

Set Image Position Parameters.

Syntax

void setImagePos(lv_obj_t* id, int32_t x, int32_t y);
void setImagePos(char* name, int32_t x, int32_t y);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] x
    Image X coordinate.
  • [in] y
    Image Y coordinate.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImagePos(p1img1, 0, 0);
}

void loop() {
  // ...
}

setImageX()

Description

Set Image X coordinate Parameters.

Syntax

void setImageX(lv_obj_t* id, int32_t x);
void setImageX(char* name, int32_t x);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] x
    Image X coordinate.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImageX(p1img1, 0);
}

void loop() {
  // ...
}

setImageY()

Description

Set Image Y coordinate Parameters.

Syntax

void setImageY(lv_obj_t* id, int32_t y);
void setImageY(char* name, int32_t y);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] y
    Image Y coordinate.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImageY(p1img1, 0);
}

void loop() {
  // ...
}

get images()

Description

Get Image X coordinate.

Syntax

int32_t getImageX(lv_obj_t* id);
int32_t getImageX(char* name);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.

Return

Image X coordinate.

Example

#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()

Description

Get Image Y coordinate.

Syntax

int32_t getImageY(lv_obj_t* id);
int32_t getImageY(char* name);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.

Return

Image Y coordinate.

Example

#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 Editor User Manual for more instructions on 86HMI widgets and API usage.

Leave a Comment

Scroll to Top