From 5967d137f6400fbc3d56d4a0d076aeff3a7f01e2 Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Thu, 25 Feb 2021 20:00:31 +0100 Subject: [PATCH] Add scale attributes --- src/hasp/hasp_attribute.cpp | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/hasp/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp index b2313255..a9444c5c 100644 --- a/src/hasp/hasp_attribute.cpp +++ b/src/hasp/hasp_attribute.cpp @@ -10,12 +10,7 @@ #include "../lv_components.h" #endif -#include "hasp.h" -#include "hasp_object.h" -#include "hasp_dispatch.h" -#include "hasp_attribute.h" -#include "hasp_utilities.h" -#include "hasp_parser.h" +#include "hasplib.h" LV_FONT_DECLARE(unscii_8_icon); extern lv_font_t* haspFonts[8]; @@ -826,6 +821,37 @@ static void hasp_local_style_attr(lv_obj_t* obj, const char* attr_p, uint16_t at return attribute_pad_inner(obj, part, state, update, attr_p, (lv_style_int_t)var); #endif + /* Scale attributes */ + case ATTR_SCALE_GRAD_COLOR: { + if(update) { + lv_color32_t c; + if(Parser::haspPayloadToColor(payload, c) && part != 64) + lv_obj_set_style_local_scale_grad_color(obj, part, state, + lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + } else { + hasp_out_color(obj, attr, lv_obj_get_style_scale_grad_color(obj, part)); + } + return; + } + case ATTR_SCALE_END_COLOR: + if(update) { + lv_color32_t c; + if(Parser::haspPayloadToColor(payload, c)) + lv_obj_set_style_local_scale_end_color(obj, part, state, + lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + } else { + hasp_out_color(obj, attr, lv_obj_get_style_scale_end_color(obj, part)); + } + return; + case ATTR_SCALE_END_LINE_WIDTH: + return attribute_scale_end_line_width(obj, part, state, update, attr_p, (lv_style_int_t)var); + case ATTR_SCALE_END_BORDER_WIDTH: + return attribute_scale_end_border_width(obj, part, state, update, attr_p, (lv_style_int_t)var); + case ATTR_SCALE_BORDER_WIDTH: + return attribute_scale_border_width(obj, part, state, update, attr_p, (lv_style_int_t)var); + case ATTR_SCALE_WIDTH: + return attribute_scale_width(obj, part, state, update, attr_p, (lv_style_int_t)var); + /* Text attributes */ case ATTR_TEXT_LETTER_SPACE: return attribute_text_letter_space(obj, part, state, update, attr_p, (lv_style_int_t)var);