Initial commit.
This commit is contained in:
commit
ceb9b961f2
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Compiled Object files
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Executables
|
||||
*.bin
|
||||
*.elf
|
||||
|
||||
# PROS
|
||||
bin/
|
||||
.vscode/
|
||||
.cache/
|
||||
compile_commands.json
|
||||
temp.log
|
||||
temp.errors
|
||||
*.ini
|
||||
.d/
|
||||
47
Makefile
Normal file
47
Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
################################################################################
|
||||
######################### User configurable parameters #########################
|
||||
# filename extensions
|
||||
CEXTS:=c
|
||||
ASMEXTS:=s S
|
||||
CXXEXTS:=cpp c++ cc
|
||||
|
||||
# probably shouldn't modify these, but you may need them below
|
||||
ROOT=.
|
||||
FWDIR:=$(ROOT)/firmware
|
||||
BINDIR=$(ROOT)/bin
|
||||
SRCDIR=$(ROOT)/src
|
||||
INCDIR=$(ROOT)/include
|
||||
|
||||
WARNFLAGS+=
|
||||
EXTRA_CFLAGS=
|
||||
EXTRA_CXXFLAGS=
|
||||
|
||||
# Set to 1 to enable hot/cold linking
|
||||
USE_PACKAGE:=1
|
||||
|
||||
# Add libraries you do not wish to include in the cold image here
|
||||
# EXCLUDE_COLD_LIBRARIES:= $(FWDIR)/your_library.a
|
||||
EXCLUDE_COLD_LIBRARIES:=
|
||||
|
||||
# Set this to 1 to add additional rules to compile your project as a PROS library template
|
||||
IS_LIBRARY:=0
|
||||
# TODO: CHANGE THIS!
|
||||
# Be sure that your header files are in the include directory inside of a folder with the
|
||||
# same name as what you set LIBNAME to below.
|
||||
LIBNAME:=libbest
|
||||
VERSION:=1.0.0
|
||||
# EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c
|
||||
# this line excludes opcontrol.c and similar files
|
||||
EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext)))
|
||||
|
||||
# files that get distributed to every user (beyond your source archive) - add
|
||||
# whatever files you want here. This line is configured to add all header files
|
||||
# that are in the directory include/LIBNAME
|
||||
TEMPLATE_FILES=$(INCDIR)/$(LIBNAME)/*.h $(INCDIR)/$(LIBNAME)/*.hpp
|
||||
|
||||
.DEFAULT_GOAL=quick
|
||||
|
||||
################################################################################
|
||||
################################################################################
|
||||
########## Nothing below this line should be edited by typical users ###########
|
||||
-include ./common.mk
|
||||
308
common.mk
Normal file
308
common.mk
Normal file
@ -0,0 +1,308 @@
|
||||
ARCHTUPLE=arm-none-eabi-
|
||||
DEVICE=VEX EDR V5
|
||||
|
||||
MFLAGS=-mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=softfp -Os -g
|
||||
CPPFLAGS=-D_POSIX_THREADS -D_UNIX98_THREAD_MUTEX_ATTRIBUTES -D_POSIX_TIMERS -D_POSIX_MONOTONIC_CLOCK
|
||||
GCCFLAGS=-ffunction-sections -fdata-sections -fdiagnostics-color -funwind-tables
|
||||
|
||||
# Check if the llemu files in libvgl exist. If they do, define macros that the
|
||||
# llemu headers in the kernel repo can use to conditionally include the libvgl
|
||||
# versions
|
||||
ifneq (,$(wildcard ./include/liblvgl/llemu.h))
|
||||
CPPFLAGS += -D_PROS_INCLUDE_LIBLVGL_LLEMU_H
|
||||
endif
|
||||
ifneq (,$(wildcard ./include/liblvgl/llemu.hpp))
|
||||
CPPFLAGS += -D_PROS_INCLUDE_LIBLVGL_LLEMU_HPP
|
||||
endif
|
||||
|
||||
WARNFLAGS+=-Wno-psabi
|
||||
|
||||
SPACE := $() $()
|
||||
COMMA := ,
|
||||
|
||||
C_STANDARD?=gnu11
|
||||
CXX_STANDARD?=gnu++20
|
||||
|
||||
DEPDIR := .d
|
||||
$(shell mkdir -p $(DEPDIR))
|
||||
DEPFLAGS = -MT $$@ -MMD -MP -MF $(DEPDIR)/$$*.Td
|
||||
MAKEDEPFOLDER = -$(VV)mkdir -p $(DEPDIR)/$$(dir $$(patsubst $(BINDIR)/%, %, $(ROOT)/$$@))
|
||||
RENAMEDEPENDENCYFILE = -$(VV)mv -f $(DEPDIR)/$$*.Td $$(patsubst $(SRCDIR)/%, $(DEPDIR)/%.d, $(ROOT)/$$<) && touch $$@
|
||||
|
||||
LIBRARIES+=$(wildcard $(FWDIR)/*.a)
|
||||
# Cannot include newlib and libc because not all of the req'd stubs are implemented
|
||||
EXCLUDE_COLD_LIBRARIES+=$(FWDIR)/libc.a $(FWDIR)/libm.a
|
||||
COLD_LIBRARIES=$(filter-out $(EXCLUDE_COLD_LIBRARIES), $(LIBRARIES))
|
||||
wlprefix=-Wl,$(subst $(SPACE),$(COMMA),$1)
|
||||
LNK_FLAGS=--gc-sections --start-group $(strip $(LIBRARIES)) -lgcc -lstdc++ --end-group -T$(FWDIR)/v5-common.ld
|
||||
|
||||
ASMFLAGS=$(MFLAGS) $(WARNFLAGS)
|
||||
CFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=$(C_STANDARD)
|
||||
CXXFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=$(CXX_STANDARD)
|
||||
LDFLAGS=$(MFLAGS) $(WARNFLAGS) -nostdlib $(GCCFLAGS)
|
||||
SIZEFLAGS=-d --common
|
||||
NUMFMTFLAGS=--to=iec --format %.2f --suffix=B
|
||||
|
||||
AR:=$(ARCHTUPLE)ar
|
||||
# using arm-none-eabi-as generates a listing by default. This produces a super verbose output.
|
||||
# Using gcc accomplishes the same thing without the extra output
|
||||
AS:=$(ARCHTUPLE)gcc
|
||||
CC:=$(ARCHTUPLE)gcc
|
||||
CXX:=$(ARCHTUPLE)g++
|
||||
LD:=$(ARCHTUPLE)g++
|
||||
OBJCOPY:=$(ARCHTUPLE)objcopy
|
||||
SIZETOOL:=$(ARCHTUPLE)size
|
||||
READELF:=$(ARCHTUPLE)readelf
|
||||
STRIP:=$(ARCHTUPLE)strip
|
||||
|
||||
ifneq (, $(shell command -v gnumfmt 2> /dev/null))
|
||||
SIZES_NUMFMT:=| gnumfmt --field=-4 --header $(NUMFMTFLAGS)
|
||||
else
|
||||
ifneq (, $(shell command -v numfmt 2> /dev/null))
|
||||
SIZES_NUMFMT:=| numfmt --field=-4 --header $(NUMFMTFLAGS)
|
||||
else
|
||||
SIZES_NUMFMT:=
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (, $(shell command -v sed 2> /dev/null))
|
||||
SIZES_SED:=| sed -e 's/ dec/total/'
|
||||
else
|
||||
SIZES_SED:=
|
||||
endif
|
||||
|
||||
rwildcard=$(foreach d,$(filter-out $3,$(wildcard $1*)),$(call rwildcard,$d/,$2,$3)$(filter $(subst *,%,$2),$d))
|
||||
|
||||
# Colors
|
||||
NO_COLOR=$(shell printf "%b" "\033[0m")
|
||||
OK_COLOR=$(shell printf "%b" "\033[32;01m")
|
||||
ERROR_COLOR=$(shell printf "%b" "\033[31;01m")
|
||||
WARN_COLOR=$(shell printf "%b" "\033[33;01m")
|
||||
STEP_COLOR=$(shell printf "%b" "\033[37;01m")
|
||||
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)
|
||||
DONE_STRING=$(OK_COLOR)[DONE]$(NO_COLOR)
|
||||
ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)
|
||||
WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)
|
||||
ECHO=/bin/printf "%s\n"
|
||||
echo=@$(ECHO) "$2$1$(NO_COLOR)"
|
||||
echon=@/bin/printf "%s" "$2$1$(NO_COLOR)"
|
||||
|
||||
define test_output_2
|
||||
@if test $(BUILD_VERBOSE) -eq $(or $4,1); then printf "%s\n" "$2"; fi;
|
||||
@output="$$($2 2>&1)"; exit=$$?; \
|
||||
if test 0 -ne $$exit; then \
|
||||
printf "%s%s\n" "$1" "$(ERROR_STRING)"; \
|
||||
printf "%s\n" "$$output"; \
|
||||
exit $$exit; \
|
||||
elif test -n "$$output"; then \
|
||||
printf "%s%s\n" "$1" "$(WARN_STRING)"; \
|
||||
printf "%s\n" "$$output"; \
|
||||
else \
|
||||
printf "%s%s\n" "$1" "$3"; \
|
||||
fi;
|
||||
endef
|
||||
|
||||
define test_output
|
||||
@output=$$($1 2>&1); exit=$$?; \
|
||||
if test 0 -ne $$exit; then \
|
||||
printf "%s\n" "$(ERROR_STRING)" $$?; \
|
||||
printf "%s\n" $$output; \
|
||||
exit $$exit; \
|
||||
elif test -n "$$output"; then \
|
||||
printf "%s\n" "$(WARN_STRING)"; \
|
||||
printf "%s" $$output; \
|
||||
else \
|
||||
printf "%s\n" "$2"; \
|
||||
fi;
|
||||
endef
|
||||
|
||||
# Makefile Verbosity
|
||||
ifeq ("$(origin VERBOSE)", "command line")
|
||||
BUILD_VERBOSE = $(VERBOSE)
|
||||
endif
|
||||
ifeq ("$(origin V)", "command line")
|
||||
BUILD_VERBOSE = $(V)
|
||||
endif
|
||||
|
||||
ifndef BUILD_VERBOSE
|
||||
BUILD_VERBOSE = 0
|
||||
endif
|
||||
|
||||
# R is reduced (default messages) - build verbose = 0
|
||||
# V is verbose messages - verbosity = 1
|
||||
# VV is super verbose - verbosity = 2
|
||||
ifeq ($(BUILD_VERBOSE), 0)
|
||||
R = @echo
|
||||
D = @
|
||||
VV = @
|
||||
endif
|
||||
ifeq ($(BUILD_VERBOSE), 1)
|
||||
R = @echo
|
||||
D =
|
||||
VV = @
|
||||
endif
|
||||
ifeq ($(BUILD_VERBOSE), 2)
|
||||
R =
|
||||
D =
|
||||
VV =
|
||||
endif
|
||||
|
||||
INCLUDE=$(foreach dir,$(INCDIR) $(EXTRA_INCDIR),-iquote"$(dir)")
|
||||
|
||||
ASMSRC=$(foreach asmext,$(ASMEXTS),$(call rwildcard, $(SRCDIR),*.$(asmext), $1))
|
||||
ASMOBJ=$(addprefix $(BINDIR)/,$(patsubst $(SRCDIR)/%,%.o,$(call ASMSRC,$1)))
|
||||
CSRC=$(foreach cext,$(CEXTS),$(call rwildcard, $(SRCDIR),*.$(cext), $1))
|
||||
COBJ=$(addprefix $(BINDIR)/,$(patsubst $(SRCDIR)/%,%.o,$(call CSRC, $1)))
|
||||
CXXSRC=$(foreach cxxext,$(CXXEXTS),$(call rwildcard, $(SRCDIR),*.$(cxxext), $1))
|
||||
CXXOBJ=$(addprefix $(BINDIR)/,$(patsubst $(SRCDIR)/%,%.o,$(call CXXSRC,$1)))
|
||||
|
||||
GETALLOBJ=$(sort $(call ASMOBJ,$1) $(call COBJ,$1) $(call CXXOBJ,$1))
|
||||
|
||||
ARCHIVE_TEXT_LIST=$(subst $(SPACE),$(COMMA),$(notdir $(basename $(LIBRARIES))))
|
||||
|
||||
LDTIMEOBJ:=$(BINDIR)/_pros_ld_timestamp.o
|
||||
|
||||
MONOLITH_BIN:=$(BINDIR)/monolith.bin
|
||||
MONOLITH_ELF:=$(basename $(MONOLITH_BIN)).elf
|
||||
|
||||
HOT_BIN:=$(BINDIR)/hot.package.bin
|
||||
HOT_ELF:=$(basename $(HOT_BIN)).elf
|
||||
COLD_BIN:=$(BINDIR)/cold.package.bin
|
||||
COLD_ELF:=$(basename $(COLD_BIN)).elf
|
||||
|
||||
# Check if USE_PACKAGE is defined to check for migration steps from purduesigbots/pros#87
|
||||
ifndef USE_PACKAGE
|
||||
$(error Your Makefile must be migrated! Visit https://pros.cs.purdue.edu/v5/releases/kernel3.1.6.html to learn how)
|
||||
endif
|
||||
|
||||
DEFAULT_BIN=$(MONOLITH_BIN)
|
||||
ifeq ($(USE_PACKAGE),1)
|
||||
DEFAULT_BIN=$(HOT_BIN)
|
||||
endif
|
||||
|
||||
-include $(wildcard $(FWDIR)/*.mk)
|
||||
|
||||
.PHONY: all clean quick
|
||||
|
||||
quick: $(DEFAULT_BIN)
|
||||
|
||||
all: clean $(DEFAULT_BIN)
|
||||
|
||||
clean:
|
||||
@echo Cleaning project
|
||||
-$Drm -rf $(BINDIR)
|
||||
-$Drm -rf $(DEPDIR)
|
||||
|
||||
ifeq ($(IS_LIBRARY),1)
|
||||
ifeq ($(LIBNAME),libbest)
|
||||
$(errror "You should rename your library! libbest is the default library name and should be changed")
|
||||
endif
|
||||
|
||||
LIBAR=$(BINDIR)/$(LIBNAME).a
|
||||
TEMPLATE_DIR=$(ROOT)/template
|
||||
|
||||
clean-template:
|
||||
@echo Cleaning $(TEMPLATE_DIR)
|
||||
-$Drm -rf $(TEMPLATE_DIR)
|
||||
|
||||
$(LIBAR): $(call GETALLOBJ,$(EXCLUDE_SRC_FROM_LIB)) $(EXTRA_LIB_DEPS)
|
||||
-$Drm -f $@
|
||||
$(call test_output_2,Creating $@ ,$(AR) rcs $@ $^, $(DONE_STRING))
|
||||
|
||||
.PHONY: library
|
||||
library: $(LIBAR)
|
||||
|
||||
.PHONY: template
|
||||
template: clean-template $(LIBAR)
|
||||
$Dpros c create-template . $(LIBNAME) $(VERSION) $(foreach file,$(TEMPLATE_FILES) $(LIBAR),--system "$(file)") --target v5 $(CREATE_TEMPLATE_FLAGS)
|
||||
endif
|
||||
|
||||
# if project is a library source, compile the archive and link output.elf against the archive rather than source objects
|
||||
ifeq ($(IS_LIBRARY),1)
|
||||
ELF_DEPS+=$(filter-out $(call GETALLOBJ,$(EXCLUDE_SRC_FROM_LIB)), $(call GETALLOBJ,$(EXCLUDE_SRCDIRS)))
|
||||
LIBRARIES+=$(LIBAR)
|
||||
else
|
||||
ELF_DEPS+=$(call GETALLOBJ,$(EXCLUDE_SRCDIRS))
|
||||
endif
|
||||
|
||||
$(MONOLITH_BIN): $(MONOLITH_ELF) $(BINDIR)
|
||||
$(call test_output_2,Creating $@ for $(DEVICE) ,$(OBJCOPY) $< -O binary -R .hot_init $@,$(DONE_STRING))
|
||||
|
||||
$(MONOLITH_ELF): $(ELF_DEPS) $(LIBRARIES)
|
||||
$(call _pros_ld_timestamp)
|
||||
$(call test_output_2,Linking project with $(ARCHIVE_TEXT_LIST) ,$(LD) $(LDFLAGS) $(ELF_DEPS) $(LDTIMEOBJ) $(call wlprefix,-T$(FWDIR)/v5.ld $(LNK_FLAGS)) -o $@,$(OK_STRING))
|
||||
@echo Section sizes:
|
||||
-$(VV)$(SIZETOOL) $(SIZEFLAGS) $@ $(SIZES_SED) $(SIZES_NUMFMT)
|
||||
|
||||
$(COLD_BIN): $(COLD_ELF)
|
||||
$(call test_output_2,Creating cold package binary for $(DEVICE) ,$(OBJCOPY) $< -O binary -R .hot_init $@,$(DONE_STRING))
|
||||
|
||||
$(COLD_ELF): $(COLD_LIBRARIES)
|
||||
$(VV)mkdir -p $(dir $@)
|
||||
$(call test_output_2,Creating cold package with $(ARCHIVE_TEXT_LIST) ,$(LD) $(LDFLAGS) $(call wlprefix,--gc-keep-exported --whole-archive $^ -lstdc++ --no-whole-archive) $(call wlprefix,-T$(FWDIR)/v5.ld $(LNK_FLAGS) -o $@),$(OK_STRING))
|
||||
$(call test_output_2,Stripping cold package ,$(OBJCOPY) --strip-symbol=install_hot_table --strip-symbol=__libc_init_array --strip-symbol=_PROS_COMPILE_DIRECTORY --strip-symbol=_PROS_COMPILE_TIMESTAMP --strip-symbol=_PROS_COMPILE_TIMESTAMP_INT $@ $@, $(DONE_STRING))
|
||||
@echo Section sizes:
|
||||
-$(VV)$(SIZETOOL) $(SIZEFLAGS) $@ $(SIZES_SED) $(SIZES_NUMFMT)
|
||||
|
||||
$(HOT_BIN): $(HOT_ELF) $(COLD_BIN)
|
||||
$(call test_output_2,Creating $@ for $(DEVICE) ,$(OBJCOPY) $< -O binary $@,$(DONE_STRING))
|
||||
|
||||
$(HOT_ELF): $(COLD_ELF) $(ELF_DEPS)
|
||||
$(call _pros_ld_timestamp)
|
||||
$(call test_output_2,Linking hot project with $(COLD_ELF) and $(ARCHIVE_TEXT_LIST) ,$(LD) -nostartfiles $(LDFLAGS) $(call wlprefix,-R $<) $(filter-out $<,$^) $(LDTIMEOBJ) $(LIBRARIES) $(call wlprefix,-T$(FWDIR)/v5-hot.ld $(LNK_FLAGS) -o $@),$(OK_STRING))
|
||||
@printf "%s\n" "Section sizes:"
|
||||
-$(VV)$(SIZETOOL) $(SIZEFLAGS) $@ $(SIZES_SED) $(SIZES_NUMFMT)
|
||||
|
||||
define asm_rule
|
||||
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1
|
||||
$(VV)mkdir -p $$(dir $$@)
|
||||
$$(call test_output_2,Compiled $$< ,$(AS) -c $(ASMFLAGS) -o $$@ $$<,$(OK_STRING))
|
||||
endef
|
||||
$(foreach asmext,$(ASMEXTS),$(eval $(call asm_rule,$(asmext))))
|
||||
|
||||
define c_rule
|
||||
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1
|
||||
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename $1).d
|
||||
$(VV)mkdir -p $$(dir $$@)
|
||||
$(MAKEDEPFOLDER)
|
||||
$$(call test_output_2,Compiled $$< ,$(CC) -c $(INCLUDE) -iquote"$(INCDIR)/$$(dir $$*)" $(CFLAGS) $(EXTRA_CFLAGS) $(DEPFLAGS) -o $$@ $$<,$(OK_STRING))
|
||||
$(RENAMEDEPENDENCYFILE)
|
||||
endef
|
||||
$(foreach cext,$(CEXTS),$(eval $(call c_rule,$(cext))))
|
||||
|
||||
define cxx_rule
|
||||
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1
|
||||
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename %).d
|
||||
$(VV)mkdir -p $$(dir $$@)
|
||||
$(MAKEDEPFOLDER)
|
||||
$$(call test_output_2,Compiled $$< ,$(CXX) -c $(INCLUDE) -iquote"$(INCDIR)/$$(dir $$*)" $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(DEPFLAGS) -o $$@ $$<,$(OK_STRING))
|
||||
$(RENAMEDEPENDENCYFILE)
|
||||
endef
|
||||
$(foreach cxxext,$(CXXEXTS),$(eval $(call cxx_rule,$(cxxext))))
|
||||
|
||||
define _pros_ld_timestamp
|
||||
$(VV)mkdir -p $(dir $(LDTIMEOBJ))
|
||||
@# Pipe a line of code defining _PROS_COMPILE_TOOLSTAMP and _PROS_COMPILE_DIRECTORY into GCC,
|
||||
@# which allows compilation from stdin. We define _PROS_COMPILE_DIRECTORY using a command line-defined macro
|
||||
@# which is the pwd | tail bit, which will truncate the path to the last 23 characters
|
||||
@#
|
||||
@# const int _PROS_COMPILE_TIMESTAMP_INT = $(( $(date +%s) - $(date +%z) * 3600 ))
|
||||
@# char const * const _PROS_COMPILE_TIEMSTAMP = __DATE__ " " __TIME__
|
||||
@# char const * const _PROS_COMPILE_DIRECTORY = "$(shell pwd | tail -c 23)";
|
||||
@#
|
||||
@# The shell command $$(($$(date +%s)+($$(date +%-z)/100*3600))) fetches the current
|
||||
@# unix timestamp, and then adds the UTC timezone offset to account for time zones.
|
||||
|
||||
$(call test_output_2,Adding timestamp ,echo 'const int _PROS_COMPILE_TIMESTAMP_INT = $(shell echo $$(($$(date +%s)+($$(date +%-z)/100*3600)))); char const * const _PROS_COMPILE_TIMESTAMP = __DATE__ " " __TIME__; char const * const _PROS_COMPILE_DIRECTORY = "$(wildcard $(shell pwd | tail -c 23))";' | $(CC) -c -x c $(CFLAGS) $(EXTRA_CFLAGS) -o $(LDTIMEOBJ) -,$(OK_STRING))
|
||||
endef
|
||||
|
||||
# these rules are for build-compile-commands, which just print out sysroot information
|
||||
cc-sysroot:
|
||||
@echo | $(CC) -c -x c $(CFLAGS) $(EXTRA_CFLAGS) --verbose -o /dev/null -
|
||||
cxx-sysroot:
|
||||
@echo | $(CXX) -c -x c++ $(CXXFLAGS) $(EXTRA_CXXFLAGS) --verbose -o /dev/null -
|
||||
|
||||
$(DEPDIR)/%.d: ;
|
||||
.PRECIOUS: $(DEPDIR)/%.d
|
||||
|
||||
include $(wildcard $(patsubst $(SRCDIR)/%,$(DEPDIR)/%.d,$(CSRC) $(CXXSRC)))
|
||||
BIN
firmware/libc.a
Normal file
BIN
firmware/libc.a
Normal file
Binary file not shown.
BIN
firmware/liblvgl.a
Normal file
BIN
firmware/liblvgl.a
Normal file
Binary file not shown.
BIN
firmware/libm.a
Normal file
BIN
firmware/libm.a
Normal file
Binary file not shown.
BIN
firmware/libpros.a
Normal file
BIN
firmware/libpros.a
Normal file
Binary file not shown.
BIN
firmware/okapilib.a
Normal file
BIN
firmware/okapilib.a
Normal file
Binary file not shown.
1
firmware/squiggles.mk
Normal file
1
firmware/squiggles.mk
Normal file
@ -0,0 +1 @@
|
||||
INCLUDE+=-iquote"$(ROOT)/include/okapi/squiggles"
|
||||
263
firmware/v5-common.ld
Normal file
263
firmware/v5-common.ld
Normal file
@ -0,0 +1,263 @@
|
||||
/* Define the sections, and where they are mapped in memory */
|
||||
SECTIONS
|
||||
{
|
||||
/* This will get stripped out before uploading, but we need to place code
|
||||
here so we can at least link to it (install_hot_table) */
|
||||
.hot_init : {
|
||||
KEEP (*(.hot_magic))
|
||||
KEEP (*(.hot_init))
|
||||
} > HOT_MEMORY
|
||||
|
||||
.text : {
|
||||
KEEP (*(.vectors))
|
||||
/* boot data should be exactly 32 bytes long */
|
||||
*(.boot_data)
|
||||
. = 0x20;
|
||||
*(.boot)
|
||||
. = ALIGN(64);
|
||||
*(.freertos_vectors)
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.plt)
|
||||
*(.gnu_warning)
|
||||
*(.gcc_except_table)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.vfp11_veneer)
|
||||
*(.ARM.extab)
|
||||
*(.gnu.linkonce.armextab.*)
|
||||
} > RAM
|
||||
|
||||
.init : {
|
||||
KEEP (*(.init))
|
||||
} > RAM
|
||||
|
||||
.fini : {
|
||||
KEEP (*(.fini))
|
||||
} > RAM
|
||||
|
||||
.rodata : {
|
||||
__rodata_start = .;
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.gnu.linkonce.r.*)
|
||||
__rodata_end = .;
|
||||
} > RAM
|
||||
|
||||
.rodata1 : {
|
||||
__rodata1_start = .;
|
||||
*(.rodata1)
|
||||
*(.rodata1.*)
|
||||
__rodata1_end = .;
|
||||
} > RAM
|
||||
|
||||
.sdata2 : {
|
||||
__sdata2_start = .;
|
||||
*(.sdata2)
|
||||
*(.sdata2.*)
|
||||
*(.gnu.linkonce.s2.*)
|
||||
__sdata2_end = .;
|
||||
} > RAM
|
||||
|
||||
.sbss2 : {
|
||||
__sbss2_start = .;
|
||||
*(.sbss2)
|
||||
*(.sbss2.*)
|
||||
*(.gnu.linkonce.sb2.*)
|
||||
__sbss2_end = .;
|
||||
} > RAM
|
||||
|
||||
.data : {
|
||||
__data_start = .;
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
*(.jcr)
|
||||
*(.got)
|
||||
*(.got.plt)
|
||||
__data_end = .;
|
||||
} > RAM
|
||||
|
||||
.data1 : {
|
||||
__data1_start = .;
|
||||
*(.data1)
|
||||
*(.data1.*)
|
||||
__data1_end = .;
|
||||
} > RAM
|
||||
|
||||
.got : {
|
||||
*(.got)
|
||||
} > RAM
|
||||
|
||||
.ctors : {
|
||||
__CTOR_LIST__ = .;
|
||||
___CTORS_LIST___ = .;
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
__CTOR_END__ = .;
|
||||
___CTORS_END___ = .;
|
||||
} > RAM
|
||||
|
||||
.dtors : {
|
||||
__DTOR_LIST__ = .;
|
||||
___DTORS_LIST___ = .;
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
__DTOR_END__ = .;
|
||||
___DTORS_END___ = .;
|
||||
} > RAM
|
||||
|
||||
.fixup : {
|
||||
__fixup_start = .;
|
||||
*(.fixup)
|
||||
__fixup_end = .;
|
||||
} > RAM
|
||||
|
||||
.eh_frame : {
|
||||
*(.eh_frame)
|
||||
} > RAM
|
||||
|
||||
.eh_framehdr : {
|
||||
__eh_framehdr_start = .;
|
||||
*(.eh_framehdr)
|
||||
__eh_framehdr_end = .;
|
||||
} > RAM
|
||||
|
||||
.gcc_except_table : {
|
||||
*(.gcc_except_table)
|
||||
} > RAM
|
||||
|
||||
.mmu_tbl (ALIGN(16384)) : {
|
||||
__mmu_tbl_start = .;
|
||||
*(.mmu_tbl)
|
||||
__mmu_tbl_end = .;
|
||||
} > RAM
|
||||
|
||||
.ARM.exidx : {
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx*)
|
||||
*(.gnu.linkonce.armexidix.*.*)
|
||||
__exidx_end = .;
|
||||
} > RAM
|
||||
|
||||
.preinit_array : {
|
||||
__preinit_array_start = .;
|
||||
KEEP (*(SORT(.preinit_array.*)))
|
||||
KEEP (*(.preinit_array))
|
||||
__preinit_array_end = .;
|
||||
} > RAM
|
||||
|
||||
.init_array : {
|
||||
__init_array_start = .;
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
__init_array_end = .;
|
||||
} > RAM
|
||||
|
||||
.fini_array : {
|
||||
__fini_array_start = .;
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array))
|
||||
__fini_array_end = .;
|
||||
} > RAM
|
||||
|
||||
.ARM.attributes : {
|
||||
__ARM.attributes_start = .;
|
||||
*(.ARM.attributes)
|
||||
__ARM.attributes_end = .;
|
||||
} > RAM
|
||||
|
||||
.sdata : {
|
||||
__sdata_start = .;
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
__sdata_end = .;
|
||||
} > RAM
|
||||
|
||||
.sbss (NOLOAD) : {
|
||||
__sbss_start = .;
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
__sbss_end = .;
|
||||
} > RAM
|
||||
|
||||
.tdata : {
|
||||
__tdata_start = .;
|
||||
*(.tdata)
|
||||
*(.tdata.*)
|
||||
*(.gnu.linkonce.td.*)
|
||||
__tdata_end = .;
|
||||
} > RAM
|
||||
|
||||
.tbss : {
|
||||
__tbss_start = .;
|
||||
*(.tbss)
|
||||
*(.tbss.*)
|
||||
*(.gnu.linkonce.tb.*)
|
||||
__tbss_end = .;
|
||||
} > RAM
|
||||
|
||||
.bss (NOLOAD) : {
|
||||
__bss_start = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
__bss_end = .;
|
||||
} > RAM
|
||||
|
||||
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
|
||||
|
||||
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
|
||||
|
||||
/* Generate Stack and Heap definitions */
|
||||
|
||||
.heap (NOLOAD) : {
|
||||
. = ALIGN(16);
|
||||
_heap = .;
|
||||
HeapBase = .;
|
||||
_heap_start = .;
|
||||
. += _HEAP_SIZE;
|
||||
_heap_end = .;
|
||||
HeapLimit = .;
|
||||
} > HEAP
|
||||
|
||||
.stack (NOLOAD) : {
|
||||
. = ALIGN(16);
|
||||
_stack_end = .;
|
||||
. += _STACK_SIZE;
|
||||
. = ALIGN(16);
|
||||
_stack = .;
|
||||
__stack = _stack;
|
||||
. = ALIGN(16);
|
||||
_irq_stack_end = .;
|
||||
. += _IRQ_STACK_SIZE;
|
||||
. = ALIGN(16);
|
||||
__irq_stack = .;
|
||||
_supervisor_stack_end = .;
|
||||
. += _SUPERVISOR_STACK_SIZE;
|
||||
. = ALIGN(16);
|
||||
__supervisor_stack = .;
|
||||
_abort_stack_end = .;
|
||||
. += _ABORT_STACK_SIZE;
|
||||
. = ALIGN(16);
|
||||
__abort_stack = .;
|
||||
_fiq_stack_end = .;
|
||||
. += _FIQ_STACK_SIZE;
|
||||
. = ALIGN(16);
|
||||
__fiq_stack = .;
|
||||
_undef_stack_end = .;
|
||||
. += _UNDEF_STACK_SIZE;
|
||||
. = ALIGN(16);
|
||||
__undef_stack = .;
|
||||
} > COLD_MEMORY
|
||||
|
||||
_end = .;
|
||||
}
|
||||
33
firmware/v5-hot.ld
Normal file
33
firmware/v5-hot.ld
Normal file
@ -0,0 +1,33 @@
|
||||
/* This stack is used during initialization, but FreeRTOS tasks have their own
|
||||
stack allocated in BSS or Heap (kernel tasks in FreeRTOS .bss heap; user tasks
|
||||
in standard heap) */
|
||||
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000;
|
||||
|
||||
_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024;
|
||||
_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048;
|
||||
_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024;
|
||||
_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024;
|
||||
_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024;
|
||||
|
||||
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */
|
||||
|
||||
/* Define Memories in the system */
|
||||
start_of_cold_mem = 0x03800000;
|
||||
_COLD_MEM_SIZE = 0x04800000;
|
||||
end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE;
|
||||
|
||||
start_of_hot_mem = 0x07800000;
|
||||
_HOT_MEM_SIZE = 0x00800000;
|
||||
end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* user code 72M */
|
||||
COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */
|
||||
HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE
|
||||
HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */
|
||||
}
|
||||
|
||||
REGION_ALIAS("RAM", HOT_MEMORY);
|
||||
|
||||
ENTRY(install_hot_table)
|
||||
33
firmware/v5.ld
Normal file
33
firmware/v5.ld
Normal file
@ -0,0 +1,33 @@
|
||||
/* This stack is used during initialization, but FreeRTOS tasks have their own
|
||||
stack allocated in BSS or Heap (kernel tasks in FreeRTOS .bss heap; user tasks
|
||||
in standard heap) */
|
||||
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x2000;
|
||||
|
||||
_ABORT_STACK_SIZE = DEFINED(_ABORT_STACK_SIZE) ? _ABORT_STACK_SIZE : 1024;
|
||||
_SUPERVISOR_STACK_SIZE = DEFINED(_SUPERVISOR_STACK_SIZE) ? _SUPERVISOR_STACK_SIZE : 2048;
|
||||
_IRQ_STACK_SIZE = DEFINED(_IRQ_STACK_SIZE) ? _IRQ_STACK_SIZE : 1024;
|
||||
_FIQ_STACK_SIZE = DEFINED(_FIQ_STACK_SIZE) ? _FIQ_STACK_SIZE : 1024;
|
||||
_UNDEF_STACK_SIZE = DEFINED(_UNDEF_STACK_SIZE) ? _UNDEF_STACK_SIZE : 1024;
|
||||
|
||||
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x02E00000; /* ~48 MB */
|
||||
|
||||
/* Define Memories in the system */
|
||||
start_of_cold_mem = 0x03800000;
|
||||
_COLD_MEM_SIZE = 0x04800000;
|
||||
end_of_cold_mem = start_of_cold_mem + _COLD_MEM_SIZE;
|
||||
|
||||
start_of_hot_mem = 0x07800000;
|
||||
_HOT_MEM_SIZE = 0x00800000;
|
||||
end_of_hot_mem = start_of_hot_mem + _HOT_MEM_SIZE;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* user code 72M */
|
||||
COLD_MEMORY : ORIGIN = start_of_cold_mem, LENGTH = _COLD_MEM_SIZE /* Just under 19 MB */
|
||||
HEAP : ORIGIN = 0x04A00000, LENGTH = _HEAP_SIZE
|
||||
HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */
|
||||
}
|
||||
|
||||
REGION_ALIAS("RAM", COLD_MEMORY);
|
||||
|
||||
ENTRY(vexStartup)
|
||||
84
include/api.h
Normal file
84
include/api.h
Normal file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* \file api.h
|
||||
*
|
||||
* PROS API header provides high-level user functionality
|
||||
*
|
||||
* Contains declarations for use by typical VEX programmers using PROS.
|
||||
*
|
||||
* This file should not be modified by users, since it gets replaced whenever
|
||||
* a kernel upgrade occurs.
|
||||
*
|
||||
* \copyright Copyright (c) 2017-2023, Purdue University ACM SIGBots.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef _PROS_API_H_
|
||||
#define _PROS_API_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cerrno>
|
||||
#include <cmath>
|
||||
#include <cstdbool>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#else /* (not) __cplusplus */
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define PROS_VERSION_MAJOR 4
|
||||
#define PROS_VERSION_MINOR 0
|
||||
#define PROS_VERSION_PATCH 6
|
||||
#define PROS_VERSION_STRING "4.0.6"
|
||||
|
||||
#include "pros/adi.h"
|
||||
#include "pros/colors.h"
|
||||
#include "pros/device.h"
|
||||
#include "pros/distance.h"
|
||||
#include "pros/error.h"
|
||||
#include "pros/ext_adi.h"
|
||||
#include "pros/gps.h"
|
||||
#include "pros/imu.h"
|
||||
#include "pros/link.h"
|
||||
#include "pros/llemu.h"
|
||||
#include "pros/misc.h"
|
||||
#include "pros/motors.h"
|
||||
#include "pros/optical.h"
|
||||
#include "pros/rotation.h"
|
||||
#include "pros/rtos.h"
|
||||
#include "pros/screen.h"
|
||||
#include "pros/vision.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "pros/adi.hpp"
|
||||
#include "pros/colors.hpp"
|
||||
#include "pros/device.hpp"
|
||||
#include "pros/distance.hpp"
|
||||
#include "pros/gps.hpp"
|
||||
#include "pros/imu.hpp"
|
||||
#include "pros/link.hpp"
|
||||
#include "pros/llemu.hpp"
|
||||
#include "pros/misc.hpp"
|
||||
#include "pros/motor_group.hpp"
|
||||
#include "pros/motors.hpp"
|
||||
#include "pros/optical.hpp"
|
||||
#include "pros/rotation.hpp"
|
||||
#include "pros/rtos.hpp"
|
||||
#include "pros/screen.hpp"
|
||||
#include "pros/vision.hpp"
|
||||
#endif
|
||||
|
||||
#endif // _PROS_API_H_
|
||||
264
include/liblvgl/core/lv_disp.h
Normal file
264
include/liblvgl/core/lv_disp.h
Normal file
@ -0,0 +1,264 @@
|
||||
/**
|
||||
* @file lv_disp.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DISP_H
|
||||
#define LV_DISP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/hal/lv_hal.h"
|
||||
#include "lv_obj.h"
|
||||
#include "lv_theme.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum {
|
||||
LV_SCR_LOAD_ANIM_NONE,
|
||||
LV_SCR_LOAD_ANIM_OVER_LEFT,
|
||||
LV_SCR_LOAD_ANIM_OVER_RIGHT,
|
||||
LV_SCR_LOAD_ANIM_OVER_TOP,
|
||||
LV_SCR_LOAD_ANIM_OVER_BOTTOM,
|
||||
LV_SCR_LOAD_ANIM_MOVE_LEFT,
|
||||
LV_SCR_LOAD_ANIM_MOVE_RIGHT,
|
||||
LV_SCR_LOAD_ANIM_MOVE_TOP,
|
||||
LV_SCR_LOAD_ANIM_MOVE_BOTTOM,
|
||||
LV_SCR_LOAD_ANIM_FADE_IN,
|
||||
LV_SCR_LOAD_ANIM_FADE_ON = LV_SCR_LOAD_ANIM_FADE_IN, /*For backward compatibility*/
|
||||
LV_SCR_LOAD_ANIM_FADE_OUT,
|
||||
LV_SCR_LOAD_ANIM_OUT_LEFT,
|
||||
LV_SCR_LOAD_ANIM_OUT_RIGHT,
|
||||
LV_SCR_LOAD_ANIM_OUT_TOP,
|
||||
LV_SCR_LOAD_ANIM_OUT_BOTTOM,
|
||||
} lv_scr_load_anim_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Return with a pointer to the active screen
|
||||
* @param disp pointer to display which active screen should be get. (NULL to use the default
|
||||
* screen)
|
||||
* @return pointer to the active screen object (loaded by 'lv_scr_load()')
|
||||
*/
|
||||
lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Return with a pointer to the previous screen. Only used during screen transitions.
|
||||
* @param disp pointer to display which previous screen should be get. (NULL to use the default
|
||||
* screen)
|
||||
* @return pointer to the previous screen object or NULL if not used now
|
||||
*/
|
||||
lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Make a screen active
|
||||
* @param scr pointer to a screen
|
||||
*/
|
||||
void lv_disp_load_scr(lv_obj_t * scr);
|
||||
|
||||
/**
|
||||
* Return with the top layer. (Same on every screen and it is above the normal screen layer)
|
||||
* @param disp pointer to display which top layer should be get. (NULL to use the default screen)
|
||||
* @return pointer to the top layer object (transparent screen sized lv_obj)
|
||||
*/
|
||||
lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Return with the sys. layer. (Same on every screen and it is above the normal screen and the top
|
||||
* layer)
|
||||
* @param disp pointer to display which sys. layer should be retrieved. (NULL to use the default screen)
|
||||
* @return pointer to the sys layer object (transparent screen sized lv_obj)
|
||||
*/
|
||||
lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Set the theme of a display
|
||||
* @param disp pointer to a display
|
||||
*/
|
||||
void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th);
|
||||
|
||||
/**
|
||||
* Get the theme of a display
|
||||
* @param disp pointer to a display
|
||||
* @return the display's theme (can be NULL)
|
||||
*/
|
||||
lv_theme_t * lv_disp_get_theme(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Set the background color of a display
|
||||
* @param disp pointer to a display
|
||||
* @param color color of the background
|
||||
*/
|
||||
void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Set the background image of a display
|
||||
* @param disp pointer to a display
|
||||
* @param img_src path to file or pointer to an `lv_img_dsc_t` variable
|
||||
*/
|
||||
void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||
|
||||
/**
|
||||
* Set opacity of the background
|
||||
* @param disp pointer to a display
|
||||
* @param opa opacity (0..255)
|
||||
*/
|
||||
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* Switch screen with animation
|
||||
* @param scr pointer to the new screen to load
|
||||
* @param anim_type type of the animation from `lv_scr_load_anim_t`, e.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT`
|
||||
* @param time time of the animation
|
||||
* @param delay delay before the transition
|
||||
* @param auto_del true: automatically delete the old screen
|
||||
*/
|
||||
void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del);
|
||||
|
||||
/**
|
||||
* Get elapsed time since last user activity on a display (e.g. click)
|
||||
* @param disp pointer to a display (NULL to get the overall smallest inactivity)
|
||||
* @return elapsed ticks (milliseconds) since the last activity
|
||||
*/
|
||||
uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Manually trigger an activity on a display
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
*/
|
||||
void lv_disp_trig_activity(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Clean any CPU cache that is related to the display.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
*/
|
||||
void lv_disp_clean_dcache(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Temporarily enable and disable the invalidation of the display.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
* @param en true: enable invalidation; false: invalidation
|
||||
*/
|
||||
void lv_disp_enable_invalidation(lv_disp_t * disp, bool en);
|
||||
|
||||
/**
|
||||
* Get display invalidation is enabled.
|
||||
* @param disp pointer to a display (NULL to use the default display)
|
||||
* @return return true if invalidation is enabled
|
||||
*/
|
||||
bool lv_disp_is_invalidation_enabled(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher timer. (NULL on error)
|
||||
*/
|
||||
lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp);
|
||||
|
||||
/*------------------------------------------------
|
||||
* To improve backward compatibility
|
||||
* Recommended only if you have one display
|
||||
*------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Get the active screen of the default display
|
||||
* @return pointer to the active screen
|
||||
*/
|
||||
static inline lv_obj_t * lv_scr_act(void)
|
||||
{
|
||||
return lv_disp_get_scr_act(lv_disp_get_default());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the top layer of the default display
|
||||
* @return pointer to the top layer
|
||||
*/
|
||||
static inline lv_obj_t * lv_layer_top(void)
|
||||
{
|
||||
return lv_disp_get_layer_top(lv_disp_get_default());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active screen of the default display
|
||||
* @return pointer to the sys layer
|
||||
*/
|
||||
static inline lv_obj_t * lv_layer_sys(void)
|
||||
{
|
||||
return lv_disp_get_layer_sys(lv_disp_get_default());
|
||||
}
|
||||
|
||||
static inline void lv_scr_load(lv_obj_t * scr)
|
||||
{
|
||||
lv_disp_load_scr(scr);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/*------------------------------------------------
|
||||
* To improve backward compatibility
|
||||
* Recommended only if you have one display
|
||||
*------------------------------------------------*/
|
||||
|
||||
#ifndef LV_HOR_RES
|
||||
/**
|
||||
* The horizontal resolution of the currently active display.
|
||||
*/
|
||||
#define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default())
|
||||
#endif
|
||||
|
||||
#ifndef LV_VER_RES
|
||||
/**
|
||||
* The vertical resolution of the currently active display.
|
||||
*/
|
||||
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default())
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
|
||||
* considering the DPI of the default display.
|
||||
* It ensures that e.g. `lv_dpx(100)` will have the same physical size regardless to the
|
||||
* DPI of the display.
|
||||
* @param n the number of pixels to scale
|
||||
* @return `n x current_dpi/160`
|
||||
*/
|
||||
static inline lv_coord_t lv_dpx(lv_coord_t n)
|
||||
{
|
||||
return LV_DPX(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
|
||||
* considering the DPI of the given display.
|
||||
* It ensures that e.g. `lv_dpx(100)` will have the same physical size regardless to the
|
||||
* DPI of the display.
|
||||
* @param obj a display whose dpi should be considered
|
||||
* @param n the number of pixels to scale
|
||||
* @return `n x current_dpi/160`
|
||||
*/
|
||||
static inline lv_coord_t lv_disp_dpx(const lv_disp_t * disp, lv_coord_t n)
|
||||
{
|
||||
return _LV_DPX_CALC(lv_disp_get_dpi(disp), n);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DISP_H*/
|
||||
363
include/liblvgl/core/lv_event.h
Normal file
363
include/liblvgl/core/lv_event.h
Normal file
@ -0,0 +1,363 @@
|
||||
/**
|
||||
* @file lv_event.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EVENT_H
|
||||
#define LV_EVENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdbool.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_event_dsc_t;
|
||||
|
||||
/**
|
||||
* Type of event being sent to the object.
|
||||
*/
|
||||
typedef enum {
|
||||
LV_EVENT_ALL = 0,
|
||||
|
||||
/** Input device events*/
|
||||
LV_EVENT_PRESSED, /**< The object has been pressed*/
|
||||
LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
||||
LV_EVENT_PRESS_LOST, /**< The object is still being pressed but slid cursor/finger off of the object */
|
||||
LV_EVENT_SHORT_CLICKED, /**< The object was pressed for a short period of time, then released it. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `long_press_time`. Not called if scrolled.*/
|
||||
LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `long_press_time` in every `long_press_repeat_time` ms. Not called if scrolled.*/
|
||||
LV_EVENT_CLICKED, /**< Called on release if not scrolled (regardless to long press)*/
|
||||
LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/
|
||||
LV_EVENT_SCROLL_BEGIN, /**< Scrolling begins. The event parameter is a pointer to the animation of the scroll. Can be modified*/
|
||||
LV_EVENT_SCROLL_END, /**< Scrolling ends*/
|
||||
LV_EVENT_SCROLL, /**< Scrolling*/
|
||||
LV_EVENT_GESTURE, /**< A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_get_act());` */
|
||||
LV_EVENT_KEY, /**< A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_get_act());`*/
|
||||
LV_EVENT_FOCUSED, /**< The object is focused*/
|
||||
LV_EVENT_DEFOCUSED, /**< The object is defocused*/
|
||||
LV_EVENT_LEAVE, /**< The object is defocused but still selected*/
|
||||
LV_EVENT_HIT_TEST, /**< Perform advanced hit-testing*/
|
||||
|
||||
/** Drawing events*/
|
||||
LV_EVENT_COVER_CHECK, /**< Check if the object fully covers an area. The event parameter is `lv_cover_check_info_t *`.*/
|
||||
LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the required extra draw area around the object (e.g. for shadow). The event parameter is `lv_coord_t *` to store the size.*/
|
||||
LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase*/
|
||||
LV_EVENT_DRAW_MAIN, /**< Perform the main drawing*/
|
||||
LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase*/
|
||||
LV_EVENT_DRAW_POST_BEGIN, /**< Starting the post draw phase (when all children are drawn)*/
|
||||
LV_EVENT_DRAW_POST, /**< Perform the post draw phase (when all children are drawn)*/
|
||||
LV_EVENT_DRAW_POST_END, /**< Finishing the post draw phase (when all children are drawn)*/
|
||||
LV_EVENT_DRAW_PART_BEGIN, /**< Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */
|
||||
LV_EVENT_DRAW_PART_END, /**< Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. */
|
||||
|
||||
/** Special events*/
|
||||
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved)*/
|
||||
LV_EVENT_INSERT, /**< A text is inserted to the object. The event data is `char *` being inserted.*/
|
||||
LV_EVENT_REFRESH, /**< Notify the object to refresh something on it (for the user)*/
|
||||
LV_EVENT_READY, /**< A process has finished*/
|
||||
LV_EVENT_CANCEL, /**< A process has been cancelled */
|
||||
|
||||
/** Other events*/
|
||||
LV_EVENT_DELETE, /**< Object is being deleted*/
|
||||
LV_EVENT_CHILD_CHANGED, /**< Child was removed, added, or its size, position were changed */
|
||||
LV_EVENT_CHILD_CREATED, /**< Child was created, always bubbles up to all parents*/
|
||||
LV_EVENT_CHILD_DELETED, /**< Child was deleted, always bubbles up to all parents*/
|
||||
LV_EVENT_SCREEN_UNLOAD_START, /**< A screen unload started, fired immediately when scr_load is called*/
|
||||
LV_EVENT_SCREEN_LOAD_START, /**< A screen load started, fired when the screen change delay is expired*/
|
||||
LV_EVENT_SCREEN_LOADED, /**< A screen was loaded*/
|
||||
LV_EVENT_SCREEN_UNLOADED, /**< A screen was unloaded*/
|
||||
LV_EVENT_SIZE_CHANGED, /**< Object coordinates/size have changed*/
|
||||
LV_EVENT_STYLE_CHANGED, /**< Object's style has changed*/
|
||||
LV_EVENT_LAYOUT_CHANGED, /**< The children position has changed due to a layout recalculation*/
|
||||
LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/
|
||||
|
||||
_LV_EVENT_LAST, /** Number of default events*/
|
||||
|
||||
|
||||
LV_EVENT_PREPROCESS = 0x80, /** This is a flag that can be set with an event so it's processed
|
||||
before the class default event processing */
|
||||
} lv_event_code_t;
|
||||
|
||||
typedef struct _lv_event_t {
|
||||
struct _lv_obj_t * target;
|
||||
struct _lv_obj_t * current_target;
|
||||
lv_event_code_t code;
|
||||
void * user_data;
|
||||
void * param;
|
||||
struct _lv_event_t * prev;
|
||||
uint8_t deleted : 1;
|
||||
uint8_t stop_processing : 1;
|
||||
uint8_t stop_bubbling : 1;
|
||||
} lv_event_t;
|
||||
|
||||
/**
|
||||
* @brief Event callback.
|
||||
* Events are used to notify the user of some action being taken on the object.
|
||||
* For details, see ::lv_event_t.
|
||||
*/
|
||||
typedef void (*lv_event_cb_t)(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Used as the event parameter of ::LV_EVENT_HIT_TEST to check if an `point` can click the object or not.
|
||||
* `res` should be set like this:
|
||||
* - If already set to `false` an other event wants that point non clickable. If you want to respect it leave it as `false` or set `true` to overwrite it.
|
||||
* - If already set `true` and `point` shouldn't be clickable set to `false`
|
||||
* - If already set to `true` you agree that `point` can click the object leave it as `true`
|
||||
*/
|
||||
typedef struct {
|
||||
const lv_point_t * point; /**< A point relative to screen to check if it can click the object or not*/
|
||||
bool res; /**< true: `point` can click the object; false: it cannot*/
|
||||
} lv_hit_test_info_t;
|
||||
|
||||
/**
|
||||
* Used as the event parameter of ::LV_EVENT_COVER_CHECK to check if an area is covered by the object or not.
|
||||
* In the event use `const lv_area_t * area = lv_event_get_cover_area(e)` to get the area to check
|
||||
* and `lv_event_set_cover_res(e, res)` to set the result.
|
||||
*/
|
||||
typedef struct {
|
||||
lv_cover_res_t res;
|
||||
const lv_area_t * area;
|
||||
} lv_cover_check_info_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Send an event to the object
|
||||
* @param obj pointer to an object
|
||||
* @param event_code the type of the event from `lv_event_t`
|
||||
* @param param arbitrary data depending on the widget type and the event. (Usually `NULL`)
|
||||
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event_code
|
||||
*/
|
||||
lv_res_t lv_event_send(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param);
|
||||
|
||||
/**
|
||||
* Used by the widgets internally to call the ancestor widget types's event handler
|
||||
* @param class_p pointer to the class of the widget (NOT the ancestor class)
|
||||
* @param e pointer to the event descriptor
|
||||
* @return LV_RES_OK: the target object was not deleted in the event; LV_RES_INV: it was deleted in the event_code
|
||||
*/
|
||||
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the object originally targeted by the event. It's the same even if the event is bubbled.
|
||||
* @param e pointer to the event descriptor
|
||||
* @return the target of the event_code
|
||||
*/
|
||||
struct _lv_obj_t * lv_event_get_target(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the current target of the event. It's the object which event handler being called.
|
||||
* If the event is not bubbled it's the same as "normal" target.
|
||||
* @param e pointer to the event descriptor
|
||||
* @return pointer to the current target of the event_code
|
||||
*/
|
||||
struct _lv_obj_t * lv_event_get_current_target(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the event code of an event
|
||||
* @param e pointer to the event descriptor
|
||||
* @return the event code. (E.g. `LV_EVENT_CLICKED`, `LV_EVENT_FOCUSED`, etc)
|
||||
*/
|
||||
lv_event_code_t lv_event_get_code(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the parameter passed when the event was sent
|
||||
* @param e pointer to the event descriptor
|
||||
* @return pointer to the parameter
|
||||
*/
|
||||
void * lv_event_get_param(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the user_data passed when the event was registered on the object
|
||||
* @param e pointer to the event descriptor
|
||||
* @return pointer to the user_data
|
||||
*/
|
||||
void * lv_event_get_user_data(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Stop the event from bubbling.
|
||||
* This is only valid when called in the middle of an event processing chain.
|
||||
* @param e pointer to the event descriptor
|
||||
*/
|
||||
void lv_event_stop_bubbling(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Stop processing this event.
|
||||
* This is only valid when called in the middle of an event processing chain.
|
||||
* @param e pointer to the event descriptor
|
||||
*/
|
||||
void lv_event_stop_processing(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Register a new, custom event ID.
|
||||
* It can be used the same way as e.g. `LV_EVENT_CLICKED` to send custom events
|
||||
* @return the new event id
|
||||
* @example
|
||||
* uint32_t LV_EVENT_MINE = 0;
|
||||
* ...
|
||||
* e = lv_event_register_id();
|
||||
* ...
|
||||
* lv_event_send(obj, LV_EVENT_MINE, &some_data);
|
||||
*/
|
||||
uint32_t lv_event_register_id(void);
|
||||
|
||||
/**
|
||||
* Nested events can be called and one of them might belong to an object that is being deleted.
|
||||
* Mark this object's `event_temp_data` deleted to know that its `lv_event_send` should return `LV_RES_INV`
|
||||
* @param obj pointer to an object to mark as deleted
|
||||
*/
|
||||
void _lv_event_mark_deleted(struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
/**
|
||||
* Add an event handler function for an object.
|
||||
* Used by the user to react on event which happens with the object.
|
||||
* An object can have multiple event handler. They will be called in the same order as they were added.
|
||||
* @param obj pointer to an object
|
||||
* @param filter and event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be sued the receive all the events.
|
||||
* @param event_cb the new event function
|
||||
* @param user_data custom data data will be available in `event_cb`
|
||||
* @return a pointer the event descriptor. Can be used in ::lv_obj_remove_event_dsc
|
||||
*/
|
||||
struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter,
|
||||
void * user_data);
|
||||
|
||||
/**
|
||||
* Remove an event handler function for an object.
|
||||
* @param obj pointer to an object
|
||||
* @param event_cb the event function to remove, or `NULL` to remove the firstly added event callback
|
||||
* @return true if any event handlers were removed
|
||||
*/
|
||||
bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
|
||||
/**
|
||||
* Remove an event handler function with a specific user_data from an object.
|
||||
* @param obj pointer to an object
|
||||
* @param event_cb the event function to remove, or `NULL` only `user_data` matters.
|
||||
* @param event_user_data the user_data specified in ::lv_obj_add_event_cb
|
||||
* @return true if any event handlers were removed
|
||||
*/
|
||||
bool lv_obj_remove_event_cb_with_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb,
|
||||
const void * event_user_data);
|
||||
|
||||
/**
|
||||
* DEPRECATED because doesn't work if multiple event handlers are added to an object.
|
||||
* Remove an event handler function for an object.
|
||||
* @param obj pointer to an object
|
||||
* @param event_dsc pointer to an event descriptor to remove (returned by ::lv_obj_add_event_cb)
|
||||
* @return true if any event handlers were removed
|
||||
*/
|
||||
bool lv_obj_remove_event_dsc(struct _lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc);
|
||||
|
||||
/**
|
||||
* The user data of an event object event callback. Always the first match with `event_cb` will be returned.
|
||||
* @param obj pointer to an object
|
||||
* @param event_cb the event function
|
||||
* @return the user_data
|
||||
*/
|
||||
void * lv_obj_get_event_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
|
||||
/**
|
||||
* Get the input device passed as parameter to indev related events.
|
||||
* @param e pointer to an event
|
||||
* @return the indev that triggered the event or NULL if called on a not indev related event
|
||||
*/
|
||||
lv_indev_t * lv_event_get_indev(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the part draw descriptor passed as parameter to `LV_EVENT_DRAW_PART_BEGIN/END`.
|
||||
* @param e pointer to an event
|
||||
* @return the part draw descriptor to hook the drawing or NULL if called on an unrelated event
|
||||
*/
|
||||
lv_obj_draw_part_dsc_t * lv_event_get_draw_part_dsc(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the draw context which should be the first parameter of the draw functions.
|
||||
* Namely: `LV_EVENT_DRAW_MAIN/POST`, `LV_EVENT_DRAW_MAIN/POST_BEGIN`, `LV_EVENT_DRAW_MAIN/POST_END`
|
||||
* @param e pointer to an event
|
||||
* @return pointer to a draw context or NULL if called on an unrelated event
|
||||
*/
|
||||
lv_draw_ctx_t * lv_event_get_draw_ctx(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the old area of the object before its size was changed. Can be used in `LV_EVENT_SIZE_CHANGED`
|
||||
* @param e pointer to an event
|
||||
* @return the old absolute area of the object or NULL if called on an unrelated event
|
||||
*/
|
||||
const lv_area_t * lv_event_get_old_size(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the key passed as parameter to an event. Can be used in `LV_EVENT_KEY`
|
||||
* @param e pointer to an event
|
||||
* @return the triggering key or NULL if called on an unrelated event
|
||||
*/
|
||||
uint32_t lv_event_get_key(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get the animation descriptor of a scrolling. Can be used in `LV_EVENT_SCROLL_BEGIN`
|
||||
* @param e pointer to an event
|
||||
* @return the animation that will scroll the object. (can be modified as required)
|
||||
*/
|
||||
lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Set the new extra draw size. Can be used in `LV_EVENT_REFR_EXT_DRAW_SIZE`
|
||||
* @param e pointer to an event
|
||||
* @param size The new extra draw size
|
||||
*/
|
||||
void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size);
|
||||
|
||||
/**
|
||||
* Get a pointer to an `lv_point_t` variable in which the self size should be saved (width in `point->x` and height `point->y`).
|
||||
* Can be used in `LV_EVENT_GET_SELF_SIZE`
|
||||
* @param e pointer to an event
|
||||
* @return pointer to `lv_point_t` or NULL if called on an unrelated event
|
||||
*/
|
||||
lv_point_t * lv_event_get_self_size_info(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get a pointer to an `lv_hit_test_info_t` variable in which the hit test result should be saved. Can be used in `LV_EVENT_HIT_TEST`
|
||||
* @param e pointer to an event
|
||||
* @return pointer to `lv_hit_test_info_t` or NULL if called on an unrelated event
|
||||
*/
|
||||
lv_hit_test_info_t * lv_event_get_hit_test_info(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Get a pointer to an area which should be examined whether the object fully covers it or not.
|
||||
* Can be used in `LV_EVENT_HIT_TEST`
|
||||
* @param e pointer to an event
|
||||
* @return an area with absolute coordinates to check
|
||||
*/
|
||||
const lv_area_t * lv_event_get_cover_area(lv_event_t * e);
|
||||
|
||||
/**
|
||||
* Set the result of cover checking. Can be used in `LV_EVENT_COVER_CHECK`
|
||||
* @param e pointer to an event
|
||||
* @param res an element of ::lv_cover_check_info_t
|
||||
*/
|
||||
void lv_event_set_cover_res(lv_event_t * e, lv_cover_res_t res);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EVENT_H*/
|
||||
266
include/liblvgl/core/lv_group.h
Normal file
266
include/liblvgl/core/lv_group.h
Normal file
@ -0,0 +1,266 @@
|
||||
/**
|
||||
* @file lv_group.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GROUP_H
|
||||
#define LV_GROUP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "liblvgl/misc/lv_ll.h"
|
||||
#include "liblvgl/misc/lv_types.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Predefined keys to control the focused object via lv_group_send(group, c)*/
|
||||
|
||||
enum {
|
||||
LV_KEY_UP = 17, /*0x11*/
|
||||
LV_KEY_DOWN = 18, /*0x12*/
|
||||
LV_KEY_RIGHT = 19, /*0x13*/
|
||||
LV_KEY_LEFT = 20, /*0x14*/
|
||||
LV_KEY_ESC = 27, /*0x1B*/
|
||||
LV_KEY_DEL = 127, /*0x7F*/
|
||||
LV_KEY_BACKSPACE = 8, /*0x08*/
|
||||
LV_KEY_ENTER = 10, /*0x0A, '\n'*/
|
||||
LV_KEY_NEXT = 9, /*0x09, '\t'*/
|
||||
LV_KEY_PREV = 11, /*0x0B, '*/
|
||||
LV_KEY_HOME = 2, /*0x02, STX*/
|
||||
LV_KEY_END = 3, /*0x03, ETX*/
|
||||
};
|
||||
typedef uint8_t lv_key_t;
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_group_t;
|
||||
|
||||
typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
|
||||
typedef void (*lv_group_edge_cb_t)(struct _lv_group_t *, bool);
|
||||
|
||||
/**
|
||||
* Groups can be used to logically hold objects so that they can be individually focused.
|
||||
* They are NOT for laying out objects on a screen (try layouts for that).
|
||||
*/
|
||||
typedef struct _lv_group_t {
|
||||
lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/
|
||||
struct _lv_obj_t ** obj_focus; /**< The object in focus*/
|
||||
|
||||
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
|
||||
lv_group_edge_cb_t edge_cb; /**< A function to call when an edge is reached, no more focus
|
||||
targets are available in this direction (to allow edge feedback
|
||||
like a sound or a scroll bounce) */
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
|
||||
uint8_t frozen : 1; /**< 1: can't focus to new object*/
|
||||
uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/
|
||||
uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on
|
||||
deletion.*/
|
||||
uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end
|
||||
of list.*/
|
||||
} lv_group_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
LV_GROUP_REFOCUS_POLICY_NEXT = 0,
|
||||
LV_GROUP_REFOCUS_POLICY_PREV = 1
|
||||
} lv_group_refocus_policy_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init. the group module
|
||||
* @remarks Internal function, do not call directly.
|
||||
*/
|
||||
void _lv_group_init(void);
|
||||
|
||||
/**
|
||||
* Create a new object group
|
||||
* @return pointer to the new object group
|
||||
*/
|
||||
lv_group_t * lv_group_create(void);
|
||||
|
||||
/**
|
||||
* Delete a group object
|
||||
* @param group pointer to a group
|
||||
*/
|
||||
void lv_group_del(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Set a default group. New object are added to this group if it's enabled in their class with `add_to_def_group = true`
|
||||
* @param group pointer to a group (can be `NULL`)
|
||||
*/
|
||||
void lv_group_set_default(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the default group
|
||||
* @return pointer to the default group
|
||||
*/
|
||||
lv_group_t * lv_group_get_default(void);
|
||||
|
||||
/**
|
||||
* Add an object to a group
|
||||
* @param group pointer to a group
|
||||
* @param obj pointer to an object to add
|
||||
*/
|
||||
void lv_group_add_obj(lv_group_t * group, struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Swap 2 object in a group. The object must be in the same group
|
||||
* @param obj1 pointer to an object
|
||||
* @param obj2 pointer to an other object
|
||||
*/
|
||||
void lv_group_swap_obj(struct _lv_obj_t * obj1, struct _lv_obj_t * obj2);
|
||||
|
||||
/**
|
||||
* Remove an object from its group
|
||||
* @param obj pointer to an object to remove
|
||||
*/
|
||||
void lv_group_remove_obj(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Remove all objects from a group
|
||||
* @param group pointer to a group
|
||||
*/
|
||||
void lv_group_remove_all_objs(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Focus on an object (defocus the current)
|
||||
* @param obj pointer to an object to focus on
|
||||
*/
|
||||
void lv_group_focus_obj(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Focus the next object in a group (defocus the current)
|
||||
* @param group pointer to a group
|
||||
*/
|
||||
void lv_group_focus_next(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Focus the previous object in a group (defocus the current)
|
||||
* @param group pointer to a group
|
||||
*/
|
||||
void lv_group_focus_prev(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Do not let to change the focus from the current object
|
||||
* @param group pointer to a group
|
||||
* @param en true: freeze, false: release freezing (normal mode)
|
||||
*/
|
||||
void lv_group_focus_freeze(lv_group_t * group, bool en);
|
||||
|
||||
/**
|
||||
* Send a control character to the focuses object of a group
|
||||
* @param group pointer to a group
|
||||
* @param c a character (use LV_KEY_.. to navigate)
|
||||
* @return result of focused object in group.
|
||||
*/
|
||||
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
|
||||
|
||||
/**
|
||||
* Set a function for a group which will be called when a new object is focused
|
||||
* @param group pointer to a group
|
||||
* @param focus_cb the call back function or NULL if unused
|
||||
*/
|
||||
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb);
|
||||
|
||||
/**
|
||||
* Set a function for a group which will be called when a focus edge is reached
|
||||
* @param group pointer to a group
|
||||
* @param edge_cb the call back function or NULL if unused
|
||||
*/
|
||||
void lv_group_set_edge_cb(lv_group_t * group, lv_group_edge_cb_t edge_cb);
|
||||
|
||||
|
||||
/**
|
||||
* Set whether the next or previous item in a group is focused if the currently focused obj is
|
||||
* deleted.
|
||||
* @param group pointer to a group
|
||||
* @param policy new refocus policy enum
|
||||
*/
|
||||
void lv_group_set_refocus_policy(lv_group_t * group, lv_group_refocus_policy_t policy);
|
||||
|
||||
/**
|
||||
* Manually set the current mode (edit or navigate).
|
||||
* @param group pointer to group
|
||||
* @param edit true: edit mode; false: navigate mode
|
||||
*/
|
||||
void lv_group_set_editing(lv_group_t * group, bool edit);
|
||||
|
||||
/**
|
||||
* Set whether focus next/prev will allow wrapping from first->last or last->first object.
|
||||
* @param group pointer to group
|
||||
* @param en true: wrapping enabled; false: wrapping disabled
|
||||
*/
|
||||
void lv_group_set_wrap(lv_group_t * group, bool en);
|
||||
|
||||
/**
|
||||
* Get the focused object or NULL if there isn't one
|
||||
* @param group pointer to a group
|
||||
* @return pointer to the focused object
|
||||
*/
|
||||
struct _lv_obj_t * lv_group_get_focused(const lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the focus callback function of a group
|
||||
* @param group pointer to a group
|
||||
* @return the call back function or NULL if not set
|
||||
*/
|
||||
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the edge callback function of a group
|
||||
* @param group pointer to a group
|
||||
* @return the call back function or NULL if not set
|
||||
*/
|
||||
lv_group_edge_cb_t lv_group_get_edge_cb(const lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the current mode (edit or navigate).
|
||||
* @param group pointer to group
|
||||
* @return true: edit mode; false: navigate mode
|
||||
*/
|
||||
bool lv_group_get_editing(const lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get whether focus next/prev will allow wrapping from first->last or last->first object.
|
||||
* @param group pointer to group
|
||||
* @param en true: wrapping enabled; false: wrapping disabled
|
||||
*/
|
||||
bool lv_group_get_wrap(lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Get the number of object in the group
|
||||
* @param group pointer to a group
|
||||
* @return number of objects in the group
|
||||
*/
|
||||
uint32_t lv_group_get_obj_count(lv_group_t * group);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GROUP_H*/
|
||||
176
include/liblvgl/core/lv_indev.h
Normal file
176
include/liblvgl/core/lv_indev.h
Normal file
@ -0,0 +1,176 @@
|
||||
/**
|
||||
* @file lv_indev.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_INDEV_H
|
||||
#define LV_INDEV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include "liblvgl/hal/lv_hal_indev.h"
|
||||
#include "lv_group.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Called periodically to read the input devices
|
||||
* @param timer pointer to a timer to read
|
||||
*/
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
|
||||
/**
|
||||
* Enable or disable one or all input devices (default enabled)
|
||||
* @param indev pointer to an input device or NULL to enable/disable all of them
|
||||
* @param en true to enable, false to disable
|
||||
*/
|
||||
void lv_indev_enable(lv_indev_t * indev, bool en);
|
||||
|
||||
/**
|
||||
* Get the currently processed input device. Can be used in action functions too.
|
||||
* @return pointer to the currently processed input device or NULL if no input device processing
|
||||
* right now
|
||||
*/
|
||||
lv_indev_t * lv_indev_get_act(void);
|
||||
|
||||
/**
|
||||
* Get the type of an input device
|
||||
* @param indev pointer to an input device
|
||||
* @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`)
|
||||
*/
|
||||
lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Reset one or all input devices
|
||||
* @param indev pointer to an input device to reset or NULL to reset all of them
|
||||
* @param obj pointer to an object which triggers the reset.
|
||||
*/
|
||||
void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Reset the long press state of an input device
|
||||
* @param indev pointer to an input device
|
||||
*/
|
||||
void lv_indev_reset_long_press(lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
|
||||
* @param indev pointer to an input device
|
||||
* @param cur_obj pointer to an object to be used as cursor
|
||||
*/
|
||||
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj);
|
||||
|
||||
/**
|
||||
* Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
|
||||
* @param indev pointer to an input device
|
||||
* @param group point to a group
|
||||
*/
|
||||
void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
|
||||
|
||||
/**
|
||||
* Set the an array of points for LV_INDEV_TYPE_BUTTON.
|
||||
* These points will be assigned to the buttons to press a specific point on the screen
|
||||
* @param indev pointer to an input device
|
||||
* @param group point to a group
|
||||
*/
|
||||
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]);
|
||||
|
||||
/**
|
||||
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
|
||||
* @param indev pointer to an input device
|
||||
* @param point pointer to a point to store the result
|
||||
*/
|
||||
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point);
|
||||
|
||||
/**
|
||||
* Get the current gesture direct
|
||||
* @param indev pointer to an input device
|
||||
* @return current gesture direct
|
||||
*/
|
||||
lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
|
||||
* @param indev pointer to an input device
|
||||
* @return the last pressed key (0 on error)
|
||||
*/
|
||||
uint32_t lv_indev_get_key(const lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Check the current scroll direction of an input device (for LV_INDEV_TYPE_POINTER and
|
||||
* LV_INDEV_TYPE_BUTTON)
|
||||
* @param indev pointer to an input device
|
||||
* @return LV_DIR_NONE: no scrolling now
|
||||
* LV_DIR_HOR/VER
|
||||
*/
|
||||
lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Get the currently scrolled object (for LV_INDEV_TYPE_POINTER and
|
||||
* LV_INDEV_TYPE_BUTTON)
|
||||
* @param indev pointer to an input device
|
||||
* @return pointer to the currently scrolled object or NULL if no scrolling by this indev
|
||||
*/
|
||||
lv_obj_t * lv_indev_get_scroll_obj(const lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Get the movement vector of an input device (for LV_INDEV_TYPE_POINTER and
|
||||
* LV_INDEV_TYPE_BUTTON)
|
||||
* @param indev pointer to an input device
|
||||
* @param point pointer to a point to store the types.pointer.vector
|
||||
*/
|
||||
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
|
||||
|
||||
/**
|
||||
* Do nothing until the next release
|
||||
* @param indev pointer to an input device
|
||||
*/
|
||||
void lv_indev_wait_release(lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Gets a pointer to the currently active object in the currently processed input device.
|
||||
* @return pointer to currently active object or NULL if no active object
|
||||
*/
|
||||
lv_obj_t * lv_indev_get_obj_act(void);
|
||||
|
||||
/**
|
||||
* Get a pointer to the indev read timer to
|
||||
* modify its parameters with `lv_timer_...` functions.
|
||||
* @param indev pointer to an input device
|
||||
* @return pointer to the indev read refresher timer. (NULL on error)
|
||||
*/
|
||||
lv_timer_t * lv_indev_get_read_timer(lv_disp_t * indev);
|
||||
|
||||
/**
|
||||
* Search the most top, clickable object by a point
|
||||
* @param obj pointer to a start object, typically the screen
|
||||
* @param point pointer to a point for searching the most top child
|
||||
* @return pointer to the found object or NULL if there was no suitable object
|
||||
*/
|
||||
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_INDEV_H*/
|
||||
65
include/liblvgl/core/lv_indev_scroll.h
Normal file
65
include/liblvgl/core/lv_indev_scroll.h
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @file lv_indev_scroll.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_INDEV_SCROLL_H
|
||||
#define LV_INDEV_SCROLL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Handle scrolling. Called by LVGL during input device processing
|
||||
* @param proc pointer to an input device's proc field
|
||||
*/
|
||||
void _lv_indev_scroll_handler(_lv_indev_proc_t * proc);
|
||||
|
||||
/**
|
||||
* Handle throwing after scrolling. Called by LVGL during input device processing
|
||||
* @param proc pointer to an input device's proc field
|
||||
*/
|
||||
void _lv_indev_scroll_throw_handler(_lv_indev_proc_t * proc);
|
||||
|
||||
/**
|
||||
* Predict where would a scroll throw end
|
||||
* @param indev pointer to an input device
|
||||
* @param dir ` LV_DIR_VER` or `LV_DIR_HOR`
|
||||
* @return the difference compared to the current position when the throw would be finished
|
||||
*/
|
||||
lv_coord_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir);
|
||||
|
||||
/**
|
||||
* Get the distance of the nearest snap point
|
||||
* @param obj the object on which snap points should be found
|
||||
* @param p save the distance of the found snap point there
|
||||
*/
|
||||
void lv_indev_scroll_get_snap_dist(lv_obj_t * obj, lv_point_t * p);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_INDEV_SCROLL_H*/
|
||||
409
include/liblvgl/core/lv_obj.h
Normal file
409
include/liblvgl/core/lv_obj.h
Normal file
@ -0,0 +1,409 @@
|
||||
/**
|
||||
* @file lv_obj.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_H
|
||||
#define LV_OBJ_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "../misc/lv_style.h"
|
||||
#include "../misc/lv_types.h"
|
||||
#include "../misc/lv_area.h"
|
||||
#include "../misc/lv_color.h"
|
||||
#include "../misc/lv_assert.h"
|
||||
#include "../hal/lv_hal.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
|
||||
/**
|
||||
* Possible states of a widget.
|
||||
* OR-ed values are possible
|
||||
*/
|
||||
enum {
|
||||
LV_STATE_DEFAULT = 0x0000,
|
||||
LV_STATE_CHECKED = 0x0001,
|
||||
LV_STATE_FOCUSED = 0x0002,
|
||||
LV_STATE_FOCUS_KEY = 0x0004,
|
||||
LV_STATE_EDITED = 0x0008,
|
||||
LV_STATE_HOVERED = 0x0010,
|
||||
LV_STATE_PRESSED = 0x0020,
|
||||
LV_STATE_SCROLLED = 0x0040,
|
||||
LV_STATE_DISABLED = 0x0080,
|
||||
|
||||
LV_STATE_USER_1 = 0x1000,
|
||||
LV_STATE_USER_2 = 0x2000,
|
||||
LV_STATE_USER_3 = 0x4000,
|
||||
LV_STATE_USER_4 = 0x8000,
|
||||
|
||||
LV_STATE_ANY = 0xFFFF, /**< Special value can be used in some functions to target all states*/
|
||||
};
|
||||
|
||||
typedef uint16_t lv_state_t;
|
||||
|
||||
/**
|
||||
* The possible parts of widgets.
|
||||
* The parts can be considered as the internal building block of the widgets.
|
||||
* E.g. slider = background + indicator + knob
|
||||
* Not all parts are used by every widget
|
||||
*/
|
||||
enum {
|
||||
LV_PART_MAIN = 0x000000, /**< A background like rectangle*/
|
||||
LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/
|
||||
LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/
|
||||
LV_PART_KNOB = 0x030000, /**< Like handle to grab to adjust the value*/
|
||||
LV_PART_SELECTED = 0x040000, /**< Indicate the currently selected option or section*/
|
||||
LV_PART_ITEMS = 0x050000, /**< Used if the widget has multiple similar elements (e.g. table cells)*/
|
||||
LV_PART_TICKS = 0x060000, /**< Ticks on scale e.g. for a chart or meter*/
|
||||
LV_PART_CURSOR = 0x070000, /**< Mark a specific place e.g. for text area's cursor or on a chart*/
|
||||
|
||||
LV_PART_CUSTOM_FIRST = 0x080000, /**< Extension point for custom widgets*/
|
||||
|
||||
LV_PART_ANY = 0x0F0000, /**< Special value can be used in some functions to target all parts*/
|
||||
};
|
||||
|
||||
typedef uint32_t lv_part_t;
|
||||
|
||||
/**
|
||||
* On/Off features controlling the object's behavior.
|
||||
* OR-ed values are possible
|
||||
*/
|
||||
enum {
|
||||
LV_OBJ_FLAG_HIDDEN = (1L << 0), /**< Make the object hidden. (Like it wasn't there at all)*/
|
||||
LV_OBJ_FLAG_CLICKABLE = (1L << 1), /**< Make the object clickable by the input devices*/
|
||||
LV_OBJ_FLAG_CLICK_FOCUSABLE = (1L << 2), /**< Add focused state to the object when clicked*/
|
||||
LV_OBJ_FLAG_CHECKABLE = (1L << 3), /**< Toggle checked state when the object is clicked*/
|
||||
LV_OBJ_FLAG_SCROLLABLE = (1L << 4), /**< Make the object scrollable*/
|
||||
LV_OBJ_FLAG_SCROLL_ELASTIC = (1L << 5), /**< Allow scrolling inside but with slower speed*/
|
||||
LV_OBJ_FLAG_SCROLL_MOMENTUM = (1L << 6), /**< Make the object scroll further when "thrown"*/
|
||||
LV_OBJ_FLAG_SCROLL_ONE = (1L << 7), /**< Allow scrolling only one snappable children*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN_HOR = (1L << 8), /**< Allow propagating the horizontal scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN_VER = (1L << 9), /**< Allow propagating the vertical scroll to a parent*/
|
||||
LV_OBJ_FLAG_SCROLL_CHAIN = (LV_OBJ_FLAG_SCROLL_CHAIN_HOR | LV_OBJ_FLAG_SCROLL_CHAIN_VER),
|
||||
LV_OBJ_FLAG_SCROLL_ON_FOCUS = (1L << 10), /**< Automatically scroll object to make it visible when focused*/
|
||||
LV_OBJ_FLAG_SCROLL_WITH_ARROW = (1L << 11), /**< Allow scrolling the focused object with arrow keys*/
|
||||
LV_OBJ_FLAG_SNAPPABLE = (1L << 12), /**< If scroll snap is enabled on the parent it can snap to this object*/
|
||||
LV_OBJ_FLAG_PRESS_LOCK = (1L << 13), /**< Keep the object pressed even if the press slid from the object*/
|
||||
LV_OBJ_FLAG_EVENT_BUBBLE = (1L << 14), /**< Propagate the events to the parent too*/
|
||||
LV_OBJ_FLAG_GESTURE_BUBBLE = (1L << 15), /**< Propagate the gestures to the parent*/
|
||||
LV_OBJ_FLAG_ADV_HITTEST = (1L << 16), /**< Allow performing more accurate hit (click) test. E.g. consider rounded corners.*/
|
||||
LV_OBJ_FLAG_IGNORE_LAYOUT = (1L << 17), /**< Make the object position-able by the layouts*/
|
||||
LV_OBJ_FLAG_FLOATING = (1L << 18), /**< Do not scroll the object when the parent scrolls and ignore layout*/
|
||||
LV_OBJ_FLAG_OVERFLOW_VISIBLE = (1L << 19), /**< Do not clip the children's content to the parent's boundary*/
|
||||
|
||||
LV_OBJ_FLAG_LAYOUT_1 = (1L << 23), /**< Custom flag, free to use by layouts*/
|
||||
LV_OBJ_FLAG_LAYOUT_2 = (1L << 24), /**< Custom flag, free to use by layouts*/
|
||||
|
||||
LV_OBJ_FLAG_WIDGET_1 = (1L << 25), /**< Custom flag, free to use by widget*/
|
||||
LV_OBJ_FLAG_WIDGET_2 = (1L << 26), /**< Custom flag, free to use by widget*/
|
||||
LV_OBJ_FLAG_USER_1 = (1L << 27), /**< Custom flag, free to use by user*/
|
||||
LV_OBJ_FLAG_USER_2 = (1L << 28), /**< Custom flag, free to use by user*/
|
||||
LV_OBJ_FLAG_USER_3 = (1L << 29), /**< Custom flag, free to use by user*/
|
||||
LV_OBJ_FLAG_USER_4 = (1L << 30), /**< Custom flag, free to use by user*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
typedef uint32_t lv_obj_flag_t;
|
||||
|
||||
/**
|
||||
* `type` field in `lv_obj_draw_part_dsc_t` if `class_p = lv_obj_class`
|
||||
* Used in `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END`
|
||||
*/
|
||||
typedef enum {
|
||||
LV_OBJ_DRAW_PART_RECTANGLE, /**< The main rectangle*/
|
||||
LV_OBJ_DRAW_PART_BORDER_POST,/**< The border if style_border_post = true*/
|
||||
LV_OBJ_DRAW_PART_SCROLLBAR, /**< The scrollbar*/
|
||||
} lv_obj_draw_part_type_t;
|
||||
|
||||
#include "lv_obj_tree.h"
|
||||
#include "lv_obj_pos.h"
|
||||
#include "lv_obj_scroll.h"
|
||||
#include "lv_obj_style.h"
|
||||
#include "lv_obj_draw.h"
|
||||
#include "lv_obj_class.h"
|
||||
#include "lv_event.h"
|
||||
#include "lv_group.h"
|
||||
|
||||
/**
|
||||
* Make the base object's class publicly available.
|
||||
*/
|
||||
extern const lv_obj_class_t lv_obj_class;
|
||||
|
||||
/**
|
||||
* Special, rarely used attributes.
|
||||
* They are allocated automatically if any elements is set.
|
||||
*/
|
||||
typedef struct {
|
||||
struct _lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
|
||||
uint32_t child_cnt; /**< Number of children*/
|
||||
lv_group_t * group_p;
|
||||
|
||||
struct _lv_event_dsc_t * event_dsc; /**< Dynamically allocated event callback and user data array*/
|
||||
lv_point_t scroll; /**< The current X/Y scroll offset*/
|
||||
|
||||
lv_coord_t ext_click_pad; /**< Extra click padding in all direction*/
|
||||
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
|
||||
|
||||
lv_scrollbar_mode_t scrollbar_mode : 2; /**< How to display scrollbars*/
|
||||
lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally*/
|
||||
lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/
|
||||
lv_dir_t scroll_dir : 4; /**< The allowed scroll direction(s)*/
|
||||
uint8_t event_dsc_cnt : 6; /**< Number of event callbacks stored in `event_dsc` array*/
|
||||
uint8_t layer_type : 2; /**< Cache the layer type here. Element of @lv_intermediate_layer_type_t */
|
||||
} _lv_obj_spec_attr_t;
|
||||
|
||||
typedef struct _lv_obj_t {
|
||||
const lv_obj_class_t * class_p;
|
||||
struct _lv_obj_t * parent;
|
||||
_lv_obj_spec_attr_t * spec_attr;
|
||||
_lv_obj_style_t * styles;
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
lv_area_t coords;
|
||||
lv_obj_flag_t flags;
|
||||
lv_state_t state;
|
||||
uint16_t layout_inv : 1;
|
||||
uint16_t scr_layout_inv : 1;
|
||||
uint16_t skip_trans : 1;
|
||||
uint16_t style_cnt : 6;
|
||||
uint16_t h_layout : 1;
|
||||
uint16_t w_layout : 1;
|
||||
} lv_obj_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize LVGL library.
|
||||
* Should be called before any other LVGL related function.
|
||||
*/
|
||||
void lv_init(void);
|
||||
|
||||
#if LV_ENABLE_GC || !LV_MEM_CUSTOM
|
||||
|
||||
/**
|
||||
* Deinit the 'lv' library
|
||||
* Currently only implemented when not using custom allocators, or GC is enabled.
|
||||
*/
|
||||
void lv_deinit(void);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns whether the 'lv' library is currently initialized
|
||||
*/
|
||||
bool lv_is_initialized(void);
|
||||
|
||||
/**
|
||||
* Create a base object (a rectangle)
|
||||
* @param parent pointer to a parent object. If NULL then a screen will be created.
|
||||
* @return pointer to the new object
|
||||
*/
|
||||
lv_obj_t * lv_obj_create(lv_obj_t * parent);
|
||||
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set one or more flags
|
||||
* @param obj pointer to an object
|
||||
* @param f R-ed values from `lv_obj_flag_t` to set.
|
||||
*/
|
||||
void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f);
|
||||
|
||||
/**
|
||||
* Clear one or more flags
|
||||
* @param obj pointer to an object
|
||||
* @param f OR-ed values from `lv_obj_flag_t` to set.
|
||||
*/
|
||||
void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f);
|
||||
|
||||
|
||||
/**
|
||||
* Add one or more states to the object. The other state bits will remain unchanged.
|
||||
* If specified in the styles, transition animation will be started from the previous state to the current.
|
||||
* @param obj pointer to an object
|
||||
* @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
|
||||
*/
|
||||
void lv_obj_add_state(lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
/**
|
||||
* Remove one or more states to the object. The other state bits will remain unchanged.
|
||||
* If specified in the styles, transition animation will be started from the previous state to the current.
|
||||
* @param obj pointer to an object
|
||||
* @param state the states to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED`
|
||||
*/
|
||||
void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
/**
|
||||
* Set the user_data field of the object
|
||||
* @param obj pointer to an object
|
||||
* @param user_data pointer to the new user_data.
|
||||
*/
|
||||
#if LV_USE_USER_DATA
|
||||
static inline void lv_obj_set_user_data(lv_obj_t * obj, void * user_data)
|
||||
{
|
||||
obj->user_data = user_data;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* Getter functions
|
||||
*======================*/
|
||||
|
||||
/**
|
||||
* Check if a given flag or all the given flags are set on an object.
|
||||
* @param obj pointer to an object
|
||||
* @param f the flag(s) to check (OR-ed values can be used)
|
||||
* @return true: all flags are set; false: not all flags are set
|
||||
*/
|
||||
bool lv_obj_has_flag(const lv_obj_t * obj, lv_obj_flag_t f);
|
||||
|
||||
/**
|
||||
* Check if a given flag or any of the flags are set on an object.
|
||||
* @param obj pointer to an object
|
||||
* @param f the flag(s) to check (OR-ed values can be used)
|
||||
* @return true: at lest one flag flag is set; false: none of the flags are set
|
||||
*/
|
||||
bool lv_obj_has_flag_any(const lv_obj_t * obj, lv_obj_flag_t f);
|
||||
|
||||
/**
|
||||
* Get the state of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the state (OR-ed values from `lv_state_t`)
|
||||
*/
|
||||
lv_state_t lv_obj_get_state(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Check if the object is in a given state or not.
|
||||
* @param obj pointer to an object
|
||||
* @param state a state or combination of states to check
|
||||
* @return true: `obj` is in `state`; false: `obj` is not in `state`
|
||||
*/
|
||||
bool lv_obj_has_state(const lv_obj_t * obj, lv_state_t state);
|
||||
|
||||
/**
|
||||
* Get the group of the object
|
||||
* @param obj pointer to an object
|
||||
* @return the pointer to group of the object
|
||||
*/
|
||||
void * lv_obj_get_group(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the user_data field of the object
|
||||
* @param obj pointer to an object
|
||||
* @return the pointer to the user_data of the object
|
||||
*/
|
||||
#if LV_USE_USER_DATA
|
||||
static inline void * lv_obj_get_user_data(lv_obj_t * obj)
|
||||
{
|
||||
return obj->user_data;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* Other functions
|
||||
*======================*/
|
||||
|
||||
/**
|
||||
* Allocate special data for an object if not allocated yet.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_allocate_spec_attr(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Check the type of obj.
|
||||
* @param obj pointer to an object
|
||||
* @param class_p a class to check (e.g. `lv_slider_class`)
|
||||
* @return true: `class_p` is the `obj` class.
|
||||
*/
|
||||
bool lv_obj_check_type(const lv_obj_t * obj, const lv_obj_class_t * class_p);
|
||||
|
||||
/**
|
||||
* Check if any object has a given class (type).
|
||||
* It checks the ancestor classes too.
|
||||
* @param obj pointer to an object
|
||||
* @param class_p a class to check (e.g. `lv_slider_class`)
|
||||
* @return true: `obj` has the given class
|
||||
*/
|
||||
bool lv_obj_has_class(const lv_obj_t * obj, const lv_obj_class_t * class_p);
|
||||
|
||||
/**
|
||||
* Get the class (type) of the object
|
||||
* @param obj pointer to an object
|
||||
* @return the class (type) of the object
|
||||
*/
|
||||
const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Check if any object is still "alive".
|
||||
* @param obj pointer to an object
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_obj_is_valid(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
|
||||
* considering the DPI of the `obj`'s display.
|
||||
* It ensures that e.g. `lv_dpx(100)` will have the same physical size regardless to the
|
||||
* DPI of the display.
|
||||
* @param obj an object whose display's dpi should be considered
|
||||
* @param n the number of pixels to scale
|
||||
* @return `n x current_dpi/160`
|
||||
*/
|
||||
static inline lv_coord_t lv_obj_dpx(const lv_obj_t * obj, lv_coord_t n)
|
||||
{
|
||||
return _LV_DPX_CALC(lv_disp_get_dpi(lv_obj_get_disp(obj)), n);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ASSERT_OBJ
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_class) \
|
||||
do { \
|
||||
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
|
||||
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
|
||||
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \
|
||||
} while(0)
|
||||
# else
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_class) do{}while(0)
|
||||
#endif
|
||||
|
||||
#if LV_USE_LOG && LV_LOG_TRACE_OBJ_CREATE
|
||||
# define LV_TRACE_OBJ_CREATE(...) LV_LOG_TRACE(__VA_ARGS__)
|
||||
#else
|
||||
# define LV_TRACE_OBJ_CREATE(...)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_H*/
|
||||
94
include/liblvgl/core/lv_obj_class.h
Normal file
94
include/liblvgl/core/lv_obj_class.h
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
* @file lv_obj_class.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_CLASS_H
|
||||
#define LV_OBJ_CLASS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_obj_class_t;
|
||||
struct _lv_event_t;
|
||||
|
||||
typedef enum {
|
||||
LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
|
||||
LV_OBJ_CLASS_EDITABLE_TRUE,
|
||||
LV_OBJ_CLASS_EDITABLE_FALSE,
|
||||
} lv_obj_class_editable_t;
|
||||
|
||||
typedef enum {
|
||||
LV_OBJ_CLASS_GROUP_DEF_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
|
||||
LV_OBJ_CLASS_GROUP_DEF_TRUE,
|
||||
LV_OBJ_CLASS_GROUP_DEF_FALSE,
|
||||
} lv_obj_class_group_def_t;
|
||||
|
||||
typedef void (*lv_obj_class_event_cb_t)(struct _lv_obj_class_t * class_p, struct _lv_event_t * e);
|
||||
/**
|
||||
* Describe the common methods of every object.
|
||||
* Similar to a C++ class.
|
||||
*/
|
||||
typedef struct _lv_obj_class_t {
|
||||
const struct _lv_obj_class_t * base_class;
|
||||
void (*constructor_cb)(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj);
|
||||
void (*destructor_cb)(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj);
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
void (*event_cb)(const struct _lv_obj_class_t * class_p,
|
||||
struct _lv_event_t * e); /**< Widget type specific event function*/
|
||||
lv_coord_t width_def;
|
||||
lv_coord_t height_def;
|
||||
uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/
|
||||
uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/
|
||||
uint32_t instance_size : 16;
|
||||
} lv_obj_class_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create an object form a class descriptor
|
||||
* @param class_p pointer to a class
|
||||
* @param parent pointer to an object where the new object should be created
|
||||
* @return pointer to the created object
|
||||
*/
|
||||
struct _lv_obj_t * lv_obj_class_create_obj(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * parent);
|
||||
|
||||
void lv_obj_class_init_obj(struct _lv_obj_t * obj);
|
||||
|
||||
void _lv_obj_destruct(struct _lv_obj_t * obj);
|
||||
|
||||
bool lv_obj_is_editable(struct _lv_obj_t * obj);
|
||||
|
||||
bool lv_obj_is_group_def(struct _lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_CLASS_H*/
|
||||
172
include/liblvgl/core/lv_obj_draw.h
Normal file
172
include/liblvgl/core/lv_obj_draw.h
Normal file
@ -0,0 +1,172 @@
|
||||
/**
|
||||
* @file lv_obj_draw.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_DRAW_H
|
||||
#define LV_OBJ_DRAW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/draw/lv_draw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_obj_class_t;
|
||||
|
||||
/** Cover check results.*/
|
||||
typedef enum {
|
||||
LV_COVER_RES_COVER = 0,
|
||||
LV_COVER_RES_NOT_COVER = 1,
|
||||
LV_COVER_RES_MASKED = 2,
|
||||
} lv_cover_res_t;
|
||||
|
||||
typedef enum {
|
||||
LV_LAYER_TYPE_NONE,
|
||||
LV_LAYER_TYPE_SIMPLE,
|
||||
LV_LAYER_TYPE_TRANSFORM,
|
||||
} lv_layer_type_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_ctx_t * draw_ctx; /**< Draw context*/
|
||||
const struct _lv_obj_class_t * class_p; /**< The class that sent the event */
|
||||
uint32_t type; /**< The type if part being draw. Element of `lv_<name>_draw_part_type_t` */
|
||||
lv_area_t * draw_area; /**< The area of the part being drawn*/
|
||||
lv_draw_rect_dsc_t *
|
||||
rect_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for rectangle-like parts*/
|
||||
lv_draw_label_dsc_t *
|
||||
label_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for text-like parts*/
|
||||
lv_draw_line_dsc_t *
|
||||
line_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for line-like parts*/
|
||||
lv_draw_img_dsc_t *
|
||||
img_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for image-like parts*/
|
||||
lv_draw_arc_dsc_t *
|
||||
arc_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for arc-like parts*/
|
||||
const lv_point_t *
|
||||
p1; /**< A point calculated during drawing. E.g. a point of chart or the center of an arc.*/
|
||||
const lv_point_t * p2; /**< A point calculated during drawing. E.g. a point of chart.*/
|
||||
char * text; /**< A text calculated during drawing. Can be modified. E.g. tick labels on a chart axis.*/
|
||||
uint32_t text_length; /**< Size of the text buffer containing null-terminated text string calculated during drawing.*/
|
||||
uint32_t part; /**< The current part for which the event is sent*/
|
||||
uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/
|
||||
lv_coord_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
|
||||
int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/
|
||||
const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */
|
||||
} lv_obj_draw_part_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize a rectangle draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* If an `..._opa` field is set to `LV_OPA_TRANSP` the related properties won't be initialized.
|
||||
* Should be initialized with `lv_draw_rect_dsc_init(draw_dsc)`.
|
||||
* @note Only the relevant fields will be set.
|
||||
* E.g. if `border width == 0` the other border properties won't be evaluated.
|
||||
*/
|
||||
void lv_obj_init_draw_rect_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Initialize a label draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized.
|
||||
* Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_label_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Initialize an image draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a line draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_line_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Initialize an arc draw descriptor from an object's styles in its current state
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object, e.g. `LV_PART_MAIN`, `LV_PART_SCROLLBAR`, `LV_PART_KNOB`, etc
|
||||
* @param draw_dsc the descriptor to initialize.
|
||||
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
|
||||
*/
|
||||
void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
|
||||
* @param obj pointer to an object
|
||||
* @param part part of the object
|
||||
* @return the extra size required around the object
|
||||
*/
|
||||
lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part);
|
||||
|
||||
/**
|
||||
* Initialize a draw descriptor used in events.
|
||||
* @param dsc pointer to a descriptor. Later it should be passed as parameter to an `LV_EVENT_DRAW_PART_BEGIN/END` event.
|
||||
* @param draw the current draw context. (usually returned by `lv_event_get_draw_ctx(e)`)
|
||||
*/
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**
|
||||
* Check the type obj a part draw descriptor
|
||||
* @param dsc the descriptor (normally the event parameter)
|
||||
* @param class_p pointer to class to which `type` is related
|
||||
* @param type element of `lv_<name>_draw_part_type_t`
|
||||
* @return true if ::dsc is related to ::class_p and ::type
|
||||
*/
|
||||
bool lv_obj_draw_part_check_type(lv_obj_draw_part_dsc_t * dsc, const struct _lv_obj_class_t * class_p, uint32_t type);
|
||||
|
||||
/**
|
||||
* Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size.
|
||||
* The result will be saved in `obj`.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the extended draw area of an object.
|
||||
* @param obj pointer to an object
|
||||
* @return the size extended draw area around the real coordinates
|
||||
*/
|
||||
lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
|
||||
|
||||
|
||||
lv_layer_type_t _lv_obj_get_layer_type(const struct _lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_DRAW_H*/
|
||||
449
include/liblvgl/core/lv_obj_pos.h
Normal file
449
include/liblvgl/core/lv_obj_pos.h
Normal file
@ -0,0 +1,449 @@
|
||||
/**
|
||||
* @file lv_obj_pos.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_POS_H
|
||||
#define LV_OBJ_POS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *, void * user_data);
|
||||
typedef struct {
|
||||
lv_layout_update_cb_t cb;
|
||||
void * user_data;
|
||||
} lv_layout_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set the position of an object relative to the set alignment.
|
||||
* @param obj pointer to an object
|
||||
* @param x new x coordinate
|
||||
* @param y new y coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the x coordinate of an object
|
||||
* @param obj pointer to an object
|
||||
* @param x new x coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x);
|
||||
|
||||
/**
|
||||
* Set the y coordinate of an object
|
||||
* @param obj pointer to an object
|
||||
* @param y new y coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the size of an object.
|
||||
* @param obj pointer to an object
|
||||
* @param w the new width
|
||||
* @param h the new height
|
||||
* @note possible values are:
|
||||
* pixel simple set the size accordingly
|
||||
* LV_SIZE_CONTENT set the size to involve all children in the given direction
|
||||
* LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings).
|
||||
* x should be in [0..1000]% range
|
||||
*/
|
||||
void lv_obj_set_size(struct _lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Recalculate the size of the object
|
||||
* @param obj pointer to an object
|
||||
* @return true: the size has been changed
|
||||
*/
|
||||
bool lv_obj_refr_size(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @param w the new width
|
||||
* @note possible values are:
|
||||
* pixel simple set the size accordingly
|
||||
* LV_SIZE_CONTENT set the size to involve all children in the given direction
|
||||
* lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings).
|
||||
* x should be in [0..1000]% range
|
||||
*/
|
||||
void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @param h the new height
|
||||
* @note possible values are:
|
||||
* pixel simple set the size accordingly
|
||||
* LV_SIZE_CONTENT set the size to involve all children in the given direction
|
||||
* lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings).
|
||||
* x should be in [0..1000]% range
|
||||
*/
|
||||
void lv_obj_set_height(struct _lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set the width reduced by the left and right padding and the border width.
|
||||
* @param obj pointer to an object
|
||||
* @param w the width without paddings in pixels
|
||||
*/
|
||||
void lv_obj_set_content_width(struct _lv_obj_t * obj, lv_coord_t w);
|
||||
|
||||
/**
|
||||
* Set the height reduced by the top and bottom padding and the border width.
|
||||
* @param obj pointer to an object
|
||||
* @param h the height without paddings in pixels
|
||||
*/
|
||||
void lv_obj_set_content_height(struct _lv_obj_t * obj, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Set a layout for an object
|
||||
* @param obj pointer to an object
|
||||
* @param layout pointer to a layout descriptor to set
|
||||
*/
|
||||
void lv_obj_set_layout(struct _lv_obj_t * obj, uint32_t layout);
|
||||
|
||||
/**
|
||||
* Test whether the and object is positioned by a layout or not
|
||||
* @param obj pointer to an object to test
|
||||
* @return true: positioned by a layout; false: not positioned by a layout
|
||||
*/
|
||||
bool lv_obj_is_layout_positioned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Mark the object for layout update.
|
||||
* @param obj pointer to an object whose children needs to be updated
|
||||
*/
|
||||
void lv_obj_mark_layout_as_dirty(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Update the layout of an object.
|
||||
* @param obj pointer to an object whose children needs to be updated
|
||||
*/
|
||||
void lv_obj_update_layout(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Register a new layout
|
||||
* @param cb the layout update callback
|
||||
* @param user_data custom data that will be passed to `cb`
|
||||
* @return the ID of the new layout
|
||||
*/
|
||||
uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data);
|
||||
|
||||
/**
|
||||
* Change the alignment of an object.
|
||||
* @param obj pointer to an object to align
|
||||
* @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used.
|
||||
*/
|
||||
void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align);
|
||||
|
||||
/**
|
||||
* Change the alignment of an object and set new coordinates.
|
||||
* Equivalent to:
|
||||
* lv_obj_set_align(obj, align);
|
||||
* lv_obj_set_pos(obj, x_ofs, y_ofs);
|
||||
* @param obj pointer to an object to align
|
||||
* @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used.
|
||||
* @param x_ofs x coordinate offset after alignment
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
*/
|
||||
void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
* @param base pointer to an other object (if NULL `obj`s parent is used). 'obj' will be aligned to it.
|
||||
* @param align type of alignment (see 'lv_align_t' enum)
|
||||
* @param x_ofs x coordinate offset after alignment
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
* @note if the position or size of `base` changes `obj` needs to be aligned manually again
|
||||
*/
|
||||
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs,
|
||||
lv_coord_t y_ofs);
|
||||
|
||||
/**
|
||||
* Align an object to the center on its parent.
|
||||
* @param obj pointer to an object to align
|
||||
* @note if the parent size changes `obj` needs to be aligned manually again
|
||||
*/
|
||||
static inline void lv_obj_center(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy the coordinates of an object to an area
|
||||
* @param obj pointer to an object
|
||||
* @param coords pointer to an area to store the coordinates
|
||||
*/
|
||||
void lv_obj_get_coords(const struct _lv_obj_t * obj, lv_area_t * coords);
|
||||
|
||||
/**
|
||||
* Get the x coordinate of object.
|
||||
* @param obj pointer to an object
|
||||
* @return distance of `obj` from the left side of its parent plus the parent's left padding
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @note Zero return value means the object is on the left padding of the parent, and not on the left edge.
|
||||
* @note Scrolling of the parent doesn't change the returned value.
|
||||
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the x2 coordinate of object.
|
||||
* @param obj pointer to an object
|
||||
* @return distance of `obj` from the right side of its parent plus the parent's right padding
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @note Zero return value means the object is on the right padding of the parent, and not on the right edge.
|
||||
* @note Scrolling of the parent doesn't change the returned value.
|
||||
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the y coordinate of object.
|
||||
* @param obj pointer to an object
|
||||
* @return distance of `obj` from the top side of its parent plus the parent's top padding
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @note Zero return value means the object is on the top padding of the parent, and not on the top edge.
|
||||
* @note Scrolling of the parent doesn't change the returned value.
|
||||
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the y2 coordinate of object.
|
||||
* @param obj pointer to an object
|
||||
* @return distance of `obj` from the bottom side of its parent plus the parent's bottom padding
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @note Zero return value means the object is on the bottom padding of the parent, and not on the bottom edge.
|
||||
* @note Scrolling of the parent doesn't change the returned value.
|
||||
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the actually set x coordinate of object, i.e. the offset form the set alignment
|
||||
* @param obj pointer to an object
|
||||
* @return the set x coordinate
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the actually set y coordinate of object, i.e. the offset form the set alignment
|
||||
* @param obj pointer to an object
|
||||
* @return the set y coordinate
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object
|
||||
* @param obj pointer to an object
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @return the width in pixels
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height of an object
|
||||
* @param obj pointer to an object
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @return the height in pixels
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width reduced by the left and right padding and the border width.
|
||||
* @param obj pointer to an object
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @return the width which still fits into its parent without causing overflow (making the parent scrollable)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height reduced by the top and bottom padding and the border width.
|
||||
* @param obj pointer to an object
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @return the height which still fits into the parent without causing overflow (making the parent scrollable)
|
||||
*/
|
||||
lv_coord_t lv_obj_get_content_height(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the area reduced by the paddings and the border width.
|
||||
* @param obj pointer to an object
|
||||
* @note The position of the object is recalculated only on the next redraw. To force coordinate recalculation
|
||||
* call `lv_obj_update_layout(obj)`.
|
||||
* @param area the area which still fits into the parent without causing overflow (making the parent scrollable)
|
||||
*/
|
||||
void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area);
|
||||
|
||||
/**
|
||||
* Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table.
|
||||
* @param obj pointer to an objects
|
||||
* @return the width of the virtually drawn content
|
||||
* @note This size independent from the real size of the widget.
|
||||
* It just tells how large the internal ("virtual") content is.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the height occupied by the "parts" of the widget. E.g. the height of all rows of a table.
|
||||
* @param obj pointer to an objects
|
||||
* @return the width of the virtually drawn content
|
||||
* @note This size independent from the real size of the widget.
|
||||
* It just tells how large the internal ("virtual") content is.
|
||||
*/
|
||||
lv_coord_t lv_obj_get_self_height(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Handle if the size of the internal ("virtual") content of an object has changed.
|
||||
* @param obj pointer to an object
|
||||
* @return false: nothing happened; true: refresh happened
|
||||
*/
|
||||
bool lv_obj_refresh_self_size(struct _lv_obj_t * obj);
|
||||
|
||||
void lv_obj_refr_pos(struct _lv_obj_t * obj);
|
||||
|
||||
void lv_obj_move_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
|
||||
void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating);
|
||||
|
||||
/**
|
||||
* Transform a point using the angle and zoom style properties of an object
|
||||
* @param obj pointer to an object whose style properties should be used
|
||||
* @param p a point to transform, the result will be written back here too
|
||||
* @param recursive consider the transformation properties of the parents too
|
||||
* @param inv do the inverse of the transformation (-angle and 1/zoom)
|
||||
*/
|
||||
void lv_obj_transform_point(const struct _lv_obj_t * obj, lv_point_t * p, bool recursive, bool inv);
|
||||
|
||||
/**
|
||||
* Transform an area using the angle and zoom style properties of an object
|
||||
* @param obj pointer to an object whose style properties should be used
|
||||
* @param area an area to transform, the result will be written back here too
|
||||
* @param recursive consider the transformation properties of the parents too
|
||||
* @param inv do the inverse of the transformation (-angle and 1/zoom)
|
||||
*/
|
||||
void lv_obj_get_transformed_area(const struct _lv_obj_t * obj, lv_area_t * area, bool recursive, bool inv);
|
||||
|
||||
/**
|
||||
* Mark an area of an object as invalid.
|
||||
* The area will be truncated to the object's area and marked for redraw.
|
||||
* @param obj pointer to an object
|
||||
* @param area the area to redraw
|
||||
*/
|
||||
void lv_obj_invalidate_area(const struct _lv_obj_t * obj, const lv_area_t * area);
|
||||
|
||||
/**
|
||||
* Mark the object as invalid to redrawn its area
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_invalidate(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Tell whether an area of an object is visible (even partially) now or not
|
||||
* @param obj pointer to an object
|
||||
* @param area the are to check. The visible part of the area will be written back here.
|
||||
* @return true visible; false not visible (hidden, out of parent, on other screen, etc)
|
||||
*/
|
||||
bool lv_obj_area_is_visible(const struct _lv_obj_t * obj, lv_area_t * area);
|
||||
|
||||
/**
|
||||
* Tell whether an object is visible (even partially) now or not
|
||||
* @param obj pointer to an object
|
||||
* @return true: visible; false not visible (hidden, out of parent, on other screen, etc)
|
||||
*/
|
||||
bool lv_obj_is_visible(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set the size of an extended clickable area
|
||||
* @param obj pointer to an object
|
||||
* @param size extended clickable area in all 4 directions [px]
|
||||
*/
|
||||
void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, lv_coord_t size);
|
||||
|
||||
/**
|
||||
* Get the an area where to object can be clicked.
|
||||
* It's the object's normal area plus the extended click area.
|
||||
* @param obj pointer to an object
|
||||
* @param area store the result area here
|
||||
*/
|
||||
void lv_obj_get_click_area(const struct _lv_obj_t * obj, lv_area_t * area);
|
||||
|
||||
/**
|
||||
* Hit-test an object given a particular point in screen space.
|
||||
* @param obj object to hit-test
|
||||
* @param point screen-space point (absolute coordinate)
|
||||
* @return true: if the object is considered under the point
|
||||
*/
|
||||
bool lv_obj_hit_test(struct _lv_obj_t * obj, const lv_point_t * point);
|
||||
|
||||
/**
|
||||
* Clamp a width between min and max width. If the min/max width is in percentage value use the ref_width
|
||||
* @param width width to clamp
|
||||
* @param min_width the minimal width
|
||||
* @param max_width the maximal width
|
||||
* @param ref_width the reference width used when min/max width is in percentage
|
||||
* @return the clamped width
|
||||
*/
|
||||
lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max_width, lv_coord_t ref_width);
|
||||
|
||||
/**
|
||||
* Clamp a height between min and max height. If the min/max height is in percentage value use the ref_height
|
||||
* @param height height to clamp
|
||||
* @param min_height the minimal height
|
||||
* @param max_height the maximal height
|
||||
* @param ref_height the reference height used when min/max height is in percentage
|
||||
* @return the clamped height
|
||||
*/
|
||||
lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t max_height, lv_coord_t ref_height);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_POS_H*/
|
||||
307
include/liblvgl/core/lv_obj_scroll.h
Normal file
307
include/liblvgl/core/lv_obj_scroll.h
Normal file
@ -0,0 +1,307 @@
|
||||
/**
|
||||
* @file lv_obj_scroll.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_SCROLL_H
|
||||
#define LV_OBJ_SCROLL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_anim.h"
|
||||
#include "liblvgl/misc/lv_types.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
/** Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
enum {
|
||||
LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/
|
||||
LV_SCROLLBAR_MODE_ON, /**< Always show scrollbars*/
|
||||
LV_SCROLLBAR_MODE_ACTIVE, /**< Show scroll bars when object is being scrolled*/
|
||||
LV_SCROLLBAR_MODE_AUTO, /**< Show scroll bars when the content is large enough to be scrolled*/
|
||||
};
|
||||
typedef uint8_t lv_scrollbar_mode_t;
|
||||
|
||||
|
||||
/** Scroll span align options. Tells where to align the snappable children when scroll stops.*/
|
||||
enum {
|
||||
LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/
|
||||
LV_SCROLL_SNAP_START, /**< Align to the left/top*/
|
||||
LV_SCROLL_SNAP_END, /**< Align to the right/bottom*/
|
||||
LV_SCROLL_SNAP_CENTER /**< Align to the center*/
|
||||
};
|
||||
typedef uint8_t lv_scroll_snap_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set how the scrollbars should behave.
|
||||
* @param obj pointer to an object
|
||||
* @param mode LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
|
||||
*/
|
||||
void lv_obj_set_scrollbar_mode(struct _lv_obj_t * obj, lv_scrollbar_mode_t mode);
|
||||
|
||||
/**
|
||||
* Set the object in which directions can be scrolled
|
||||
* @param obj pointer to an object
|
||||
* @param dir the allow scroll directions. An element or OR-ed values of `lv_dir_t`
|
||||
*/
|
||||
void lv_obj_set_scroll_dir(struct _lv_obj_t * obj, lv_dir_t dir);
|
||||
|
||||
/**
|
||||
* Set where to snap the children when scrolling ends horizontally
|
||||
* @param obj pointer to an object
|
||||
* @param align the snap align to set from `lv_scroll_snap_t`
|
||||
*/
|
||||
void lv_obj_set_scroll_snap_x(struct _lv_obj_t * obj, lv_scroll_snap_t align);
|
||||
|
||||
/**
|
||||
* Set where to snap the children when scrolling ends vertically
|
||||
* @param obj pointer to an object
|
||||
* @param align the snap align to set from `lv_scroll_snap_t`
|
||||
*/
|
||||
void lv_obj_set_scroll_snap_y(struct _lv_obj_t * obj, lv_scroll_snap_t align);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the current scroll mode (when to hide the scrollbars)
|
||||
* @param obj pointer to an object
|
||||
* @return the current scroll mode from `lv_scrollbar_mode_t`
|
||||
*/
|
||||
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the object in which directions can be scrolled
|
||||
* @param obj pointer to an object
|
||||
* @param dir the allow scroll directions. An element or OR-ed values of `lv_dir_t`
|
||||
*/
|
||||
lv_dir_t lv_obj_get_scroll_dir(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get where to snap the children when scrolling ends horizontally
|
||||
* @param obj pointer to an object
|
||||
* @return the current snap align from `lv_scroll_snap_t`
|
||||
*/
|
||||
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get where to snap the children when scrolling ends vertically
|
||||
* @param obj pointer to an object
|
||||
* @return the current snap align from `lv_scroll_snap_t`
|
||||
*/
|
||||
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get current X scroll position.
|
||||
* @param obj pointer to an object
|
||||
* @return the current scroll position from the left edge.
|
||||
* If the object is not scrolled return 0
|
||||
* If scrolled return > 0
|
||||
* If scrolled in (elastic scroll) return < 0
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get current Y scroll position.
|
||||
* @param obj pointer to an object
|
||||
* @return the current scroll position from the top edge.
|
||||
* If the object is not scrolled return 0
|
||||
* If scrolled return > 0
|
||||
* If scrolled inside return < 0
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the height of the area above the object.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj pointer to an object
|
||||
* @return the scrollable area above the object in pixels
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the height of the area below the object.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj pointer to an object
|
||||
* @return the scrollable area below the object in pixels
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the width of the area on the left the object.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj pointer to an object
|
||||
* @return the scrollable area on the left the object in pixels
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Return the width of the area on the right the object.
|
||||
* That is the number of pixels the object can be scrolled down.
|
||||
* Normally positive but can be negative when scrolled inside.
|
||||
* @param obj pointer to an object
|
||||
* @return the scrollable area on the right the object in pixels
|
||||
*/
|
||||
lv_coord_t lv_obj_get_scroll_right(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the X and Y coordinates where the scrolling will end for this object if a scrolling animation is in progress.
|
||||
* If no scrolling animation, give the current `x` or `y` scroll position.
|
||||
* @param obj pointer to an object
|
||||
* @param end pointer to store the result
|
||||
*/
|
||||
void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Scroll by a given amount of pixels
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param dx pixels to scroll horizontally
|
||||
* @param dy pixels to scroll vertically
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
* @note > 0 value means scroll right/bottom (show the more content on the right/bottom)
|
||||
* @note e.g. dy = -20 means scroll down 20 px
|
||||
*/
|
||||
void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll by a given amount of pixels.
|
||||
* `dx` and `dy` will be limited internally to allow scrolling only on the content area.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param dx pixels to scroll horizontally
|
||||
* @param dy pixels to scroll vertically
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
* @note e.g. dy = -20 means scroll down 20 px
|
||||
*/
|
||||
void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll to a given coordinate on an object.
|
||||
* `x` and `y` will be limited internally to allow scrolling only on the content area.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param x pixels to scroll horizontally
|
||||
* @param y pixels to scroll vertically
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
*/
|
||||
void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll to a given X coordinate on an object.
|
||||
* `x` will be limited internally to allow scrolling only on the content area.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param x pixels to scroll horizontally
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
*/
|
||||
void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll to a given Y coordinate on an object
|
||||
* `y` will be limited internally to allow scrolling only on the content area.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param y pixels to scroll vertically
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
*/
|
||||
void lv_obj_scroll_to_y(struct _lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll to an object until it becomes visible on its parent
|
||||
* @param obj pointer to an object to scroll into view
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
*/
|
||||
void lv_obj_scroll_to_view(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Scroll to an object until it becomes visible on its parent.
|
||||
* Do the same on the parent's parent, and so on.
|
||||
* Therefore the object will be scrolled into view even it has nested scrollable parents
|
||||
* @param obj pointer to an object to scroll into view
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
|
||||
*/
|
||||
void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
|
||||
|
||||
|
||||
/**
|
||||
* Low level function to scroll by given x and y coordinates.
|
||||
* `LV_EVENT_SCROLL` is sent.
|
||||
* @param obj pointer to an object to scroll
|
||||
* @param x pixels to scroll horizontally
|
||||
* @param y pixels to scroll vertically
|
||||
* @return `LV_RES_INV`: to object was deleted in `LV_EVENT_SCROLL`;
|
||||
* `LV_RES_OK`: if the object is still valid
|
||||
*/
|
||||
lv_res_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Tell whether an object is being scrolled or not at this moment
|
||||
* @param obj pointer to an object
|
||||
* @return true: `obj` is being scrolled
|
||||
*/
|
||||
bool lv_obj_is_scrolling(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Check the children of `obj` and scroll `obj` to fulfill the scroll_snap settings
|
||||
* @param obj an object whose children needs to checked and snapped
|
||||
* @param anim_en LV_ANIM_ON/OFF
|
||||
*/
|
||||
void lv_obj_update_snap(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
|
||||
|
||||
/**
|
||||
* Get the area of the scrollbars
|
||||
* @param obj pointer to an object
|
||||
* @param hor pointer to store the area of the horizontal scrollbar
|
||||
* @param ver pointer to store the area of the vertical scrollbar
|
||||
*/
|
||||
void lv_obj_get_scrollbar_area(struct _lv_obj_t * obj, lv_area_t * hor, lv_area_t * ver);
|
||||
|
||||
/**
|
||||
* Invalidate the area of the scrollbars
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_scrollbar_invalidate(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Checked if the content is scrolled "in" and adjusts it to a normal position.
|
||||
* @param obj pointer to an object
|
||||
* @param anim_en LV_ANIM_ON/OFF
|
||||
*/
|
||||
void lv_obj_readjust_scroll(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_SCROLL_H*/
|
||||
248
include/liblvgl/core/lv_obj_style.h
Normal file
248
include/liblvgl/core/lv_obj_style.h
Normal file
@ -0,0 +1,248 @@
|
||||
/**
|
||||
* @file lv_obj_style.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_STYLE_H
|
||||
#define LV_OBJ_STYLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "liblvgl/misc/lv_bidi.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
_LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/
|
||||
_LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/
|
||||
} _lv_style_state_cmp_t;
|
||||
|
||||
typedef uint32_t lv_style_selector_t;
|
||||
|
||||
typedef struct {
|
||||
lv_style_t * style;
|
||||
uint32_t selector : 24;
|
||||
uint32_t is_local : 1;
|
||||
uint32_t is_trans : 1;
|
||||
} _lv_obj_style_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t time;
|
||||
uint16_t delay;
|
||||
lv_style_selector_t selector;
|
||||
lv_style_prop_t prop;
|
||||
lv_anim_path_cb_t path_cb;
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
} _lv_obj_style_transition_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the object related style manager module.
|
||||
* Called by LVGL in `lv_init()`
|
||||
*/
|
||||
void _lv_obj_style_init(void);
|
||||
|
||||
/**
|
||||
* Add a style to an object.
|
||||
* @param obj pointer to an object
|
||||
* @param style pointer to a style to add
|
||||
* @param selector OR-ed value of parts and state to which the style should be added
|
||||
* @example lv_obj_add_style(btn, &style_btn, 0); //Default button style
|
||||
* @example lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed
|
||||
*/
|
||||
void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Add a style to an object.
|
||||
* @param obj pointer to an object
|
||||
* @param style pointer to a style to remove. Can be NULL to check only the selector
|
||||
* @param selector OR-ed values of states and a part to remove only styles with matching selectors. LV_STATE_ANY and LV_PART_ANY can be used
|
||||
* @example lv_obj_remove_style(obj, &style, LV_PART_ANY | LV_STATE_ANY); //Remove a specific style
|
||||
* @example lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part
|
||||
* @example lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles
|
||||
*/
|
||||
void lv_obj_remove_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Remove all styles from an object
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static inline void lv_obj_remove_style_all(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify all object if a style is modified
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_obj_report_style_change(lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Notify an object and its children about its style is modified.
|
||||
* @param obj pointer to an object
|
||||
* @param part the part whose style was changed. E.g. `LV_PART_ANY`, `LV_PART_MAIN`
|
||||
* @param prop `LV_STYLE_PROP_ANY` or an `LV_STYLE_...` property.
|
||||
* It is used to optimize what needs to be refreshed.
|
||||
* `LV_STYLE_PROP_INV` to perform only a style cache update
|
||||
*/
|
||||
void lv_obj_refresh_style(struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
|
||||
|
||||
/**
|
||||
* Enable or disable automatic style refreshing when a new style is added/removed to/from an object
|
||||
* or any other style change happens.
|
||||
* @param en true: enable refreshing; false: disable refreshing
|
||||
*/
|
||||
void lv_obj_enable_style_refresh(bool en);
|
||||
|
||||
/**
|
||||
* Get the value of a style property. The current state of the object will be considered.
|
||||
* Inherited properties will be inherited.
|
||||
* If a property is not set a default value will be returned.
|
||||
* @param obj pointer to an object
|
||||
* @param part a part from which the property should be get
|
||||
* @param prop the property to get
|
||||
* @return the value of the property.
|
||||
* Should be read from the correct field of the `lv_style_value_t` according to the type of the property.
|
||||
*/
|
||||
lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
|
||||
|
||||
/**
|
||||
* Set local style property on an object's part and state.
|
||||
* @param obj pointer to an object
|
||||
* @param prop the property
|
||||
* @param value value of the property. The correct element should be set according to the type of the property
|
||||
* @param selector OR-ed value of parts and state for which the style should be set
|
||||
*/
|
||||
void lv_obj_set_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
void lv_obj_set_local_style_prop_meta(struct _lv_obj_t * obj, lv_style_prop_t prop, uint16_t meta,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
lv_style_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Remove a local style property from a part of an object with a given state.
|
||||
* @param obj pointer to an object
|
||||
* @param prop a style property to remove.
|
||||
* @param selector OR-ed value of parts and state for which the style should be removed
|
||||
* @return true the property was found and removed; false: the property was not found
|
||||
*/
|
||||
bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Used internally for color filtering
|
||||
*/
|
||||
lv_style_value_t _lv_obj_style_apply_color_filter(const struct _lv_obj_t * obj, uint32_t part, lv_style_value_t v);
|
||||
|
||||
/**
|
||||
* Used internally to create a style transition
|
||||
* @param obj
|
||||
* @param part
|
||||
* @param prev_state
|
||||
* @param new_state
|
||||
* @param tr
|
||||
*/
|
||||
void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_part_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr);
|
||||
|
||||
/**
|
||||
* Used internally to compare the appearance of an object in 2 states
|
||||
* @param obj
|
||||
* @param state1
|
||||
* @param state2
|
||||
* @return
|
||||
*/
|
||||
_lv_style_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
|
||||
|
||||
/**
|
||||
* Fade in an an object and all its children.
|
||||
* @param obj the object to fade in
|
||||
* @param time time of fade
|
||||
* @param delay delay to start the animation
|
||||
*/
|
||||
void lv_obj_fade_in(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
/**
|
||||
* Fade out an an object and all its children.
|
||||
* @param obj the object to fade out
|
||||
* @param time time of fade
|
||||
* @param delay delay to start the animation
|
||||
*/
|
||||
void lv_obj_fade_out(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector);
|
||||
|
||||
lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector);
|
||||
|
||||
#include "lv_obj_style_gen.h"
|
||||
|
||||
static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_left(obj, value, selector);
|
||||
lv_obj_set_style_pad_right(obj, value, selector);
|
||||
lv_obj_set_style_pad_top(obj, value, selector);
|
||||
lv_obj_set_style_pad_bottom(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_left(obj, value, selector);
|
||||
lv_obj_set_style_pad_right(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_top(obj, value, selector);
|
||||
lv_obj_set_style_pad_bottom(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_row(obj, value, selector);
|
||||
lv_obj_set_style_pad_column(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_width(obj, value, selector);
|
||||
lv_obj_set_style_height(obj, value, selector);
|
||||
}
|
||||
|
||||
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_STYLE_H*/
|
||||
648
include/liblvgl/core/lv_obj_style_gen.h
Normal file
648
include/liblvgl/core/lv_obj_style_gen.h
Normal file
@ -0,0 +1,648 @@
|
||||
static inline lv_coord_t lv_obj_get_style_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_min_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_max_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_height(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_HEIGHT);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_min_height(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_HEIGHT);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_max_height(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_HEIGHT);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_x(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_X);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_Y);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_align_t lv_obj_get_style_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ALIGN);
|
||||
return (lv_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_translate_x(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_translate_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ANGLE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_pivot_x(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_pivot_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_bottom(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_right(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_row(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_ROW);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_pad_column(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_COLUMN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_bg_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_grad_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR);
|
||||
return (lv_grad_dir_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_bg_main_stop(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_bg_grad_stop(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD);
|
||||
return (const lv_grad_dsc_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_dither_mode_t lv_obj_get_style_bg_dither_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_DITHER_MODE);
|
||||
return (lv_dither_mode_t)v.num;
|
||||
}
|
||||
|
||||
static inline const void * lv_obj_get_style_bg_img_src(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_SRC);
|
||||
return (const void *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_bg_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_img_recolor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_bg_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_bg_img_recolor_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_bg_img_tiled(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_TILED);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_border_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_border_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_border_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_border_side_t lv_obj_get_style_border_side(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE);
|
||||
return (lv_border_side_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_border_post(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_outline_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_outline_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_outline_pad(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_shadow_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_shadow_ofs_x(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_X);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_shadow_ofs_y(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFS_Y);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_shadow_spread(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_shadow_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_img_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_img_recolor_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_line_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_line_dash_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_line_dash_gap(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_line_rounded(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_line_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_line_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_line_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_arc_width(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_WIDTH);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_arc_rounded(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_ROUNDED);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_arc_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_arc_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const void * lv_obj_get_style_arc_img_src(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_IMG_SRC);
|
||||
return (const void *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_text_color(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR);
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_color_t lv_obj_get_style_text_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR));
|
||||
return v.color;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_text_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT);
|
||||
return (const lv_font_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR);
|
||||
return (lv_text_decor_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN);
|
||||
return (lv_text_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER);
|
||||
return (bool)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
|
||||
return (const lv_color_filter_dsc_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_color_filter_opa(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_anim_t * lv_obj_get_style_anim(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM);
|
||||
return (const lv_anim_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline uint32_t lv_obj_get_style_anim_time(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_TIME);
|
||||
return (uint32_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint32_t lv_obj_get_style_anim_speed(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_SPEED);
|
||||
return (uint32_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION);
|
||||
return (const lv_style_transition_dsc_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE);
|
||||
return (lv_blend_mode_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint16_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT);
|
||||
return (uint16_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_base_dir_t lv_obj_get_style_base_dir(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR);
|
||||
return (lv_base_dir_t)v.num;
|
||||
}
|
||||
|
||||
void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_min_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_max_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_min_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_max_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_align(struct _lv_obj_t * obj, lv_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_grad(struct _lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_bg_img_tiled(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_side(struct _lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_ofs_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_ofs_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_arc_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
|
||||
172
include/liblvgl/core/lv_obj_tree.h
Normal file
172
include/liblvgl/core/lv_obj_tree.h
Normal file
@ -0,0 +1,172 @@
|
||||
/**
|
||||
* @file struct _lv_obj_tree.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OBJ_TREE_H
|
||||
#define LV_OBJ_TREE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_obj_t;
|
||||
struct _lv_obj_class_t;
|
||||
|
||||
typedef enum {
|
||||
LV_OBJ_TREE_WALK_NEXT,
|
||||
LV_OBJ_TREE_WALK_SKIP_CHILDREN,
|
||||
LV_OBJ_TREE_WALK_END,
|
||||
} lv_obj_tree_walk_res_t;
|
||||
|
||||
typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(struct _lv_obj_t *, void *);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Delete an object and all of its children.
|
||||
* Also remove the objects from their group and remove all animations (if any).
|
||||
* Send `LV_EVENT_DELETED` to deleted objects.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_del(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Delete all children of an object.
|
||||
* Also remove the objects from their group and remove all animations (if any).
|
||||
* Send `LV_EVENT_DELETED` to deleted objects.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_clean(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Delete an object after some delay
|
||||
* @param obj pointer to an object
|
||||
* @param delay_ms time to wait before delete in milliseconds
|
||||
*/
|
||||
void lv_obj_del_delayed(struct _lv_obj_t * obj, uint32_t delay_ms);
|
||||
|
||||
/**
|
||||
* A function to be easily used in animation ready callback to delete an object when the animation is ready
|
||||
* @param a pointer to the animation
|
||||
*/
|
||||
void lv_obj_del_anim_ready_cb(lv_anim_t * a);
|
||||
|
||||
/**
|
||||
* Helper function for asynchronously deleting objects.
|
||||
* Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent).
|
||||
* @param obj object to delete
|
||||
* @see lv_async_call
|
||||
*/
|
||||
void lv_obj_del_async(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Move the parent of an object. The relative coordinates will be kept.
|
||||
*
|
||||
* @param obj pointer to an object whose parent needs to be changed
|
||||
* @param parent pointer to the new parent
|
||||
*/
|
||||
void lv_obj_set_parent(struct _lv_obj_t * obj, struct _lv_obj_t * parent);
|
||||
|
||||
/**
|
||||
* Swap the positions of two objects.
|
||||
* When used in listboxes, it can be used to sort the listbox items.
|
||||
* @param obj1 pointer to the first object
|
||||
* @param obj2 pointer to the second object
|
||||
*/
|
||||
void lv_obj_swap(struct _lv_obj_t * obj1, struct _lv_obj_t * obj2);
|
||||
|
||||
/**
|
||||
* moves the object to the given index in its parent.
|
||||
* When used in listboxes, it can be used to sort the listbox items.
|
||||
* @param obj pointer to the object to be moved.
|
||||
* @param index new index in parent. -1 to count from the back
|
||||
* @note to move to the background: lv_obj_move_to_index(obj, 0)
|
||||
* @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1)
|
||||
*/
|
||||
void lv_obj_move_to_index(struct _lv_obj_t * obj, int32_t index);
|
||||
|
||||
/**
|
||||
* Get the screen of an object
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the object's screen
|
||||
*/
|
||||
struct _lv_obj_t * lv_obj_get_screen(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the display of the object
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the object's display
|
||||
*/
|
||||
lv_disp_t * lv_obj_get_disp(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the parent of an object
|
||||
* @param obj pointer to an object
|
||||
* @return the parent of the object. (NULL if `obj` was a screen)
|
||||
*/
|
||||
struct _lv_obj_t * lv_obj_get_parent(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the child of an object by the child's index.
|
||||
* @param obj pointer to an object whose child should be get
|
||||
* @param id the index of the child.
|
||||
* 0: the oldest (firstly created) child
|
||||
* 1: the second oldest
|
||||
* child count-1: the youngest
|
||||
* -1: the youngest
|
||||
* -2: the second youngest
|
||||
* @return pointer to the child or NULL if the index was invalid
|
||||
*/
|
||||
struct _lv_obj_t * lv_obj_get_child(const struct _lv_obj_t * obj, int32_t id);
|
||||
|
||||
/**
|
||||
* Get the number of children
|
||||
* @param obj pointer to an object
|
||||
* @return the number of children
|
||||
*/
|
||||
uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the index of a child.
|
||||
* @param obj pointer to an object
|
||||
* @return the child index of the object.
|
||||
* E.g. 0: the oldest (firstly created child)
|
||||
*/
|
||||
uint32_t lv_obj_get_index(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Iterate through all children of any object.
|
||||
* @param start_obj start integrating from this object
|
||||
* @param cb call this callback on the objects
|
||||
* @param user_data pointer to any user related data (will be passed to `cb`)
|
||||
*/
|
||||
void lv_obj_tree_walk(struct _lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OBJ_TREE_H*/
|
||||
115
include/liblvgl/core/lv_refr.h
Normal file
115
include/liblvgl/core/lv_refr.h
Normal file
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* @file lv_refr.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_REFR_H
|
||||
#define LV_REFR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_REFR_TASK_PRIO LV_TASK_PRIO_MID
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the screen refresh subsystem
|
||||
*/
|
||||
void _lv_refr_init(void);
|
||||
|
||||
/**
|
||||
* Redraw the invalidated areas now.
|
||||
* Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process
|
||||
* can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process
|
||||
* (e.g. progress bar) this function can be called when the screen should be updated.
|
||||
* @param disp pointer to display to refresh. NULL to refresh all displays.
|
||||
*/
|
||||
void lv_refr_now(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Redrawn on object an all its children using the passed draw context
|
||||
* @param draw pointer to an initialized draw context
|
||||
* @param obj the start object from the redraw should start
|
||||
*/
|
||||
void lv_obj_redraw(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Invalidate an area on display to redraw it
|
||||
* @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas)
|
||||
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
|
||||
* only one display)
|
||||
*/
|
||||
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p);
|
||||
|
||||
/**
|
||||
* Get the display which is being refreshed
|
||||
* @return the display being refreshed
|
||||
*/
|
||||
lv_disp_t * _lv_refr_get_disp_refreshing(void);
|
||||
|
||||
/**
|
||||
* Set the display which is being refreshed.
|
||||
* It shouldn't be used directly by the user.
|
||||
* It can be used to trick the drawing functions about there is an active display.
|
||||
* @param the display being refreshed
|
||||
*/
|
||||
void _lv_refr_set_disp_refreshing(lv_disp_t * disp);
|
||||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
/**
|
||||
* Reset FPS counter
|
||||
*/
|
||||
void lv_refr_reset_fps_counter(void);
|
||||
|
||||
/**
|
||||
* Get the average FPS
|
||||
* @return the average FPS
|
||||
*/
|
||||
uint32_t lv_refr_get_fps_avg(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Called periodically to handle the refreshing
|
||||
* @param timer pointer to the timer itself
|
||||
*/
|
||||
void _lv_disp_refr_timer(lv_timer_t * timer);
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_REFR_H*/
|
||||
120
include/liblvgl/core/lv_theme.h
Normal file
120
include/liblvgl/core/lv_theme.h
Normal file
@ -0,0 +1,120 @@
|
||||
/**
|
||||
*@file lv_theme.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_H
|
||||
#define LV_THEME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_theme_t;
|
||||
struct _lv_disp_t;
|
||||
|
||||
typedef void (*lv_theme_apply_cb_t)(struct _lv_theme_t *, lv_obj_t *);
|
||||
|
||||
typedef struct _lv_theme_t {
|
||||
lv_theme_apply_cb_t apply_cb;
|
||||
struct _lv_theme_t * parent; /**< Apply the current theme's style on top of this theme.*/
|
||||
void * user_data;
|
||||
struct _lv_disp_t * disp;
|
||||
lv_color_t color_primary;
|
||||
lv_color_t color_secondary;
|
||||
const lv_font_t * font_small;
|
||||
const lv_font_t * font_normal;
|
||||
const lv_font_t * font_large;
|
||||
uint32_t flags; /*Any custom flag used by the theme*/
|
||||
} lv_theme_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the theme assigned to the display of the object
|
||||
* @param obj pointer to a theme object
|
||||
* @return the theme of the object's display (can be NULL)
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Apply the active theme on an object
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_theme_apply(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set a base theme for a theme.
|
||||
* The styles from the base them will be added before the styles of the current theme.
|
||||
* Arbitrary long chain of themes can be created by setting base themes.
|
||||
* @param new_theme pointer to theme which base should be set
|
||||
* @param parent pointer to the base theme
|
||||
*/
|
||||
void lv_theme_set_parent(lv_theme_t * new_theme, lv_theme_t * parent);
|
||||
|
||||
/**
|
||||
* Set an apply callback for a theme.
|
||||
* The apply callback is used to add styles to different objects
|
||||
* @param theme pointer to theme which callback should be set
|
||||
* @param apply_cb pointer to the callback
|
||||
*/
|
||||
void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb);
|
||||
|
||||
/**
|
||||
* Get the small font of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the font
|
||||
*/
|
||||
const lv_font_t * lv_theme_get_font_small(lv_obj_t * obj);
|
||||
/**
|
||||
* Get the normal font of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the font
|
||||
*/
|
||||
const lv_font_t * lv_theme_get_font_normal(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the subtitle font of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to the font
|
||||
*/
|
||||
const lv_font_t * lv_theme_get_font_large(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the primary color of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return the color
|
||||
*/
|
||||
lv_color_t lv_theme_get_color_primary(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the secondary color of the theme
|
||||
* @param obj pointer to an object
|
||||
* @return the color
|
||||
*/
|
||||
lv_color_t lv_theme_get_color_secondary(lv_obj_t * obj);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_H*/
|
||||
51
include/liblvgl/draw/arm2d/lv_gpu_arm2d.h
Normal file
51
include/liblvgl/draw/arm2d/lv_gpu_arm2d.h
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file lv_gpu_arm2d.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_ARM2D_H
|
||||
#define LV_GPU_ARM2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/hal/lv_hal_disp.h"
|
||||
#include "liblvgl/draw/sw/lv_draw_sw.h"
|
||||
|
||||
#if LV_USE_GPU_ARM2D
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_arm2d_ctx_t;
|
||||
|
||||
struct _lv_disp_drv_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_arm2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_arm2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_ARM2D*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_ARM2D_H*/
|
||||
218
include/liblvgl/draw/lv_draw.h
Normal file
218
include/liblvgl/draw/lv_draw.h
Normal file
@ -0,0 +1,218 @@
|
||||
/**
|
||||
* @file lv_draw.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_H
|
||||
#define LV_DRAW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
#include "liblvgl/misc/lv_txt.h"
|
||||
#include "lv_img_decoder.h"
|
||||
#include "lv_img_cache.h"
|
||||
|
||||
#include "lv_draw_rect.h"
|
||||
#include "lv_draw_label.h"
|
||||
#include "lv_draw_img.h"
|
||||
#include "lv_draw_line.h"
|
||||
#include "lv_draw_triangle.h"
|
||||
#include "lv_draw_arc.h"
|
||||
#include "lv_draw_mask.h"
|
||||
#include "lv_draw_transform.h"
|
||||
#include "lv_draw_layer.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
void * user_data;
|
||||
} lv_draw_mask_t;
|
||||
|
||||
typedef struct _lv_draw_layer_ctx_t {
|
||||
lv_area_t area_full;
|
||||
lv_area_t area_act;
|
||||
lv_coord_t max_row_with_alpha;
|
||||
lv_coord_t max_row_with_no_alpha;
|
||||
void * buf;
|
||||
struct {
|
||||
const lv_area_t * clip_area;
|
||||
lv_area_t * buf_area;
|
||||
void * buf;
|
||||
bool screen_transp;
|
||||
} original;
|
||||
} lv_draw_layer_ctx_t;
|
||||
|
||||
typedef struct _lv_draw_ctx_t {
|
||||
/**
|
||||
* Pointer to a buffer to draw into
|
||||
*/
|
||||
void * buf;
|
||||
|
||||
/**
|
||||
* The position and size of `buf` (absolute coordinates)
|
||||
*/
|
||||
lv_area_t * buf_area;
|
||||
|
||||
/**
|
||||
* The current clip area with absolute coordinates, always the same or smaller than `buf_area`
|
||||
*/
|
||||
const lv_area_t * clip_area;
|
||||
|
||||
|
||||
void (*draw_rect)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
void (*draw_arc)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
uint16_t radius, uint16_t start_angle, uint16_t end_angle);
|
||||
|
||||
void (*draw_img_decoded)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format);
|
||||
|
||||
lv_res_t (*draw_img)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src);
|
||||
|
||||
void (*draw_letter)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter);
|
||||
|
||||
|
||||
void (*draw_line)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2);
|
||||
|
||||
|
||||
void (*draw_polygon)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc,
|
||||
const lv_point_t * points, uint16_t point_cnt);
|
||||
|
||||
|
||||
/**
|
||||
* Get an area of a transformed image (zoomed and/or rotated)
|
||||
* @param draw_ctx pointer to a draw context
|
||||
* @param dest_area get this area of the result image. It assumes that the original image is placed to the 0;0 position.
|
||||
* @param src_buf the source image
|
||||
* @param src_w width of the source image in [px]
|
||||
* @param src_h height of the source image in [px]
|
||||
* @param src_stride the stride in [px].
|
||||
* @param draw_dsc an `lv_draw_img_dsc_t` descriptor containing the transformation parameters
|
||||
* @param cf the color format of `src_buf`
|
||||
* @param cbuf place the colors of the pixels on `dest_area` here in RGB format
|
||||
* @param abuf place the opacity of the pixels on `dest_area` here
|
||||
*/
|
||||
void (*draw_transform)(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf,
|
||||
lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf);
|
||||
|
||||
/**
|
||||
* Replace the buffer with a rect without decoration like radius or borders
|
||||
*/
|
||||
void (*draw_bg)(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_area_t * coords);
|
||||
|
||||
/**
|
||||
* Wait until all background operations are finished. (E.g. GPU operations)
|
||||
*/
|
||||
void (*wait_for_finish)(struct _lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**
|
||||
* Copy an area from buffer to an other
|
||||
* @param draw_ctx pointer to a draw context
|
||||
* @param dest_buf copy the buffer into this buffer
|
||||
* @param dest_stride the width of the dest_buf in pixels
|
||||
* @param dest_area the destination area
|
||||
* @param src_buf copy from this buffer
|
||||
* @param src_stride the width of src_buf in pixels
|
||||
* @param src_area the source area.
|
||||
*
|
||||
* @note dest_area and src_area must have the same width and height
|
||||
* but can have different x and y position.
|
||||
* @note dest_area and src_area must be clipped to the real dimensions of the buffers
|
||||
*/
|
||||
void (*buffer_copy)(struct _lv_draw_ctx_t * draw_ctx, void * dest_buf, lv_coord_t dest_stride,
|
||||
const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
/**
|
||||
* Initialize a new layer context.
|
||||
* The original buffer and area data are already saved from `draw_ctx` to `layer_ctx`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_area the coordinates of the layer
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
* @return pointer to the layer context, or NULL on error
|
||||
*/
|
||||
struct _lv_draw_layer_ctx_t * (*layer_init)(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Adjust the layer_ctx and/or draw_ctx based on the `layer_ctx->area_act`.
|
||||
* It's called only if flags has `LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
*/
|
||||
void (*layer_adjust)(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Blend a rendered layer to `layer_ctx->area_act`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param draw_dsc pointer to an image draw descriptor
|
||||
*/
|
||||
void (*layer_blend)(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Destroy a layer context. The original buffer and area data of the `draw_ctx` will be restored
|
||||
* and the `layer_ctx` itself will be freed automatically.
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
*/
|
||||
void (*layer_destroy)(struct _lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
/**
|
||||
* Size of a layer context in bytes.
|
||||
*/
|
||||
size_t layer_instance_size;
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
|
||||
} lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_init(void);
|
||||
|
||||
|
||||
void lv_draw_wait_for_finish(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* POST INCLUDES
|
||||
*********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_H*/
|
||||
83
include/liblvgl/draw/lv_draw_arc.h
Normal file
83
include/liblvgl/draw/lv_draw_arc.h
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @file lv_draw_arc.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_ARC_H
|
||||
#define LV_DRAW_ARC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
lv_color_t color;
|
||||
lv_coord_t width;
|
||||
uint16_t start_angle;
|
||||
uint16_t end_angle;
|
||||
const void * img_src;
|
||||
lv_opa_t opa;
|
||||
lv_blend_mode_t blend_mode : 2;
|
||||
uint8_t rounded : 1;
|
||||
} lv_draw_arc_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Draw an arc. (Can draw pie too with great thickness.)
|
||||
* @param center_x the x coordinate of the center of the arc
|
||||
* @param center_y the y coordinate of the center of the arc
|
||||
* @param radius the radius of the arc
|
||||
* @param mask the arc will be drawn only in this mask
|
||||
* @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right)
|
||||
* @param end_angle the end angle of the arc
|
||||
* @param clip_area the arc will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_arc(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
uint16_t radius, uint16_t start_angle, uint16_t end_angle);
|
||||
|
||||
/**
|
||||
* Get an area the should be invalidated when the arcs angle changed between start_angle and end_ange
|
||||
* @param x the x coordinate of the center of the arc
|
||||
* @param y the y coordinate of the center of the arc
|
||||
* @param radius the radius of the arc
|
||||
* @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right)
|
||||
* @param end_angle the end angle of the arc
|
||||
* @param w width of the arc
|
||||
* @param rounded true: the arc is rounded
|
||||
* @param area store the area to invalidate here
|
||||
*/
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
|
||||
lv_coord_t w, bool rounded, lv_area_t * area);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_ARC_H*/
|
||||
104
include/liblvgl/draw/lv_draw_img.h
Normal file
104
include/liblvgl/draw/lv_draw_img.h
Normal file
@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @file lv_draw_img.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_IMG_H
|
||||
#define LV_DRAW_IMG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_img_decoder.h"
|
||||
#include "lv_img_buf.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
|
||||
int16_t angle;
|
||||
uint16_t zoom;
|
||||
lv_point_t pivot;
|
||||
|
||||
lv_color_t recolor;
|
||||
lv_opa_t recolor_opa;
|
||||
|
||||
lv_opa_t opa;
|
||||
lv_blend_mode_t blend_mode : 4;
|
||||
|
||||
int32_t frame_id;
|
||||
uint8_t antialias : 1;
|
||||
} lv_draw_img_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
|
||||
/**
|
||||
* Draw an image
|
||||
* @param coords the coordinates of the image
|
||||
* @param mask the image will be drawn only in this area
|
||||
* @param src pointer to a lv_color_t array which contains the pixels of the image
|
||||
* @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_img(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc, const lv_area_t * coords,
|
||||
const void * src);
|
||||
|
||||
|
||||
void lv_draw_img_decoded(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format);
|
||||
|
||||
/**
|
||||
* Get the type of an image source
|
||||
* @param src pointer to an image source:
|
||||
* - pointer to an 'lv_img_t' variable (image stored internally and compiled into the code)
|
||||
* - a path to a file (e.g. "S:/folder/image.bin")
|
||||
* - or a symbol (e.g. LV_SYMBOL_CLOSE)
|
||||
* @return type of the image source LV_IMG_SRC_VARIABLE/FILE/SYMBOL/UNKNOWN
|
||||
*/
|
||||
lv_img_src_t lv_img_src_get_type(const void * src);
|
||||
|
||||
/**
|
||||
* Get the pixel size of a color format in bits
|
||||
* @param cf a color format (`LV_IMG_CF_...`)
|
||||
* @return the pixel size in bits
|
||||
*/
|
||||
uint8_t lv_img_cf_get_px_size(lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* Check if a color format is chroma keyed or not
|
||||
* @param cf a color format (`LV_IMG_CF_...`)
|
||||
* @return true: chroma keyed; false: not chroma keyed
|
||||
*/
|
||||
bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* Check if a color format has alpha channel or not
|
||||
* @param cf a color format (`LV_IMG_CF_...`)
|
||||
* @return true: has alpha channel; false: doesn't have alpha channel
|
||||
*/
|
||||
bool lv_img_cf_has_alpha(lv_img_cf_t cf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_IMG_H*/
|
||||
100
include/liblvgl/draw/lv_draw_label.h
Normal file
100
include/liblvgl/draw/lv_draw_label.h
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* @file lv_draw_label.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_LABEL_H
|
||||
#define LV_DRAW_LABEL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_bidi.h"
|
||||
#include "liblvgl/misc/lv_txt.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_DRAW_LABEL_NO_TXT_SEL (0xFFFF)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
const lv_font_t * font;
|
||||
uint32_t sel_start;
|
||||
uint32_t sel_end;
|
||||
lv_color_t color;
|
||||
lv_color_t sel_color;
|
||||
lv_color_t sel_bg_color;
|
||||
lv_coord_t line_space;
|
||||
lv_coord_t letter_space;
|
||||
lv_coord_t ofs_x;
|
||||
lv_coord_t ofs_y;
|
||||
lv_opa_t opa;
|
||||
lv_base_dir_t bidi_dir;
|
||||
lv_text_align_t align;
|
||||
lv_text_flag_t flag;
|
||||
lv_text_decor_t decor : 3;
|
||||
lv_blend_mode_t blend_mode: 3;
|
||||
} lv_draw_label_dsc_t;
|
||||
|
||||
/** Store some info to speed up drawing of very large texts
|
||||
* It takes a lot of time to get the first visible character because
|
||||
* all the previous characters needs to be checked to calculate the positions.
|
||||
* This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
|
||||
* Therefore the calculations can start from here.*/
|
||||
typedef struct _lv_draw_label_hint_t {
|
||||
/** Index of the line at `y` coordinate*/
|
||||
int32_t line_start;
|
||||
|
||||
/** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/
|
||||
int32_t y;
|
||||
|
||||
/** The 'y1' coordinate of the label when the hint was saved.
|
||||
* Used to invalidate the hint if the label has moved too much.*/
|
||||
int32_t coord_y;
|
||||
} lv_draw_label_hint_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Write a text
|
||||
* @param coords coordinates of the label
|
||||
* @param mask the label will be drawn only in this area
|
||||
* @param dsc pointer to draw descriptor
|
||||
* @param txt `\0` terminated text to write
|
||||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the draw to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_area_t * coords, const char * txt, lv_draw_label_hint_t * hint);
|
||||
|
||||
void lv_draw_letter(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter);
|
||||
|
||||
/***********************
|
||||
* GLOBAL VARIABLES
|
||||
***********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LABEL_H*/
|
||||
83
include/liblvgl/draw/lv_draw_layer.h
Normal file
83
include/liblvgl/draw/lv_draw_layer.h
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @file lv_draw_layer.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_LAYER_H
|
||||
#define LV_DRAW_LAYER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct _lv_draw_ctx_t;
|
||||
struct _lv_draw_layer_ctx_t;
|
||||
|
||||
typedef enum {
|
||||
LV_DRAW_LAYER_FLAG_NONE,
|
||||
LV_DRAW_LAYER_FLAG_HAS_ALPHA,
|
||||
LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE,
|
||||
} lv_draw_layer_flags_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a new layer context. It is used to start and independent rendering session
|
||||
* with the current draw_ctx
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_area the coordinates of the layer
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
* @return pointer to the layer context, or NULL on error
|
||||
*/
|
||||
struct _lv_draw_layer_ctx_t * lv_draw_layer_create(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * layer_area,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Adjust the layer_ctx and/or draw_ctx based on the `layer_ctx->area_act`.
|
||||
* It's called only if flags has `LV_DRAW_LAYER_FLAG_CAN_SUBDIVIDE`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param flags OR-ed flags from @lv_draw_layer_flags_t
|
||||
*/
|
||||
void lv_draw_layer_adjust(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
/**
|
||||
* Blend a rendered layer to `layer_ctx->area_act`
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
* @param draw_dsc pointer to an image draw descriptor
|
||||
*/
|
||||
void lv_draw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Destroy a layer context.
|
||||
* @param draw_ctx pointer to the current draw context
|
||||
* @param layer_ctx pointer to a layer context
|
||||
*/
|
||||
void lv_draw_layer_destroy(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LAYER_H*/
|
||||
67
include/liblvgl/draw/lv_draw_line.h
Normal file
67
include/liblvgl/draw/lv_draw_line.h
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @file lv_draw_line.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_LINE_H
|
||||
#define LV_DRAW_LINE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
lv_color_t color;
|
||||
lv_coord_t width;
|
||||
lv_coord_t dash_width;
|
||||
lv_coord_t dash_gap;
|
||||
lv_opa_t opa;
|
||||
lv_blend_mode_t blend_mode : 2;
|
||||
uint8_t round_start : 1;
|
||||
uint8_t round_end : 1;
|
||||
uint8_t raw_end : 1; /*Do not bother with perpendicular line ending if it's not visible for any reason*/
|
||||
} lv_draw_line_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
* @param point1 first point of the line
|
||||
* @param point2 second point of the line
|
||||
* @param clip the line will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_LINE_H*/
|
||||
394
include/liblvgl/draw/lv_draw_mask.h
Normal file
394
include/liblvgl/draw/lv_draw_mask.h
Normal file
@ -0,0 +1,394 @@
|
||||
/**
|
||||
* @file lv_draw_mask.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_MASK_H
|
||||
#define LV_DRAW_MASK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdbool.h>
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_math.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_MASK_ID_INV (-1)
|
||||
#if LV_DRAW_COMPLEX
|
||||
# define _LV_MASK_MAX_NUM 16
|
||||
#else
|
||||
# define _LV_MASK_MAX_NUM 1
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
enum {
|
||||
LV_DRAW_MASK_RES_TRANSP,
|
||||
LV_DRAW_MASK_RES_FULL_COVER,
|
||||
LV_DRAW_MASK_RES_CHANGED,
|
||||
LV_DRAW_MASK_RES_UNKNOWN
|
||||
};
|
||||
|
||||
typedef uint8_t lv_draw_mask_res_t;
|
||||
|
||||
typedef struct {
|
||||
void * param;
|
||||
void * custom_id;
|
||||
} _lv_draw_mask_saved_t;
|
||||
|
||||
typedef _lv_draw_mask_saved_t _lv_draw_mask_saved_arr_t[_LV_MASK_MAX_NUM];
|
||||
|
||||
|
||||
|
||||
#if LV_DRAW_COMPLEX == 0
|
||||
static inline uint8_t lv_draw_mask_get_cnt(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool lv_draw_mask_is_any(const lv_area_t * a)
|
||||
{
|
||||
LV_UNUSED(a);
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
|
||||
enum {
|
||||
LV_DRAW_MASK_TYPE_LINE,
|
||||
LV_DRAW_MASK_TYPE_ANGLE,
|
||||
LV_DRAW_MASK_TYPE_RADIUS,
|
||||
LV_DRAW_MASK_TYPE_FADE,
|
||||
LV_DRAW_MASK_TYPE_MAP,
|
||||
LV_DRAW_MASK_TYPE_POLYGON,
|
||||
};
|
||||
|
||||
typedef uint8_t lv_draw_mask_type_t;
|
||||
|
||||
enum {
|
||||
LV_DRAW_MASK_LINE_SIDE_LEFT = 0,
|
||||
LV_DRAW_MASK_LINE_SIDE_RIGHT,
|
||||
LV_DRAW_MASK_LINE_SIDE_TOP,
|
||||
LV_DRAW_MASK_LINE_SIDE_BOTTOM,
|
||||
};
|
||||
|
||||
/**
|
||||
* A common callback type for every mask type.
|
||||
* Used internally by the library.
|
||||
*/
|
||||
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
void * p);
|
||||
|
||||
typedef uint8_t lv_draw_mask_line_side_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_mask_xcb_t cb;
|
||||
lv_draw_mask_type_t type;
|
||||
} _lv_draw_mask_common_dsc_t;
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
/*First point*/
|
||||
lv_point_t p1;
|
||||
|
||||
/*Second point*/
|
||||
lv_point_t p2;
|
||||
|
||||
/*Which side to keep?*/
|
||||
lv_draw_mask_line_side_t side : 2;
|
||||
} cfg;
|
||||
|
||||
/*A point of the line*/
|
||||
lv_point_t origo;
|
||||
|
||||
/*X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/
|
||||
int32_t xy_steep;
|
||||
|
||||
/*Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/
|
||||
int32_t yx_steep;
|
||||
|
||||
/*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines*/
|
||||
int32_t steep;
|
||||
|
||||
/*Steepness in 1 px in 0..255 range. Used only by flat lines.*/
|
||||
int32_t spx;
|
||||
|
||||
/*1: It's a flat line? (Near to horizontal)*/
|
||||
uint8_t flat : 1;
|
||||
|
||||
/*Invert the mask. The default is: Keep the left part.
|
||||
*It is used to select left/right/top/bottom*/
|
||||
uint8_t inv: 1;
|
||||
} lv_draw_mask_line_param_t;
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
lv_point_t vertex_p;
|
||||
lv_coord_t start_angle;
|
||||
lv_coord_t end_angle;
|
||||
} cfg;
|
||||
|
||||
lv_draw_mask_line_param_t start_line;
|
||||
lv_draw_mask_line_param_t end_line;
|
||||
uint16_t delta_deg;
|
||||
} lv_draw_mask_angle_param_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t * buf;
|
||||
lv_opa_t * cir_opa; /*Opacity of values on the circumference of an 1/4 circle*/
|
||||
uint16_t * x_start_on_y; /*The x coordinate of the circle for each y value*/
|
||||
uint16_t * opa_start_on_y; /*The index of `cir_opa` for each y value*/
|
||||
int32_t life; /*How many times the entry way used*/
|
||||
uint32_t used_cnt; /*Like a semaphore to count the referencing masks*/
|
||||
lv_coord_t radius; /*The radius of the entry*/
|
||||
} _lv_draw_mask_radius_circle_dsc_t;
|
||||
|
||||
typedef _lv_draw_mask_radius_circle_dsc_t _lv_draw_mask_radius_circle_dsc_arr_t[LV_CIRCLE_CACHE_SIZE];
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
lv_area_t rect;
|
||||
lv_coord_t radius;
|
||||
/*Invert the mask. 0: Keep the pixels inside.*/
|
||||
uint8_t outer: 1;
|
||||
} cfg;
|
||||
|
||||
_lv_draw_mask_radius_circle_dsc_t * circle;
|
||||
} lv_draw_mask_radius_param_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
lv_area_t coords;
|
||||
lv_coord_t y_top;
|
||||
lv_coord_t y_bottom;
|
||||
lv_opa_t opa_top;
|
||||
lv_opa_t opa_bottom;
|
||||
} cfg;
|
||||
|
||||
} lv_draw_mask_fade_param_t;
|
||||
|
||||
|
||||
typedef struct _lv_draw_mask_map_param_t {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
lv_area_t coords;
|
||||
const lv_opa_t * map;
|
||||
} cfg;
|
||||
} lv_draw_mask_map_param_t;
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
_lv_draw_mask_common_dsc_t dsc;
|
||||
|
||||
struct {
|
||||
lv_point_t * points;
|
||||
uint16_t point_cnt;
|
||||
} cfg;
|
||||
} lv_draw_mask_polygon_param_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Add a draw mask. Everything drawn after it (until removing the mask) will be affected by the mask.
|
||||
* @param param an initialized mask parameter. Only the pointer is saved.
|
||||
* @param custom_id a custom pointer to identify the mask. Used in `lv_draw_mask_remove_custom`.
|
||||
* @return the an integer, the ID of the mask. Can be used in `lv_draw_mask_remove_id`.
|
||||
*/
|
||||
int16_t lv_draw_mask_add(void * param, void * custom_id);
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Apply the added buffers on a line. Used internally by the library's drawing routines.
|
||||
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
|
||||
* @param abs_x absolute X coordinate where the line to calculate start
|
||||
* @param abs_y absolute Y coordinate where the line to calculate start
|
||||
* @param len length of the line to calculate (in pixel count)
|
||||
* @return One of these values:
|
||||
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len);
|
||||
|
||||
/**
|
||||
* Apply the specified buffers on a line. Used internally by the library's drawing routines.
|
||||
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
|
||||
* @param abs_x absolute X coordinate where the line to calculate start
|
||||
* @param abs_y absolute Y coordinate where the line to calculate start
|
||||
* @param len length of the line to calculate (in pixel count)
|
||||
* @param ids ID array of added buffers
|
||||
* @param ids_count number of ID array
|
||||
* @return One of these values:
|
||||
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len, const int16_t * ids, int16_t ids_count);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Remove a mask with a given ID
|
||||
* @param id the ID of the mask. Returned by `lv_draw_mask_add`
|
||||
* @return the parameter of the removed mask.
|
||||
* If more masks have `custom_id` ID then the last mask's parameter will be returned
|
||||
*/
|
||||
void * lv_draw_mask_remove_id(int16_t id);
|
||||
|
||||
/**
|
||||
* Remove all mask with a given custom ID
|
||||
* @param custom_id a pointer used in `lv_draw_mask_add`
|
||||
* @return return the parameter of the removed mask.
|
||||
* If more masks have `custom_id` ID then the last mask's parameter will be returned
|
||||
*/
|
||||
void * lv_draw_mask_remove_custom(void * custom_id);
|
||||
|
||||
/**
|
||||
* Free the data from the parameter.
|
||||
* It's called inside `lv_draw_mask_remove_id` and `lv_draw_mask_remove_custom`
|
||||
* Needs to be called only in special cases when the mask is not added by `lv_draw_mask_add`
|
||||
* and not removed by `lv_draw_mask_remove_id` or `lv_draw_mask_remove_custom`
|
||||
* @param p pointer to a mask parameter
|
||||
*/
|
||||
void lv_draw_mask_free_param(void * p);
|
||||
|
||||
/**
|
||||
* Called by LVGL the rendering of a screen is ready to clean up
|
||||
* the temporal (cache) data of the masks
|
||||
*/
|
||||
void _lv_draw_mask_cleanup(void);
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Count the currently added masks
|
||||
* @return number of active masks
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void);
|
||||
|
||||
|
||||
/**
|
||||
* Check if there is any added draw mask
|
||||
* @param a an area to test for affecting masks.
|
||||
* @return true: there is t least 1 draw mask; false: there are no draw masks
|
||||
*/
|
||||
bool lv_draw_mask_is_any(const lv_area_t * a);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
*Initialize a line mask from two points.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param p1x X coordinate of the first point of the line
|
||||
* @param p1y Y coordinate of the first point of the line
|
||||
* @param p2x X coordinate of the second point of the line
|
||||
* @param p2y y coordinate of the second point of the line
|
||||
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
|
||||
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
|
||||
* With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept
|
||||
*/
|
||||
void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x,
|
||||
lv_coord_t p2y, lv_draw_mask_line_side_t side);
|
||||
|
||||
/**
|
||||
*Initialize a line mask from a point and an angle.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param px X coordinate of a point of the line
|
||||
* @param py X coordinate of a point of the line
|
||||
* @param angle right 0 deg, bottom: 90
|
||||
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
|
||||
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
|
||||
* With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept
|
||||
*/
|
||||
void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle,
|
||||
lv_draw_mask_line_side_t side);
|
||||
|
||||
/**
|
||||
* Initialize an angle mask.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param vertex_x X coordinate of the angle vertex (absolute coordinates)
|
||||
* @param vertex_y Y coordinate of the angle vertex (absolute coordinates)
|
||||
* @param start_angle start angle in degrees. 0 deg on the right, 90 deg, on the bottom
|
||||
* @param end_angle end angle
|
||||
*/
|
||||
void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vertex_x, lv_coord_t vertex_y,
|
||||
lv_coord_t start_angle, lv_coord_t end_angle);
|
||||
|
||||
/**
|
||||
* Initialize a fade mask.
|
||||
* @param param pointer to an `lv_draw_mask_radius_param_t` to initialize
|
||||
* @param rect coordinates of the rectangle to affect (absolute coordinates)
|
||||
* @param radius radius of the rectangle
|
||||
* @param inv true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
|
||||
*/
|
||||
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);
|
||||
|
||||
/**
|
||||
* Initialize a fade mask.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param coords coordinates of the area to affect (absolute coordinates)
|
||||
* @param opa_top opacity on the top
|
||||
* @param y_top at which coordinate start to change to opacity to `opa_bottom`
|
||||
* @param opa_bottom opacity at the bottom
|
||||
* @param y_bottom at which coordinate reach `opa_bottom`.
|
||||
*/
|
||||
void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top,
|
||||
lv_coord_t y_top,
|
||||
lv_opa_t opa_bottom, lv_coord_t y_bottom);
|
||||
|
||||
/**
|
||||
* Initialize a map mask.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
* @param coords coordinates of the map (absolute coordinates)
|
||||
* @param map array of bytes with the mask values
|
||||
*/
|
||||
void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map);
|
||||
|
||||
void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_point_t * points, uint16_t point_cnt);
|
||||
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_MASK_H*/
|
||||
96
include/liblvgl/draw/lv_draw_rect.h
Normal file
96
include/liblvgl/draw/lv_draw_rect.h
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* @file lv_draw_rect.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_RECT_H
|
||||
#define LV_DRAW_RECT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
#include "sw/lv_draw_sw_gradient.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_RADIUS_CIRCLE 0x7FFF /**< A very big radius to always draw as circle*/
|
||||
LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE);
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t radius;
|
||||
lv_blend_mode_t blend_mode;
|
||||
|
||||
/*Background*/
|
||||
lv_opa_t bg_opa;
|
||||
lv_color_t bg_color; /**< First element of a gradient is a color, so it maps well here*/
|
||||
lv_grad_dsc_t bg_grad;
|
||||
|
||||
/*Background img*/
|
||||
const void * bg_img_src;
|
||||
const void * bg_img_symbol_font;
|
||||
lv_color_t bg_img_recolor;
|
||||
lv_opa_t bg_img_opa;
|
||||
lv_opa_t bg_img_recolor_opa;
|
||||
uint8_t bg_img_tiled;
|
||||
|
||||
/*Border*/
|
||||
lv_color_t border_color;
|
||||
lv_coord_t border_width;
|
||||
lv_opa_t border_opa;
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later.*/
|
||||
lv_border_side_t border_side : 5;
|
||||
|
||||
/*Outline*/
|
||||
lv_color_t outline_color;
|
||||
lv_coord_t outline_width;
|
||||
lv_coord_t outline_pad;
|
||||
lv_opa_t outline_opa;
|
||||
|
||||
/*Shadow*/
|
||||
lv_color_t shadow_color;
|
||||
lv_coord_t shadow_width;
|
||||
lv_coord_t shadow_ofs_x;
|
||||
lv_coord_t shadow_ofs_y;
|
||||
lv_coord_t shadow_spread;
|
||||
lv_opa_t shadow_opa;
|
||||
} lv_draw_rect_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
* @param coords the coordinates of the rectangle
|
||||
* @param clip the rectangle will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_rect(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_RECT_H*/
|
||||
44
include/liblvgl/draw/lv_draw_transform.h
Normal file
44
include/liblvgl/draw/lv_draw_transform.h
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file lv_draw_transform.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_TRANSFORM_H
|
||||
#define LV_DRAW_TRANSFORM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_transform(struct _lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf,
|
||||
lv_coord_t src_w, lv_coord_t src_h,
|
||||
lv_coord_t src_stride, const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_TRANSFORM_H*/
|
||||
42
include/liblvgl/draw/lv_draw_triangle.h
Normal file
42
include/liblvgl/draw/lv_draw_triangle.h
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file lv_draw_triangle.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_TRIANGLE_H
|
||||
#define LV_DRAW_TRIANGLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_rect.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_polygon(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_point_t points[],
|
||||
uint16_t point_cnt);
|
||||
|
||||
void lv_draw_triangle(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc, const lv_point_t points[]);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_TRIANGLE_H*/
|
||||
249
include/liblvgl/draw/lv_img_buf.h
Normal file
249
include/liblvgl/draw/lv_img_buf.h
Normal file
@ -0,0 +1,249 @@
|
||||
/**
|
||||
* @file lv_img_buf.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_IMG_BUF_H
|
||||
#define LV_IMG_BUF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdbool.h>
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*If image pixels contains alpha we need to know how much byte is a pixel*/
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
#define LV_IMG_PX_SIZE_ALPHA_BYTE 2
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
#define LV_IMG_PX_SIZE_ALPHA_BYTE 3
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define LV_IMG_PX_SIZE_ALPHA_BYTE 4
|
||||
#endif
|
||||
|
||||
#define LV_IMG_BUF_SIZE_TRUE_COLOR(w, h) ((LV_COLOR_SIZE / 8) * w * h)
|
||||
#define LV_IMG_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h) ((LV_COLOR_SIZE / 8) * w * h)
|
||||
#define LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(w, h) (LV_IMG_PX_SIZE_ALPHA_BYTE * w * h)
|
||||
|
||||
/*+ 1: to be sure no fractional row*/
|
||||
#define LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) ((((w / 8) + 1) * h))
|
||||
#define LV_IMG_BUF_SIZE_ALPHA_2BIT(w, h) ((((w / 4) + 1) * h))
|
||||
#define LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h) ((((w / 2) + 1) * h))
|
||||
#define LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h) ((w * h))
|
||||
|
||||
/*4 * X: for palette*/
|
||||
#define LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h) + 4 * 2)
|
||||
#define LV_IMG_BUF_SIZE_INDEXED_2BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_2BIT(w, h) + 4 * 4)
|
||||
#define LV_IMG_BUF_SIZE_INDEXED_4BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h) + 4 * 16)
|
||||
#define LV_IMG_BUF_SIZE_INDEXED_8BIT(w, h) (LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h) + 4 * 256)
|
||||
|
||||
#define _LV_ZOOM_INV_UPSCALE 5
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Image color format*/
|
||||
enum {
|
||||
LV_IMG_CF_UNKNOWN = 0,
|
||||
|
||||
LV_IMG_CF_RAW, /**< Contains the file as it is. Needs custom decoder function*/
|
||||
LV_IMG_CF_RAW_ALPHA, /**< Contains the file as it is. The image has alpha. Needs custom decoder
|
||||
function*/
|
||||
LV_IMG_CF_RAW_CHROMA_KEYED, /**< Contains the file as it is. The image is chroma keyed. Needs
|
||||
custom decoder function*/
|
||||
|
||||
LV_IMG_CF_TRUE_COLOR, /**< Color format and depth should match with LV_COLOR settings*/
|
||||
LV_IMG_CF_TRUE_COLOR_ALPHA, /**< Same as `LV_IMG_CF_TRUE_COLOR` but every pixel has an alpha byte*/
|
||||
LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED, /**< Same as `LV_IMG_CF_TRUE_COLOR` but LV_COLOR_TRANSP pixels
|
||||
will be transparent*/
|
||||
|
||||
LV_IMG_CF_INDEXED_1BIT, /**< Can have 2 different colors in a palette (can't be chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_2BIT, /**< Can have 4 different colors in a palette (can't be chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_4BIT, /**< Can have 16 different colors in a palette (can't be chroma keyed)*/
|
||||
LV_IMG_CF_INDEXED_8BIT, /**< Can have 256 different colors in a palette (can't be chroma keyed)*/
|
||||
|
||||
LV_IMG_CF_ALPHA_1BIT, /**< Can have one color and it can be drawn or not*/
|
||||
LV_IMG_CF_ALPHA_2BIT, /**< Can have one color but 4 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_4BIT, /**< Can have one color but 16 different alpha value*/
|
||||
LV_IMG_CF_ALPHA_8BIT, /**< Can have one color but 256 different alpha value*/
|
||||
|
||||
LV_IMG_CF_RGB888,
|
||||
LV_IMG_CF_RGBA8888,
|
||||
LV_IMG_CF_RGBX8888,
|
||||
LV_IMG_CF_RGB565,
|
||||
LV_IMG_CF_RGBA5658,
|
||||
LV_IMG_CF_RGB565A8,
|
||||
|
||||
LV_IMG_CF_RESERVED_15, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_16, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_17, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_18, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_19, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_20, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_21, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_22, /**< Reserved for further use.*/
|
||||
LV_IMG_CF_RESERVED_23, /**< Reserved for further use.*/
|
||||
|
||||
LV_IMG_CF_USER_ENCODED_0, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_1, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_2, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_3, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_4, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_5, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_6, /**< User holder encoding format.*/
|
||||
LV_IMG_CF_USER_ENCODED_7, /**< User holder encoding format.*/
|
||||
};
|
||||
typedef uint8_t lv_img_cf_t;
|
||||
|
||||
|
||||
/**
|
||||
* The first 8 bit is very important to distinguish the different source types.
|
||||
* For more info see `lv_img_get_src_type()` in lv_img.c
|
||||
* On big endian systems the order is reversed so cf and always_zero must be at
|
||||
* the end of the struct.
|
||||
*/
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
typedef struct {
|
||||
|
||||
uint32_t h : 11; /*Height of the image map*/
|
||||
uint32_t w : 11; /*Width of the image map*/
|
||||
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
non-printable character*/
|
||||
uint32_t cf : 5; /*Color format: See `lv_img_color_format_t`*/
|
||||
|
||||
} lv_img_header_t;
|
||||
#else
|
||||
typedef struct {
|
||||
|
||||
uint32_t cf : 5; /*Color format: See `lv_img_color_format_t`*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
non-printable character*/
|
||||
|
||||
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||
|
||||
uint32_t w : 11; /*Width of the image map*/
|
||||
uint32_t h : 11; /*Height of the image map*/
|
||||
} lv_img_header_t;
|
||||
#endif
|
||||
|
||||
/** Image header it is compatible with
|
||||
* the result from image converter utility*/
|
||||
typedef struct {
|
||||
lv_img_header_t header; /**< A header describing the basics of the image*/
|
||||
uint32_t data_size; /**< Size of the image in bytes*/
|
||||
const uint8_t * data; /**< Pointer to the data of the image*/
|
||||
} lv_img_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Allocate an image buffer in RAM
|
||||
* @param w width of image
|
||||
* @param h height of image
|
||||
* @param cf a color format (`LV_IMG_CF_...`)
|
||||
* @return an allocated image, or NULL on failure
|
||||
*/
|
||||
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* Get the color of an image's pixel
|
||||
* @param dsc an image descriptor
|
||||
* @param x x coordinate of the point to get
|
||||
* @param y x coordinate of the point to get
|
||||
* @param color the color of the image. In case of `LV_IMG_CF_ALPHA_1/2/4/8` this color is used.
|
||||
* Not used in other cases.
|
||||
* @param safe true: check out of bounds
|
||||
* @return color of the point
|
||||
*/
|
||||
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Get the alpha value of an image's pixel
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param x x coordinate of the point to set
|
||||
* @param y x coordinate of the point to set
|
||||
* @param safe true: check out of bounds
|
||||
* @return alpha value of the point
|
||||
*/
|
||||
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the color of a pixel of an image. The alpha channel won't be affected.
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param x x coordinate of the point to set
|
||||
* @param y x coordinate of the point to set
|
||||
* @param c color of the point
|
||||
* @param safe true: check out of bounds
|
||||
*/
|
||||
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
|
||||
|
||||
/**
|
||||
* Set the alpha value of a pixel of an image. The color won't be affected
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param x x coordinate of the point to set
|
||||
* @param y x coordinate of the point to set
|
||||
* @param opa the desired opacity
|
||||
* @param safe true: check out of bounds
|
||||
*/
|
||||
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param id the palette color to set:
|
||||
* - for `LV_IMG_CF_INDEXED1`: 0..1
|
||||
* - for `LV_IMG_CF_INDEXED2`: 0..3
|
||||
* - for `LV_IMG_CF_INDEXED4`: 0..15
|
||||
* - for `LV_IMG_CF_INDEXED8`: 0..255
|
||||
* @param c the color to set
|
||||
*/
|
||||
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
|
||||
|
||||
/**
|
||||
* Free an allocated image buffer
|
||||
* @param dsc image buffer to free
|
||||
*/
|
||||
void lv_img_buf_free(lv_img_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Get the memory consumption of a raw bitmap, given color format and dimensions.
|
||||
* @param w width
|
||||
* @param h height
|
||||
* @param cf color format
|
||||
* @return size in bytes
|
||||
*/
|
||||
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* Get the area of a rectangle if its rotated and scaled
|
||||
* @param res store the coordinates here
|
||||
* @param w width of the rectangle to transform
|
||||
* @param h height of the rectangle to transform
|
||||
* @param angle angle of rotation
|
||||
* @param zoom zoom, (256 no zoom)
|
||||
* @param pivot x,y pivot coordinates of rotation
|
||||
*/
|
||||
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
|
||||
const lv_point_t * pivot);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_BUF_H*/
|
||||
78
include/liblvgl/draw/lv_img_cache.h
Normal file
78
include/liblvgl/draw/lv_img_cache.h
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file lv_img_cache.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_IMG_CACHE_H
|
||||
#define LV_IMG_CACHE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_img_decoder.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* When loading images from the network it can take a long time to download and decode the image.
|
||||
*
|
||||
* To avoid repeating this heavy load images can be cached.
|
||||
*/
|
||||
typedef struct {
|
||||
lv_img_decoder_dsc_t dec_dsc; /**< Image information*/
|
||||
|
||||
/** Count the cache entries's life. Add `time_to_open` to `life` when the entry is used.
|
||||
* Decrement all lifes by one every in every ::lv_img_cache_open.
|
||||
* If life == 0 the entry can be reused*/
|
||||
int32_t life;
|
||||
} _lv_img_cache_entry_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Open an image using the image decoder interface and cache it.
|
||||
* The image will be left open meaning if the image decoder open callback allocated memory then it will remain.
|
||||
* The image is closed if a new image is opened and the new image takes its place in the cache.
|
||||
* @param src source of the image. Path to file or pointer to an `lv_img_dsc_t` variable
|
||||
* @param color The color of the image with `LV_IMG_CF_ALPHA_...`
|
||||
* @param frame_id the index of the frame. Used only with animated images, set 0 for normal images
|
||||
* @return pointer to the cache entry or NULL if can open the image
|
||||
*/
|
||||
_lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color, int32_t frame_id);
|
||||
|
||||
/**
|
||||
* Set the number of images to be cached.
|
||||
* More cached images mean more opened image at same time which might mean more memory usage.
|
||||
* E.g. if 20 PNG or JPG images are open in the RAM they consume memory while opened in the cache.
|
||||
* @param new_entry_cnt number of image to cache
|
||||
*/
|
||||
void lv_img_cache_set_size(uint16_t new_slot_num);
|
||||
|
||||
/**
|
||||
* Invalidate an image source in the cache.
|
||||
* Useful if the image source is updated therefore it needs to be cached again.
|
||||
* @param src an image source path to a file or pointer to an `lv_img_dsc_t` variable.
|
||||
*/
|
||||
void lv_img_cache_invalidate_src(const void * src);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_CACHE_H*/
|
||||
274
include/liblvgl/draw/lv_img_decoder.h
Normal file
274
include/liblvgl/draw/lv_img_decoder.h
Normal file
@ -0,0 +1,274 @@
|
||||
/**
|
||||
* @file lv_img_decoder.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_IMG_DECODER_H
|
||||
#define LV_IMG_DECODER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lv_img_buf.h"
|
||||
#include "liblvgl/misc/lv_fs.h"
|
||||
#include "liblvgl/misc/lv_types.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Source of image.*/
|
||||
enum {
|
||||
LV_IMG_SRC_VARIABLE, /** Binary/C variable*/
|
||||
LV_IMG_SRC_FILE, /** File in filesystem*/
|
||||
LV_IMG_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/
|
||||
LV_IMG_SRC_UNKNOWN, /** Unknown source*/
|
||||
};
|
||||
|
||||
typedef uint8_t lv_img_src_t;
|
||||
|
||||
/*Decoder function definitions*/
|
||||
struct _lv_img_decoder_dsc_t;
|
||||
struct _lv_img_decoder_t;
|
||||
|
||||
/**
|
||||
* Get info from an image and store in the `header`
|
||||
* @param src the image source. Can be a pointer to a C array or a file name (Use
|
||||
* `lv_img_src_get_type` to determine the type)
|
||||
* @param header store the info here
|
||||
* @return LV_RES_OK: info written correctly; LV_RES_INV: failed
|
||||
*/
|
||||
typedef lv_res_t (*lv_img_decoder_info_f_t)(struct _lv_img_decoder_t * decoder, const void * src,
|
||||
lv_img_header_t * header);
|
||||
|
||||
/**
|
||||
* Open an image for decoding. Prepare it as it is required to read it later
|
||||
* @param decoder pointer to the decoder the function associated with
|
||||
* @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it.
|
||||
*/
|
||||
typedef lv_res_t (*lv_img_decoder_open_f_t)(struct _lv_img_decoder_t * decoder, struct _lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
|
||||
* Required only if the "open" function can't return with the whole decoded pixel array.
|
||||
* @param decoder pointer to the decoder the function associated with
|
||||
* @param dsc pointer to decoder descriptor
|
||||
* @param x start x coordinate
|
||||
* @param y start y coordinate
|
||||
* @param len number of pixels to decode
|
||||
* @param buf a buffer to store the decoded pixels
|
||||
* @return LV_RES_OK: ok; LV_RES_INV: failed
|
||||
*/
|
||||
typedef lv_res_t (*lv_img_decoder_read_line_f_t)(struct _lv_img_decoder_t * decoder, struct _lv_img_decoder_dsc_t * dsc,
|
||||
lv_coord_t x, lv_coord_t y, lv_coord_t len, uint8_t * buf);
|
||||
|
||||
/**
|
||||
* Close the pending decoding. Free resources etc.
|
||||
* @param decoder pointer to the decoder the function associated with
|
||||
* @param dsc pointer to decoder descriptor
|
||||
*/
|
||||
typedef void (*lv_img_decoder_close_f_t)(struct _lv_img_decoder_t * decoder, struct _lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
|
||||
typedef struct _lv_img_decoder_t {
|
||||
lv_img_decoder_info_f_t info_cb;
|
||||
lv_img_decoder_open_f_t open_cb;
|
||||
lv_img_decoder_read_line_f_t read_line_cb;
|
||||
lv_img_decoder_close_f_t close_cb;
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
} lv_img_decoder_t;
|
||||
|
||||
|
||||
/**Describe an image decoding session. Stores data about the decoding*/
|
||||
typedef struct _lv_img_decoder_dsc_t {
|
||||
/**The decoder which was able to open the image source*/
|
||||
lv_img_decoder_t * decoder;
|
||||
|
||||
/**The image source. A file path like "S:my_img.png" or pointer to an `lv_img_dsc_t` variable*/
|
||||
const void * src;
|
||||
|
||||
/**Color to draw the image. USed when the image has alpha channel only*/
|
||||
lv_color_t color;
|
||||
|
||||
/**Frame of the image, using with animated images*/
|
||||
int32_t frame_id;
|
||||
|
||||
/**Type of the source: file or variable. Can be set in `open` function if required*/
|
||||
lv_img_src_t src_type;
|
||||
|
||||
/**Info about the opened image: color format, size, etc. MUST be set in `open` function*/
|
||||
lv_img_header_t header;
|
||||
|
||||
/** Pointer to a buffer where the image's data (pixels) are stored in a decoded, plain format.
|
||||
* MUST be set in `open` function*/
|
||||
const uint8_t * img_data;
|
||||
|
||||
/** How much time did it take to open the image. [ms]
|
||||
* If not set `lv_img_cache` will measure and set the time to open*/
|
||||
uint32_t time_to_open;
|
||||
|
||||
/**A text to display instead of the image when the image can't be opened.
|
||||
* Can be set in `open` function or set NULL.*/
|
||||
const char * error_msg;
|
||||
|
||||
/**Store any custom data here is required*/
|
||||
void * user_data;
|
||||
} lv_img_decoder_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the image decoder module
|
||||
*/
|
||||
void _lv_img_decoder_init(void);
|
||||
|
||||
/**
|
||||
* Get information about an image.
|
||||
* Try the created image decoder one by one. Once one is able to get info that info will be used.
|
||||
* @param src the image source. Can be
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register()`)
|
||||
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
|
||||
* 3) Symbol: E.g. `LV_SYMBOL_OK`
|
||||
* @param header the image info will be stored here
|
||||
* @return LV_RES_OK: success; LV_RES_INV: wasn't able to get info about the image
|
||||
*/
|
||||
lv_res_t lv_img_decoder_get_info(const void * src, lv_img_header_t * header);
|
||||
|
||||
/**
|
||||
* Open an image.
|
||||
* Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc`
|
||||
* @param dsc describes a decoding session. Simply a pointer to an `lv_img_decoder_dsc_t` variable.
|
||||
* @param src the image source. Can be
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`)
|
||||
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
|
||||
* 3) Symbol: E.g. `LV_SYMBOL_OK`
|
||||
* @param color The color of the image with `LV_IMG_CF_ALPHA_...`
|
||||
* @param frame_id the index of the frame. Used only with animated images, set 0 for normal images
|
||||
* @return LV_RES_OK: opened the image. `dsc->img_data` and `dsc->header` are set.
|
||||
* LV_RES_INV: none of the registered image decoders were able to open the image.
|
||||
*/
|
||||
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_color_t color, int32_t frame_id);
|
||||
|
||||
/**
|
||||
* Read a line from an opened image
|
||||
* @param dsc pointer to `lv_img_decoder_dsc_t` used in `lv_img_decoder_open`
|
||||
* @param x start X coordinate (from left)
|
||||
* @param y start Y coordinate (from top)
|
||||
* @param len number of pixels to read
|
||||
* @param buf store the data here
|
||||
* @return LV_RES_OK: success; LV_RES_INV: an error occurred
|
||||
*/
|
||||
lv_res_t lv_img_decoder_read_line(lv_img_decoder_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_coord_t len,
|
||||
uint8_t * buf);
|
||||
|
||||
/**
|
||||
* Close a decoding session
|
||||
* @param dsc pointer to `lv_img_decoder_dsc_t` used in `lv_img_decoder_open`
|
||||
*/
|
||||
void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Create a new image decoder
|
||||
* @return pointer to the new image decoder
|
||||
*/
|
||||
lv_img_decoder_t * lv_img_decoder_create(void);
|
||||
|
||||
/**
|
||||
* Delete an image decoder
|
||||
* @param decoder pointer to an image decoder
|
||||
*/
|
||||
void lv_img_decoder_delete(lv_img_decoder_t * decoder);
|
||||
|
||||
/**
|
||||
* Set a callback to get information about the image
|
||||
* @param decoder pointer to an image decoder
|
||||
* @param info_cb a function to collect info about an image (fill an `lv_img_header_t` struct)
|
||||
*/
|
||||
void lv_img_decoder_set_info_cb(lv_img_decoder_t * decoder, lv_img_decoder_info_f_t info_cb);
|
||||
|
||||
/**
|
||||
* Set a callback to open an image
|
||||
* @param decoder pointer to an image decoder
|
||||
* @param open_cb a function to open an image
|
||||
*/
|
||||
void lv_img_decoder_set_open_cb(lv_img_decoder_t * decoder, lv_img_decoder_open_f_t open_cb);
|
||||
|
||||
/**
|
||||
* Set a callback to a decoded line of an image
|
||||
* @param decoder pointer to an image decoder
|
||||
* @param read_line_cb a function to read a line of an image
|
||||
*/
|
||||
void lv_img_decoder_set_read_line_cb(lv_img_decoder_t * decoder, lv_img_decoder_read_line_f_t read_line_cb);
|
||||
|
||||
/**
|
||||
* Set a callback to close a decoding session. E.g. close files and free other resources.
|
||||
* @param decoder pointer to an image decoder
|
||||
* @param close_cb a function to close a decoding session
|
||||
*/
|
||||
void lv_img_decoder_set_close_cb(lv_img_decoder_t * decoder, lv_img_decoder_close_f_t close_cb);
|
||||
|
||||
/**
|
||||
* Get info about a built-in image
|
||||
* @param decoder the decoder where this function belongs
|
||||
* @param src the image source: pointer to an `lv_img_dsc_t` variable, a file path or a symbol
|
||||
* @param header store the image data here
|
||||
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error.
|
||||
*/
|
||||
lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * src, lv_img_header_t * header);
|
||||
|
||||
/**
|
||||
* Open a built in image
|
||||
* @param decoder the decoder where this function belongs
|
||||
* @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it.
|
||||
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error.
|
||||
*/
|
||||
lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
|
||||
* Required only if the "open" function can't return with the whole decoded pixel array.
|
||||
* @param decoder pointer to the decoder the function associated with
|
||||
* @param dsc pointer to decoder descriptor
|
||||
* @param x start x coordinate
|
||||
* @param y start y coordinate
|
||||
* @param len number of pixels to decode
|
||||
* @param buf a buffer to store the decoded pixels
|
||||
* @return LV_RES_OK: ok; LV_RES_INV: failed
|
||||
*/
|
||||
lv_res_t lv_img_decoder_built_in_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc, lv_coord_t x,
|
||||
lv_coord_t y, lv_coord_t len, uint8_t * buf);
|
||||
|
||||
/**
|
||||
* Close the pending decoding. Free resources etc.
|
||||
* @param decoder pointer to the decoder the function associated with
|
||||
* @param dsc pointer to decoder descriptor
|
||||
*/
|
||||
void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_IMG_DECODER_H*/
|
||||
71
include/liblvgl/draw/nxp/lv_gpu_nxp.h
Normal file
71
include/liblvgl/draw/nxp/lv_gpu_nxp.h
Normal file
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_H
|
||||
#define LV_GPU_NXP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#if LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE
|
||||
#include "../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_nxp_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_nxp_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_nxp_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_GPU_NXP_PXP || LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_H*/
|
||||
143
include/liblvgl/draw/nxp/pxp/lv_draw_pxp_blend.h
Normal file
143
include/liblvgl/draw/nxp/pxp/lv_draw_pxp_blend.h
Normal file
@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @file lv_draw_pxp_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_PXP_BLEND_H
|
||||
#define LV_DRAW_PXP_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by PXP*/
|
||||
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by PXP during buffer sync */
|
||||
#define LV_GPU_NXP_PXP_BUFF_SYNC_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with 100% opacity*/
|
||||
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with transparency*/
|
||||
#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] fill_area area to fill
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_stride, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects.
|
||||
* By default, image is copied directly, with optional opacity. This function can also
|
||||
* rotate the display output buffer to a specified angle (90x step).
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] opa opacity of the result
|
||||
* @param[in] angle display rotation angle (90x)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_opa_t opa, lv_disp_rot_t angle);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation.
|
||||
*
|
||||
*
|
||||
* @param[in/out] dest_buf destination buffer
|
||||
* @param[in] dest_area destination area
|
||||
* @param[in] dest_stride width (stride) of destination buffer in pixels
|
||||
* @param[in] src_buf source buffer
|
||||
* @param[in] src_area source area with absolute coordinates to draw on destination buffer
|
||||
* @param[in] dsc image descriptor
|
||||
* @param[in] cf color format
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_PXP_BLEND_H*/
|
||||
153
include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp.h
Normal file
153
include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp.h
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_pxp.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_H
|
||||
#define LV_GPU_NXP_PXP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "fsl_cache.h"
|
||||
#include "fsl_pxp.h"
|
||||
|
||||
#include "../../../misc/lv_log.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** PXP module instance to use*/
|
||||
#define LV_GPU_NXP_PXP_ID PXP
|
||||
|
||||
/** PXP interrupt line ID*/
|
||||
#define LV_GPU_NXP_PXP_IRQ_ID PXP_IRQn
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_LOG_ERRORS
|
||||
/** Enable logging of PXP errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_PXP_LOG_ERRORS 1
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_LOG_TRACES
|
||||
/** Enable logging of PXP errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_PXP_LOG_TRACES 0
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* NXP PXP device configuration - call-backs used for
|
||||
* interrupt init/wait/deinit.
|
||||
*/
|
||||
typedef struct {
|
||||
/** Callback for PXP interrupt initialization*/
|
||||
lv_res_t (*pxp_interrupt_init)(void);
|
||||
|
||||
/** Callback for PXP interrupt de-initialization*/
|
||||
void (*pxp_interrupt_deinit)(void);
|
||||
|
||||
/** Callback that should start PXP and wait for operation complete*/
|
||||
void (*pxp_run)(void);
|
||||
} lv_nxp_pxp_cfg_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Reset and initialize PXP device. This function should be called as a part
|
||||
* of display init sequence.
|
||||
*
|
||||
* @retval LV_RES_OK PXP init completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_PXP_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_init(void);
|
||||
|
||||
/**
|
||||
* Disable PXP device. Should be called during display deinit sequence.
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_deinit(void);
|
||||
|
||||
/**
|
||||
* Start PXP job and wait for completion.
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_run(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define PXP_COND_STOP(cond, txt) \
|
||||
do { \
|
||||
if (cond) { \
|
||||
LV_LOG_ERROR("%s. STOP!", txt); \
|
||||
for ( ; ; ); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#if LV_GPU_NXP_PXP_LOG_ERRORS
|
||||
#define PXP_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
return LV_RES_INV; \
|
||||
} while (0)
|
||||
#else
|
||||
#define PXP_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
return LV_RES_INV; \
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_PXP_LOG_ERRORS*/
|
||||
|
||||
#if LV_GPU_NXP_PXP_LOG_TRACES
|
||||
#define PXP_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define PXP_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
#endif /*LV_GPU_NXP_PXP_LOG_TRACES*/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_PXP_H*/
|
||||
78
include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp_osa.h
Normal file
78
include/liblvgl/draw/nxp/pxp/lv_gpu_nxp_pxp_osa.h
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_pxp_osa.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_PXP_OSA_H
|
||||
#define LV_GPU_NXP_PXP_OSA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
#include "lv_gpu_nxp_pxp.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* PXP device interrupt handler. Used to check PXP task completion status.
|
||||
*/
|
||||
void PXP_IRQHandler(void);
|
||||
|
||||
/**
|
||||
* Helper function to get the PXP default configuration.
|
||||
*/
|
||||
lv_nxp_pxp_cfg_t * lv_gpu_nxp_pxp_get_cfg(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_PXP_OSA_H*/
|
||||
79
include/liblvgl/draw/nxp/vglite/lv_draw_vglite_arc.h
Normal file
79
include/liblvgl/draw/nxp/vglite/lv_draw_vglite_arc.h
Normal file
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_arc.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_ARC_H
|
||||
#define LV_DRAW_VGLITE_ARC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/***
|
||||
* Draw arc shape with effects
|
||||
* @param draw_ctx drawing context
|
||||
* @param dsc the arc description structure (width, rounded ending, opacity)
|
||||
* @param center the coordinates of the arc center
|
||||
* @param radius the radius of external arc
|
||||
* @param start_angle the starting angle in degrees
|
||||
* @param end_angle the ending angle in degrees
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center,
|
||||
int32_t radius, int32_t start_angle, int32_t end_angle);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_ARC_H*/
|
||||
149
include/liblvgl/draw/nxp/vglite/lv_draw_vglite_blend.h
Normal file
149
include/liblvgl/draw/nxp/vglite/lv_draw_vglite_blend.h
Normal file
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_BLEND_H
|
||||
#define LV_DRAW_VGLITE_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by VG-Lite with 100% opacity*/
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by VG-Lite with transparency*/
|
||||
#define LV_GPU_NXP_VG_LITE_FILL_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by VG-Lite*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT
|
||||
/** Minimum invalidated area (in pixels) to be synchronized by VG-Lite during buffer sync */
|
||||
#define LV_GPU_NXP_VG_LITE_BUFF_SYNC_BLIT_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by VG-Lite*/
|
||||
#define LV_GPU_NXP_VG_LITE_BLIT_OPA_SIZE_LIMIT 5000
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* BLock Image Transfer descriptor structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
const lv_color_t * src; /**< Source buffer pointer (must be aligned on 32 bytes)*/
|
||||
lv_area_t src_area; /**< Area to be copied from source*/
|
||||
lv_coord_t src_width; /**< Source buffer width*/
|
||||
lv_coord_t src_height; /**< Source buffer height*/
|
||||
int32_t src_stride; /**< Source buffer stride in bytes (must be aligned on 16 px)*/
|
||||
|
||||
const lv_color_t * dst; /**< Destination buffer pointer (must be aligned on 32 bytes)*/
|
||||
lv_area_t dst_area; /**< Target area in destination buffer (must be the same as src_area)*/
|
||||
lv_coord_t dst_width; /**< Destination buffer width*/
|
||||
lv_coord_t dst_height; /**< Destination buffer height*/
|
||||
int32_t dst_stride; /**< Destination buffer stride in bytes (must be aligned on 16 px)*/
|
||||
|
||||
lv_opa_t opa; /**< Opacity - alpha mix (0 = source not copied, 255 = 100% opaque)*/
|
||||
uint32_t angle; /**< Rotation angle (1/10 of degree)*/
|
||||
uint32_t zoom; /**< 256 = no zoom (1:1 scale ratio)*/
|
||||
lv_point_t pivot; /**< The coordinates of rotation pivot in source image buffer*/
|
||||
} lv_gpu_nxp_vglite_blit_info_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fill area, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf Destination buffer pointer (must be aligned on 32 bytes)
|
||||
* @param[in] dest_width Destination buffer width in pixels (must be aligned on 16 px)
|
||||
* @param[in] dest_height Destination buffer height in pixels
|
||||
* @param[in] fill_area Area to be filled
|
||||
* @param[in] color Fill color
|
||||
* @param[in] opa Opacity (255 = full, 128 = 50% background/50% color, 0 = no fill)
|
||||
* @retval LV_RES_OK Fill completed
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer with transformation.
|
||||
*
|
||||
* @param[in] blit Description of the transfer
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_gpu_nxp_vglite_blit_info_t * blit);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_BLEND_H*/
|
||||
77
include/liblvgl/draw/nxp/vglite/lv_draw_vglite_rect.h
Normal file
77
include/liblvgl/draw/nxp/vglite/lv_draw_vglite_rect.h
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @file lv_draw_vglite_rect.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2021, 2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_VGLITE_RECT_H
|
||||
#define LV_DRAW_VGLITE_RECT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_gpu_nxp_vglite.h"
|
||||
#include "../../lv_draw_rect.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Draw rectangle shape with effects (rounded corners, gradient)
|
||||
*
|
||||
* @param draw_ctx drawing context
|
||||
* @param dsc description of the rectangle
|
||||
* @param coords the area where rectangle is clipped
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_VGLITE_RECT_H*/
|
||||
185
include/liblvgl/draw/nxp/vglite/lv_gpu_nxp_vglite.h
Normal file
185
include/liblvgl/draw/nxp/vglite/lv_gpu_nxp_vglite.h
Normal file
@ -0,0 +1,185 @@
|
||||
/**
|
||||
* @file lv_gpu_nxp_vglite.h
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* MIT License
|
||||
*
|
||||
* Copyright 2020-2022 NXP
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next paragraph)
|
||||
* shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_NXP_VGLITE_H
|
||||
#define LV_GPU_NXP_VGLITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "vg_lite.h"
|
||||
#include "../../sw/lv_draw_sw.h"
|
||||
#include "../../../misc/lv_log.h"
|
||||
#include "fsl_debug_console.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/** Use this symbol as limit to disable feature (value has to be larger than supported resolution) */
|
||||
#define LV_GPU_NXP_VG_LITE_FEATURE_DISABLED (1920*1080+1)
|
||||
|
||||
/** Stride in px required by VG-Lite HW. Don't change this. */
|
||||
#define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16U
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_VG_LITE_LOG_ERRORS 1
|
||||
#endif
|
||||
|
||||
#ifndef LV_GPU_NXP_VG_LITE_LOG_TRACES
|
||||
/** Enable logging of VG-Lite errors (\see LV_LOG_ERROR)*/
|
||||
#define LV_GPU_NXP_VG_LITE_LOG_TRACES 0
|
||||
#endif
|
||||
|
||||
/* Draw rectangles around BLIT tiles */
|
||||
#define BLIT_DBG_AREAS 0
|
||||
|
||||
/* Print detailed info to SDK console (NOT to LVGL log system) */
|
||||
#define BLIT_DBG_VERBOSE 0
|
||||
|
||||
/* Verbose debug print */
|
||||
#if BLIT_DBG_VERBOSE
|
||||
#define PRINT_BLT PRINTF
|
||||
#else
|
||||
#define PRINT_BLT(...)
|
||||
#endif
|
||||
|
||||
/* The optimal Bezier control point offset for radial unit
|
||||
* see: https://spencermortensen.com/articles/bezier-circle/
|
||||
**/
|
||||
#define BEZIER_OPTIM_CIRCLE 0.551915024494f
|
||||
|
||||
/* Draw lines for control points of Bezier curves */
|
||||
#define BEZIER_DBG_CONTROL_POINTS 0
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Fills vg_lite_buffer_t structure according given parameters.
|
||||
*
|
||||
* @param[in/out] vgbuf Buffer structure to be filled
|
||||
* @param[in] width Width of buffer in pixels
|
||||
* @param[in] height Height of buffer in pixels
|
||||
* @param[in] stride Stride of the buffer in bytes
|
||||
* @param[in] ptr Pointer to the buffer (must be aligned according VG-Lite requirements)
|
||||
* @param[in] source Boolean to check if this is a source buffer
|
||||
*/
|
||||
lv_res_t lv_vglite_init_buf(vg_lite_buffer_t * vgbuf, uint32_t width, uint32_t height, uint32_t stride,
|
||||
const lv_color_t * ptr, bool source);
|
||||
|
||||
#if BLIT_DBG_AREAS
|
||||
/**
|
||||
* Draw a simple rectangle, 1 px line width.
|
||||
*
|
||||
* @param dest_buf Destination buffer
|
||||
* @param dest_width Destination buffer width (must be aligned on 16px)
|
||||
* @param dest_height Destination buffer height
|
||||
* @param fill_area Rectangle coordinates
|
||||
* @param color Rectangle color
|
||||
*/
|
||||
void lv_vglite_dbg_draw_rectangle(lv_color_t * dest_buf, lv_coord_t dest_width, lv_coord_t dest_height,
|
||||
lv_area_t * fill_area, lv_color_t color);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clean & invalidate cache.
|
||||
*/
|
||||
void lv_vglite_invalidate_cache(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define VG_LITE_COND_STOP(cond, txt) \
|
||||
do { \
|
||||
if (cond) { \
|
||||
LV_LOG_ERROR("%s. STOP!", txt); \
|
||||
for ( ; ; ); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
#define VG_LITE_ERR_RETURN_INV(err, fmt, ...) \
|
||||
do { \
|
||||
if(err != VG_LITE_SUCCESS) { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
return LV_RES_INV; \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define VG_LITE_ERR_RETURN_INV(err, fmt, ...) \
|
||||
do { \
|
||||
if(err != VG_LITE_SUCCESS) { \
|
||||
return LV_RES_INV; \
|
||||
} \
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_VG_LITE_LOG_ERRORS*/
|
||||
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_TRACES
|
||||
#define VG_LITE_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define VG_LITE_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
return LV_RES_INV; \
|
||||
} while (0)
|
||||
#else
|
||||
#define VG_LITE_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
} while (0)
|
||||
#define VG_LITE_RETURN_INV(fmt, ...) \
|
||||
do { \
|
||||
return LV_RES_INV; \
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_VG_LITE_LOG_TRACES*/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_NXP_VGLITE_H*/
|
||||
96
include/liblvgl/draw/sdl/lv_draw_sdl.h
Normal file
96
include/liblvgl/draw/sdl/lv_draw_sdl.h
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* @file lv_draw_sdl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_H
|
||||
#define LV_DRAW_SDL_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
#include "../../core/lv_disp.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define LV_DRAW_SDL_TEXTURE_FORMAT SDL_PIXELFORMAT_ARGB8888
|
||||
#else
|
||||
#define LV_DRAW_SDL_TEXTURE_FORMAT SDL_PIXELFORMAT_RGBA8888
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct lv_draw_sdl_context_internals_t;
|
||||
|
||||
typedef struct {
|
||||
/**
|
||||
* Render for display driver
|
||||
*/
|
||||
SDL_Renderer * renderer;
|
||||
void * user_data;
|
||||
} lv_draw_sdl_drv_param_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_ctx_t base_draw;
|
||||
SDL_Renderer * renderer;
|
||||
struct lv_draw_sdl_context_internals_t * internals;
|
||||
} lv_draw_sdl_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_init_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**
|
||||
* @brief Free caches
|
||||
*
|
||||
*/
|
||||
void lv_draw_sdl_deinit_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_create_screen_texture(SDL_Renderer * renderer, lv_coord_t hor, lv_coord_t ver);
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_H*/
|
||||
73
include/liblvgl/draw/sdl/lv_draw_sdl_composite.h
Normal file
73
include/liblvgl/draw/sdl/lv_draw_sdl_composite.h
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_composite.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_COMPOSITE_H
|
||||
#define LV_DRAW_SDL_COMPOSITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum lv_draw_sdl_composite_texture_id_t {
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET1,
|
||||
LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0,
|
||||
} lv_draw_sdl_composite_texture_id_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Begin drawing with mask. Render target will be switched to a temporary texture,
|
||||
* and drawing coordinates may get clipped or translated
|
||||
* @param coords_in Original coordinates
|
||||
* @param clip_in Original clip area
|
||||
* @param extension Useful for shadows or outlines, can be NULL
|
||||
* @param coords_out Translated coords
|
||||
* @param clip_out Translated clip area
|
||||
* @param apply_area Area of actual composited texture will be drawn
|
||||
* @return true if there are any mask needs to be drawn, false otherwise
|
||||
*/
|
||||
bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords_in, const lv_area_t * clip_in,
|
||||
const lv_area_t * extension, lv_blend_mode_t blend_mode, lv_area_t * coords_out,
|
||||
lv_area_t * clip_out, lv_area_t * apply_area);
|
||||
|
||||
void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_area, lv_blend_mode_t blend_mode);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
|
||||
lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_COMPOSITE_H*/
|
||||
72
include/liblvgl/draw/sdl/lv_draw_sdl_img.h
Normal file
72
include/liblvgl/draw/sdl/lv_draw_sdl_img.h
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_img.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_IMG_H
|
||||
#define LV_DRAW_SDL_IMG_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_sdl_img_header_t {
|
||||
lv_img_header_t base;
|
||||
SDL_Rect rect;
|
||||
} lv_draw_sdl_img_header_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key_head_img_t * key, size_t key_size,
|
||||
const void * src, int32_t frame_id, SDL_Texture ** texture,
|
||||
lv_draw_sdl_img_header_t ** header);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_IMG_H*/
|
||||
55
include/liblvgl/draw/sdl/lv_draw_sdl_layer.h
Normal file
55
include/liblvgl/draw/sdl/lv_draw_sdl_layer.h
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_refr.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_TEMPL_H
|
||||
#define LV_TEMPL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_sdl.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct _lv_draw_sdl_layer_ctx_t {
|
||||
lv_draw_layer_ctx_t base;
|
||||
|
||||
SDL_Texture * orig_target;
|
||||
SDL_Texture * target;
|
||||
SDL_Rect target_rect;
|
||||
lv_draw_layer_flags_t flags;
|
||||
} lv_draw_sdl_layer_ctx_t;
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_draw_layer_ctx_t * lv_draw_sdl_layer_init(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
void lv_draw_sdl_layer_blend(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * transform_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
void lv_draw_sdl_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
void lv_draw_sdl_transform_areas_offset(lv_draw_sdl_ctx_t * ctx, bool has_composite, lv_area_t * apply_area,
|
||||
lv_area_t * coords, lv_area_t * clip);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_TEMPL_H*/
|
||||
51
include/liblvgl/draw/sdl/lv_draw_sdl_mask.h
Normal file
51
include/liblvgl/draw/sdl/lv_draw_sdl_mask.h
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_mask.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_MASK_H
|
||||
#define LV_DRAW_SDL_MASK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_opa_t * lv_draw_sdl_mask_dump_opa(const lv_area_t * coords, const int16_t * ids, int16_t ids_count);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_mask_dump_texture(SDL_Renderer * renderer, const lv_area_t * coords, const int16_t * ids,
|
||||
int16_t ids_count);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_MASK_H*/
|
||||
72
include/liblvgl/draw/sdl/lv_draw_sdl_priv.h
Normal file
72
include/liblvgl/draw/sdl/lv_draw_sdl_priv.h
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_priv.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_PRIV_H
|
||||
#define LV_DRAW_SDL_PRIV_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
#include "../../misc/lv_lru.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_sdl_context_internals_t {
|
||||
lv_lru_t * texture_cache;
|
||||
SDL_Texture * mask;
|
||||
SDL_Texture * composition;
|
||||
SDL_Texture * target_backup;
|
||||
uint8_t transform_count;
|
||||
} lv_draw_sdl_context_internals_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_PRIV_H*/
|
||||
75
include/liblvgl/draw/sdl/lv_draw_sdl_rect.h
Normal file
75
include/liblvgl/draw/sdl/lv_draw_sdl_rect.h
Normal file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_rect.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_RECT_H
|
||||
#define LV_DRAW_SDL_RECT_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
|
||||
#include "lv_draw_sdl_texture_cache.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct lv_draw_sdl_rect_header_t {
|
||||
lv_img_header_t base;
|
||||
SDL_Rect rect;
|
||||
} lv_draw_sdl_rect_header_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius);
|
||||
|
||||
void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clip, bool full);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_RECT_H*/
|
||||
46
include/liblvgl/draw/sdl/lv_draw_sdl_stack_blur.h
Normal file
46
include/liblvgl/draw/sdl/lv_draw_sdl_stack_blur.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_stack_blur.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_DRAW_SDL_STACK_BLUR_H
|
||||
#define LV_DRAW_SDL_STACK_BLUR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "../../misc/lv_color.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_stack_blur_grayscale(lv_opa_t * buf, uint16_t w, uint16_t h, uint16_t r);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_STACK_BLUR_H*/
|
||||
102
include/liblvgl/draw/sdl/lv_draw_sdl_texture_cache.h
Normal file
102
include/liblvgl/draw/sdl/lv_draw_sdl_texture_cache.h
Normal file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_texture_cache.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SDL_TEXTURE_CACHE_H
|
||||
#define LV_DRAW_SDL_TEXTURE_CACHE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_priv.h"
|
||||
#include "../../draw/lv_img_decoder.h"
|
||||
#include "../../misc/lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_DRAW_SDL_DEC_DSC_TEXTURE_HEAD "@LVSDLTex"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
char head[8];
|
||||
SDL_Texture * texture;
|
||||
SDL_Rect rect;
|
||||
bool texture_managed;
|
||||
bool texture_referenced;
|
||||
} lv_draw_sdl_dec_dsc_userdata_t;
|
||||
|
||||
typedef enum {
|
||||
LV_GPU_CACHE_KEY_MAGIC_ARC = 0x01,
|
||||
LV_GPU_CACHE_KEY_MAGIC_IMG = 0x11,
|
||||
LV_GPU_CACHE_KEY_MAGIC_IMG_ROUNDED_CORNERS = 0x12,
|
||||
LV_GPU_CACHE_KEY_MAGIC_LINE = 0x21,
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_BG = 0x31,
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_SHADOW = 0x32,
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_BORDER = 0x33,
|
||||
LV_GPU_CACHE_KEY_MAGIC_FONT_GLYPH = 0x41,
|
||||
LV_GPU_CACHE_KEY_MAGIC_MASK = 0x51,
|
||||
} lv_sdl_cache_key_magic_t;
|
||||
|
||||
typedef enum {
|
||||
LV_DRAW_SDL_CACHE_FLAG_NONE = 0,
|
||||
LV_DRAW_SDL_CACHE_FLAG_MANAGED = 1,
|
||||
} lv_draw_sdl_cache_flag_t;
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_img_src_t type;
|
||||
int32_t frame_id;
|
||||
} lv_draw_sdl_cache_key_head_img_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_texture_cache_init(lv_draw_sdl_ctx_t * ctx);
|
||||
|
||||
void lv_draw_sdl_texture_cache_deinit(lv_draw_sdl_ctx_t * ctx);
|
||||
|
||||
/**
|
||||
* Find cached texture by key. The texture can be destroyed during usage.
|
||||
*/
|
||||
SDL_Texture * lv_draw_sdl_texture_cache_get(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, bool * found);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_texture_cache_get_with_userdata(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length,
|
||||
bool * found, void ** userdata);
|
||||
|
||||
void lv_draw_sdl_texture_cache_put(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, SDL_Texture * texture);
|
||||
|
||||
void lv_draw_sdl_texture_cache_put_advanced(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length,
|
||||
SDL_Texture * texture, void * userdata, void userdata_free(void *),
|
||||
lv_draw_sdl_cache_flag_t flags);
|
||||
|
||||
lv_draw_sdl_cache_key_head_img_t * lv_draw_sdl_texture_img_key_create(const void * src, int32_t frame_id,
|
||||
size_t * size);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_TEXTURE_CACHE_H*/
|
||||
65
include/liblvgl/draw/sdl/lv_draw_sdl_utils.h
Normal file
65
include/liblvgl/draw/sdl/lv_draw_sdl_utils.h
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @file lv_draw_sdl_utils.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_DRAW_SDL_UTILS_H
|
||||
#define LV_DRAW_SDL_UTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#if LV_USE_GPU_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "../../misc/lv_color.h"
|
||||
#include "../../misc/lv_area.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void _lv_draw_sdl_utils_init();
|
||||
|
||||
void _lv_draw_sdl_utils_deinit();
|
||||
|
||||
void lv_area_to_sdl_rect(const lv_area_t * in, SDL_Rect * out);
|
||||
|
||||
void lv_color_to_sdl_color(const lv_color_t * in, SDL_Color * out);
|
||||
|
||||
void lv_area_zoom_to_sdl_rect(const lv_area_t * in, SDL_Rect * out, uint16_t zoom, const lv_point_t * pivot);
|
||||
|
||||
SDL_Palette * lv_sdl_alloc_palette_for_bpp(const uint8_t * mapping, uint8_t bpp);
|
||||
|
||||
SDL_Surface * lv_sdl_create_opa_surface(lv_opa_t * opa, lv_coord_t width, lv_coord_t height, lv_coord_t stride);
|
||||
|
||||
SDL_Texture * lv_sdl_create_opa_texture(SDL_Renderer * renderer, lv_opa_t * pixels, lv_coord_t width,
|
||||
lv_coord_t height, lv_coord_t stride);
|
||||
|
||||
void lv_sdl_to_8bpp(uint8_t * dest, const uint8_t * src, int width, int height, int stride, uint8_t bpp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SDL_UTILS_H*/
|
||||
70
include/liblvgl/draw/stm32_dma2d/lv_gpu_stm32_dma2d.h
Normal file
70
include/liblvgl/draw/stm32_dma2d/lv_gpu_stm32_dma2d.h
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @file lv_gpu_stm32_dma2d.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_STM32_DMA2D_H
|
||||
#define LV_GPU_STM32_DMA2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/hal/lv_hal_disp.h"
|
||||
#include "liblvgl/draw/sw/lv_draw_sw.h"
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_DMA2D_ARGB8888 0
|
||||
#define LV_DMA2D_RGB888 1
|
||||
#define LV_DMA2D_RGB565 2
|
||||
#define LV_DMA2D_ARGB1555 3
|
||||
#define LV_DMA2D_ARGB4444 4
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_stm32_dma2d_ctx_t;
|
||||
|
||||
struct _lv_disp_drv_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Turn on the peripheral and set output color mode, this only needs to be done once
|
||||
*/
|
||||
void lv_draw_stm32_dma2d_init(void);
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_stm32_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
void lv_draw_stm32_dma2d_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
void lv_gpu_stm32_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_STM32_DMA2D*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_STM32_DMA2D_H*/
|
||||
104
include/liblvgl/draw/sw/lv_draw_sw.h
Normal file
104
include/liblvgl/draw/sw/lv_draw_sw.h
Normal file
@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @file lv_draw_sw.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SW_H
|
||||
#define LV_DRAW_SW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw_sw_blend.h"
|
||||
#include "liblvgl/draw/lv_draw.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/hal/lv_hal_disp.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
struct _lv_disp_drv_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_ctx_t base_draw;
|
||||
|
||||
/** Fill an area of the destination buffer with a color*/
|
||||
void (*blend)(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
} lv_draw_sw_ctx_t;
|
||||
|
||||
typedef struct {
|
||||
lv_draw_layer_ctx_t base_draw;
|
||||
|
||||
uint32_t buf_size_bytes: 31;
|
||||
uint32_t has_alpha : 1;
|
||||
} lv_draw_sw_layer_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_sw_init_ctx(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
void lv_draw_sw_deinit_ctx(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_sw_wait_for_finish(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_sw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * dsc, const lv_point_t * center, uint16_t radius,
|
||||
uint16_t start_angle, uint16_t end_angle);
|
||||
|
||||
void lv_draw_sw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
|
||||
void lv_draw_sw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords);
|
||||
void lv_draw_sw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_img_decoded(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const uint8_t * src_buf, lv_img_cf_t cf);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc,
|
||||
const lv_point_t * point1, const lv_point_t * point2);
|
||||
|
||||
void lv_draw_sw_polygon(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * draw_dsc,
|
||||
const lv_point_t * points, uint16_t point_cnt);
|
||||
|
||||
void lv_draw_sw_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
void lv_draw_sw_transform(lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area, const void * src_buf,
|
||||
lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t cf, lv_color_t * cbuf, lv_opa_t * abuf);
|
||||
|
||||
struct _lv_draw_layer_ctx_t * lv_draw_sw_layer_create(struct _lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
void lv_draw_sw_layer_adjust(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
lv_draw_layer_flags_t flags);
|
||||
|
||||
void lv_draw_sw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_layer_ctx_t * layer_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
void lv_draw_sw_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx);
|
||||
|
||||
/***********************
|
||||
* GLOBAL VARIABLES
|
||||
***********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SW_H*/
|
||||
69
include/liblvgl/draw/sw/lv_draw_sw_blend.h
Normal file
69
include/liblvgl/draw/sw/lv_draw_sw_blend.h
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @file lv_draw_sw_blend.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SW_BLEND_H
|
||||
#define LV_DRAW_SW_BLEND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_area.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
#include "liblvgl/draw/lv_draw_mask.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
const lv_area_t * blend_area; /**< The area with absolute coordinates to draw on `draw_ctx->buf`
|
||||
* will be clipped to `draw_ctx->clip_area` */
|
||||
const lv_color_t * src_buf; /**< Pointer to an image to blend. If set `fill_color` is ignored */
|
||||
lv_color_t color; /**< Fill color*/
|
||||
lv_opa_t * mask_buf; /**< NULL if ignored, or an alpha mask to apply on `blend_area`*/
|
||||
lv_draw_mask_res_t mask_res; /**< The result of the previous mask operation */
|
||||
const lv_area_t * mask_area; /**< The area of `mask_buf` with absolute coordinates*/
|
||||
lv_opa_t opa; /**< The overall opacity*/
|
||||
lv_blend_mode_t blend_mode; /**< E.g. LV_BLEND_MODE_ADDITIVE*/
|
||||
} lv_draw_sw_blend_dsc_t;
|
||||
|
||||
struct _lv_draw_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Call the blend function of the `draw_ctx`.
|
||||
* @param draw_ctx pointer to a draw context
|
||||
* @param dsc pointer to an initialized blend descriptor
|
||||
*/
|
||||
void lv_draw_sw_blend(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* The basic blend function used with software rendering.
|
||||
* @param draw_ctx pointer to a draw context
|
||||
* @param dsc pointer to an initialized blend descriptor
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_basic(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_SW_BLEND_H*/
|
||||
70
include/liblvgl/draw/sw/lv_draw_sw_dither.h
Normal file
70
include/liblvgl/draw/sw/lv_draw_sw_dither.h
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @file lv_draw_sw_dither.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SW_DITHER_H
|
||||
#define LV_DRAW_SW_DITHER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj_pos.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#if LV_COLOR_DEPTH < 32 && LV_DITHER_GRADIENT == 1
|
||||
#define _DITHER_GRADIENT 1
|
||||
#else
|
||||
#define _DITHER_GRADIENT 0
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
#if _DITHER_GRADIENT
|
||||
/*A signed error color component*/
|
||||
typedef struct {
|
||||
int8_t r, g, b;
|
||||
} lv_scolor24_t;
|
||||
|
||||
struct _lv_gradient_cache_t;
|
||||
typedef void (*lv_dither_func_t)(struct _lv_gradient_cache_t * grad, lv_coord_t x, lv_coord_t y, lv_coord_t w);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* PROTOTYPES
|
||||
**********************/
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if _DITHER_GRADIENT
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_dither_none(struct _lv_gradient_cache_t * grad, lv_coord_t x, lv_coord_t y, lv_coord_t w);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_dither_ordered_hor(struct _lv_gradient_cache_t * grad, const lv_coord_t xs,
|
||||
const lv_coord_t y, const lv_coord_t w);
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_dither_ordered_ver(struct _lv_gradient_cache_t * grad, const lv_coord_t xs,
|
||||
const lv_coord_t y, const lv_coord_t w);
|
||||
|
||||
#if LV_DITHER_ERROR_DIFFUSION == 1
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_dither_err_diff_hor(struct _lv_gradient_cache_t * grad, const lv_coord_t xs,
|
||||
const lv_coord_t y, const lv_coord_t w);
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_dither_err_diff_ver(struct _lv_gradient_cache_t * grad, const lv_coord_t xs,
|
||||
const lv_coord_t y, const lv_coord_t w);
|
||||
#endif /* LV_DITHER_ERROR_DIFFUSION */
|
||||
|
||||
#endif /* _DITHER_GRADIENT */
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
97
include/liblvgl/draw/sw/lv_draw_sw_gradient.h
Normal file
97
include/liblvgl/draw/sw/lv_draw_sw_gradient.h
Normal file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @file lv_draw_sw_gradient.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SW_GRADIENT_H
|
||||
#define LV_DRAW_SW_GRADIENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/misc/lv_style.h"
|
||||
#include "lv_draw_sw_dither.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#if LV_GRADIENT_MAX_STOPS < 2
|
||||
#error LVGL needs at least 2 stops for gradients. Please increase the LV_GRADIENT_MAX_STOPS
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
#if _DITHER_GRADIENT
|
||||
typedef lv_color32_t lv_grad_color_t;
|
||||
#else
|
||||
typedef lv_color_t lv_grad_color_t;
|
||||
#endif
|
||||
|
||||
/** To avoid recomputing gradient for each draw operation,
|
||||
* it's possible to cache the computation in this structure instance.
|
||||
* Whenever possible, this structure is reused instead of recomputing the gradient map */
|
||||
typedef struct _lv_gradient_cache_t {
|
||||
uint32_t key; /**< A discriminating key that's built from the drawing operation.
|
||||
* If the key does not match, the cache item is not used */
|
||||
uint32_t life : 30; /**< A life counter that's incremented on usage. Higher counter is
|
||||
* less likely to be evicted from the cache */
|
||||
uint32_t filled : 1; /**< Used to skip dithering in it if already done */
|
||||
uint32_t not_cached: 1; /**< The cache was too small so this item is not managed by the cache*/
|
||||
lv_color_t * map; /**< The computed gradient low bitdepth color map, points into the
|
||||
* cache's buffer, no free needed */
|
||||
lv_coord_t alloc_size; /**< The map allocated size in colors */
|
||||
lv_coord_t size; /**< The computed gradient color map size, in colors */
|
||||
#if _DITHER_GRADIENT
|
||||
lv_color32_t * hmap; /**< If dithering, we need to store the current, high bitdepth gradient
|
||||
* map too, points to the cache's buffer, no free needed */
|
||||
#if LV_DITHER_ERROR_DIFFUSION == 1
|
||||
lv_scolor24_t * error_acc; /**< Error diffusion dithering algorithm requires storing the last error
|
||||
* drawn, points to the cache's buffer, no free needed */
|
||||
lv_coord_t w; /**< The error array width in pixels */
|
||||
#endif
|
||||
#endif
|
||||
} lv_grad_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* PROTOTYPES
|
||||
**********************/
|
||||
/** Compute the color in the given gradient and fraction
|
||||
* Gradient are specified in a virtual [0-255] range, so this function scales the virtual range to the given range
|
||||
* @param dsc The gradient descriptor to use
|
||||
* @param range The range to use in computation.
|
||||
* @param frac The current part used in the range. frac is in [0; range]
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_grad_color_t lv_gradient_calculate(const lv_grad_dsc_t * dsc, lv_coord_t range,
|
||||
lv_coord_t frac);
|
||||
|
||||
/**
|
||||
* Set the gradient cache size
|
||||
* @param max_bytes Max cahce size
|
||||
*/
|
||||
void lv_gradient_set_cache_size(size_t max_bytes);
|
||||
|
||||
/** Free the gradient cache */
|
||||
void lv_gradient_free_cache(void);
|
||||
|
||||
/** Get a gradient cache from the given parameters */
|
||||
lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * gradient, lv_coord_t w, lv_coord_t h);
|
||||
|
||||
/**
|
||||
* Clean up the gradient item after it was get with `lv_grad_get_from_cache`.
|
||||
* @param grad pointer to a gradient
|
||||
*/
|
||||
void lv_gradient_cleanup(lv_grad_t * grad);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_DRAW_GRADIENT_H*/
|
||||
64
include/liblvgl/draw/swm341_dma2d/lv_gpu_swm341_dma2d.h
Normal file
64
include/liblvgl/draw/swm341_dma2d/lv_gpu_swm341_dma2d.h
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @file lv_gpu_swm341_dma2d.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GPU_SWM341_DMA2D_H
|
||||
#define LV_GPU_SWM341_DMA2D_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/misc/lv_color.h"
|
||||
#include "liblvgl/hal/lv_hal_disp.h"
|
||||
#include "liblvgl/draw/sw/lv_draw_sw.h"
|
||||
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_SWM341_DMA2D_ARGB8888 0
|
||||
#define LV_SWM341_DMA2D_RGB888 1
|
||||
#define LV_SWM341_DMA2D_RGB565 2
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_swm341_dma2d_ctx_t;
|
||||
|
||||
struct _lv_disp_drv_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Turn on the peripheral and set output color mode, this only needs to be done once
|
||||
*/
|
||||
void lv_draw_swm341_dma2d_init(void);
|
||||
|
||||
void lv_draw_swm341_dma2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_swm341_dma2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_swm341_dma2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
void lv_gpu_swm341_dma2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SWM341_DMA2D*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GPU_SWM341_DMA2D_H*/
|
||||
152
include/liblvgl/extra/layouts/flex/lv_flex.h
Normal file
152
include/liblvgl/extra/layouts/flex/lv_flex.h
Normal file
@ -0,0 +1,152 @@
|
||||
/**
|
||||
* @file lv_flex.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_FLEX_H
|
||||
#define LV_FLEX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
#if LV_USE_FLEX
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_OBJ_FLAG_FLEX_IN_NEW_TRACK LV_OBJ_FLAG_LAYOUT_1
|
||||
LV_EXPORT_CONST_INT(LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||
|
||||
#define _LV_FLEX_COLUMN (1 << 0)
|
||||
#define _LV_FLEX_WRAP (1 << 2)
|
||||
#define _LV_FLEX_REVERSE (1 << 3)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
LV_FLEX_ALIGN_START,
|
||||
LV_FLEX_ALIGN_END,
|
||||
LV_FLEX_ALIGN_CENTER,
|
||||
LV_FLEX_ALIGN_SPACE_EVENLY,
|
||||
LV_FLEX_ALIGN_SPACE_AROUND,
|
||||
LV_FLEX_ALIGN_SPACE_BETWEEN,
|
||||
} lv_flex_align_t;
|
||||
|
||||
typedef enum {
|
||||
LV_FLEX_FLOW_ROW = 0x00,
|
||||
LV_FLEX_FLOW_COLUMN = _LV_FLEX_COLUMN,
|
||||
LV_FLEX_FLOW_ROW_WRAP = LV_FLEX_FLOW_ROW | _LV_FLEX_WRAP,
|
||||
LV_FLEX_FLOW_ROW_REVERSE = LV_FLEX_FLOW_ROW | _LV_FLEX_REVERSE,
|
||||
LV_FLEX_FLOW_ROW_WRAP_REVERSE = LV_FLEX_FLOW_ROW | _LV_FLEX_WRAP | _LV_FLEX_REVERSE,
|
||||
LV_FLEX_FLOW_COLUMN_WRAP = LV_FLEX_FLOW_COLUMN | _LV_FLEX_WRAP,
|
||||
LV_FLEX_FLOW_COLUMN_REVERSE = LV_FLEX_FLOW_COLUMN | _LV_FLEX_REVERSE,
|
||||
LV_FLEX_FLOW_COLUMN_WRAP_REVERSE = LV_FLEX_FLOW_COLUMN | _LV_FLEX_WRAP | _LV_FLEX_REVERSE,
|
||||
} lv_flex_flow_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
extern uint16_t LV_LAYOUT_FLEX;
|
||||
extern lv_style_prop_t LV_STYLE_FLEX_FLOW;
|
||||
extern lv_style_prop_t LV_STYLE_FLEX_MAIN_PLACE;
|
||||
extern lv_style_prop_t LV_STYLE_FLEX_CROSS_PLACE;
|
||||
extern lv_style_prop_t LV_STYLE_FLEX_TRACK_PLACE;
|
||||
extern lv_style_prop_t LV_STYLE_FLEX_GROW;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize a flex layout the default values
|
||||
* @param flex pointer to a flex layout descriptor
|
||||
*/
|
||||
void lv_flex_init(void);
|
||||
|
||||
/**
|
||||
* Set hot the item should flow
|
||||
* @param flex pointer to a flex layout descriptor
|
||||
* @param flow an element of `lv_flex_flow_t`.
|
||||
*/
|
||||
void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow);
|
||||
|
||||
/**
|
||||
* Set how to place (where to align) the items and tracks
|
||||
* @param flex pointer: to a flex layout descriptor
|
||||
* @param main_place where to place the items on main axis (in their track). Any value of `lv_flex_align_t`.
|
||||
* @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER`
|
||||
* @param track_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`.
|
||||
*/
|
||||
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
|
||||
lv_flex_align_t track_cross_place);
|
||||
|
||||
/**
|
||||
* Sets the width or height (on main axis) to grow the object in order fill the free space
|
||||
* @param obj pointer to an object. The parent must have flex layout else nothing will happen.
|
||||
* @param grow a value to set how much free space to take proportionally to other growing items.
|
||||
*/
|
||||
void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow);
|
||||
|
||||
void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value);
|
||||
void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value);
|
||||
void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value);
|
||||
void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value);
|
||||
void lv_style_set_flex_grow(lv_style_t * style, uint8_t value);
|
||||
void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_flex_main_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_flex_cross_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_flex_track_place(lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_flex_grow(lv_obj_t * obj, uint8_t value, lv_style_selector_t selector);
|
||||
|
||||
static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW);
|
||||
return (lv_flex_flow_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE);
|
||||
return (lv_flex_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE);
|
||||
return (lv_flex_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE);
|
||||
return (lv_flex_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_GROW);
|
||||
return (uint8_t)v.num;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_FLEX*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_FLEX_H*/
|
||||
194
include/liblvgl/extra/layouts/grid/lv_grid.h
Normal file
194
include/liblvgl/extra/layouts/grid/lv_grid.h
Normal file
@ -0,0 +1,194 @@
|
||||
/**
|
||||
* @file lv_grid.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GRID_H
|
||||
#define LV_GRID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
#if LV_USE_GRID
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/**
|
||||
* Can be used track size to make the track fill the free space.
|
||||
* @param x how much space to take proportionally to other FR tracks
|
||||
* @return a special track size
|
||||
*/
|
||||
#define LV_GRID_FR(x) (LV_COORD_MAX - 100 + x)
|
||||
|
||||
#define LV_GRID_CONTENT (LV_COORD_MAX - 101)
|
||||
LV_EXPORT_CONST_INT(LV_GRID_CONTENT);
|
||||
|
||||
#define LV_GRID_TEMPLATE_LAST (LV_COORD_MAX)
|
||||
LV_EXPORT_CONST_INT(LV_GRID_TEMPLATE_LAST);
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Can't include lv_obj.h because it includes this header file*/
|
||||
struct _lv_obj_t;
|
||||
|
||||
typedef enum {
|
||||
LV_GRID_ALIGN_START,
|
||||
LV_GRID_ALIGN_CENTER,
|
||||
LV_GRID_ALIGN_END,
|
||||
LV_GRID_ALIGN_STRETCH,
|
||||
LV_GRID_ALIGN_SPACE_EVENLY,
|
||||
LV_GRID_ALIGN_SPACE_AROUND,
|
||||
LV_GRID_ALIGN_SPACE_BETWEEN,
|
||||
} lv_grid_align_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
extern uint16_t LV_LAYOUT_GRID;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COLUMN_DSC_ARRAY;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_COLUMN_ALIGN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_DSC_ARRAY;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_ROW_ALIGN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_POS;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_COLUMN_SPAN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_X_ALIGN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_POS;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_ROW_SPAN;
|
||||
extern lv_style_prop_t LV_STYLE_GRID_CELL_Y_ALIGN;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_grid_init(void);
|
||||
|
||||
void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]);
|
||||
|
||||
void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align);
|
||||
|
||||
/**
|
||||
* Set the cell of an object. The object's parent needs to have grid layout, else nothing will happen
|
||||
* @param obj pointer to an object
|
||||
* @param column_align the vertical alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH`
|
||||
* @param col_pos column ID
|
||||
* @param col_span number of columns to take (>= 1)
|
||||
* @param row_align the horizontal alignment in the cell. `LV_GRID_START/END/CENTER/STRETCH`
|
||||
* @param row_pos row ID
|
||||
* @param row_span number of rows to take (>= 1)
|
||||
*/
|
||||
void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span,
|
||||
lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span);
|
||||
|
||||
/**
|
||||
* Just a wrapper to `LV_GRID_FR` for bindings.
|
||||
*/
|
||||
static inline lv_coord_t lv_grid_fr(uint8_t x)
|
||||
{
|
||||
return LV_GRID_FR(x);
|
||||
}
|
||||
|
||||
void lv_style_set_grid_row_dsc_array(lv_style_t * style, const lv_coord_t value[]);
|
||||
void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_coord_t value[]);
|
||||
void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value);
|
||||
void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value);
|
||||
void lv_style_set_grid_cell_column_pos(lv_style_t * style, lv_coord_t value);
|
||||
void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coord_t value);
|
||||
void lv_style_set_grid_cell_row_pos(lv_style_t * style, lv_coord_t value);
|
||||
void lv_style_set_grid_cell_row_span(lv_style_t * style, lv_coord_t value);
|
||||
void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_coord_t value);
|
||||
void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_coord_t value);
|
||||
|
||||
void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_row_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_column_align(lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_cell_x_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
|
||||
static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY);
|
||||
return (const lv_coord_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY);
|
||||
return (const lv_coord_t *)v.ptr;
|
||||
}
|
||||
|
||||
static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN);
|
||||
return (lv_grid_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN);
|
||||
return (lv_grid_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_GRID*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GRID_H*/
|
||||
44
include/liblvgl/extra/layouts/lv_layouts.h
Normal file
44
include/liblvgl/extra/layouts/lv_layouts.h
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file lv_layouts.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_LAYOUTS_H
|
||||
#define LV_LAYOUTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "flex/lv_flex.h"
|
||||
#include "grid/lv_grid.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_USE_LOG && LV_LOG_TRACE_LAYOUT
|
||||
# define LV_TRACE_LAYOUT(...) LV_LOG_TRACE(__VA_ARGS__)
|
||||
#else
|
||||
# define LV_TRACE_LAYOUT(...)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_LAYOUTS_H*/
|
||||
42
include/liblvgl/extra/libs/bmp/lv_bmp.h
Normal file
42
include/liblvgl/extra/libs/bmp/lv_bmp.h
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file lv_bmp.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_BMP_H
|
||||
#define LV_BMP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#if LV_USE_BMP
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_bmp_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_BMP*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_BMP_H*/
|
||||
104
include/liblvgl/extra/libs/ffmpeg/lv_ffmpeg.h
Normal file
104
include/liblvgl/extra/libs/ffmpeg/lv_ffmpeg.h
Normal file
@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @file lv_ffmpeg.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_FFMPEG_H
|
||||
#define LV_FFMPEG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
#if LV_USE_FFMPEG != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct ffmpeg_context_s;
|
||||
|
||||
extern const lv_obj_class_t lv_ffmpeg_player_class;
|
||||
|
||||
typedef struct {
|
||||
lv_img_t img;
|
||||
lv_timer_t * timer;
|
||||
lv_img_dsc_t imgdsc;
|
||||
bool auto_restart;
|
||||
struct ffmpeg_context_s * ffmpeg_ctx;
|
||||
} lv_ffmpeg_player_t;
|
||||
|
||||
typedef enum {
|
||||
LV_FFMPEG_PLAYER_CMD_START,
|
||||
LV_FFMPEG_PLAYER_CMD_STOP,
|
||||
LV_FFMPEG_PLAYER_CMD_PAUSE,
|
||||
LV_FFMPEG_PLAYER_CMD_RESUME,
|
||||
_LV_FFMPEG_PLAYER_CMD_LAST
|
||||
} lv_ffmpeg_player_cmd_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Register FFMPEG image decoder
|
||||
*/
|
||||
void lv_ffmpeg_init(void);
|
||||
|
||||
/**
|
||||
* Get the number of frames contained in the file
|
||||
* @param path image or video file name
|
||||
* @return Number of frames, less than 0 means failed
|
||||
*/
|
||||
int lv_ffmpeg_get_frame_num(const char * path);
|
||||
|
||||
/**
|
||||
* Create ffmpeg_player object
|
||||
* @param parent pointer to an object, it will be the parent of the new player
|
||||
* @return pointer to the created ffmpeg_player
|
||||
*/
|
||||
lv_obj_t * lv_ffmpeg_player_create(lv_obj_t * parent);
|
||||
|
||||
/**
|
||||
* Set the path of the file to be played
|
||||
* @param obj pointer to a ffmpeg_player object
|
||||
* @param path video file path
|
||||
* @return LV_RES_OK: no error; LV_RES_INV: can't get the info.
|
||||
*/
|
||||
lv_res_t lv_ffmpeg_player_set_src(lv_obj_t * obj, const char * path);
|
||||
|
||||
/**
|
||||
* Set command control video player
|
||||
* @param obj pointer to a ffmpeg_player object
|
||||
* @param cmd control commands
|
||||
*/
|
||||
void lv_ffmpeg_player_set_cmd(lv_obj_t * obj, lv_ffmpeg_player_cmd_t cmd);
|
||||
|
||||
/**
|
||||
* Set the video to automatically replay
|
||||
* @param obj pointer to a ffmpeg_player object
|
||||
* @param en true: enable the auto restart
|
||||
*/
|
||||
void lv_ffmpeg_player_set_auto_restart(lv_obj_t * obj, bool en);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_FFMPEG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_FFMPEG_H*/
|
||||
83
include/liblvgl/extra/libs/freetype/lv_freetype.h
Normal file
83
include/liblvgl/extra/libs/freetype/lv_freetype.h
Normal file
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* @file lv_freetype.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_FREETYPE_H
|
||||
#define LV_FREETYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
#if LV_USE_FREETYPE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef enum {
|
||||
FT_FONT_STYLE_NORMAL = 0,
|
||||
FT_FONT_STYLE_ITALIC = 1 << 0,
|
||||
FT_FONT_STYLE_BOLD = 1 << 1
|
||||
} LV_FT_FONT_STYLE;
|
||||
|
||||
typedef struct {
|
||||
const char * name; /* The name of the font file */
|
||||
const void * mem; /* The pointer of the font file */
|
||||
size_t mem_size; /* The size of the memory */
|
||||
lv_font_t * font; /* point to lvgl font */
|
||||
uint16_t weight; /* font size */
|
||||
uint16_t style; /* font style */
|
||||
} lv_ft_info_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* init freetype library
|
||||
* @param max_faces Maximum number of opened FT_Face objects managed by this cache instance. Use 0 for defaults.
|
||||
* @param max_sizes Maximum number of opened FT_Size objects managed by this cache instance. Use 0 for defaults.
|
||||
* @param max_bytes Maximum number of bytes to use for cached data nodes. Use 0 for defaults.
|
||||
* Note that this value does not account for managed FT_Face and FT_Size objects.
|
||||
* @return true on success, otherwise false.
|
||||
*/
|
||||
bool lv_freetype_init(uint16_t max_faces, uint16_t max_sizes, uint32_t max_bytes);
|
||||
|
||||
/**
|
||||
* Destroy freetype library
|
||||
*/
|
||||
void lv_freetype_destroy(void);
|
||||
|
||||
/**
|
||||
* Creates a font with info parameter specified.
|
||||
* @param info See lv_ft_info_t for details.
|
||||
* when success, lv_ft_info_t->font point to the font you created.
|
||||
* @return true on success, otherwise false.
|
||||
*/
|
||||
bool lv_ft_font_init(lv_ft_info_t * info);
|
||||
|
||||
/**
|
||||
* Destroy a font that has been created.
|
||||
* @param font pointer to font.
|
||||
*/
|
||||
void lv_ft_font_destroy(lv_font_t * font);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_FREETYPE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* LV_FREETYPE_H */
|
||||
55
include/liblvgl/extra/libs/fsdrv/lv_fsdrv.h
Normal file
55
include/liblvgl/extra/libs/fsdrv/lv_fsdrv.h
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @file lv_fsdrv.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_FSDRV_H
|
||||
#define LV_FSDRV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
#if LV_USE_FS_FATFS != '\0'
|
||||
void lv_fs_fatfs_init(void);
|
||||
#endif
|
||||
|
||||
#if LV_USE_FS_STDIO != '\0'
|
||||
void lv_fs_stdio_init(void);
|
||||
#endif
|
||||
|
||||
#if LV_USE_FS_POSIX != '\0'
|
||||
void lv_fs_posix_init(void);
|
||||
#endif
|
||||
|
||||
#if LV_USE_FS_WIN32 != '\0'
|
||||
void lv_fs_win32_init(void);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_FSDRV_H*/
|
||||
|
||||
60
include/liblvgl/extra/libs/gif/gifdec.h
Normal file
60
include/liblvgl/extra/libs/gif/gifdec.h
Normal file
@ -0,0 +1,60 @@
|
||||
#ifndef GIFDEC_H
|
||||
#define GIFDEC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "liblvgl/misc/lv_fs.h"
|
||||
|
||||
#if LV_USE_GIF
|
||||
|
||||
typedef struct gd_Palette {
|
||||
int size;
|
||||
uint8_t colors[0x100 * 3];
|
||||
} gd_Palette;
|
||||
|
||||
typedef struct gd_GCE {
|
||||
uint16_t delay;
|
||||
uint8_t tindex;
|
||||
uint8_t disposal;
|
||||
int input;
|
||||
int transparency;
|
||||
} gd_GCE;
|
||||
|
||||
|
||||
|
||||
typedef struct gd_GIF {
|
||||
lv_fs_file_t fd;
|
||||
const char * data;
|
||||
uint8_t is_file;
|
||||
uint32_t f_rw_p;
|
||||
int32_t anim_start;
|
||||
uint16_t width, height;
|
||||
uint16_t depth;
|
||||
uint16_t loop_count;
|
||||
gd_GCE gce;
|
||||
gd_Palette *palette;
|
||||
gd_Palette lct, gct;
|
||||
void (*plain_text)(
|
||||
struct gd_GIF *gif, uint16_t tx, uint16_t ty,
|
||||
uint16_t tw, uint16_t th, uint8_t cw, uint8_t ch,
|
||||
uint8_t fg, uint8_t bg
|
||||
);
|
||||
void (*comment)(struct gd_GIF *gif);
|
||||
void (*application)(struct gd_GIF *gif, char id[8], char auth[3]);
|
||||
uint16_t fx, fy, fw, fh;
|
||||
uint8_t bgindex;
|
||||
uint8_t *canvas, *frame;
|
||||
} gd_GIF;
|
||||
|
||||
gd_GIF * gd_open_gif_file(const char *fname);
|
||||
|
||||
gd_GIF * gd_open_gif_data(const void *data);
|
||||
|
||||
void gd_render_frame(gd_GIF *gif, uint8_t *buffer);
|
||||
|
||||
int gd_get_frame(gd_GIF *gif);
|
||||
void gd_rewind(gd_GIF *gif);
|
||||
void gd_close_gif(gd_GIF *gif);
|
||||
|
||||
#endif /*LV_USE_GIF*/
|
||||
|
||||
#endif /* GIFDEC_H */
|
||||
58
include/liblvgl/extra/libs/gif/lv_gif.h
Normal file
58
include/liblvgl/extra/libs/gif/lv_gif.h
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @file lv_gif.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GIF_H
|
||||
#define LV_GIF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "liblvgl/lvgl.h"
|
||||
#if LV_USE_GIF
|
||||
|
||||
#include "gifdec.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_img_t img;
|
||||
gd_GIF * gif;
|
||||
lv_timer_t * timer;
|
||||
lv_img_dsc_t imgdsc;
|
||||
uint32_t last_call;
|
||||
} lv_gif_t;
|
||||
|
||||
extern const lv_obj_class_t lv_gif_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_obj_t * lv_gif_create(lv_obj_t * parent);
|
||||
void lv_gif_set_src(lv_obj_t * obj, const void * src);
|
||||
void lv_gif_restart(lv_obj_t * gif);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GIF*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_GIF_H*/
|
||||
46
include/liblvgl/extra/libs/lv_libs.h
Normal file
46
include/liblvgl/extra/libs/lv_libs.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file lv_libs.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_LIBS_H
|
||||
#define LV_LIBS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "bmp/lv_bmp.h"
|
||||
#include "fsdrv/lv_fsdrv.h"
|
||||
#include "png/lv_png.h"
|
||||
#include "gif/lv_gif.h"
|
||||
#include "qrcode/lv_qrcode.h"
|
||||
#include "sjpg/lv_sjpg.h"
|
||||
#include "freetype/lv_freetype.h"
|
||||
#include "rlottie/lv_rlottie.h"
|
||||
#include "ffmpeg/lv_ffmpeg.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_LIBS_H*/
|
||||
1981
include/liblvgl/extra/libs/png/lodepng.h
Normal file
1981
include/liblvgl/extra/libs/png/lodepng.h
Normal file
File diff suppressed because it is too large
Load Diff
46
include/liblvgl/extra/libs/png/lv_png.h
Normal file
46
include/liblvgl/extra/libs/png/lv_png.h
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @file lv_png.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_PNG_H
|
||||
#define LV_PNG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#if LV_USE_PNG
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Register the PNG decoder functions in LVGL
|
||||
*/
|
||||
void lv_png_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_PNG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_PNG_H*/
|
||||
69
include/liblvgl/extra/libs/qrcode/lv_qrcode.h
Normal file
69
include/liblvgl/extra/libs/qrcode/lv_qrcode.h
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @file lv_qrcode
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_QRCODE_H
|
||||
#define LV_QRCODE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
#if LV_USE_QRCODE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
extern const lv_obj_class_t lv_qrcode_class;
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create an empty QR code (an `lv_canvas`) object.
|
||||
* @param parent point to an object where to create the QR code
|
||||
* @param size width and height of the QR code
|
||||
* @param dark_color dark color of the QR code
|
||||
* @param light_color light color of the QR code
|
||||
* @return pointer to the created QR code object
|
||||
*/
|
||||
lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color);
|
||||
|
||||
/**
|
||||
* Set the data of a QR code object
|
||||
* @param qrcode pointer to aQ code object
|
||||
* @param data data to display
|
||||
* @param data_len length of data in bytes
|
||||
* @return LV_RES_OK: if no error; LV_RES_INV: on error
|
||||
*/
|
||||
lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_len);
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use normal lv_obj_del instead
|
||||
* Delete a QR code object
|
||||
* @param qrcode pointer to a QR code object
|
||||
*/
|
||||
void lv_qrcode_delete(lv_obj_t * qrcode);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_QRCODE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_QRCODE_H*/
|
||||
319
include/liblvgl/extra/libs/qrcode/qrcodegen.h
Normal file
319
include/liblvgl/extra/libs/qrcode/qrcodegen.h
Normal file
@ -0,0 +1,319 @@
|
||||
/*
|
||||
* QR Code generator library (C)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This library creates QR Code symbols, which is a type of two-dimension barcode.
|
||||
* Invented by Denso Wave and described in the ISO/IEC 18004 standard.
|
||||
* A QR Code structure is an immutable square grid of black and white cells.
|
||||
* The library provides functions to create a QR Code from text or binary data.
|
||||
* The library covers the QR Code Model 2 specification, supporting all versions (sizes)
|
||||
* from 1 to 40, all 4 error correction levels, and 4 character encoding modes.
|
||||
*
|
||||
* Ways to create a QR Code object:
|
||||
* - High level: Take the payload data and call qrcodegen_encodeText() or qrcodegen_encodeBinary().
|
||||
* - Low level: Custom-make the list of segments and call
|
||||
* qrcodegen_encodeSegments() or qrcodegen_encodeSegmentsAdvanced().
|
||||
* (Note that all ways require supplying the desired error correction level and various byte buffers.)
|
||||
*/
|
||||
|
||||
|
||||
/*---- Enum and struct types----*/
|
||||
|
||||
/*
|
||||
* The error correction level in a QR Code symbol.
|
||||
*/
|
||||
enum qrcodegen_Ecc {
|
||||
// Must be declared in ascending order of error protection
|
||||
// so that an internal qrcodegen function works properly
|
||||
qrcodegen_Ecc_LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords
|
||||
qrcodegen_Ecc_MEDIUM , // The QR Code can tolerate about 15% erroneous codewords
|
||||
qrcodegen_Ecc_QUARTILE, // The QR Code can tolerate about 25% erroneous codewords
|
||||
qrcodegen_Ecc_HIGH , // The QR Code can tolerate about 30% erroneous codewords
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* The mask pattern used in a QR Code symbol.
|
||||
*/
|
||||
enum qrcodegen_Mask {
|
||||
// A special value to tell the QR Code encoder to
|
||||
// automatically select an appropriate mask pattern
|
||||
qrcodegen_Mask_AUTO = -1,
|
||||
// The eight actual mask patterns
|
||||
qrcodegen_Mask_0 = 0,
|
||||
qrcodegen_Mask_1,
|
||||
qrcodegen_Mask_2,
|
||||
qrcodegen_Mask_3,
|
||||
qrcodegen_Mask_4,
|
||||
qrcodegen_Mask_5,
|
||||
qrcodegen_Mask_6,
|
||||
qrcodegen_Mask_7,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Describes how a segment's data bits are interpreted.
|
||||
*/
|
||||
enum qrcodegen_Mode {
|
||||
qrcodegen_Mode_NUMERIC = 0x1,
|
||||
qrcodegen_Mode_ALPHANUMERIC = 0x2,
|
||||
qrcodegen_Mode_BYTE = 0x4,
|
||||
qrcodegen_Mode_KANJI = 0x8,
|
||||
qrcodegen_Mode_ECI = 0x7,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* A segment of character/binary/control data in a QR Code symbol.
|
||||
* The mid-level way to create a segment is to take the payload data
|
||||
* and call a factory function such as qrcodegen_makeNumeric().
|
||||
* The low-level way to create a segment is to custom-make the bit buffer
|
||||
* and initialize a qrcodegen_Segment struct with appropriate values.
|
||||
* Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
|
||||
* Any segment longer than this is meaningless for the purpose of generating QR Codes.
|
||||
* Moreover, the maximum allowed bit length is 32767 because
|
||||
* the largest QR Code (version 40) has 31329 modules.
|
||||
*/
|
||||
struct qrcodegen_Segment {
|
||||
// The mode indicator of this segment.
|
||||
enum qrcodegen_Mode mode;
|
||||
|
||||
// The length of this segment's unencoded data. Measured in characters for
|
||||
// numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
||||
// Always zero or positive. Not the same as the data's bit length.
|
||||
int numChars;
|
||||
|
||||
// The data bits of this segment, packed in bitwise big endian.
|
||||
// Can be null if the bit length is zero.
|
||||
uint8_t *data;
|
||||
|
||||
// The number of valid data bits used in the buffer. Requires
|
||||
// 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
|
||||
// The character count (numChars) must agree with the mode and the bit buffer length.
|
||||
int bitLength;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---- Macro constants and functions ----*/
|
||||
|
||||
#define qrcodegen_VERSION_MIN 1 // The minimum version number supported in the QR Code Model 2 standard
|
||||
#define qrcodegen_VERSION_MAX 40 // The maximum version number supported in the QR Code Model 2 standard
|
||||
|
||||
// Calculates the number of bytes needed to store any QR Code up to and including the given version number,
|
||||
// as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
|
||||
// can store any single QR Code from version 1 to 25 (inclusive). The result fits in an int (or int16).
|
||||
// Requires qrcodegen_VERSION_MIN <= n <= qrcodegen_VERSION_MAX.
|
||||
#define qrcodegen_BUFFER_LEN_FOR_VERSION(n) ((((n) * 4 + 17) * ((n) * 4 + 17) + 7) / 8 + 1)
|
||||
|
||||
// The worst-case number of bytes needed to store one QR Code, up to and including
|
||||
// version 40. This value equals 3918, which is just under 4 kilobytes.
|
||||
// Use this more convenient value to avoid calculating tighter memory bounds for buffers.
|
||||
#define qrcodegen_BUFFER_LEN_MAX qrcodegen_BUFFER_LEN_FOR_VERSION(qrcodegen_VERSION_MAX)
|
||||
|
||||
|
||||
|
||||
/*---- Functions (high level) to generate QR Codes ----*/
|
||||
|
||||
/*
|
||||
* Encodes the given text string to a QR Code, returning true if encoding succeeded.
|
||||
* If the data is too long to fit in any version in the given range
|
||||
* at the given ECC level, then false is returned.
|
||||
* - The input text must be encoded in UTF-8 and contain no NULs.
|
||||
* - The variables ecl and mask must correspond to enum constant values.
|
||||
* - Requires 1 <= minVersion <= maxVersion <= 40.
|
||||
* - The arrays tempBuffer and qrcode must each have a length
|
||||
* of at least qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion).
|
||||
* - After the function returns, tempBuffer contains no useful data.
|
||||
* - If successful, the resulting QR Code may use numeric,
|
||||
* alphanumeric, or byte mode to encode the text.
|
||||
* - In the most optimistic case, a QR Code at version 40 with low ECC
|
||||
* can hold any UTF-8 string up to 2953 bytes, or any alphanumeric string
|
||||
* up to 4296 characters, or any digit string up to 7089 characters.
|
||||
* These numbers represent the hard upper limit of the QR Code standard.
|
||||
* - Please consult the QR Code specification for information on
|
||||
* data capacities per version, ECC level, and text encoding mode.
|
||||
*/
|
||||
bool qrcodegen_encodeText(const char *text, uint8_t tempBuffer[], uint8_t qrcode[],
|
||||
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
|
||||
|
||||
|
||||
/*
|
||||
* Encodes the given binary data to a QR Code, returning true if encoding succeeded.
|
||||
* If the data is too long to fit in any version in the given range
|
||||
* at the given ECC level, then false is returned.
|
||||
* - The input array range dataAndTemp[0 : dataLen] should normally be
|
||||
* valid UTF-8 text, but is not required by the QR Code standard.
|
||||
* - The variables ecl and mask must correspond to enum constant values.
|
||||
* - Requires 1 <= minVersion <= maxVersion <= 40.
|
||||
* - The arrays dataAndTemp and qrcode must each have a length
|
||||
* of at least qrcodegen_BUFFER_LEN_FOR_VERSION(maxVersion).
|
||||
* - After the function returns, the contents of dataAndTemp may have changed,
|
||||
* and does not represent useful data anymore.
|
||||
* - If successful, the resulting QR Code will use byte mode to encode the data.
|
||||
* - In the most optimistic case, a QR Code at version 40 with low ECC can hold any byte
|
||||
* sequence up to length 2953. This is the hard upper limit of the QR Code standard.
|
||||
* - Please consult the QR Code specification for information on
|
||||
* data capacities per version, ECC level, and text encoding mode.
|
||||
*/
|
||||
bool qrcodegen_encodeBinary(uint8_t dataAndTemp[], size_t dataLen, uint8_t qrcode[],
|
||||
enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl);
|
||||
|
||||
|
||||
/*---- Functions (low level) to generate QR Codes ----*/
|
||||
|
||||
/*
|
||||
* Renders a QR Code representing the given segments at the given error correction level.
|
||||
* The smallest possible QR Code version is automatically chosen for the output. Returns true if
|
||||
* QR Code creation succeeded, or false if the data is too long to fit in any version. The ECC level
|
||||
* of the result may be higher than the ecl argument if it can be done without increasing the version.
|
||||
* This function allows the user to create a custom sequence of segments that switches
|
||||
* between modes (such as alphanumeric and byte) to encode text in less space.
|
||||
* This is a low-level API; the high-level API is qrcodegen_encodeText() and qrcodegen_encodeBinary().
|
||||
* To save memory, the segments' data buffers can alias/overlap tempBuffer, and will
|
||||
* result in them being clobbered, but the QR Code output will still be correct.
|
||||
* But the qrcode array must not overlap tempBuffer or any segment's data buffer.
|
||||
*/
|
||||
bool qrcodegen_encodeSegments(const struct qrcodegen_Segment segs[], size_t len,
|
||||
enum qrcodegen_Ecc ecl, uint8_t tempBuffer[], uint8_t qrcode[]);
|
||||
|
||||
|
||||
/*
|
||||
* Renders a QR Code representing the given segments with the given encoding parameters.
|
||||
* Returns true if QR Code creation succeeded, or false if the data is too long to fit in the range of versions.
|
||||
* The smallest possible QR Code version within the given range is automatically
|
||||
* chosen for the output. Iff boostEcl is true, then the ECC level of the result
|
||||
* may be higher than the ecl argument if it can be done without increasing the
|
||||
* version. The mask number is either between 0 to 7 (inclusive) to force that
|
||||
* mask, or -1 to automatically choose an appropriate mask (which may be slow).
|
||||
* This function allows the user to create a custom sequence of segments that switches
|
||||
* between modes (such as alphanumeric and byte) to encode text in less space.
|
||||
* This is a low-level API; the high-level API is qrcodegen_encodeText() and qrcodegen_encodeBinary().
|
||||
* To save memory, the segments' data buffers can alias/overlap tempBuffer, and will
|
||||
* result in them being clobbered, but the QR Code output will still be correct.
|
||||
* But the qrcode array must not overlap tempBuffer or any segment's data buffer.
|
||||
*/
|
||||
bool qrcodegen_encodeSegmentsAdvanced(const struct qrcodegen_Segment segs[], size_t len, enum qrcodegen_Ecc ecl,
|
||||
int minVersion, int maxVersion, int mask, bool boostEcl, uint8_t tempBuffer[], uint8_t qrcode[]);
|
||||
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
||||
* A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
||||
* (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
bool qrcodegen_isAlphanumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in numeric mode.
|
||||
* A string is encodable iff each character is in the range 0 to 9.
|
||||
*/
|
||||
bool qrcodegen_isNumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Returns the number of bytes (uint8_t) needed for the data buffer of a segment
|
||||
* containing the given number of characters using the given mode. Notes:
|
||||
* - Returns SIZE_MAX on failure, i.e. numChars > INT16_MAX or
|
||||
* the number of needed bits exceeds INT16_MAX (i.e. 32767).
|
||||
* - Otherwise, all valid results are in the range [0, ceil(INT16_MAX / 8)], i.e. at most 4096.
|
||||
* - It is okay for the user to allocate more bytes for the buffer than needed.
|
||||
* - For byte mode, numChars measures the number of bytes, not Unicode code points.
|
||||
* - For ECI mode, numChars must be 0, and the worst-case number of bytes is returned.
|
||||
* An actual ECI segment can have shorter data. For non-ECI modes, the result is exact.
|
||||
*/
|
||||
size_t qrcodegen_calcSegmentBufferSize(enum qrcodegen_Mode mode, size_t numChars);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given binary data encoded in
|
||||
* byte mode. All input byte arrays are acceptable. Any text string
|
||||
* can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeBytes(const uint8_t data[], size_t len, uint8_t buf[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeNumeric(const char *digits, uint8_t buf[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given text string encoded in alphanumeric mode.
|
||||
* The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
||||
* dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeAlphanumeric(const char *text, uint8_t buf[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing an Extended Channel Interpretation
|
||||
* (ECI) designator with the given assignment value.
|
||||
*/
|
||||
struct qrcodegen_Segment qrcodegen_makeEci(long assignVal, uint8_t buf[]);
|
||||
|
||||
|
||||
/*---- Functions to extract raw data from QR Codes ----*/
|
||||
|
||||
/*
|
||||
* Returns the side length of the given QR Code, assuming that encoding succeeded.
|
||||
* The result is in the range [21, 177]. Note that the length of the array buffer
|
||||
* is related to the side length - every 'uint8_t qrcode[]' must have length at least
|
||||
* qrcodegen_BUFFER_LEN_FOR_VERSION(version), which equals ceil(size^2 / 8 + 1).
|
||||
*/
|
||||
int qrcodegen_getSize(const uint8_t qrcode[]);
|
||||
|
||||
|
||||
/*
|
||||
* Returns the color of the module (pixel) at the given coordinates, which is false
|
||||
* for white or true for black. The top left corner has the coordinates (x=0, y=0).
|
||||
* If the given coordinates are out of bounds, then false (white) is returned.
|
||||
*/
|
||||
bool qrcodegen_getModule(const uint8_t qrcode[], int x, int y);
|
||||
|
||||
/*
|
||||
* Returns the qrcode size of the specified version. Returns -1 on failure
|
||||
*/
|
||||
int qrcodegen_version2size(int version);
|
||||
/*
|
||||
* Returns the min version of the data that can be stored. Returns -1 on failure
|
||||
*/
|
||||
int qrcodegen_getMinFitVersion(enum qrcodegen_Ecc ecl, size_t dataLen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
75
include/liblvgl/extra/libs/rlottie/lv_rlottie.h
Normal file
75
include/liblvgl/extra/libs/rlottie/lv_rlottie.h
Normal file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @file lv_rlottie.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_RLOTTIE_H
|
||||
#define LV_RLOTTIE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
#if LV_USE_RLOTTIE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef enum {
|
||||
LV_RLOTTIE_CTRL_FORWARD = 0,
|
||||
LV_RLOTTIE_CTRL_BACKWARD = 1,
|
||||
LV_RLOTTIE_CTRL_PAUSE = 2,
|
||||
LV_RLOTTIE_CTRL_PLAY = 0, /* Yes, play = 0 is the default mode */
|
||||
LV_RLOTTIE_CTRL_LOOP = 8,
|
||||
} lv_rlottie_ctrl_t;
|
||||
|
||||
/** definition in lottieanimation_capi.c */
|
||||
struct Lottie_Animation_S;
|
||||
typedef struct {
|
||||
lv_img_t img_ext;
|
||||
struct Lottie_Animation_S * animation;
|
||||
lv_timer_t * task;
|
||||
lv_img_dsc_t imgdsc;
|
||||
size_t total_frames;
|
||||
size_t current_frame;
|
||||
size_t framerate;
|
||||
uint32_t * allocated_buf;
|
||||
size_t allocated_buffer_size;
|
||||
size_t scanline_width;
|
||||
lv_rlottie_ctrl_t play_ctrl;
|
||||
size_t dest_frame;
|
||||
} lv_rlottie_t;
|
||||
|
||||
extern const lv_obj_class_t lv_rlottie_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, lv_coord_t width, lv_coord_t height, const char * path);
|
||||
|
||||
lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, lv_coord_t width, lv_coord_t height,
|
||||
const char * rlottie_desc);
|
||||
|
||||
void lv_rlottie_set_play_mode(lv_obj_t * rlottie, const lv_rlottie_ctrl_t ctrl);
|
||||
void lv_rlottie_set_current_frame(lv_obj_t * rlottie, const size_t goto_frame);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_RLOTTIE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_RLOTTIE_H*/
|
||||
43
include/liblvgl/extra/libs/sjpg/lv_sjpg.h
Normal file
43
include/liblvgl/extra/libs/sjpg/lv_sjpg.h
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @file lv_sjpg.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_SJPEG_H
|
||||
#define LV_SJPEG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#if LV_USE_SJPG
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_split_jpeg_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_SJPG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LV_SJPEG_H */
|
||||
93
include/liblvgl/extra/libs/sjpg/tjpgd.h
Normal file
93
include/liblvgl/extra/libs/sjpg/tjpgd.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*----------------------------------------------------------------------------/
|
||||
/ TJpgDec - Tiny JPEG Decompressor R0.03 include file (C)ChaN, 2021
|
||||
/----------------------------------------------------------------------------*/
|
||||
#ifndef DEF_TJPGDEC
|
||||
#define DEF_TJPGDEC
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#if LV_USE_SJPG
|
||||
|
||||
#include "tjpgdcnf.h"
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if JD_FASTDECODE >= 1
|
||||
typedef int16_t jd_yuv_t;
|
||||
#else
|
||||
typedef uint8_t jd_yuv_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Error code */
|
||||
typedef enum {
|
||||
JDR_OK = 0, /* 0: Succeeded */
|
||||
JDR_INTR, /* 1: Interrupted by output function */
|
||||
JDR_INP, /* 2: Device error or wrong termination of input stream */
|
||||
JDR_MEM1, /* 3: Insufficient memory pool for the image */
|
||||
JDR_MEM2, /* 4: Insufficient stream input buffer */
|
||||
JDR_PAR, /* 5: Parameter error */
|
||||
JDR_FMT1, /* 6: Data format error (may be broken data) */
|
||||
JDR_FMT2, /* 7: Right format but not supported */
|
||||
JDR_FMT3 /* 8: Not supported JPEG standard */
|
||||
} JRESULT;
|
||||
|
||||
/* Rectangular region in the output image */
|
||||
typedef struct {
|
||||
uint16_t left; /* Left end */
|
||||
uint16_t right; /* Right end */
|
||||
uint16_t top; /* Top end */
|
||||
uint16_t bottom; /* Bottom end */
|
||||
} JRECT;
|
||||
|
||||
/* Decompressor object structure */
|
||||
typedef struct JDEC JDEC;
|
||||
struct JDEC {
|
||||
size_t dctr; /* Number of bytes available in the input buffer */
|
||||
uint8_t* dptr; /* Current data read ptr */
|
||||
uint8_t* inbuf; /* Bit stream input buffer */
|
||||
uint8_t dbit; /* Number of bits availavble in wreg or reading bit mask */
|
||||
uint8_t scale; /* Output scaling ratio */
|
||||
uint8_t msx, msy; /* MCU size in unit of block (width, height) */
|
||||
uint8_t qtid[3]; /* Quantization table ID of each component, Y, Cb, Cr */
|
||||
uint8_t ncomp; /* Number of color components 1:grayscale, 3:color */
|
||||
int16_t dcv[3]; /* Previous DC element of each component */
|
||||
uint16_t nrst; /* Restart inverval */
|
||||
uint16_t width, height; /* Size of the input image (pixel) */
|
||||
uint8_t* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
|
||||
uint16_t* huffcode[2][2]; /* Huffman code word tables [id][dcac] */
|
||||
uint8_t* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
|
||||
int32_t* qttbl[4]; /* Dequantizer tables [id] */
|
||||
#if JD_FASTDECODE >= 1
|
||||
uint32_t wreg; /* Working shift register */
|
||||
uint8_t marker; /* Detected marker (0:None) */
|
||||
#if JD_FASTDECODE == 2
|
||||
uint8_t longofs[2][2]; /* Table offset of long code [id][dcac] */
|
||||
uint16_t* hufflut_ac[2]; /* Fast huffman decode tables for AC short code [id] */
|
||||
uint8_t* hufflut_dc[2]; /* Fast huffman decode tables for DC short code [id] */
|
||||
#endif
|
||||
#endif
|
||||
void* workbuf; /* Working buffer for IDCT and RGB output */
|
||||
jd_yuv_t* mcubuf; /* Working buffer for the MCU */
|
||||
void* pool; /* Pointer to available memory pool */
|
||||
size_t sz_pool; /* Size of momory pool (bytes available) */
|
||||
size_t (*infunc)(JDEC*, uint8_t*, size_t); /* Pointer to jpeg stream input function */
|
||||
void* device; /* Pointer to I/O device identifiler for the session */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* TJpgDec API functions */
|
||||
JRESULT jd_prepare (JDEC* jd, size_t (*infunc)(JDEC*,uint8_t*,size_t), void* pool, size_t sz_pool, void* dev);
|
||||
JRESULT jd_decomp (JDEC* jd, int (*outfunc)(JDEC*,void*,JRECT*), uint8_t scale);
|
||||
|
||||
#endif /*LV_USE_SJPG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TJPGDEC */
|
||||
33
include/liblvgl/extra/libs/sjpg/tjpgdcnf.h
Normal file
33
include/liblvgl/extra/libs/sjpg/tjpgdcnf.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*----------------------------------------------*/
|
||||
/* TJpgDec System Configurations R0.03 */
|
||||
/*----------------------------------------------*/
|
||||
|
||||
#define JD_SZBUF 512
|
||||
/* Specifies size of stream input buffer */
|
||||
|
||||
#define JD_FORMAT 0
|
||||
/* Specifies output pixel format.
|
||||
/ 0: RGB888 (24-bit/pix)
|
||||
/ 1: RGB565 (16-bit/pix)
|
||||
/ 2: Grayscale (8-bit/pix)
|
||||
*/
|
||||
|
||||
#define JD_USE_SCALE 1
|
||||
/* Switches output descaling feature.
|
||||
/ 0: Disable
|
||||
/ 1: Enable
|
||||
*/
|
||||
|
||||
#define JD_TBLCLIP 1
|
||||
/* Use table conversion for saturation arithmetic. A bit faster, but increases 1 KB of code size.
|
||||
/ 0: Disable
|
||||
/ 1: Enable
|
||||
*/
|
||||
|
||||
#define JD_FASTDECODE 0
|
||||
/* Optimization level
|
||||
/ 0: Basic optimization. Suitable for 8/16-bit MCUs.
|
||||
/ 1: + 32-bit barrel shifter. Suitable for 32-bit MCUs.
|
||||
/ 2: + Table conversion for huffman decoding (wants 6 << HUFF_BIT bytes of RAM)
|
||||
*/
|
||||
|
||||
48
include/liblvgl/extra/lv_extra.h
Normal file
48
include/liblvgl/extra/lv_extra.h
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @file lv_extra.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EXTRA_H
|
||||
#define LV_EXTRA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "layouts/lv_layouts.h"
|
||||
#include "libs/lv_libs.h"
|
||||
#include "others/lv_others.h"
|
||||
#include "themes/lv_themes.h"
|
||||
#include "widgets/lv_widgets.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the extra components
|
||||
*/
|
||||
void lv_extra_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXTRA_H*/
|
||||
339
include/liblvgl/extra/others/fragment/lv_fragment.h
Normal file
339
include/liblvgl/extra/others/fragment/lv_fragment.h
Normal file
@ -0,0 +1,339 @@
|
||||
/**
|
||||
* Public header for Fragment
|
||||
* @file lv_fragment.h
|
||||
*/
|
||||
|
||||
#ifndef LV_FRAGMENT_H
|
||||
#define LV_FRAGMENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_FRAGMENT
|
||||
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct _lv_fragment_manager_t lv_fragment_manager_t;
|
||||
|
||||
typedef struct _lv_fragment_t lv_fragment_t;
|
||||
typedef struct _lv_fragment_class_t lv_fragment_class_t;
|
||||
typedef struct _lv_fragment_managed_states_t lv_fragment_managed_states_t;
|
||||
|
||||
struct _lv_fragment_t {
|
||||
/**
|
||||
* Class of this fragment
|
||||
*/
|
||||
const lv_fragment_class_t * cls;
|
||||
/**
|
||||
* Managed fragment states. If not null, then this fragment is managed.
|
||||
*
|
||||
* @warning Don't modify values inside this struct!
|
||||
*/
|
||||
lv_fragment_managed_states_t * managed;
|
||||
/**
|
||||
* Child fragment manager
|
||||
*/
|
||||
lv_fragment_manager_t * child_manager;
|
||||
/**
|
||||
* lv_obj returned by create_obj_cb
|
||||
*/
|
||||
lv_obj_t * obj;
|
||||
|
||||
};
|
||||
|
||||
struct _lv_fragment_class_t {
|
||||
/**
|
||||
* Constructor function for fragment class
|
||||
* @param self Fragment instance
|
||||
* @param args Arguments assigned by fragment manager
|
||||
*/
|
||||
void (*constructor_cb)(lv_fragment_t * self, void * args);
|
||||
|
||||
/**
|
||||
* Destructor function for fragment class
|
||||
* @param self Fragment instance, will be freed after this call
|
||||
*/
|
||||
void (*destructor_cb)(lv_fragment_t * self);
|
||||
|
||||
/**
|
||||
* Fragment attached to manager
|
||||
* @param self Fragment instance
|
||||
*/
|
||||
void (*attached_cb)(lv_fragment_t * self);
|
||||
|
||||
/**
|
||||
* Fragment detached from manager
|
||||
* @param self Fragment instance
|
||||
*/
|
||||
void (*detached_cb)(lv_fragment_t * self);
|
||||
|
||||
/**
|
||||
* Create objects
|
||||
* @param self Fragment instance
|
||||
* @param container Container of the objects should be created upon
|
||||
* @return Created object, NULL if multiple objects has been created
|
||||
*/
|
||||
lv_obj_t * (*create_obj_cb)(lv_fragment_t * self, lv_obj_t * container);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param self Fragment instance
|
||||
* @param obj lv_obj returned by create_obj_cb
|
||||
*/
|
||||
void (*obj_created_cb)(lv_fragment_t * self, lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Called before objects in the fragment will be deleted.
|
||||
*
|
||||
* @param self Fragment instance
|
||||
* @param obj object with this fragment
|
||||
*/
|
||||
void (*obj_will_delete_cb)(lv_fragment_t * self, lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Called when the object created by fragment received `LV_EVENT_DELETE` event
|
||||
* @param self Fragment instance
|
||||
* @param obj object with this fragment
|
||||
*/
|
||||
void (*obj_deleted_cb)(lv_fragment_t * self, lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Handle event
|
||||
* @param self Fragment instance
|
||||
* @param which User-defined ID of event
|
||||
* @param data1 User-defined data
|
||||
* @param data2 User-defined data
|
||||
*/
|
||||
bool (*event_cb)(lv_fragment_t * self, int code, void * userdata);
|
||||
|
||||
/**
|
||||
* *REQUIRED*: Allocation size of fragment
|
||||
*/
|
||||
size_t instance_size;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fragment states
|
||||
*/
|
||||
typedef struct _lv_fragment_managed_states_t {
|
||||
/**
|
||||
* Class of the fragment
|
||||
*/
|
||||
const lv_fragment_class_t * cls;
|
||||
/**
|
||||
* Manager the fragment attached to
|
||||
*/
|
||||
lv_fragment_manager_t * manager;
|
||||
/**
|
||||
* Container object the fragment adding view to
|
||||
*/
|
||||
lv_obj_t * const * container;
|
||||
/**
|
||||
* Fragment instance
|
||||
*/
|
||||
lv_fragment_t * instance;
|
||||
/**
|
||||
* true between `create_obj_cb` and `obj_deleted_cb`
|
||||
*/
|
||||
bool obj_created;
|
||||
/**
|
||||
* true before `lv_fragment_del_obj` is called. Don't touch any object if this is true
|
||||
*/
|
||||
bool destroying_obj;
|
||||
/**
|
||||
* true if this fragment is in navigation stack that can be popped
|
||||
*/
|
||||
bool in_stack;
|
||||
} lv_fragment_managed_states_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create fragment manager instance
|
||||
* @param parent Parent fragment if this manager is placed inside another fragment, can be null.
|
||||
* @return Fragment manager instance
|
||||
*/
|
||||
lv_fragment_manager_t * lv_fragment_manager_create(lv_fragment_t * parent);
|
||||
|
||||
/**
|
||||
* Destroy fragment manager instance
|
||||
* @param manager Fragment manager instance
|
||||
*/
|
||||
void lv_fragment_manager_del(lv_fragment_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Create object of all fragments managed by this manager.
|
||||
* @param manager Fragment manager instance
|
||||
*/
|
||||
void lv_fragment_manager_create_obj(lv_fragment_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Delete object created by all fragments managed by this manager. Instance of fragments will not be deleted.
|
||||
* @param manager Fragment manager instance
|
||||
*/
|
||||
void lv_fragment_manager_del_obj(lv_fragment_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Attach fragment to manager, and add to container.
|
||||
* @param manager Fragment manager instance
|
||||
* @param fragment Fragment instance
|
||||
* @param container Pointer to container object for manager to add objects to
|
||||
*/
|
||||
void lv_fragment_manager_add(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container);
|
||||
|
||||
/**
|
||||
* Detach and destroy fragment. If fragment is in navigation stack, remove from it.
|
||||
* @param manager Fragment manager instance
|
||||
* @param fragment Fragment instance
|
||||
*/
|
||||
void lv_fragment_manager_remove(lv_fragment_manager_t * manager, lv_fragment_t * fragment);
|
||||
|
||||
/**
|
||||
* Attach fragment to manager and add to navigation stack.
|
||||
* @param manager Fragment manager instance
|
||||
* @param fragment Fragment instance
|
||||
* @param container Pointer to container object for manager to add objects to
|
||||
*/
|
||||
void lv_fragment_manager_push(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container);
|
||||
|
||||
/**
|
||||
* Remove the top-most fragment for stack
|
||||
* @param manager Fragment manager instance
|
||||
* @return true if there is fragment to pop
|
||||
*/
|
||||
bool lv_fragment_manager_pop(lv_fragment_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Replace fragment. Old item in the stack will be removed.
|
||||
* @param manager Fragment manager instance
|
||||
* @param fragment Fragment instance
|
||||
* @param container Pointer to container object for manager to add objects to
|
||||
*/
|
||||
void lv_fragment_manager_replace(lv_fragment_manager_t * manager, lv_fragment_t * fragment,
|
||||
lv_obj_t * const * container);
|
||||
|
||||
/**
|
||||
* Send event to top-most fragment
|
||||
* @param manager Fragment manager instance
|
||||
* @param code User-defined ID of event
|
||||
* @param userdata User-defined data
|
||||
* @return true if fragment returned true
|
||||
*/
|
||||
bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, void * userdata);
|
||||
|
||||
/**
|
||||
* Get stack size of this fragment manager
|
||||
* @param manager Fragment manager instance
|
||||
* @return Stack size of this fragment manager
|
||||
*/
|
||||
size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Get top most fragment instance
|
||||
* @param manager Fragment manager instance
|
||||
* @return Top most fragment instance
|
||||
*/
|
||||
lv_fragment_t * lv_fragment_manager_get_top(lv_fragment_manager_t * manager);
|
||||
|
||||
/**
|
||||
* Find first fragment instance in the container
|
||||
* @param manager Fragment manager instance
|
||||
* @param container Container which target fragment added to
|
||||
* @return First fragment instance in the container
|
||||
*/
|
||||
lv_fragment_t * lv_fragment_manager_find_by_container(lv_fragment_manager_t * manager, const lv_obj_t * container);
|
||||
|
||||
/**
|
||||
* Get parent fragment
|
||||
* @param manager Fragment manager instance
|
||||
* @return Parent fragment instance
|
||||
*/
|
||||
lv_fragment_t * lv_fragment_manager_get_parent_fragment(lv_fragment_manager_t * manager);
|
||||
|
||||
|
||||
/**
|
||||
* Create a fragment instance.
|
||||
*
|
||||
* @param cls Fragment class. This fragment must return non null object.
|
||||
* @param args Arguments assigned by fragment manager
|
||||
* @return Fragment instance
|
||||
*/
|
||||
lv_fragment_t * lv_fragment_create(const lv_fragment_class_t * cls, void * args);
|
||||
|
||||
/**
|
||||
* Destroy a fragment.
|
||||
* @param fragment Fragment instance.
|
||||
*/
|
||||
void lv_fragment_del(lv_fragment_t * fragment);
|
||||
|
||||
/**
|
||||
* Get associated manager of this fragment
|
||||
* @param fragment Fragment instance
|
||||
* @return Fragment manager instance
|
||||
*/
|
||||
lv_fragment_manager_t * lv_fragment_get_manager(lv_fragment_t * fragment);
|
||||
|
||||
/**
|
||||
* Get container object of this fragment
|
||||
* @param fragment Fragment instance
|
||||
* @return Reference to container object
|
||||
*/
|
||||
lv_obj_t * const * lv_fragment_get_container(lv_fragment_t * fragment);
|
||||
|
||||
/**
|
||||
* Get parent fragment of this fragment
|
||||
* @param fragment Fragment instance
|
||||
* @return Parent fragment
|
||||
*/
|
||||
lv_fragment_t * lv_fragment_get_parent(lv_fragment_t * fragment);
|
||||
|
||||
/**
|
||||
* Create object by fragment.
|
||||
*
|
||||
* @param fragment Fragment instance.
|
||||
* @param container Container of the objects should be created upon.
|
||||
* @return Created object
|
||||
*/
|
||||
lv_obj_t * lv_fragment_create_obj(lv_fragment_t * fragment, lv_obj_t * container);
|
||||
|
||||
/**
|
||||
* Delete created object of a fragment
|
||||
*
|
||||
* @param fragment Fragment instance.
|
||||
*/
|
||||
void lv_fragment_del_obj(lv_fragment_t * fragment);
|
||||
|
||||
/**
|
||||
* Destroy obj in fragment, and recreate them.
|
||||
* @param fragment Fragment instance
|
||||
*/
|
||||
void lv_fragment_recreate_obj(lv_fragment_t * fragment);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_FRAGMENT*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_FRAGMENT_H*/
|
||||
123
include/liblvgl/extra/others/gridnav/lv_gridnav.h
Normal file
123
include/liblvgl/extra/others/gridnav/lv_gridnav.h
Normal file
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @file lv_templ.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*This typedef exists purely to keep -Wpedantic happy when the file is empty.*/
|
||||
/*It can be removed.*/
|
||||
typedef int _keep_pedantic_happy;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
/**
|
||||
* @file lv_gridnav.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_GRIDFOCUS_H
|
||||
#define LV_GRIDFOCUS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
#if LV_USE_GRIDNAV
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef enum {
|
||||
LV_GRIDNAV_CTRL_NONE = 0x0,
|
||||
|
||||
/**
|
||||
* If there is no next/previous object in a direction,
|
||||
* the focus goes to the object in the next/previous row (on left/right keys)
|
||||
* or first/last row (on up/down keys)
|
||||
*/
|
||||
LV_GRIDNAV_CTRL_ROLLOVER = 0x1,
|
||||
|
||||
/**
|
||||
* If an arrow is pressed and the focused object can be scrolled in that direction
|
||||
* then it will be scrolled instead of going to the next/previous object.
|
||||
* If there is no more room for scrolling the next/previous object will be focused normally */
|
||||
LV_GRIDNAV_CTRL_SCROLL_FIRST = 0x2,
|
||||
|
||||
} lv_gridnav_ctrl_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Add grid navigation feature to an object. It expects the children to be arranged
|
||||
* into a grid-like layout. Although it's not required to have pixel perfect alignment.
|
||||
* This feature makes possible to use keys to navigate among the children and focus them.
|
||||
* The keys other than arrows and press/release related events
|
||||
* are forwarded to the focused child.
|
||||
* @param obj pointer to an object on which navigation should be applied.
|
||||
* @param ctrl control flags from `lv_gridnav_ctrl_t`.
|
||||
*/
|
||||
void lv_gridnav_add(lv_obj_t * obj, lv_gridnav_ctrl_t ctrl);
|
||||
|
||||
/**
|
||||
* Remove the grid navigation support from an object
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_gridnav_remove(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Manually focus an object on gridnav container
|
||||
* @param cont pointer to a gridnav container
|
||||
* @param to_focus pointer to an object to focus
|
||||
* @param anim_en LV_ANIM_ON/OFF
|
||||
*/
|
||||
void lv_gridnav_set_focused(lv_obj_t * cont, lv_obj_t * to_focus, lv_anim_enable_t anim_en);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_GRIDNAV*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_GRIDFOCUS_H*/
|
||||
145
include/liblvgl/extra/others/ime/lv_ime_pinyin.h
Normal file
145
include/liblvgl/extra/others/ime/lv_ime_pinyin.h
Normal file
@ -0,0 +1,145 @@
|
||||
/**
|
||||
* @file lv_ime_pinyin.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_IME_PINYIN_H
|
||||
#define LV_IME_PINYIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
|
||||
#if LV_USE_IME_PINYIN != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_IME_PINYIN_K9_MAX_INPUT 7
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum {
|
||||
LV_IME_PINYIN_MODE_K26,
|
||||
LV_IME_PINYIN_MODE_K9,
|
||||
} lv_ime_pinyin_mode_t;
|
||||
|
||||
/*Data of pinyin_dict*/
|
||||
typedef struct {
|
||||
const char * const py;
|
||||
const char * const py_mb;
|
||||
} lv_pinyin_dict_t;
|
||||
|
||||
/*Data of 9-key input(k9) mode*/
|
||||
typedef struct {
|
||||
char py_str[7];
|
||||
} ime_pinyin_k9_py_str_t;
|
||||
|
||||
/*Data of lv_ime_pinyin*/
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_obj_t * kb;
|
||||
lv_obj_t * cand_panel;
|
||||
lv_pinyin_dict_t * dict;
|
||||
lv_ll_t k9_legal_py_ll;
|
||||
char * cand_str; /* Candidate string */
|
||||
char input_char[16]; /* Input box character */
|
||||
#if LV_IME_PINYIN_USE_K9_MODE
|
||||
char k9_input_str[LV_IME_PINYIN_K9_MAX_INPUT]; /* 9-key input(k9) mode input string */
|
||||
uint16_t k9_py_ll_pos; /* Current pinyin map pages(k9) */
|
||||
uint16_t k9_legal_py_count; /* Count of legal Pinyin numbers(k9) */
|
||||
uint16_t k9_input_str_len; /* 9-key input(k9) mode input string max len */
|
||||
#endif
|
||||
uint16_t ta_count; /* The number of characters entered in the text box this time */
|
||||
uint16_t cand_num; /* Number of candidates */
|
||||
uint16_t py_page; /* Current pinyin map pages(k26) */
|
||||
uint16_t py_num[26]; /* Number and length of Pinyin */
|
||||
uint16_t py_pos[26]; /* Pinyin position */
|
||||
uint8_t mode : 1; /* Set mode, 1: 26-key input(k26), 0: 9-key input(k9). Default: 1. */
|
||||
} lv_ime_pinyin_t;
|
||||
|
||||
/***********************
|
||||
* GLOBAL VARIABLES
|
||||
***********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
lv_obj_t * lv_ime_pinyin_create(lv_obj_t * parent);
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the keyboard of Pinyin input method.
|
||||
* @param obj pointer to a Pinyin input method object
|
||||
* @param dict pointer to a Pinyin input method keyboard
|
||||
*/
|
||||
void lv_ime_pinyin_set_keyboard(lv_obj_t * obj, lv_obj_t * kb);
|
||||
|
||||
/**
|
||||
* Set the dictionary of Pinyin input method.
|
||||
* @param obj pointer to a Pinyin input method object
|
||||
* @param dict pointer to a Pinyin input method dictionary
|
||||
*/
|
||||
void lv_ime_pinyin_set_dict(lv_obj_t * obj, lv_pinyin_dict_t * dict);
|
||||
|
||||
/**
|
||||
* Set mode, 26-key input(k26) or 9-key input(k9).
|
||||
* @param obj pointer to a Pinyin input method object
|
||||
* @param mode the mode from 'lv_ime_pinyin_mode_t'
|
||||
*/
|
||||
void lv_ime_pinyin_set_mode(lv_obj_t * obj, lv_ime_pinyin_mode_t mode);
|
||||
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the dictionary of Pinyin input method.
|
||||
* @param obj pointer to a Pinyin IME object
|
||||
* @return pointer to the Pinyin IME keyboard
|
||||
*/
|
||||
lv_obj_t * lv_ime_pinyin_get_kb(lv_obj_t * obj);
|
||||
|
||||
|
||||
/**
|
||||
* Set the dictionary of Pinyin input method.
|
||||
* @param obj pointer to a Pinyin input method object
|
||||
* @return pointer to the Pinyin input method candidate panel
|
||||
*/
|
||||
lv_obj_t * lv_ime_pinyin_get_cand_panel(lv_obj_t * obj);
|
||||
|
||||
|
||||
/**
|
||||
* Set the dictionary of Pinyin input method.
|
||||
* @param obj pointer to a Pinyin input method object
|
||||
* @return pointer to the Pinyin input method dictionary
|
||||
*/
|
||||
lv_pinyin_dict_t * lv_ime_pinyin_get_dict(lv_obj_t * obj);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_IME_PINYIN*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_USE_IME_PINYIN*/
|
||||
|
||||
|
||||
60
include/liblvgl/extra/others/imgfont/lv_imgfont.h
Normal file
60
include/liblvgl/extra/others/imgfont/lv_imgfont.h
Normal file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @file lv_imgfont.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_IMGFONT_H
|
||||
#define LV_IMGFONT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
|
||||
#if LV_USE_IMGFONT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* gets the image path name of this character */
|
||||
typedef bool (*lv_get_imgfont_path_cb_t)(const lv_font_t * font, void * img_src,
|
||||
uint16_t len, uint32_t unicode, uint32_t unicode_next);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Creates a image font with info parameter specified.
|
||||
* @param height font size
|
||||
* @param path_cb a function to get the image path name of character.
|
||||
* @return pointer to the new imgfont or NULL if create error.
|
||||
*/
|
||||
lv_font_t * lv_imgfont_create(uint16_t height, lv_get_imgfont_path_cb_t path_cb);
|
||||
|
||||
/**
|
||||
* Destroy a image font that has been created.
|
||||
* @param font pointer to image font handle.
|
||||
*/
|
||||
void lv_imgfont_destroy(lv_font_t * font);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_IMGFONT*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /* LV_IMGFONT_H */
|
||||
44
include/liblvgl/extra/others/lv_others.h
Normal file
44
include/liblvgl/extra/others/lv_others.h
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file lv_others.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_OTHERS_H
|
||||
#define LV_OTHERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "snapshot/lv_snapshot.h"
|
||||
#include "monkey/lv_monkey.h"
|
||||
#include "gridnav/lv_gridnav.h"
|
||||
#include "fragment/lv_fragment.h"
|
||||
#include "imgfont/lv_imgfont.h"
|
||||
#include "msg/lv_msg.h"
|
||||
#include "ime/lv_ime_pinyin.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_OTHERS_H*/
|
||||
118
include/liblvgl/extra/others/monkey/lv_monkey.h
Normal file
118
include/liblvgl/extra/others/monkey/lv_monkey.h
Normal file
@ -0,0 +1,118 @@
|
||||
/**
|
||||
* @file lv_monkey.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_MONKEY_H
|
||||
#define LV_MONKEY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
|
||||
#if LV_USE_MONKEY != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
struct _lv_monkey;
|
||||
typedef struct _lv_monkey lv_monkey_t;
|
||||
|
||||
typedef struct {
|
||||
/**< Input device type*/
|
||||
lv_indev_type_t type;
|
||||
|
||||
/**< Monkey execution period*/
|
||||
struct {
|
||||
uint32_t min;
|
||||
uint32_t max;
|
||||
} period_range;
|
||||
|
||||
/**< The range of input value*/
|
||||
struct {
|
||||
int32_t min;
|
||||
int32_t max;
|
||||
} input_range;
|
||||
} lv_monkey_config_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize a monkey config with default values
|
||||
* @param config pointer to 'lv_monkey_config_t' variable to initialize
|
||||
*/
|
||||
void lv_monkey_config_init(lv_monkey_config_t * config);
|
||||
|
||||
/**
|
||||
* Create monkey for test
|
||||
* @param config pointer to 'lv_monkey_config_t' variable
|
||||
* @return pointer to the created monkey
|
||||
*/
|
||||
lv_monkey_t * lv_monkey_create(const lv_monkey_config_t * config);
|
||||
|
||||
/**
|
||||
* Get monkey input device
|
||||
* @param monkey pointer to a monkey
|
||||
* @return pointer to the input device
|
||||
*/
|
||||
lv_indev_t * lv_monkey_get_indev(lv_monkey_t * monkey);
|
||||
|
||||
/**
|
||||
* Enable monkey
|
||||
* @param monkey pointer to a monkey
|
||||
* @param en set to true to enable
|
||||
*/
|
||||
void lv_monkey_set_enable(lv_monkey_t * monkey, bool en);
|
||||
|
||||
/**
|
||||
* Get whether monkey is enabled
|
||||
* @param monkey pointer to a monkey
|
||||
* @return return true if monkey enabled
|
||||
*/
|
||||
bool lv_monkey_get_enable(lv_monkey_t * monkey);
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
|
||||
/**
|
||||
* Set the user_data field of the monkey
|
||||
* @param monkey pointer to a monkey
|
||||
* @param user_data pointer to the new user_data.
|
||||
*/
|
||||
void lv_monkey_set_user_data(lv_monkey_t * monkey, void * user_data);
|
||||
|
||||
/**
|
||||
* Get the user_data field of the monkey
|
||||
* @param monkey pointer to a monkey
|
||||
* @return the pointer to the user_data of the monkey
|
||||
*/
|
||||
void * lv_monkey_get_user_data(lv_monkey_t * monkey);
|
||||
|
||||
#endif/*LV_USE_USER_DATA*/
|
||||
|
||||
/**
|
||||
* Delete monkey
|
||||
* @param monkey pointer to monkey
|
||||
*/
|
||||
void lv_monkey_del(lv_monkey_t * monkey);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_MONKEY*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_MONKEY_H*/
|
||||
124
include/liblvgl/extra/others/msg/lv_msg.h
Normal file
124
include/liblvgl/extra/others/msg/lv_msg.h
Normal file
@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @file lv_msg.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_MSG_H
|
||||
#define LV_MSG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
#if LV_USE_MSG
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
uint32_t id; /*Identifier of the message*/
|
||||
void * user_data; /*Set the the user_data set in `lv_msg_subscribe`*/
|
||||
void * _priv_data; /*Used internally*/
|
||||
const void * payload; /*Pointer to the data of the message*/
|
||||
} lv_msg_t;
|
||||
|
||||
typedef void (*lv_msg_subscribe_cb_t)(void * s, lv_msg_t * msg);
|
||||
|
||||
typedef void (*lv_msg_request_cb_t)(void * r, uint32_t msg_id);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Called internally to initialize the message module
|
||||
*/
|
||||
void lv_msg_init(void);
|
||||
|
||||
/**
|
||||
* Subscribe to an `msg_id`
|
||||
* @param msg_id the message ID to listen to
|
||||
* @param cb callback to call if a message with `msg_id` was sent
|
||||
* @param user_data arbitrary data which will be available in `cb` too
|
||||
* @return pointer to a "subscribe object". It can be used the unsubscribe.
|
||||
*/
|
||||
void * lv_msg_subsribe(uint32_t msg_id, lv_msg_subscribe_cb_t cb, void * user_data);
|
||||
|
||||
/**
|
||||
* Subscribe an `lv_obj` to a message.
|
||||
* `LV_EVENT_MSG_RECEIVED` will be triggered if a message with matching ID was sent
|
||||
* @param msg_id the message ID to listen to
|
||||
* @param obj pointer to an `lv_obj`
|
||||
* @param user_data arbitrary data which will be available in `cb` too
|
||||
* @return pointer to a "subscribe object". It can be used the unsubscribe.
|
||||
*/
|
||||
void * lv_msg_subsribe_obj(uint32_t msg_id, lv_obj_t * obj, void * user_data);
|
||||
|
||||
/**
|
||||
* Cancel a previous subscription
|
||||
* @param s pointer to a "subscibe object".
|
||||
* Return value of `lv_msg_subsribe` or `lv_msg_subsribe_obj`
|
||||
*/
|
||||
void lv_msg_unsubscribe(void * s);
|
||||
|
||||
/**
|
||||
* Send a message with a given ID and payload
|
||||
* @param msg_id ID of the message to send
|
||||
* @param data pointer to the data to send
|
||||
*/
|
||||
void lv_msg_send(uint32_t msg_id, const void * payload);
|
||||
|
||||
/**
|
||||
* Get the ID of a message object. Typically used in the subscriber callback.
|
||||
* @param m pointer to a message object
|
||||
* @return the ID of the message
|
||||
*/
|
||||
uint32_t lv_msg_get_id(lv_msg_t * m);
|
||||
|
||||
/**
|
||||
* Get the payload of a message object. Typically used in the subscriber callback.
|
||||
* @param m pointer to a message object
|
||||
* @return the payload of the message
|
||||
*/
|
||||
const void * lv_msg_get_payload(lv_msg_t * m);
|
||||
|
||||
/**
|
||||
* Get the user data of a message object. Typically used in the subscriber callback.
|
||||
* @param m pointer to a message object
|
||||
* @return the user data of the message
|
||||
*/
|
||||
void * lv_msg_get_user_data(lv_msg_t * m);
|
||||
|
||||
/**
|
||||
* Get the message object from an event object. Can be used in `LV_EVENT_MSG_RECEIVED` events.
|
||||
* @param e pointer to an event object
|
||||
* @return the message object or NULL if called with unrelated event code.
|
||||
*/
|
||||
lv_msg_t * lv_event_get_msg(lv_event_t * e);
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
extern lv_event_code_t LV_EVENT_MSG_RECEIVED;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_MSG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_MSG_H*/
|
||||
84
include/liblvgl/extra/others/snapshot/lv_snapshot.h
Normal file
84
include/liblvgl/extra/others/snapshot/lv_snapshot.h
Normal file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @file lv_snapshot.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_SNAPSHOT_H
|
||||
#define LV_SNAPSHOT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "liblvgl/lv_conf_internal.h"
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_USE_SNAPSHOT
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/** Take snapshot for object with its children.
|
||||
*
|
||||
* @param obj The object to generate snapshot.
|
||||
* @param cf color format for generated image.
|
||||
*
|
||||
* @return a pointer to an image descriptor, or NULL if failed.
|
||||
*/
|
||||
lv_img_dsc_t * lv_snapshot_take(lv_obj_t * obj, lv_img_cf_t cf);
|
||||
|
||||
/** Free the snapshot image returned by @ref lv_snapshot_take
|
||||
*
|
||||
* It will firstly free the data image takes, then the image descriptor.
|
||||
*
|
||||
* @param dsc The image descriptor generated by lv_snapshot_take.
|
||||
*
|
||||
*/
|
||||
void lv_snapshot_free(lv_img_dsc_t * dsc);
|
||||
|
||||
/** Get the buffer needed for object snapshot image.
|
||||
*
|
||||
* @param obj The object to generate snapshot.
|
||||
* @param cf color format for generated image.
|
||||
*
|
||||
* @return the buffer size needed in bytes
|
||||
*/
|
||||
uint32_t lv_snapshot_buf_size_needed(lv_obj_t * obj, lv_img_cf_t cf);
|
||||
|
||||
/** Take snapshot for object with its children, save image info to provided buffer.
|
||||
*
|
||||
* @param obj The object to generate snapshot.
|
||||
* @param cf color format for generated image.
|
||||
* @param dsc image descriptor to store the image result.
|
||||
* @param buff the buffer to store image data.
|
||||
* @param buff_size provided buffer size in bytes.
|
||||
*
|
||||
* @return LV_RES_OK on success, LV_RES_INV on error.
|
||||
*/
|
||||
lv_res_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_img_cf_t cf, lv_img_dsc_t * dsc, void * buf, uint32_t buff_size);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
#endif /*LV_USE_SNAPSHOT*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
55
include/liblvgl/extra/themes/basic/lv_theme_basic.h
Normal file
55
include/liblvgl/extra/themes/basic/lv_theme_basic.h
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @file lv_theme_basic.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_BASIC_H
|
||||
#define LV_THEME_BASIC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
#if LV_USE_THEME_BASIC
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the theme
|
||||
* @param disp pointer to display to attach the theme
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_basic_init(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Check if the theme is initialized
|
||||
* @return true if default theme is initialized, false otherwise
|
||||
*/
|
||||
bool lv_theme_basic_is_inited(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_BASIC_H*/
|
||||
64
include/liblvgl/extra/themes/default/lv_theme_default.h
Normal file
64
include/liblvgl/extra/themes/default/lv_theme_default.h
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @file lv_theme_default.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEME_DEFAULT_H
|
||||
#define LV_THEME_DEFAULT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the theme
|
||||
* @param color_primary the primary color of the theme
|
||||
* @param color_secondary the secondary color for the theme
|
||||
* @param font pointer to a font to use.
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark,
|
||||
const lv_font_t * font);
|
||||
|
||||
/**
|
||||
* Get default theme
|
||||
* @return a pointer to default theme, or NULL if this is not initialized
|
||||
*/
|
||||
lv_theme_t * lv_theme_default_get(void);
|
||||
|
||||
/**
|
||||
* Check if default theme is initialized
|
||||
* @return true if default theme is initialized, false otherwise
|
||||
*/
|
||||
bool lv_theme_default_is_inited(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_DEFAULT_H*/
|
||||
40
include/liblvgl/extra/themes/lv_themes.h
Normal file
40
include/liblvgl/extra/themes/lv_themes.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @file lv_themes.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_THEMES_H
|
||||
#define LV_THEMES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "default/lv_theme_default.h"
|
||||
#include "mono/lv_theme_mono.h"
|
||||
#include "basic/lv_theme_basic.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEMES_H*/
|
||||
57
include/liblvgl/extra/themes/mono/lv_theme_mono.h
Normal file
57
include/liblvgl/extra/themes/mono/lv_theme_mono.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @file lv_theme_mono.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_USE_THEME_MONO_H
|
||||
#define LV_USE_THEME_MONO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
|
||||
#if LV_USE_THEME_MONO
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the theme
|
||||
* @param color_primary the primary color of the theme
|
||||
* @param color_secondary the secondary color for the theme
|
||||
* @param font pointer to a font to use.
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_mono_init(lv_disp_t * disp, bool dark_bg, const lv_font_t * font);
|
||||
|
||||
/**
|
||||
* Check if the theme is initialized
|
||||
* @return true if default theme is initialized, false otherwise
|
||||
*/
|
||||
bool lv_theme_mono_is_inited(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_USE_THEME_MONO_H*/
|
||||
103
include/liblvgl/extra/widgets/animimg/lv_animimg.h
Normal file
103
include/liblvgl/extra/widgets/animimg/lv_animimg.h
Normal file
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* @file lv_animimg.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_ANIM_IMG_H
|
||||
#define LV_ANIM_IMG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/lvgl.h"
|
||||
|
||||
#if LV_USE_ANIMIMG != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if LV_USE_IMG == 0
|
||||
#error "lv_animimg: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1)"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
extern const lv_obj_class_t lv_animimg_class;
|
||||
|
||||
/*Data of image*/
|
||||
typedef struct {
|
||||
lv_img_t img;
|
||||
lv_anim_t anim;
|
||||
/*picture sequence */
|
||||
lv_img_dsc_t ** dsc;
|
||||
int8_t pic_count;
|
||||
} lv_animimg_t;
|
||||
|
||||
|
||||
/*Image parts*/
|
||||
enum {
|
||||
LV_ANIM_IMG_PART_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_animimg_part_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create an animation image objects
|
||||
* @param parent pointer to an object, it will be the parent of the new button
|
||||
* @return pointer to the created animation image object
|
||||
*/
|
||||
lv_obj_t * lv_animimg_create(lv_obj_t * parent);
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the image animation images source.
|
||||
* @param img pointer to an animation image object
|
||||
* @param dsc pointer to a series images
|
||||
* @param num images' number
|
||||
*/
|
||||
void lv_animimg_set_src(lv_obj_t * img, lv_img_dsc_t * dsc[], uint8_t num);
|
||||
|
||||
/**
|
||||
* Startup the image animation.
|
||||
* @param obj pointer to an animation image object
|
||||
*/
|
||||
void lv_animimg_start(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set the image animation duration time. unit:ms
|
||||
* @param img pointer to an animation image object
|
||||
*/
|
||||
void lv_animimg_set_duration(lv_obj_t * img, uint32_t duration);
|
||||
|
||||
/**
|
||||
* Set the image animation reapeatly play times.
|
||||
* @param img pointer to an animation image object
|
||||
* @param count the number of times to repeat the animation
|
||||
*/
|
||||
void lv_animimg_set_repeat_count(lv_obj_t * img, uint16_t count);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
#endif /*LV_USE_ANIMIMG*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_ANIM_IMG_H*/
|
||||
164
include/liblvgl/extra/widgets/calendar/lv_calendar.h
Normal file
164
include/liblvgl/extra/widgets/calendar/lv_calendar.h
Normal file
@ -0,0 +1,164 @@
|
||||
/**
|
||||
* @file lv_calendar.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_CALENDAR_H
|
||||
#define LV_CALENDAR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/widgets/lv_btnmatrix.h"
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Represents a date on the calendar object (platform-agnostic).
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t year;
|
||||
int8_t month; /** 1..12*/
|
||||
int8_t day; /** 1..31*/
|
||||
} lv_calendar_date_t;
|
||||
|
||||
/*Data of calendar*/
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_obj_t * btnm;
|
||||
/*New data for this type*/
|
||||
lv_calendar_date_t today; /*Date of today*/
|
||||
lv_calendar_date_t showed_date; /*Currently visible month (day is ignored)*/
|
||||
lv_calendar_date_t *
|
||||
highlighted_dates; /*Apply different style on these days (pointer to an array defined by the user)*/
|
||||
uint16_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/
|
||||
const char * map[8 * 7];
|
||||
char nums [7 * 6][4];
|
||||
} lv_calendar_t;
|
||||
|
||||
extern const lv_obj_class_t lv_calendar_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
lv_obj_t * lv_calendar_create(lv_obj_t * parent);
|
||||
|
||||
/*======================
|
||||
* Add/remove functions
|
||||
*=====================*/
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the today's date
|
||||
* @param obj pointer to a calendar object
|
||||
* @param year today's year
|
||||
* @param month today's month [1..12]
|
||||
* @param day today's day [1..31]
|
||||
*/
|
||||
void lv_calendar_set_today_date(lv_obj_t * obj, uint32_t year, uint32_t month, uint32_t day);
|
||||
|
||||
/**
|
||||
* Set the currently showed
|
||||
* @param obj pointer to a calendar object
|
||||
* @param year today's year
|
||||
* @param month today's month [1..12]
|
||||
*/
|
||||
void lv_calendar_set_showed_date(lv_obj_t * obj, uint32_t year, uint32_t month);
|
||||
|
||||
/**
|
||||
* Set the highlighted dates
|
||||
* @param obj pointer to a calendar object
|
||||
* @param highlighted pointer to an `lv_calendar_date_t` array containing the dates.
|
||||
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
|
||||
* @param date_num number of dates in the array
|
||||
*/
|
||||
void lv_calendar_set_highlighted_dates(lv_obj_t * obj, lv_calendar_date_t highlighted[], uint16_t date_num);
|
||||
|
||||
/**
|
||||
* Set the name of the days
|
||||
* @param obj pointer to a calendar object
|
||||
* @param day_names pointer to an array with the names.
|
||||
* E.g. `const char * days[7] = {"Sun", "Mon", ...}`
|
||||
* Only the pointer will be saved so this variable can't be local which will be destroyed later.
|
||||
*/
|
||||
void lv_calendar_set_day_names(lv_obj_t * obj, const char ** day_names);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the button matrix object of the calendar.
|
||||
* It shows the dates and day names.
|
||||
* @param obj pointer to a calendar object
|
||||
* @return pointer to a the button matrix
|
||||
*/
|
||||
lv_obj_t * lv_calendar_get_btnmatrix(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the today's date
|
||||
* @param calendar pointer to a calendar object
|
||||
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
|
||||
*/
|
||||
const lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar);
|
||||
|
||||
/**
|
||||
* Get the currently showed
|
||||
* @param calendar pointer to a calendar object
|
||||
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
|
||||
*/
|
||||
const lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
|
||||
|
||||
/**
|
||||
* Get the highlighted dates
|
||||
* @param calendar pointer to a calendar object
|
||||
* @return pointer to an `lv_calendar_date_t` array containing the dates.
|
||||
*/
|
||||
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar);
|
||||
|
||||
/**
|
||||
* Get the number of the highlighted dates
|
||||
* @param calendar pointer to a calendar object
|
||||
* @return number of highlighted days
|
||||
*/
|
||||
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar);
|
||||
|
||||
/**
|
||||
* Get the currently pressed day
|
||||
* @param calendar pointer to a calendar object
|
||||
* @param date store the pressed date here
|
||||
* @return LV_RES_OK: there is a valid pressed date; LV_RES_INV: there is no pressed data
|
||||
*/
|
||||
lv_res_t lv_calendar_get_pressed_date(const lv_obj_t * calendar, lv_calendar_date_t * date);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_CALENDAR*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_CALENDAR_H*/
|
||||
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file lv_calendar_header_arrow.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_CALENDAR_HEADER_ARROW_H
|
||||
#define LV_CALENDAR_HEADER_ARROW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "liblvgl/core/lv_obj.h"
|
||||
#if LV_USE_CALENDAR_HEADER_ARROW
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
extern const lv_obj_class_t lv_calendar_header_arrow_class;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a calendar header with drop-drowns to select the year and month
|
||||
* @param parent pointer to a calendar object.
|
||||
* @return the created header
|
||||
*/
|
||||
lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_CALENDAR_HEADER_ARROW*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_CALENDAR_HEADER_ARROW_H*/
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user