microvg  2.1.0
microvg
Macros | Functions
microvg_helper.h File Reference

MicroEJ MicroVG library low level API: helper to implement library natives methods. More...

#include <stdio.h>
#include <sni.h>
#include "mej_log.h"

Go to the source code of this file.

Macros

#define MEJ_LOG_INFO_MICROVG(fmt, ...)
 
#define MEJ_LOG_ERROR_MICROVG(fmt, ...)   MEJ_LOG(ERROR,MICROVG,fmt, ##__VA_ARGS__ )
 
#define MICROVG_HELPER_NULL_GRADIENT   0
 Set this define to monitor freetype heap evolution. It needs MEJ_LOG_MICROVG and MEJ_LOG_INFO_LEVEL defines to print the heap logs. More...
 
#define FT_FACE_FLAG_COMPLEX_LAYOUT   (((uint32_t)1) << 31)
 Freetype supplementary flag for complex layout Uses a free bit in freetype face flags to convey the complex layout mode information with the freetype face. freetype.h must be checked on freetype update to ensure that this bit is still free.
 
#define M_PI   3.1415926535
 
#define RAD_TO_DEG(r)   ((r) * (180.0f / M_PI))
 
#define DEG_TO_RAD(d)   (((d) * M_PI) / 180.0f)
 
#define JFLOAT_TO_UINT32_t(f)   (*(uint32_t*)&(f))
 
#define UINT32_t_TO_JFLOAT(i)   (*(float*)&(i))
 

Functions

void MICROVG_HELPER_initialize (void)
 
int MICROVG_HELPER_get_utf (unsigned short *text, int length, int *offset)
 Gets the next UTF character from a text buffer. More...
 
void MICROVG_HELPER_layout_configure (int faceHandle, unsigned short *text, int length)
 
bool MICROVG_HELPER_layout_load_glyph (int *glyph_idx, int *x_advance, int *y_advance, int *x_offset, int *y_offset)
 
jfloat * MICROVG_HELPER_check_matrix (jfloat *matrix)
 
uint32_t MICROVG_HELPER_apply_alpha (uint32_t color, uint32_t alpha)
 

Detailed Description

MicroEJ MicroVG library low level API: helper to implement library natives methods.

Author
MicroEJ Developer Team
Version
2.1.0

Definition in file microvg_helper.h.

Macro Definition Documentation

§ MICROVG_HELPER_NULL_GRADIENT

#define MICROVG_HELPER_NULL_GRADIENT   0

Set this define to monitor freetype heap evolution. It needs MEJ_LOG_MICROVG and MEJ_LOG_INFO_LEVEL defines to print the heap logs.

NULL Gradient value

Definition at line 58 of file microvg_helper.h.

Function Documentation

§ MICROVG_HELPER_get_utf()

int MICROVG_HELPER_get_utf ( unsigned short *  text,
int  length,
int *  offset 
)

Gets the next UTF character from a text buffer.

Parameters
[in]texttext buffer encoded in UTF16 where to read UTF character.
[in]lengthlenght of the text buffer.

Definition at line 101 of file microvg_helper.c.

101  {
102 
103  unsigned short highPart = GET_NEXT_CHARACTER(textCharRam, length, *offset);
104  int ret;
105 
106  if (((highPart >= MIN_HIGH_SURROGATE) && (highPart <= MAX_HIGH_SURROGATE))
107  && (*offset < (length - 1))) {
108 
109  unsigned short lowPart = GET_NEXT_CHARACTER(textCharRam, length, *(offset) + 1);
110 
111  if ((lowPart >= MIN_LOW_SURROGATE) && (lowPart <= MAX_LOW_SURROGATE)) {
112  *offset += 2;
113 
114  ret = 0;
115  ret += ((int)highPart - (int)MIN_HIGH_SURROGATE);
116  ret <<= (int)10;
117  ret += ((int)lowPart - (int)MIN_LOW_SURROGATE);
118  ret += (int)MIN_SUPPLEMENTARY_CODE_POINT;
119  }
120  }
121  else {
122  *offset += 1;
123 
124  // standard character or missing low part
125  ret = 0x0000FFFF & (int)highPart;
126  }
127 
128  return ret;
129 }
#define MIN_HIGH_SURROGATE