#include "./././lv_examples.h" #if LV_USE_IMG #define SLIDER_WIDTH 20 static void create_sliders ( void ) static void slider_event_cb ( lv_obj_t * slider, lv_event_t event ) static lv_obj_t * red_slider, * green_slider, * blue_slider, * intense_slider static lv_obj_t * img1 LV_IMG_DECLARE ( img_cogwheel_argb ) void lv_ex_img_2 ( void ) ) def slider_event_cb ( slider, event ): if event = lv. That is lv_obj_get_width/height/x/y() will returned the original, non-zoomed coordinates. Note that, the real coordinates of image object won't change during transformation. In other words transformations work only on true color images stored as C array, or if a custom Image decoder returns the whole image. Therefore indexed images ( LV_IMG_CF_INDEXED_.), alpha only images ( LV_IMG_CF_ALPHA_.) or images from files can not be transformed. The transformations require the whole image to be available. With enabled anti-aliasing the transformations has a higher quality but they are slower. The quality of the transformation can be adjusted with lv_img_set_antialias(img, true/false). It can be changed with lv_img_set_pivot(img, pivot_x, pivot_y). Angle has 0.1 degree precision, so for 45.8° set 458.īy default, the pivot point of the rotation is the center of the image. To rotate the image use lv_img_set_angle(img, angle). 128 half size).įractional scale works as well. 512 double size), a smaller value shrinks it (e.g. Set factor to 256 or LV_IMG_ZOOM_NONE to disable zooming.Ī larger value enlarges the images (e.g. Using the lv_img_set_zoom(img, factor) the images will be zoomed. You can set symbol like lv_img_set_src(img1, LV_SYMBOL_OK). It enables to use of light-weighted mono-color In this case, the image will be rendered as text according to the font specified in the style. You can set a symbol similarly to Labels. To set an image sourced from a file, use lv_img_set_src(img, "S:folder1/my_img.bin"). ![]() ![]() You also need to use LVGL's file system module and register a driver with some functions for the basic file operation. To use external files, you also need to convert the image files using the online converter tool but now you should select the binary Output format. To make the variable visible in the C file, you need to declare it with LV_IMG_DECLARE(converted_img_var). To generate a pixel array from a PNG, JPG or BMP image, use the Online image converter tool and set the converted image with its pointer: lv_img_set_src(img1, &converted_img_var) To set the source of an image, use lv_img_set_src(img, src). To provide maximum flexibility, the source of the image can be:Ī variable in the code (a C array with the pixels).Ī file stored externally (like on an SD card).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |