Gradient
Principle
The Gradient module contains the C part of the MicroVG implementation, which manages linear gradients. This module is composed of only one element: an implementation of the Abstraction Layer APIs to create gradient elements compatible with the hardware.
Functional Description
The Gradient module implements the framework of the MicroVG LinearGradient. It provides Abstraction Layer APIs that consist in creating a linear gradient in a VEE Port-specific format. After the gradient creation and encoding, the gradient data should not change when the application draws it: the encoded format should be used by the VEE Port-specific implementation (generally GPU).
A linear gradient is a succession of colors at different positions. The colors from the MicroVG library implementation are encoded in the 32-bit format: ARGB8888. The color encoding in the gradient is a VEE Port-specific implementation.
The buffer where the gradient is encoded is stored in the Java heap. The MicroVG implementation on demand automatically increases the buffer size.
Abstraction Layer API
There are two separate Abstraction Layer API header files (see LLVG_GRADIENT: Vector Linear Gradient):
LLVG_GRADIENT_impl.h
specifies the Abstraction Layer APIs used to create and encode the gradient.LLVG_PAINTER_impl.h
lists the Abstraction Layer APIs called by VectorGraphicsPainter to draw the path.
MicroVG library calls the BSP functions through the header files
LLVG_GRADIENT_impl.h
andLLVG_PAINTER_impl.h
.The C module MicroVG provides an implementation of
LLVG_PAINTER_impl.c
that synchronizes the drawing with the MicroUI Graphics Engine and redirects the drawing itself to a third-party drawer throughvg_drawing.h
..A C module dedicated to a GPU provides an implementation of this drawer (
vg_drawing_gpu.c
) that implements the drawings over the GPU library.This dedicated GPU C module provides an implementation of
LLVG_GRADIENT_impl.h
(LLVG_GRADIENT_impl_gpu.c
) that encodes the gradient.These files are automatically copied in the BSP project when fetching the C modules during the VEE Port build.
Use
The MicroVG Gradient APIs are available in the class ej.microvg.
LinearGradient.