23 #if defined(VG_FEATURE_PATH) && defined(VG_FEATURE_PATH_DUAL_ARRAY) && (VG_FEATURE_PATH == VG_FEATURE_PATH_DUAL_ARRAY)
34 #include <LLVG_PATH_impl.h>
51 static int32_t _extend_path(
VG_PATH_HEADER_t *path, jint array_length, VG_path_command_t cmd, uint32_t nb_params) {
53 (path->cmd_length *
sizeof(VG_path_command_t));
58 if (required_size > array_length) {
59 ret = array_length - required_size;
65 ((uint8_t *)VG_PATH_get_path_param_end(path)) + (nb_params *
sizeof(VG_path_param_t)) >
66 (uint8_t *)VG_PATH_get_path_command_begin(path)
67 || ((uint8_t *)VG_PATH_get_path_command_end(path)) +
sizeof(VG_path_command_t) >
68 ((uint8_t *)path) + array_length
71 sizeof(VG_path_command_t));
73 (void)memmove(((uint8_t *)VG_PATH_get_path_param_begin(path)) + new_cmd_offset,
74 VG_PATH_get_path_command_begin(path), path->cmd_length *
sizeof(VG_path_command_t));
75 path->cmd_offset = new_cmd_offset;
83 static int32_t _close_path(
VG_PATH_HEADER_t *path, jint length, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
84 int32_t index = _extend_path(path, length, LLVG_PATH_CMD_CLOSE, 0);
85 int32_t ret = LLVG_SUCCESS;
117 return (1u *
sizeof(VG_path_command_t)) + (nbParams *
sizeof(VG_path_param_t));
128 path->cmd_length += 1u;
141 VG_path_param_t *param_ptr = VG_PATH_get_path_param_end(path);
145 path->cmd_length += 1u;
146 path->param_length += 2u;
153 jfloat y1, jfloat x2, jfloat y2) {
159 VG_path_param_t *param_ptr = VG_PATH_get_path_param_end(path);
165 path->cmd_length += 1u;
166 path->param_length += 4u;
173 jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
179 VG_path_param_t *param_ptr = VG_PATH_get_path_param_end(path);
187 path->cmd_length += 1u;
188 path->param_length += 6u;
198 jint LLVG_PATH_IMPL_initializePath(jbyte *jpath, jint length) {
201 jint ret = LLVG_SUCCESS;
203 if (length >= header_size) {
204 path->cmd_length = 0;
205 path->param_length = 0;
206 path->cmd_offset = 0;
217 jint LLVG_PATH_IMPL_appendPathCommand1(jbyte *jpath, jint length, jint cmd, jfloat x, jfloat y) {
219 jint ret = LLVG_SUCCESS;
221 int32_t index = _extend_path(path, length, cmd, 2);
233 jint LLVG_PATH_IMPL_appendPathCommand2(jbyte *jpath, jint length, jint cmd, jfloat x1, jfloat y1, jfloat x2,
236 jint ret = LLVG_SUCCESS;
238 if (LLVG_PATH_CMD_CLOSE == cmd) {
240 ret = _close_path(path, length, x1, y1, x2, y2);
242 int32_t index = _extend_path(path, length, cmd, 4);
255 jint LLVG_PATH_IMPL_appendPathCommand3(jbyte *jpath, jint length, jint cmd, jfloat x1, jfloat y1, jfloat x2, jfloat y2,
256 jfloat x3, jfloat y3) {
258 jint ret = LLVG_SUCCESS;
260 int32_t index = _extend_path(path, length, cmd, 6);
272 void LLVG_PATH_IMPL_reopenPath(jbyte *jpath) {
274 path->cmd_length -= 1u;
Map a jbyte array that represents a path.
MicroEJ MicroVG library low level API: enable some features according to the hardware capacities.
MicroEJ MicroVG library low level API: helper to implement library natives methods.
MicroEJ MicroVG library low level API: implementation of Path.
uint32_t VG_PATH_append_path_command1(jbyte *path, jint array_length, jint cmd, jfloat x, jfloat y)
Appends the command with 1 point parameter in the path's array.
void VG_PATH_initialize(void)
Initializes the path builder.
uint32_t VG_PATH_append_path_command0(jbyte *path, jint array_length, jint cmd)
Appends the command with zero parameter in the path's array.
uint32_t VG_PATH_append_path_command3(jbyte *path, jint array_length, jint cmd, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3)
Appends the command with 3 points parameter in the path's array.
uint32_t VG_PATH_convert_path_command(jint command)
Converts the command in destination format.
uint32_t VG_PATH_append_path_command2(jbyte *path, jint array_length, jint cmd, jfloat x1, jfloat y1, jfloat x2, jfloat y2)
Appends the command with 2 points parameter in the path's array.
struct MICROVG_PATH_HEADER VG_PATH_HEADER_t
Map a jbyte array that represents a path.
uint32_t VG_PATH_get_path_command_size(jint command, uint32_t nbParams)
Gets the size to add in the path array to encode the command and its parameters.
uint32_t VG_PATH_get_path_header_size(void)
Gets the path's array header size.
uint8_t VG_PATH_get_path_encoder_format(void)
Gets the path's array format used to encode the commands and parameters. This format is stored into t...