refactor(image): rename align to inner_align (#5560)
This commit is contained in:
committed by
GitHub
parent
5dc2f7e1cc
commit
8754d4d8be
@@ -78,7 +78,7 @@ static void moving_wallpaper_cb(void)
|
|||||||
lv_obj_t * img = lv_img_create(lv_screen_active());
|
lv_obj_t * img = lv_img_create(lv_screen_active());
|
||||||
lv_obj_set_size(img, lv_pct(150), lv_pct(150));
|
lv_obj_set_size(img, lv_pct(150), lv_pct(150));
|
||||||
lv_image_set_src(img, &img_benchmark_cogwheel_rgb);
|
lv_image_set_src(img, &img_benchmark_cogwheel_rgb);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
shake_anim(img, - lv_display_get_vertical_resolution(NULL) / 3);
|
shake_anim(img, - lv_display_get_vertical_resolution(NULL) / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
lvgl.h
3
lvgl.h
@@ -115,7 +115,8 @@ extern "C" {
|
|||||||
|
|
||||||
#include "src/drivers/lv_drivers.h"
|
#include "src/drivers/lv_drivers.h"
|
||||||
|
|
||||||
#include "src/lv_api_map.h"
|
#include "src/lv_api_map_v8.h"
|
||||||
|
#include "src/lv_api_map_v9_0.h"
|
||||||
|
|
||||||
#include "src/core/lv_global.h"
|
#include "src/core/lv_global.h"
|
||||||
/*********************
|
/*********************
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ static void lv_barcode_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob
|
|||||||
barcode->light_color = lv_color_white();
|
barcode->light_color = lv_color_white();
|
||||||
barcode->scale = 1;
|
barcode->scale = 1;
|
||||||
barcode->direction = LV_DIR_HOR;
|
barcode->direction = LV_DIR_HOR;
|
||||||
lv_image_set_align(obj, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(obj, LV_IMAGE_ALIGN_TILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lv_barcode_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
static void lv_barcode_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
/**
|
/**
|
||||||
* @file lv_api_map.h
|
* @file lv_api_map_v8.h
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LV_API_MAP_H
|
#ifndef LV_API_MAP_V8_H
|
||||||
#define LV_API_MAP_H
|
#define LV_API_MAP_V8_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -263,4 +263,4 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
|
|||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*LV_API_MAP_H*/
|
#endif /*LV_API_MAP_V8_H*/
|
||||||
48
src/lv_api_map_v9_0.h
Normal file
48
src/lv_api_map_v9_0.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* @file lv_api_map_v9_0.h
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LV_API_MAP_V9_0_H
|
||||||
|
#define LV_API_MAP_V9_0_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* INCLUDES
|
||||||
|
*********************/
|
||||||
|
#include "../lvgl.h"
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* DEFINES
|
||||||
|
*********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* TYPEDEFS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* GLOBAL PROTOTYPES
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* MACROS
|
||||||
|
**********************/
|
||||||
|
#define lv_image_set_align lv_image_set_inner_align
|
||||||
|
#define lv_image_get_align lv_image_get_inner_align
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* MACROS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* DEPRECATED FUNCTIONS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /*extern "C"*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*LV_API_MAP_V9_0_H*/
|
||||||
@@ -84,8 +84,8 @@ static const lv_property_ops_t properties[] = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
.id = LV_PROPERTY_IMAGE_ALIGN,
|
.id = LV_PROPERTY_IMAGE_ALIGN,
|
||||||
.setter = lv_image_set_align,
|
.setter = lv_image_set_inner_align,
|
||||||
.getter = lv_image_get_align,
|
.getter = lv_image_get_inner_align,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -413,7 +413,7 @@ void lv_image_set_antialias(lv_obj_t * obj, bool antialias)
|
|||||||
lv_obj_invalidate(obj);
|
lv_obj_invalidate(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_image_set_align(lv_obj_t * obj, lv_image_align_t align)
|
void lv_image_set_inner_align(lv_obj_t * obj, lv_image_align_t align)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ bool lv_image_get_antialias(lv_obj_t * obj)
|
|||||||
return img->antialias ? true : false;
|
return img->antialias ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_image_align_t lv_image_get_align(lv_obj_t * obj)
|
lv_image_align_t lv_image_get_inner_align(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void lv_image_set_antialias(lv_obj_t * obj, bool antialias);
|
|||||||
* @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT`
|
* @note if image_align is `LV_IMAGE_ALIGN_STRETCH` or `LV_IMAGE_ALIGN_FIT`
|
||||||
* rotation, scale and pivot will be overwritten and controlled internally.
|
* rotation, scale and pivot will be overwritten and controlled internally.
|
||||||
*/
|
*/
|
||||||
void lv_image_set_align(lv_obj_t * obj, lv_image_align_t align);
|
void lv_image_set_inner_align(lv_obj_t * obj, lv_image_align_t align);
|
||||||
|
|
||||||
/*=====================
|
/*=====================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
@@ -312,7 +312,7 @@ bool lv_image_get_antialias(lv_obj_t * obj);
|
|||||||
* @param obj pointer to an image object
|
* @param obj pointer to an image object
|
||||||
* @return element of @ref lv_image_align_t
|
* @return element of @ref lv_image_align_t
|
||||||
*/
|
*/
|
||||||
lv_image_align_t lv_image_get_align(lv_obj_t * obj);
|
lv_image_align_t lv_image_get_inner_align(lv_obj_t * obj);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ void test_snapshot_take_snapshot_immidiately_after_obj_create(void)
|
|||||||
TEST_ASSERT_EQUAL_SCREENSHOT("snapshot_0.png");
|
TEST_ASSERT_EQUAL_SCREENSHOT("snapshot_0.png");
|
||||||
|
|
||||||
lv_obj_center(img_obj);
|
lv_obj_center(img_obj);
|
||||||
lv_image_set_align(img_obj, LV_IMAGE_ALIGN_CENTER);
|
lv_image_set_inner_align(img_obj, LV_IMAGE_ALIGN_CENTER);
|
||||||
lv_image_set_rotation(img_obj, 450);
|
lv_image_set_rotation(img_obj, 450);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_SCREENSHOT("snapshot_1.png");
|
TEST_ASSERT_EQUAL_SCREENSHOT("snapshot_1.png");
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ void test_image_normal_align(void)
|
|||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, 200, 120);
|
lv_obj_set_size(img, 200, 120);
|
||||||
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
||||||
lv_image_set_align(img, aligns[i]);
|
lv_image_set_inner_align(img, aligns[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/image_normal_align.png");
|
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/image_normal_align.png");
|
||||||
@@ -204,7 +204,7 @@ void test_image_normal_align_offset(void)
|
|||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, 200, 120);
|
lv_obj_set_size(img, 200, 120);
|
||||||
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
||||||
lv_image_set_align(img, aligns[i]);
|
lv_image_set_inner_align(img, aligns[i]);
|
||||||
lv_image_set_offset_x(img, 15);
|
lv_image_set_offset_x(img, 15);
|
||||||
lv_image_set_offset_y(img, 20);
|
lv_image_set_offset_y(img, 20);
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ void test_image_transform_align(void)
|
|||||||
lv_image_set_scale_x(img, 300);
|
lv_image_set_scale_x(img, 300);
|
||||||
lv_image_set_scale_y(img, 200);
|
lv_image_set_scale_y(img, 200);
|
||||||
lv_image_set_rotation(img, 200);
|
lv_image_set_rotation(img, 200);
|
||||||
lv_image_set_align(img, aligns[i]);
|
lv_image_set_inner_align(img, aligns[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/image_transform_align.png");
|
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/image_transform_align.png");
|
||||||
@@ -249,7 +249,7 @@ void test_image_transform_align_offset(void)
|
|||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, 200, 120);
|
lv_obj_set_size(img, 200, 120);
|
||||||
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
||||||
lv_image_set_align(img, aligns[i]);
|
lv_image_set_inner_align(img, aligns[i]);
|
||||||
lv_image_set_offset_x(img, 15);
|
lv_image_set_offset_x(img, 15);
|
||||||
lv_image_set_offset_y(img, 20);
|
lv_image_set_offset_y(img, 20);
|
||||||
lv_image_set_scale_x(img, 300);
|
lv_image_set_scale_x(img, 300);
|
||||||
@@ -275,7 +275,7 @@ void test_image_stretch(void)
|
|||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, w_array[i / 3], h_array[i % 3]);
|
lv_obj_set_size(img, w_array[i / 3], h_array[i % 3]);
|
||||||
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
lv_obj_set_pos(img, 30 + (i % 3) * 260, 40 + (i / 3) * 150);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_STRETCH);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_STRETCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/image_stretch.png");
|
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/image_stretch.png");
|
||||||
@@ -287,29 +287,29 @@ void test_image_tile(void)
|
|||||||
|
|
||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, 350, LV_SIZE_CONTENT);
|
lv_obj_set_size(img, 350, LV_SIZE_CONTENT);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_pos(img, 20, 20);
|
lv_obj_set_pos(img, 20, 20);
|
||||||
img = img_create();
|
img = img_create();
|
||||||
|
|
||||||
lv_obj_set_size(img, LV_SIZE_CONTENT, 150);
|
lv_obj_set_size(img, LV_SIZE_CONTENT, 150);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_pos(img, 420, 20);
|
lv_obj_set_pos(img, 420, 20);
|
||||||
|
|
||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
lv_obj_set_size(img, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_pos(img, 20, 220);
|
lv_obj_set_pos(img, 20, 220);
|
||||||
lv_image_set_offset_x(img, -20);
|
lv_image_set_offset_x(img, -20);
|
||||||
lv_image_set_offset_y(img, 20);
|
lv_image_set_offset_y(img, 20);
|
||||||
|
|
||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, 150, 150);
|
lv_obj_set_size(img, 150, 150);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_pos(img, 220, 220);
|
lv_obj_set_pos(img, 220, 220);
|
||||||
|
|
||||||
img = img_create();
|
img = img_create();
|
||||||
lv_obj_set_size(img, 150, 150);
|
lv_obj_set_size(img, 150, 150);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
lv_obj_set_pos(img, 420, 220);
|
lv_obj_set_pos(img, 420, 220);
|
||||||
lv_image_set_offset_x(img, -2000);
|
lv_image_set_offset_x(img, -2000);
|
||||||
lv_image_set_offset_y(img, 2000);
|
lv_image_set_offset_y(img, 2000);
|
||||||
@@ -321,7 +321,7 @@ void test_image_ignore_transformation_settings_when_stretched(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * img = img_create();
|
lv_obj_t * img = img_create();
|
||||||
lv_obj_set_size(img, 200, 300);
|
lv_obj_set_size(img, 200, 300);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_STRETCH);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_STRETCH);
|
||||||
|
|
||||||
lv_image_set_rotation(img, 100);
|
lv_image_set_rotation(img, 100);
|
||||||
lv_image_set_pivot(img, 200, 300);
|
lv_image_set_pivot(img, 200, 300);
|
||||||
@@ -344,7 +344,7 @@ void test_image_ignore_transformation_settings_when_tiled(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * img = img_create();
|
lv_obj_t * img = img_create();
|
||||||
lv_obj_set_size(img, 200, 300);
|
lv_obj_set_size(img, 200, 300);
|
||||||
lv_image_set_align(img, LV_IMAGE_ALIGN_TILE);
|
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
|
||||||
|
|
||||||
lv_image_set_rotation(img, 100);
|
lv_image_set_rotation(img, 100);
|
||||||
lv_image_set_pivot(img, 200, 300);
|
lv_image_set_pivot(img, 200, 300);
|
||||||
|
|||||||
Reference in New Issue
Block a user