BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
27fa1699
Commit
27fa1699
authored
Jun 15, 2016
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_img transp_en moved to img header + minor modsin objx
parent
2666ed5f
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
110 additions
and
245 deletions
+110
-245
lv_draw.c
lv_draw/lv_draw.c
+14
-166
lv_draw.h
lv_draw/lv_draw.h
+1
-1
lv_draw_rbasic.c
lv_draw/lv_draw_rbasic.c
+2
-1
lv_draw_rbasic.h
lv_draw/lv_draw_rbasic.h
+2
-1
lv_draw_vbasic.c
lv_draw/lv_draw_vbasic.c
+51
-3
lv_draw_vbasic.h
lv_draw/lv_draw_vbasic.h
+2
-1
lv_obj.c
lv_obj/lv_obj.c
+4
-31
lv_obj.h
lv_obj/lv_obj.h
+0
-2
lv_btn.c
lv_objx/lv_btn.c
+1
-1
lv_img.c
lv_objx/lv_img.c
+13
-9
lv_img.h
lv_objx/lv_img.h
+5
-4
lv_label.c
lv_objx/lv_label.c
+5
-5
lv_label.h
lv_objx/lv_label.h
+1
-1
lv_line.c
lv_objx/lv_line.c
+5
-14
lv_line.h
lv_objx/lv_line.h
+0
-2
lv_page.c
lv_objx/lv_page.c
+3
-2
lv_rect.c
lv_objx/lv_rect.c
+1
-1
No files found.
lv_draw/lv_draw.c
View file @
27fa1699
...
...
@@ -43,7 +43,7 @@ static uint16_t lv_draw_rect_radius_corr(uint16_t r, cord_t w, cord_t h);
#if LV_VDB_SIZE != 0
static
void
(
*
fill_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
=
lv_vfill
;
static
void
(
*
letter_fp
)(
const
point_t
*
pos_p
,
const
area_t
*
mask_p
,
const
font_t
*
font_p
,
uint8_t
letter
,
color_t
color
,
opa_t
opa
)
=
lv_vletter
;
static
void
(
*
map_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
)
=
lv_vmap
;
static
void
(
*
map_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
color_t
recolor
,
opa_t
recolor_opa
)
=
lv_vmap
;
#else
static
void
(
*
fill_fp
)(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
color_t
color
,
opa_t
opa
)
=
lv_rfill
;
static
void
(
*
letter_fp
)(
const
point_t
*
pos_p
,
const
area_t
*
mask_p
,
const
font_t
*
font_p
,
uint8_t
letter
,
color_t
color
,
opa_t
opa
)
=
lv_rletter
;
...
...
@@ -58,7 +58,7 @@ static lv_rects_t lv_img_no_pic_rects = {
};
static
lv_labels_t
lv_img_no_pic_labels
=
{
.
font
=
LV_FONT_DEFAULT
,
.
color
=
COLOR_WHITE
,
.
font
=
LV_FONT_DEFAULT
,
.
objs
.
color
=
COLOR_WHITE
,
.
letter_space
=
1
*
LV_STYLE_MULT
,
.
line_space
=
1
*
LV_STYLE_MULT
,
.
mid
=
1
,
};
...
...
@@ -134,7 +134,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p,
while
(
txt
[
line_start
]
!=
'\0'
)
{
/*Write all letter of a line*/
for
(
i
=
line_start
;
i
<
line_end
;
i
++
)
{
letter_fp
(
&
pos
,
mask_p
,
font_p
,
txt
[
i
],
labels_p
->
color
,
opa
);
letter_fp
(
&
pos
,
mask_p
,
font_p
,
txt
[
i
],
labels_p
->
objs
.
color
,
opa
);
pos
.
x
+=
font_get_width
(
font_p
,
txt
[
i
])
+
labels_p
->
letter_space
;
}
/*Go to next line*/
...
...
@@ -163,12 +163,12 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p,
* @param opa opacity of the image (0..255)
*/
void
lv_draw_img
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_imgs_t
*
imgs_p
,
opa_t
opa
,
const
char
*
fn
,
const
color_t
*
map_p
)
const
lv_imgs_t
*
imgs_p
,
opa_t
opa
,
const
char
*
fn
)
{
if
(
map_p
!=
NULL
)
{
map_fp
(
cords_p
,
mask_p
,
map_p
,
opa
,
imgs_p
->
transp_en
);
}
else
if
(
fn
!=
NULL
)
{
if
(
fn
==
NULL
)
{
lv_draw_rect
(
cords_p
,
mask_p
,
&
lv_img_no_pic_rects
,
opa
);
lv_draw_label
(
cords_p
,
mask_p
,
&
lv_img_no_pic_labels
,
opa
,
"No data"
);
}
else
{
fs_file_t
file
;
fs_res_t
res
=
fs_open
(
&
file
,
fn
,
FS_MODE_RD
);
if
(
res
==
FS_RES_OK
)
{
...
...
@@ -199,8 +199,10 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
fs_close
(
&
file
);
return
;
}
lv_img_raw_header_t
header
;
res
=
fs_read
(
&
file
,
&
header
,
sizeof
(
lv_img_raw_header_t
),
&
br
);
uint32_t
start_offset
=
sizeof
(
lv_img_raw_header_t
)
;
uint32_t
start_offset
=
0
;
start_offset
+=
(
area_get_width
(
cords_p
)
>>
ds_shift
)
*
((
mask_sub
.
y1
-
cords_p
->
y1
)
>>
ds_shift
)
*
sizeof
(
color_t
);
/*First row*/
start_offset
+=
((
mask_sub
.
x1
-
cords_p
->
x1
)
>>
ds_shift
)
*
sizeof
(
color_t
);
/*First col*/
...
...
@@ -215,7 +217,8 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
for
(
row
=
mask_sub
.
y1
;
row
<=
mask_sub
.
y2
;
row
+=
ds_num
)
{
res
=
fs_read
(
&
file
,
buf
,
useful_data
,
&
br
);
map_fp
(
&
act_area
,
&
mask_sub
,
buf
,
opa
,
imgs_p
->
transp_en
);
map_fp
(
&
act_area
,
&
mask_sub
,
buf
,
opa
,
header
.
transp
,
imgs_p
->
objs
.
color
,
imgs_p
->
recolor_opa
);
fs_tell
(
&
file
,
&
act_pos
);
fs_seek
(
&
file
,
act_pos
+
next_row
);
act_area
.
y1
+=
ds_num
;
...
...
@@ -229,14 +232,11 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
lv_draw_rect
(
cords_p
,
mask_p
,
&
lv_img_no_pic_rects
,
opa
);
lv_draw_label
(
cords_p
,
mask_p
,
&
lv_img_no_pic_labels
,
opa
,
fn
);
}
}
else
{
lv_draw_rect
(
cords_p
,
mask_p
,
&
lv_img_no_pic_rects
,
opa
);
lv_draw_label
(
cords_p
,
mask_p
,
&
lv_img_no_pic_labels
,
opa
,
"No data"
);
}
}
/**
* Draw a line
* @param p1 first point of the line
...
...
@@ -248,158 +248,6 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
void
lv_draw_line
(
const
point_t
*
p1
,
const
point_t
*
p2
,
const
area_t
*
mask_p
,
const
lv_lines_t
*
lines_p
,
opa_t
opa
)
{
/*Draw circle*//*
point_t c1;
point_t c2;
cord_t ctmp1;
cord_t ctmp2;
area_t tmp_a;
circ_init(&c1, &ctmp1, lines_p->line_width);
cord_t dx = abs(p2->x - p1->x);
cord_t dy = abs(p2->y - p1->y);
uint16_t width;
uint16_t wcor;
opa = OPA_20;
static const uint8_t width_corr_array[] = {
64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66,
67, 67, 67, 68, 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 74,
74, 75, 75, 76, 77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 84, 84, 85,
86, 86, 87, 88, 88, 89, 90, 91,
};
wcor = (dy * LINE_WIDTH_CORR_BASE) / dx;
width = ((lines_p->line_width) * LV_DOWNSCALE * width_corr_array[wcor]) >> LINE_WIDTH_CORR_SHIFT;
point_t e;
int32_t x_tmp = ((width*dy*dx)/(dx*dx+dy*dy));
e.x = p2->x + x_tmp;
e.y = p2->y - (x_tmp * dx)/dy;
area_t e_area;
e_area.x1 = e.x-3;
e_area.x2 = e.x+3;
e_area.y1 = e.y-3;
e_area.y2 = e.y+3;
lv_vfill(&e_area, mask_p, COLOR_GREEN, OPA_40);
color_t rnd_clr = {{130, 43, 99}};
uint16_t cnt = 0;
while(circ_cont(&c1)) {
area_set(&tmp_a, CIRC_OCT1_X(c1)+p2->x, CIRC_OCT1_Y(c1)+p2->y, CIRC_OCT1_X(c1)+p2->x, CIRC_OCT1_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, COLOR_BLUE, OPA_COVER);
area_set(&tmp_a, CIRC_OCT2_X(c1)+p2->x, CIRC_OCT2_Y(c1)+p2->y, CIRC_OCT2_X(c1)+p2->x, CIRC_OCT2_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, lines_p->color, opa);
area_set(&tmp_a, CIRC_OCT3_X(c1)+p2->x, CIRC_OCT3_Y(c1)+p2->y, CIRC_OCT3_X(c1)+p2->x, CIRC_OCT3_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, lines_p->color, opa);
area_set(&tmp_a, CIRC_OCT4_X(c1)+p2->x, CIRC_OCT4_Y(c1)+p2->y, CIRC_OCT4_X(c1)+p2->x, CIRC_OCT4_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, lines_p->color, opa);
area_set(&tmp_a, CIRC_OCT5_X(c1)+p2->x, CIRC_OCT5_Y(c1)+p2->y, CIRC_OCT5_X(c1)+p2->x, CIRC_OCT5_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, lines_p->color, opa);
area_set(&tmp_a, CIRC_OCT6_X(c1)+p2->x, CIRC_OCT6_Y(c1)+p2->y, CIRC_OCT6_X(c1)+p2->x, CIRC_OCT6_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, lines_p->color, opa);
area_set(&tmp_a, CIRC_OCT7_X(c1)+p2->x, CIRC_OCT7_Y(c1)+p2->y, CIRC_OCT7_X(c1)+p2->x, CIRC_OCT7_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, COLOR_PURPLE, OPA_COVER);
area_set(&tmp_a, CIRC_OCT8_X(c1)+p2->x, CIRC_OCT8_Y(c1)+p2->y, CIRC_OCT8_X(c1)+p2->x, CIRC_OCT8_Y(c1)+p2->y);
lv_vfill(&tmp_a, mask_p, lines_p->color, opa);
cord_t err = (dx > dy ? dx : -dy) / 2;
cord_t e2;
point_t act_point;
act_point.x = p1->x;
act_point.y = p1->y;
rnd_clr.full += 0x238993;
while(1){
//if(c1.y > 4) break;
area_t act_area;
*/
/*if(act_point.x < p2->x + CIRC_OCT8_X(c1))
{
act_area.x1 = act_point.x;
act_area.x2 = act_point.x;
act_area.y1 = act_point.y - ((CIRC_OCT8_X(c1)*dy) - (CIRC_OCT8_Y(c1)*dx)) / (dx);
act_area.y2 = act_point.y - ((CIRC_OCT8_X(c1)*dy) - (CIRC_OCT8_Y(c1)*dx)) / (dx);// (dy * c1.x)/dx + CIRC_OCT8_Y(c1);
lv_vfill(&act_area, mask_p, COLOR_RED, OPA_50);
}*/
/*
if(act_point.x < p2->x + CIRC_OCT1_X(c1)) {
act_area.x1 = act_point.x;
act_area.x2 = act_point.x;
act_area.y1 = act_point.y - (dy * c1.x)/dx + CIRC_OCT1_Y(c1);
act_area.y2 = act_point.y - (dy * c1.x)/dx + CIRC_OCT1_Y(c1);
lv_vfill(&act_area, mask_p, COLOR_RED, OPA_50);
}
if(act_point.x < p2->x + CIRC_OCT2_X(c1)) {
act_area.x1 = act_point.x;
act_area.x2 = act_point.x;
act_area.y1 = act_point.y - (dy * CIRC_OCT2_X(c1))/dx + CIRC_OCT2_Y(c1);
act_area.y2 = act_point.y - (dy * CIRC_OCT2_X(c1))/dx + CIRC_OCT2_Y(c1);
lv_vfill(&act_area, mask_p, COLOR_RED, OPA_50);
}
if(act_point.x < p2->x + CIRC_OCT3_X(c1)) {
act_area.x1 = act_point.x;
act_area.x2 = act_point.x;
act_area.y1 = act_point.y - (dy * CIRC_OCT3_X(c1))/dx + CIRC_OCT3_Y(c1);
act_area.y2 = act_point.y - (dy * CIRC_OCT3_X(c1))/dx + CIRC_OCT3_Y(c1);
lv_vfill(&act_area, mask_p, COLOR_RED, OPA_50);
}
*//*
if(e.x > p2->x && e.x < p2->x + lines_p->line_width / 2 &&
act_point.x < p2->x + CIRC_OCT7_X(c1))
{
act_area.x1 = act_point.x;
act_area.x2 = act_point.x;
act_area.y1 = act_point.y - (dy * CIRC_OCT7_X(c1))/dx + CIRC_OCT7_Y(c1);
act_area.y2 = act_area.y1;
lv_vfill(&act_area, mask_p, COLOR_RED, OPA_50);
}*/
/*
if(act_point.x < p2->x + CIRC_OCT7_X(c1)) {
act_area.x1 = act_point.x;
act_area.x2 = act_point.x;
act_area.y1 = act_point.y - (dy * CIRC_OCT7_X(c1))/dx + CIRC_OCT7_Y(c1);
act_area.y2 = act_point.y - (dy * CIRC_OCT7_X(c1))/dx + CIRC_OCT7_Y(c1);
lv_vfill(&act_area, mask_p, COLOR_RED, OPA_50);
}
*/
//printf("hor x1:%d, y1:%d, x2:%d, y2:%d\n", act_area.x1, act_area.y1, act_area.x2, act_area.y2);
/*if (act_point.x == p2->x + c1.x)
{
printf("line end x%d, y%d\n", act_area.x1, act_area.y1);
cnt++;
if(cnt == 11) {
cnt++;
cnt--;
}
break;
}
e2 = err;
if (e2 >-dx) {
err -= dy;
act_point.x ++;
}
if (e2 < dy) {
err += dx;
act_point.y ++;
}
}
circ_next(&c1, &ctmp1);
}
return;*/
if
(
lines_p
->
width
==
0
)
return
;
if
(
p1
->
x
==
p2
->
x
&&
p1
->
y
==
p2
->
y
)
return
;
...
...
lv_draw/lv_draw.h
View file @
27fa1699
...
...
@@ -33,7 +33,7 @@ void lv_draw_label(const area_t * cords_p,const area_t * mask_p,
void
lv_draw_line
(
const
point_t
*
p1
,
const
point_t
*
p2
,
const
area_t
*
mask_p
,
const
lv_lines_t
*
lines_p
,
opa_t
opa
);
void
lv_draw_img
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
lv_imgs_t
*
imgs_p
,
opa_t
opa
,
const
char
*
fn
,
const
color_t
*
map_p
);
const
lv_imgs_t
*
imgs_p
,
opa_t
opa
,
const
char
*
fn
);
/**********************
* MACROS
**********************/
...
...
lv_draw/lv_draw_rbasic.c
View file @
27fa1699
...
...
@@ -110,7 +110,8 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
* @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels
*/
void
lv_rmap
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
)
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
color_t
recolor
,
color_t
recolor_opa
)
{
area_t
masked_a
;
bool
union_ok
;
...
...
lv_draw/lv_draw_rbasic.h
View file @
27fa1699
...
...
@@ -30,7 +30,8 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
const
font_t
*
font_p
,
uint8_t
letter
,
color_t
color
,
opa_t
opa
);
void
lv_rmap
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
);
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
color_t
recolor
,
color_t
recolor_opa
);
/**********************
* MACROS
**********************/
...
...
lv_draw/lv_draw_vbasic.c
View file @
27fa1699
...
...
@@ -146,7 +146,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
* @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels
*/
void
lv_vmap
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
)
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
color_t
recolor
,
opa_t
recolor_opa
)
{
area_t
masked_a
;
bool
union_ok
;
...
...
@@ -196,6 +197,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
cord_t
row
;
cord_t
col
;
color_t
transp_color
=
LV_IMG_COLOR_TRANSP
;
color_t
color_tmp
;
cord_t
map_i
;
map_p
-=
map_width
;
/*Compensate the first row % LV_DOWNSCALE*/
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
...
...
@@ -203,9 +205,12 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
map_i
=
masked_a
.
x1
>>
ds_shift
;
map_i
--
;
/*Compensate the first col % LV_DOWNSCALE*/
for
(
col
=
masked_a
.
x1
;
col
<=
masked_a
.
x2
;
col
++
)
{
if
(
col
%
LV_DOWNSCALE
==
0
)
map_i
++
;
if
(
col
%
LV_DOWNSCALE
==
0
)
{
map_i
++
;
color_tmp
=
color_mix
(
recolor
,
map_p
[
map_i
],
recolor_opa
);
}
if
(
transp
==
false
||
map_p
[
map_i
].
full
!=
transp_color
.
full
)
{
vdb_buf_tmp
[
col
]
=
color_mix
(
map_p
[
map_i
]
,
vdb_buf_tmp
[
col
],
opa
);
vdb_buf_tmp
[
col
]
=
color_mix
(
color_tmp
,
vdb_buf_tmp
[
col
],
opa
);
}
}
vdb_buf_tmp
+=
vdb_width
;
/*Next row on the VDB*/
...
...
@@ -232,10 +237,19 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
vdb_buf_tmp
+=
vdb_width
;
/*Next row on the VDB*/
}
}
/*To recolor draw simply a rectangle above the image*/
#if LV_VDB_SIZE != 0
lv_vfill
(
cords_p
,
mask_p
,
recolor
,
recolor_opa
);
#endif
}
else
{
/*transp == true: Check all pixels */
cord_t
row
;
cord_t
col
;
color_t
transp_color
=
LV_IMG_COLOR_TRANSP
;
if
(
recolor_opa
==
OPA_TRANSP
)
/*No recolor*/
{
if
(
opa
==
OPA_COVER
)
{
/*no opa */
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
for
(
col
=
masked_a
.
x1
;
col
<=
masked_a
.
x2
;
col
++
)
{
...
...
@@ -259,6 +273,35 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
vdb_buf_tmp
+=
vdb_width
;
/*Next row on the VDB*/
}
}
}
else
{
/*Recolor needed*/
color_t
color_tmp
;
if
(
opa
==
OPA_COVER
)
{
/*no opa */
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
for
(
col
=
masked_a
.
x1
;
col
<=
masked_a
.
x2
;
col
++
)
{
if
(
map_p
[
col
].
full
!=
transp_color
.
full
)
{
color_tmp
=
color_mix
(
recolor
,
map_p
[
col
],
recolor_opa
);
vdb_buf_tmp
[
col
]
=
color_tmp
;
}
}
map_p
+=
map_width
;
/*Next row on the map*/
vdb_buf_tmp
+=
vdb_width
;
/*Next row on the VDB*/
}
}
else
{
for
(
row
=
masked_a
.
y1
;
row
<=
masked_a
.
y2
;
row
++
)
{
for
(
col
=
masked_a
.
x1
;
col
<=
masked_a
.
x2
;
col
++
)
{
if
(
map_p
[
col
].
full
!=
transp_color
.
full
)
{
color_tmp
=
color_mix
(
recolor
,
map_p
[
col
],
recolor_opa
);
vdb_buf_tmp
[
col
]
=
color_mix
(
color_tmp
,
vdb_buf_tmp
[
col
],
opa
);
}
}
map_p
+=
map_width
;
/*Next row on the map*/
vdb_buf_tmp
+=
vdb_width
;
/*Next row on the VDB*/
}
}
}
}
#endif
/*No upscale and no downscale*/
}
...
...
@@ -347,4 +390,9 @@ static bool lv_vletter_get_px(const font_t * font_p, uint8_t letter, cord_t x, c
if
((
map_byte
&
(
1
<<
col_sub
))
==
0
)
return
false
;
else
return
true
;
}
#endif
lv_draw/lv_draw_vbasic.h
View file @
27fa1699
...
...
@@ -36,7 +36,8 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
color_t
color
,
opa_t
opa
);
void
lv_vmap
(
const
area_t
*
cords_p
,
const
area_t
*
mask_p
,
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
);
const
color_t
*
map_p
,
opa_t
opa
,
bool
transp
,
color_t
recolor
,
color_t
recolor_opa
);
/**********************
...
...
lv_obj/lv_obj.c
View file @
27fa1699
...
...
@@ -34,11 +34,10 @@ lv_obj_t* def_scr_dp = NULL;
lv_obj_t
*
act_scr_dp
=
NULL
;
ll_dsc_t
scr_ll
;
lv_objs_t
lv_objs_def
=
{.
color
=
COLOR_GRAY
,
.
empty
=
0
,
.
auto_color
=
1
};
lv_objs_t
lv_objs_color
=
{.
color
=
COLOR_RED
,
.
empty
=
0
,
.
auto_color
=
0
};
lv_objs_t
lv_objs_scr
=
{.
color
=
LV_OBJ_DEF_SCR_COLOR
,
.
empty
=
0
,
.
auto_color
=
0
};
lv_objs_t
lv_objs_empty
=
{.
color
=
COLOR_GRAY
,
.
empty
=
1
,
.
auto_color
=
0
};
lv_objs_t
lv_objs_autocolor
=
{.
color
=
COLOR_GRAY
,
.
empty
=
0
,
.
auto_color
=
1
};
lv_objs_t
lv_objs_def
=
{.
color
=
COLOR_GRAY
,
.
empty
=
0
};
lv_objs_t
lv_objs_scr
=
{.
color
=
LV_OBJ_DEF_SCR_COLOR
,
.
empty
=
0
};
lv_objs_t
lv_objs_color
=
{.
color
=
COLOR_RED
,
.
empty
=
0
};
lv_objs_t
lv_objs_empty
=
{.
color
=
COLOR_GRAY
,
.
empty
=
1
};
/**********************
* MACROS
...
...
@@ -336,9 +335,6 @@ lv_objs_t * lv_objs_get(lv_objs_builtin_t style, lv_objs_t * copy_p)
case
LV_OBJS_EMPTY
:
style_p
=
&
lv_objs_empty
;
break
;
case
LV_OBJS_AUTOCOLOR
:
style_p
=
&
lv_objs_autocolor
;
break
;
default:
style_p
=
NULL
;
}
...
...
@@ -1243,29 +1239,6 @@ static bool lv_obj_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
opa_t
opa
=
lv_obj_get_opa
(
obj_dp
);
color_t
color
=
objs_p
->
color
;
/*Calculate the color*/
if
(
objs_p
->
auto_color
!=
0
)
{
lv_obj_t
*
par_dp
=
lv_obj_get_parent
(
obj_dp
);
if
(
par_dp
==
NULL
)
{
/*If it is a screen use the default color*/
color
=
LV_OBJ_DEF_SCR_COLOR
;
}
else
{
/*Add a random color on every level*/
color
=
COLOR_WHITE
;
while
(
par_dp
!=
NULL
)
{
#if COLOR_DEPTH == 1
color
.
full
++
;
#elif COLOR_DEPTH == 8
color
.
full
+=
0x52
;
#elif COLOR_DEPTH == 16
color
.
full
+=
0xA953
;
#elif COLOR_DEPTH == 24
color
.
full
+=
0x2963A9
;
#endif
par_dp
=
lv_obj_get_parent
(
par_dp
);
}
}
}
/*Simply draw a rectangle*/
#if LV_VDB_SIZE == 0
lv_rfill
(
&
obj_dp
->
cords
,
mask_p
,
color
,
opa
);
...
...
lv_obj/lv_obj.h
View file @
27fa1699
...
...
@@ -134,7 +134,6 @@ typedef struct
{
color_t
color
;
uint8_t
empty
:
1
;
uint8_t
auto_color
:
1
;
}
lv_objs_t
;
typedef
enum
...
...
@@ -143,7 +142,6 @@ typedef enum
LV_OBJS_COLOR
,
LV_OBJS_SCR
,
LV_OBJS_EMPTY
,
LV_OBJS_AUTOCOLOR
,
}
lv_objs_builtin_t
;
/**********************
...
...
lv_objx/lv_btn.c
View file @
27fa1699
...
...
@@ -351,7 +351,7 @@ lv_btns_t * lv_btns_get(lv_btns_builtin_t style, lv_btns_t * copy_p)
style_p
=
&
lv_btns_border
;
break
;
default:
style_p
=
NULL
;
style_p
=
&
lv_btns_def
;
}
if
(
copy_p
!=
NULL
)
{
...
...
lv_objx/lv_img.c
View file @
27fa1699
...
...
@@ -33,8 +33,9 @@ static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
/*-----------------
* Style definition
*-----------------*/
static
lv_imgs_t
lv_imgs_def
=
{.
transp_en
=
0
};
static
lv_imgs_t
lv_imgs_transp
=
{.
transp_en
=
1
};
static
lv_imgs_t
lv_imgs_def
=
{.
recolor_opa
=
OPA_TRANSP
};
static
lv_imgs_t
lv_imgs_light
=
{.
objs
.
color
=
COLOR_WHITE
,
.
recolor_opa
=
OPA_50
};
static
lv_imgs_t
lv_imgs_dark
=
{.
objs
.
color
=
COLOR_BLACK
,
.
recolor_opa
=
OPA_50
};
/**********************
* MACROS
...
...
@@ -129,11 +130,14 @@ lv_imgs_t * lv_imgs_get(lv_imgs_builtin_t style, lv_imgs_t * copy_p)
case
LV_IMGS_DEF
:
style_p
=
&
lv_imgs_def
;
break
;
case
LV_IMGS_TRANSP
:
style_p
=
&
lv_imgs_transp
;
case
LV_IMGS_LIGHT
:
style_p
=
&
lv_imgs_light
;
break
;
case
LV_IMGS_DARK
:
style_p
=
&
lv_imgs_dark
;
break
;
default:
style_p
=
NULL
;
style_p
=
&
lv_imgs_def
;
}
if
(
copy_p
!=
NULL
)
{
...
...
@@ -252,9 +256,10 @@ bool lv_img_get_auto_size(lv_obj_t* obj_dp)
*/
static
bool
lv_img_design
(
lv_obj_t
*
obj_dp
,
const
area_t
*
mask_p
,
lv_design_mode_t
mode
)
{
if
(
mode
==
LV_DESIGN_COVER_CHK
)
{
lv_imgs_t
*
imgs_p
=
lv_obj_get_style
(
obj_dp
);
if
(
imgs_p
->
transp_en
==
0
)
{
if
(
mode
==
LV_DESIGN_COVER_CHK
)
{
if
(
imgs_p
->
objs
.
empty
==
0
)
{
bool
cover
;
cover
=
area_is_in
(
mask_p
,
&
obj_dp
->
cords
);
return
cover
;
...
...
@@ -276,10 +281,9 @@ static bool lv_img_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mod
cords_tmp
.
x1
=
cords
.
x1
;
cords_tmp
.
x2
=
cords
.
x1
+
img_ext_p
->
w
-
1
;
for
(;
cords_tmp
.
x1
<
cords
.
x2
;
cords_tmp
.
x1
+=
img_ext_p
->
w
,
cords_tmp
.
x2
+=
img_ext_p
->
w
)
{
lv_draw_img
(
&
cords_tmp
,
mask_p
,
lv_obj_get_style
(
obj_dp
),
opa
,
img_ext_p
->
fn_dp
,
NULL
);
lv_draw_img
(
&
cords_tmp
,
mask_p
,
lv_obj_get_style
(
obj_dp
),
opa
,
img_ext_p
->
fn_dp
);
}
}
return
true
;
}
...
...
lv_objx/lv_img.h
View file @
27fa1699
...
...
@@ -26,7 +26,7 @@
typedef
struct
{
lv_objs_t
objs
;
uint8_t
transp_en
:
1
;
opa_t
recolor_opa
;
}
lv_imgs_t
;
typedef
struct
...
...
@@ -40,15 +40,16 @@ typedef struct
typedef
enum
{
LV_IMGS_DEF
,
LV_IMGS_TRANSP
LV_IMGS_LIGHT
,
LV_IMGS_DARK
,
}
lv_imgs_builtin_t
;
typedef
struct
{
uint16_t
w
;
uint16_t
h
;
uint16_t
res1
;
uint16_t
res2
;
uint16_t
cd
;
/*Color depth*/
uint16_t
transp
:
1
;
/*Do not draw LV_IMG_TRANSP_COLOR pixels*/
}
lv_img_raw_header_t
;
...
...
lv_objx/lv_label.c
View file @
27fa1699
...
...
@@ -32,25 +32,25 @@ static bool lv_label_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_m
* STATIC VARIABLES
**********************/
static
lv_labels_t
lv_labels_def
=
{
.
font
=
LV_FONT_DEFAULT
,
.
color
=
COLOR_MAKE
(
0x10
,
0x18
,
0x20
),
.
font
=
LV_FONT_DEFAULT
,
.
objs
.
color
=
COLOR_MAKE
(
0x10
,
0x18
,
0x20
),
.
letter_space
=
2
*
LV_STYLE_MULT
,
.
line_space
=
2
*
LV_STYLE_MULT
,
.
mid
=
1
};
static
lv_labels_t
lv_labels_btn
=
{
.
font
=
LV_FONT_DEFAULT
,
.
color
=
COLOR_MAKE
(
0xd0
,
0xe0
,
0xf0
),
.
font
=
LV_FONT_DEFAULT
,
.
objs
.
color
=
COLOR_MAKE
(
0xd0
,
0xe0
,
0xf0
),
.
letter_space
=
2
*
LV_STYLE_MULT
,
.
line_space
=
2
*
LV_STYLE_MULT
,
.
mid
=
1
,
};
static
lv_labels_t
lv_labels_title
=
{
.
font
=
LV_FONT_DEFAULT
,
.
color
=
COLOR_MAKE
(
0x10
,
0x20
,
0x30
),
.
font
=
LV_FONT_DEFAULT
,
.
objs
.
color
=
COLOR_MAKE
(
0x10
,
0x20
,
0x30
),
.
letter_space
=
4
*
LV_STYLE_MULT
,
.
line_space
=
4
*
LV_STYLE_MULT
,
.
mid
=
0
,
};
static
lv_labels_t
lv_labels_txt
=
{
.
font
=
LV_FONT_DEFAULT
,
.
color
=
COLOR_MAKE
(
0x16
,
0x23
,
0x34
),
.
font
=
LV_FONT_DEFAULT
,
.
objs
.
color
=
COLOR_MAKE
(
0x16
,
0x23
,
0x34
),
.
letter_space
=
1
*
LV_STYLE_MULT
,
.
line_space
=
2
*
LV_STYLE_MULT
,
.
mid
=
0
,
};
...
...
@@ -274,7 +274,7 @@ lv_labels_t * lv_labels_get(lv_labels_builtin_t style, lv_labels_t * copy_p)
style_p
=
&
lv_labels_title
;
break
;
default:
style_p
=
NULL
;
style_p
=
&
lv_labels_def
;
}
if
(
copy_p
!=
NULL
)
{
...
...
lv_objx/lv_label.h
View file @
27fa1699
...
...
@@ -25,8 +25,8 @@
typedef
struct
{
lv_objs_t
objs
;
font_types_t
font
;
color_t
color
;
uint16_t
letter_space
;
uint16_t
line_space
;
uint8_t
mid
:
1
;
...
...
lv_objx/lv_line.c
View file @
27fa1699
...
...
@@ -38,14 +38,11 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
/**********************
* STATIC VARIABLES
**********************/
static
lv_lines_t
lv_lines_def
=
{
.
width
=
2
*
LV_STYLE_MULT
,
.
objs
.
color
=
COLOR_RED
,
.
bg_color
=
COLOR_BLACK
,
.
bg_opa
=
0
};
static
lv_lines_t
lv_lines_def
=
{
.
width
=
2
*
LV_STYLE_MULT
,
.
objs
.
color
=
COLOR_RED
};
static
lv_lines_t
lv_lines_decor
=
{
.
width
=
1
*
LV_STYLE_MULT
,
.
objs
.
color
=
COLOR_GRAY
,
.
bg_color
=
COLOR_BLACK
,
.
bg_opa
=
0
};
static
lv_lines_t
lv_lines_decor
=
{
.
width
=
1
*
LV_STYLE_MULT
,
.
objs
.
color
=
COLOR_GRAY
};
static
lv_lines_t
lv_lines_chart
=
{
.
width
=
3
*
LV_STYLE_MULT
,
.
objs
.
color
=
COLOR_BLUE
,
.
bg_color
=
COLOR_BLACK
,
.
bg_opa
=
0
};
static
lv_lines_t
lv_lines_chart
=
{
.
width
=
3
*
LV_STYLE_MULT
,
.
objs
.
color
=
COLOR_BLUE
};
/**********************
* MACROS
...
...
@@ -265,7 +262,7 @@ lv_lines_t * lv_lines_get(lv_lines_builtin_t style, lv_lines_t * copy_p)
style_p
=
&
lv_lines_chart
;
break
;
default:
style_p
=
NULL
;
style_p
=
&
lv_lines_def
;
}
if
(
copy_p
!=
NULL
)
{
...
...
@@ -298,13 +295,7 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
if
(
ext_p
->
point_num
==
0
||
ext_p
->
point_p
==
NULL
)
return
false
;
lv_lines_t
*
lines_p
=
lv_obj_get_style
(
obj_dp
);
if
(
lines_p
->
bg_opa
!=
0
)
{
#if LV_VDB_SIZE != 0
lv_vfill
(
&
obj_dp
->
cords
,
mask_p
,
lines_p
->
bg_color
,
lines_p
->
bg_opa
*
255
/
100
);
#else
lv_rfill
(
&
obj_dp
->
cords
,
mask_p
,
lines_p
->
bg_color
,
lines_p
->
bg_opa
*
255
/
100
);
#endif
}
opa_t
opa
=
lv_obj_get_opa
(
obj_dp
);
area_t
area
;
lv_obj_get_cords
(
obj_dp
,
&
area
);
...
...
lv_objx/lv_line.h
View file @
27fa1699
...
...
@@ -33,9 +33,7 @@ typedef struct
typedef
struct
{
lv_objs_t
objs
;
color_t
bg_color
;
uint16_t
width
;
opa_t
bg_opa
;
}
lv_lines_t
;
typedef
enum
...
...
lv_objx/lv_page.c
View file @
27fa1699
...
...
@@ -156,6 +156,7 @@ lv_obj_t* lv_page_create(lv_obj_t * par_dp, lv_obj_t * ori_dp)
page_p
->
sbh_dp
=
lv_rect_create
(
par_dp
,
NULL
);
lv_obj_set_height
(
page_p
->
sbh_dp
,
pages_p
->
sb_width
);
lv_obj_set_style
(
page_p
->
sbh_dp
,
&
pages_p
->
sb_rects
);
lv_obj_set_click
(
page_p
->
sbh_dp
,
false
);
if
(
pages_p
->
sb_mode
==
LV_PAGE_SB_MODE_ON
)
{
lv_obj_set_opa
(
page_p
->
sbh_dp
,
(
pages_p
->
sb_opa
*
OPA_COVER
)
/
100
);
}
else
{
...
...
@@ -166,6 +167,7 @@ lv_obj_t* lv_page_create(lv_obj_t * par_dp, lv_obj_t * ori_dp)
page_p
->
sbv_dp
=
lv_rect_create
(
par_dp
,
NULL
);
lv_obj_set_width
(
page_p
->
sbv_dp
,
pages_p
->
sb_width
);
lv_obj_set_style
(
page_p
->
sbv_dp
,
&
pages_p
->
sb_rects
);
lv_obj_set_click
(
page_p
->
sbv_dp
,
false
);
if
(
lv_pages_def
.
sb_mode
==
LV_PAGE_SB_MODE_ON
)
{
lv_obj_set_opa
(
page_p
->
sbv_dp
,
(
pages_p
->
sb_opa
*
OPA_COVER
)
/
100
);
}
else
{
...
...
@@ -299,7 +301,6 @@ bool lv_page_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param)
}
return
obj_valid
;
}
/**
...
...
@@ -334,7 +335,7 @@ lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * to_copy)
style_p
=
&
lv_pages_transp
;
break
;
default:
style_p
=
NULL
;
style_p
=
&
lv_pages_def
;
}
if
(
to_copy
!=
NULL
)
{
...
...
lv_objx/lv_rect.c
View file @
27fa1699
...
...
@@ -229,7 +229,7 @@ lv_rects_t * lv_rects_get(lv_rects_builtin_t style, lv_rects_t * copy_p)
style_p
=
&
lv_rects_transp
;
break
;
default:
style_p
=
NULL
;
style_p
=
&
lv_rects_def
;
}
if
(
copy_p
!=
NULL
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment