CARPLAY版本整理
This commit is contained in:
59
MXC_A27-PCB4.5-270T/app/pointer_halo/app.h
Normal file
59
MXC_A27-PCB4.5-270T/app/pointer_halo/app.h
Normal file
@ -0,0 +1,59 @@
|
||||
//****************************************************************************
|
||||
//
|
||||
// Copyright (C) 2010 ShenZhen ExceedSpace
|
||||
//
|
||||
// Author ZhuoYongHong
|
||||
//
|
||||
// File name: app.h
|
||||
// D3<44>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
//
|
||||
// Revision history
|
||||
//
|
||||
// 2010.09.06 ZhuoYongHong Initial version
|
||||
//
|
||||
//****************************************************************************
|
||||
|
||||
#ifndef _XSPACE_APP_H_
|
||||
#define _XSPACE_APP_H_
|
||||
|
||||
#include <xm_user.h>
|
||||
#include <xm_base.h>
|
||||
#include <xm_key.h>
|
||||
#include <xm_assert.h>
|
||||
#include <xm_printf.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define XMTIMER_DESKTOPVIEW 1 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)<29>µĶ<C2B5>ʱ<EFBFBD><CAB1>, <20><><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD>ָ<EFBFBD><D6B8>ˢ<EFBFBD><CBA2>
|
||||
#define XMTIMER_CIRCULAR_POINTER_VIEW 2 // <20><>״ָ<D7B4><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<C2B5>ʱ<EFBFBD><CAB1>, <20><><EFBFBD>ڻ<EFBFBD>״ָ<D7B4><D6B8>ˢ<EFBFBD><CBA2>
|
||||
#define XMTIMER_CLOCK_VIEW 3 // ʱ<>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD>µĶ<C2B5>ʱ<EFBFBD><CAB1>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>)<29><>ͼ
|
||||
XMHWND_DECLARE(Desktop)
|
||||
|
||||
// <20><>״ָ<D7B4><D6B8><EFBFBD><EFBFBD>ͼ
|
||||
XMHWND_DECLARE(CircularPointer)
|
||||
|
||||
// ʱ<><CAB1><EFBFBD><EFBFBD>ͼ
|
||||
XMHWND_DECLARE(ClockView)
|
||||
|
||||
|
||||
|
||||
|
||||
void AppInit (void);
|
||||
void AppExit (void);
|
||||
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif /* end of __cplusplus */
|
||||
|
||||
#endif // #ifndef _XSPACE_APP_H_w
|
303
MXC_A27-PCB4.5-270T/app/pointer_halo/arial_font.c
Normal file
303
MXC_A27-PCB4.5-270T/app/pointer_halo/arial_font.c
Normal file
@ -0,0 +1,303 @@
|
||||
#include "vg_font.h"
|
||||
|
||||
#if defined(VG_DRIVER) && !defined(VG_ONLY)
|
||||
|
||||
// font (arial), total glyph (10)
|
||||
static const VGubyte arial_glyph48_commands[] = {
|
||||
VG_MOVE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH, VG_MOVE_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH
|
||||
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph48_coordinates[] = {
|
||||
0.041504f, 0.353027f, 0.041504f, 0.479980f, 0.067383f, 0.557129f, 0.093750f, 0.634766f,
|
||||
0.145020f, 0.676758f, 0.196777f, 0.718750f, 0.274902f, 0.718750f, 0.332520f, 0.718750f,
|
||||
0.375977f, 0.695313f, 0.419434f, 0.672363f, 0.447754f, 0.628418f, 0.476074f, 0.584961f,
|
||||
0.492188f, 0.521973f, 0.508301f, 0.459473f, 0.508301f, 0.353027f, 0.508301f, 0.227051f,
|
||||
0.482422f, 0.149414f, 0.456543f, 0.072266f, 0.404785f, 0.029785f, 0.353516f, -0.012207f,
|
||||
0.274902f, -0.012207f, 0.171387f, -0.012207f, 0.112305f, 0.062012f, 0.041504f, 0.151367f,
|
||||
0.041504f, 0.353027f, 0.131836f, 0.353027f, 0.131836f, 0.176758f, 0.172852f, 0.118164f,
|
||||
0.214355f, 0.060059f, 0.274902f, 0.060059f, 0.335449f, 0.060059f, 0.376465f, 0.118652f,
|
||||
0.417969f, 0.177246f, 0.417969f, 0.353027f, 0.417969f, 0.529785f, 0.376465f, 0.587891f,
|
||||
0.335449f, 0.645996f, 0.273926f, 0.645996f, 0.213379f, 0.645996f, 0.177246f, 0.594727f,
|
||||
0.131836f, 0.529297f, 0.131836f, 0.353027f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph49_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_LINE_TO, VG_LINE_TO, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph49_coordinates[] = {
|
||||
0.372559f, 0.000000f, 0.284668f, 0.000000f, 0.284668f, 0.560059f, 0.252930f, 0.529785f,
|
||||
0.201172f, 0.499512f, 0.149902f, 0.469238f, 0.108887f, 0.454102f, 0.108887f, 0.539063f,
|
||||
0.182617f, 0.573730f, 0.237793f, 0.623047f, 0.292969f, 0.672363f, 0.315918f, 0.718750f,
|
||||
0.372559f, 0.718750f, 0.372559f, 0.000000f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph50_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_LINE_TO, VG_CLOSE_PATH
|
||||
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph50_coordinates[] = {
|
||||
0.503418f, 0.084473f, 0.503418f, 0.000000f, 0.030273f, 0.000000f, 0.029297f, 0.031738f,
|
||||
0.040527f, 0.061035f, 0.058594f, 0.109375f, 0.098145f, 0.156250f, 0.138184f, 0.203125f,
|
||||
0.213379f, 0.264648f, 0.330078f, 0.360352f, 0.371094f, 0.416016f, 0.412109f, 0.472168f,
|
||||
0.412109f, 0.521973f, 0.412109f, 0.574219f, 0.374512f, 0.609863f, 0.337402f, 0.645996f,
|
||||
0.277344f, 0.645996f, 0.213867f, 0.645996f, 0.175781f, 0.607910f, 0.137695f, 0.569824f,
|
||||
0.137207f, 0.502441f, 0.046875f, 0.511719f, 0.056152f, 0.612793f, 0.116699f, 0.665527f,
|
||||
0.177246f, 0.718750f, 0.279297f, 0.718750f, 0.382324f, 0.718750f, 0.442383f, 0.661621f,
|
||||
0.502441f, 0.604492f, 0.502441f, 0.520020f, 0.502441f, 0.477051f, 0.484863f, 0.435547f,
|
||||
0.467285f, 0.394043f, 0.426270f, 0.348145f, 0.385742f, 0.302246f, 0.291016f, 0.222168f,
|
||||
0.211914f, 0.155762f, 0.189453f, 0.131836f, 0.166992f, 0.108398f, 0.152344f, 0.084473f,
|
||||
0.503418f, 0.084473f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph51_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH
|
||||
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph51_coordinates[] = {
|
||||
0.041992f, 0.188965f, 0.129883f, 0.200684f, 0.145020f, 0.125977f, 0.181152f, 0.092773f,
|
||||
0.217773f, 0.060059f, 0.270020f, 0.060059f, 0.332031f, 0.060059f, 0.374512f, 0.103027f,
|
||||
0.417480f, 0.145996f, 0.417480f, 0.209473f, 0.417480f, 0.270020f, 0.377930f, 0.309082f,
|
||||
0.338379f, 0.348633f, 0.277344f, 0.348633f, 0.252441f, 0.348633f, 0.215332f, 0.338867f,
|
||||
0.225098f, 0.416016f, 0.233887f, 0.415039f, 0.239258f, 0.415039f, 0.295410f, 0.415039f,
|
||||
0.340332f, 0.444336f, 0.385254f, 0.473633f, 0.385254f, 0.534668f, 0.385254f, 0.583008f,
|
||||
0.352539f, 0.614746f, 0.319824f, 0.646484f, 0.268066f, 0.646484f, 0.216797f, 0.646484f,
|
||||
0.182617f, 0.614258f, 0.148438f, 0.582031f, 0.138672f, 0.517578f, 0.050781f, 0.533203f,
|
||||
0.066895f, 0.621582f, 0.124023f, 0.669922f, 0.181152f, 0.718750f, 0.266113f, 0.718750f,
|
||||
0.324707f, 0.718750f, 0.374023f, 0.693359f, 0.423340f, 0.668457f, 0.449219f, 0.625000f,
|
||||
0.475586f, 0.581543f, 0.475586f, 0.532715f, 0.475586f, 0.486328f, 0.450684f, 0.448242f,
|
||||
0.425781f, 0.410156f, 0.376953f, 0.387695f, 0.440430f, 0.373047f, 0.475586f, 0.326660f,
|
||||
0.510742f, 0.280762f, 0.510742f, 0.211426f, 0.510742f, 0.117676f, 0.442383f, 0.052246f,
|
||||
0.374023f, -0.012695f, 0.269531f, -0.012695f, 0.175293f, -0.012695f, 0.112793f, 0.043457f,
|
||||
0.050781f, 0.099609f, 0.041992f, 0.188965f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph52_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO,
|
||||
VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_CLOSE_PATH, VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO,
|
||||
VG_LINE_TO, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph52_coordinates[] = {
|
||||
0.323242f, 0.000000f, 0.323242f, 0.171387f, 0.012695f, 0.171387f, 0.012695f, 0.251953f,
|
||||
0.339355f, 0.715820f, 0.411133f, 0.715820f, 0.411133f, 0.251953f, 0.507813f, 0.251953f,
|
||||
0.507813f, 0.171387f, 0.411133f, 0.171387f, 0.411133f, 0.000000f, 0.323242f, 0.000000f,
|
||||
0.323242f, 0.251953f, 0.323242f, 0.574707f, 0.099121f, 0.251953f, 0.323242f, 0.251953f
|
||||
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph53_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH
|
||||
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph53_coordinates[] = {
|
||||
0.041504f, 0.187500f, 0.133789f, 0.195313f, 0.144043f, 0.127930f, 0.181152f, 0.093750f,
|
||||
0.218750f, 0.060059f, 0.271484f, 0.060059f, 0.334961f, 0.060059f, 0.378906f, 0.107910f,
|
||||
0.422852f, 0.155762f, 0.422852f, 0.234863f, 0.422852f, 0.310059f, 0.380371f, 0.353516f,
|
||||
0.338379f, 0.396973f, 0.270020f, 0.396973f, 0.227539f, 0.396973f, 0.193359f, 0.377441f,
|
||||
0.159180f, 0.358398f, 0.139648f, 0.327637f, 0.057129f, 0.338379f, 0.126465f, 0.706055f,
|
||||
0.482422f, 0.706055f, 0.482422f, 0.622070f, 0.196777f, 0.622070f, 0.158203f, 0.429688f,
|
||||
0.222656f, 0.474609f, 0.293457f, 0.474609f, 0.387207f, 0.474609f, 0.451660f, 0.409668f,
|
||||
0.516113f, 0.344727f, 0.516113f, 0.242676f, 0.516113f, 0.145508f, 0.459473f, 0.074707f,
|
||||
0.390625f, -0.012207f, 0.271484f, -0.012207f, 0.173828f, -0.012207f, 0.111816f, 0.042480f,
|
||||
0.050293f, 0.097168f, 0.041504f, 0.187500f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph54_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH, VG_MOVE_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH
|
||||
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph54_coordinates[] = {
|
||||
0.497559f, 0.540527f, 0.410156f, 0.533691f, 0.398438f, 0.585449f, 0.376953f, 0.608887f,
|
||||
0.341309f, 0.646484f, 0.289063f, 0.646484f, 0.247070f, 0.646484f, 0.215332f, 0.623047f,
|
||||
0.173828f, 0.592773f, 0.149902f, 0.534668f, 0.125977f, 0.476563f, 0.125000f, 0.369141f,
|
||||
0.156738f, 0.417480f, 0.202637f, 0.440918f, 0.248535f, 0.464355f, 0.298828f, 0.464355f,
|
||||
0.386719f, 0.464355f, 0.448242f, 0.399414f, 0.510254f, 0.334961f, 0.510254f, 0.232422f,
|
||||
0.510254f, 0.165039f, 0.480957f, 0.106934f, 0.452148f, 0.049316f, 0.401367f, 0.018555f,
|
||||
0.350586f, -0.012207f, 0.286133f, -0.012207f, 0.176270f, -0.012207f, 0.106934f, 0.068359f,
|
||||
0.037598f, 0.149414f, 0.037598f, 0.334961f, 0.037598f, 0.542480f, 0.114258f, 0.636719f,
|
||||
0.181152f, 0.718750f, 0.294434f, 0.718750f, 0.378906f, 0.718750f, 0.432617f, 0.671387f,
|
||||
0.486816f, 0.624023f, 0.497559f, 0.540527f, 0.138672f, 0.231934f, 0.138672f, 0.186523f,
|
||||
0.157715f, 0.145020f, 0.177246f, 0.103516f, 0.211914f, 0.081543f, 0.246582f, 0.060059f,
|
||||
0.284668f, 0.060059f, 0.340332f, 0.060059f, 0.380371f, 0.104980f, 0.420410f, 0.149902f,
|
||||
0.420410f, 0.227051f, 0.420410f, 0.301270f, 0.380859f, 0.343750f, 0.341309f, 0.386719f,
|
||||
0.281250f, 0.386719f, 0.221680f, 0.386719f, 0.180176f, 0.343750f, 0.138672f, 0.301270f,
|
||||
0.138672f, 0.231934f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph55_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_LINE_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_LINE_TO, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph55_coordinates[] = {
|
||||
0.047363f, 0.622070f, 0.047363f, 0.706543f, 0.510742f, 0.706543f, 0.510742f, 0.638184f,
|
||||
0.442383f, 0.565430f, 0.375000f, 0.444824f, 0.308105f, 0.324219f, 0.271484f, 0.196777f,
|
||||
0.245117f, 0.106934f, 0.237793f, 0.000000f, 0.147461f, 0.000000f, 0.148926f, 0.084473f,
|
||||
0.180664f, 0.204102f, 0.212402f, 0.323730f, 0.271484f, 0.434570f, 0.331055f, 0.545898f,
|
||||
0.397949f, 0.622070f, 0.047363f, 0.622070f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph56_commands[] = {
|
||||
VG_MOVE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_CLOSE_PATH, VG_MOVE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH, VG_MOVE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph56_coordinates[] = {
|
||||
0.176758f, 0.388184f, 0.122070f, 0.408203f, 0.095703f, 0.445313f, 0.069336f, 0.482422f,
|
||||
0.069336f, 0.534180f, 0.069336f, 0.612305f, 0.125488f, 0.665527f, 0.181641f, 0.718750f,
|
||||
0.274902f, 0.718750f, 0.368652f, 0.718750f, 0.425781f, 0.664063f, 0.482910f, 0.609863f,
|
||||
0.482910f, 0.531738f, 0.482910f, 0.481934f, 0.456543f, 0.444824f, 0.430664f, 0.408203f,
|
||||
0.377441f, 0.388184f, 0.443359f, 0.366699f, 0.477539f, 0.318848f, 0.512207f, 0.270996f,
|
||||
0.512207f, 0.204590f, 0.512207f, 0.112793f, 0.447266f, 0.050293f, 0.382324f, -0.012207f,
|
||||
0.276367f, -0.012207f, 0.170410f, -0.012207f, 0.105469f, 0.050293f, 0.040527f, 0.113281f,
|
||||
0.040527f, 0.207031f, 0.040527f, 0.276855f, 0.075684f, 0.323730f, 0.111328f, 0.371094f,
|
||||
0.176758f, 0.388184f, 0.159180f, 0.537109f, 0.159180f, 0.486328f, 0.191895f, 0.454102f,
|
||||
0.224609f, 0.421875f, 0.276855f, 0.421875f, 0.327637f, 0.421875f, 0.359863f, 0.453613f,
|
||||
0.392578f, 0.485840f, 0.392578f, 0.532227f, 0.392578f, 0.580566f, 0.358887f, 0.613281f,
|
||||
0.325684f, 0.646484f, 0.275879f, 0.646484f, 0.225586f, 0.646484f, 0.192383f, 0.614258f,
|
||||
0.159180f, 0.582031f, 0.159180f, 0.537109f, 0.130859f, 0.206543f, 0.130859f, 0.168945f,
|
||||
0.148438f, 0.133789f, 0.166504f, 0.098633f, 0.201660f, 0.079102f, 0.236816f, 0.060059f,
|
||||
0.277344f, 0.060059f, 0.340332f, 0.060059f, 0.381348f, 0.100586f, 0.422363f, 0.141113f,
|
||||
0.422363f, 0.203613f, 0.422363f, 0.267090f, 0.379883f, 0.308594f, 0.337891f, 0.350098f,
|
||||
0.274414f, 0.350098f, 0.212402f, 0.350098f, 0.171387f, 0.309082f, 0.130859f, 0.268066f,
|
||||
0.130859f, 0.206543f
|
||||
};
|
||||
|
||||
static const VGubyte arial_glyph57_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_CLOSE_PATH,
|
||||
VG_MOVE_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO, VG_QUAD_TO,
|
||||
VG_QUAD_TO, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat arial_glyph57_coordinates[] = {
|
||||
0.054688f, 0.165527f, 0.139160f, 0.173340f, 0.149902f, 0.113770f, 0.180176f, 0.086914f,
|
||||
0.210449f, 0.060059f, 0.257813f, 0.060059f, 0.298340f, 0.060059f, 0.328613f, 0.078613f,
|
||||
0.359375f, 0.097168f, 0.378906f, 0.127930f, 0.398438f, 0.159180f, 0.411621f, 0.211914f,
|
||||
0.424805f, 0.264648f, 0.424805f, 0.319336f, 0.424805f, 0.325195f, 0.424316f, 0.336914f,
|
||||
0.397949f, 0.294922f, 0.352051f, 0.268555f, 0.306641f, 0.242676f, 0.253418f, 0.242676f,
|
||||
0.164551f, 0.242676f, 0.103027f, 0.307129f, 0.041504f, 0.371582f, 0.041504f, 0.477051f,
|
||||
0.041504f, 0.585938f, 0.105469f, 0.652344f, 0.169922f, 0.718750f, 0.266602f, 0.718750f,
|
||||
0.336426f, 0.718750f, 0.394043f, 0.681152f, 0.452148f, 0.643555f, 0.481934f, 0.573730f,
|
||||
0.512207f, 0.504395f, 0.512207f, 0.372559f, 0.512207f, 0.235352f, 0.482422f, 0.153809f,
|
||||
0.452637f, 0.072754f, 0.393555f, 0.030273f, 0.334961f, -0.012207f, 0.255859f, -0.012207f,
|
||||
0.171875f, -0.012207f, 0.118652f, 0.034180f, 0.065430f, 0.081055f, 0.054688f, 0.165527f,
|
||||
0.414551f, 0.481445f, 0.414551f, 0.557129f, 0.374023f, 0.601563f, 0.333984f, 0.645996f,
|
||||
0.277344f, 0.645996f, 0.218750f, 0.645996f, 0.175293f, 0.598145f, 0.131836f, 0.550293f,
|
||||
0.131836f, 0.474121f, 0.131836f, 0.405762f, 0.172852f, 0.362793f, 0.214355f, 0.320313f,
|
||||
0.274902f, 0.320313f, 0.335938f, 0.320313f, 0.375000f, 0.362793f, 0.414551f, 0.405762f,
|
||||
0.414551f, 0.481445f
|
||||
};
|
||||
|
||||
// font glyphs, sorted by ascending glyph index
|
||||
static const Glyph arial_glyphs[] = {
|
||||
{ 48, { 0.556152f, 0.000000f }, 24, arial_glyph48_commands, 84, arial_glyph48_coordinates, VG_NON_ZERO },
|
||||
{ 49, { 0.556152f, 0.000000f }, 11, arial_glyph49_commands, 28, arial_glyph49_coordinates, VG_NON_ZERO },
|
||||
{ 50, { 0.556152f, 0.000000f }, 24, arial_glyph50_commands, 82, arial_glyph50_coordinates, VG_NON_ZERO },
|
||||
{ 51, { 0.556152f, 0.000000f }, 32, arial_glyph51_commands, 116, arial_glyph51_coordinates, VG_NON_ZERO },
|
||||
{ 52, { 0.556152f, 0.000000f }, 18, arial_glyph52_commands, 32, arial_glyph52_coordinates, VG_NON_ZERO },
|
||||
{ 53, { 0.556152f, 0.000000f }, 24, arial_glyph53_commands, 76, arial_glyph53_coordinates, VG_NON_ZERO },
|
||||
{ 54, { 0.556152f, 0.000000f }, 32, arial_glyph54_commands, 114, arial_glyph54_coordinates, VG_NON_ZERO },
|
||||
{ 55, { 0.556152f, 0.000000f }, 13, arial_glyph55_commands, 36, arial_glyph55_coordinates, VG_NON_ZERO },
|
||||
{ 56, { 0.556152f, 0.000000f }, 39, arial_glyph56_commands, 138, arial_glyph56_coordinates, VG_NON_ZERO },
|
||||
{ 57, { 0.556152f, 0.000000f }, 34, arial_glyph57_commands, 122, arial_glyph57_coordinates, VG_NON_ZERO }};
|
||||
|
||||
// the arial font structure
|
||||
Font arial_font = {
|
||||
// OpenVG font object
|
||||
VG_INVALID_HANDLE,
|
||||
// glyphs data (entries are sorted by ascending glyph index)
|
||||
arial_glyphs,
|
||||
// number of glyphs
|
||||
10,
|
||||
// kerning table
|
||||
0, //arial_kerning_table,
|
||||
// number of kerning entries
|
||||
0
|
||||
};
|
||||
|
||||
// initialize arial font
|
||||
VGErrorCode arialFontInit(void)
|
||||
{
|
||||
VGErrorCode err = VG_NO_ERROR;
|
||||
const VGfloat arial_glyphs_origin[2] = { 0.0f, 0.0f };
|
||||
|
||||
if (arial_font.openvgHandle == VG_INVALID_HANDLE)
|
||||
{
|
||||
// create OpenVG font object
|
||||
arial_font.openvgHandle = vgCreateFont(arial_font.glyphsCount);
|
||||
if (arial_font.openvgHandle != VG_INVALID_HANDLE)
|
||||
{
|
||||
VGuint i;
|
||||
// create OpenVG glyphs
|
||||
for (i = 0; i < arial_font.glyphsCount; ++i)
|
||||
{
|
||||
VGPath path = vgCreatePath (VG_PATH_FORMAT_STANDARD,
|
||||
VG_PATH_DATATYPE_F,
|
||||
1.0f,
|
||||
0.0f,
|
||||
arial_font.glyphs[i].commandsCount,
|
||||
arial_font.glyphs[i].coordinatesCount,
|
||||
VG_PATH_CAPABILITY_ALL
|
||||
);
|
||||
vgAppendPathData(path, arial_font.glyphs[i].commandsCount, arial_font.glyphs[i].commands, arial_font.glyphs[i].coordinates);
|
||||
// remove "editing" capabilities, so that OpenVG driver can try to free some memory
|
||||
vgRemovePathCapabilities(path, VG_PATH_CAPABILITY_APPEND_FROM | VG_PATH_CAPABILITY_APPEND_TO |
|
||||
VG_PATH_CAPABILITY_MODIFY | VG_PATH_CAPABILITY_TRANSFORM_FROM |
|
||||
VG_PATH_CAPABILITY_TRANSFORM_TO | VG_PATH_CAPABILITY_INTERPOLATE_FROM |
|
||||
VG_PATH_CAPABILITY_INTERPOLATE_TO);
|
||||
vgSetGlyphToPath (arial_font.openvgHandle,
|
||||
arial_font.glyphs[i].glyphIndex,
|
||||
path, VG_FALSE,
|
||||
(float *)arial_glyphs_origin,
|
||||
(float *)arial_font.glyphs[i].escapement);
|
||||
vgDestroyPath(path);
|
||||
}
|
||||
}
|
||||
// check for errors from the OpenVG driver side
|
||||
err = vgGetError();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
// destroy arial font
|
||||
void arialFontDestroy(void)
|
||||
{
|
||||
if (arial_font.openvgHandle != VG_INVALID_HANDLE)
|
||||
{
|
||||
VGuint i;
|
||||
for (i = 0; i < arial_font.glyphsCount; ++i)
|
||||
{
|
||||
vgClearGlyph (arial_font.openvgHandle, arial_font.glyphs[i].glyphIndex);
|
||||
}
|
||||
vgDestroyFont(arial_font.openvgHandle);
|
||||
arial_font.openvgHandle = VG_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
499
MXC_A27-PCB4.5-270T/app/pointer_halo/pointer_halo.c
Normal file
499
MXC_A27-PCB4.5-270T/app/pointer_halo/pointer_halo.c
Normal file
@ -0,0 +1,499 @@
|
||||
#include <vg/openvg.h>
|
||||
#include <vg/vgu.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include "vg_font.h"
|
||||
|
||||
#include "romfile.h"
|
||||
#include "vg_driver.h"
|
||||
|
||||
#ifdef VG_DRIVER
|
||||
#if !defined(VG_ONLY) && !defined(AWTK)
|
||||
|
||||
extern void * XM_heap_malloc (int size);
|
||||
extern void XM_heap_free (void *mem);
|
||||
extern unsigned int xm_vg_get_bpp (void);
|
||||
extern unsigned int xm_vg_get_osd_fb (int *no);
|
||||
|
||||
#define SCREEN_WIDTH VG_W
|
||||
#define SCREEN_HEIGHT VG_H
|
||||
|
||||
// 514, 306为VG区域的中心点坐标
|
||||
#define VG_OSD_X VG_X
|
||||
#define VG_OSD_Y VG_Y
|
||||
#define PT_CENTRE_X VG_W/2
|
||||
#define PT_CENTRE_Y VG_H/2
|
||||
|
||||
|
||||
// 光晕底图aRGB8888
|
||||
static unsigned int *halo;
|
||||
|
||||
static VGImage maskImage;
|
||||
static VGPaint maskPaint;
|
||||
|
||||
static VGPath innerPath;
|
||||
static VGPath outerPath;
|
||||
static VGPath circlePath;
|
||||
static VGPaint colorPaint;
|
||||
|
||||
|
||||
// 绘制表盘的光晕效果
|
||||
// startAngle 光晕对应的开始角度 (笛卡尔坐标系, 顺时针方向)
|
||||
// angleExtent 光晕的展开角度
|
||||
static void drawHalo(float startAngle, float angleExtent )
|
||||
{
|
||||
VGPath path;
|
||||
|
||||
// 设置图像填充模式
|
||||
vgPaintPattern(maskPaint, maskImage);
|
||||
// 2.2 第一个对应于指针扇区(从指针起始指向角度(0读数)延伸到当前指针读数)的pie行path
|
||||
// 该path使用完整光晕的背景底板进行绘制,即得到仅包含有效区域的光晕
|
||||
// 定义起始角度 (笛卡尔坐标系)
|
||||
vgSetPaint( maskPaint, VG_FILL_PATH );
|
||||
// 光晕图像与path使用相同的空间尺寸(VG_W, VG_H)
|
||||
// 定位到光晕图像的中心点
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
|
||||
vgLoadIdentity();
|
||||
vgTranslate( -VG_W/2, -VG_H/2 );
|
||||
// 定位到path的中心点
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
vgTranslate( VG_W/2, VG_H/2 );
|
||||
|
||||
vgSeti ( VG_FILL_RULE, VG_NON_ZERO );
|
||||
// 创建一个扇区路径
|
||||
path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
|
||||
//printf ("startAngle=%f, angleExtent=%f\n", startAngle, angleExtent);
|
||||
vguArc( path, 0.0f, 0.0f, VG_W, VG_H, startAngle, angleExtent, VGU_ARC_PIE );
|
||||
// 删去以下属性可确保资源使用完毕后立刻被释放
|
||||
vgRemovePathCapabilities(path, VG_PATH_CAPABILITY_APPEND_FROM | VG_PATH_CAPABILITY_APPEND_TO |
|
||||
VG_PATH_CAPABILITY_MODIFY | VG_PATH_CAPABILITY_TRANSFORM_FROM |
|
||||
VG_PATH_CAPABILITY_TRANSFORM_TO | VG_PATH_CAPABILITY_INTERPOLATE_FROM |
|
||||
VG_PATH_CAPABILITY_INTERPOLATE_TO);
|
||||
// 使用图像填充扇区
|
||||
vgDrawPath( path, VG_FILL_PATH );
|
||||
// 马上释放资源(资源占有内存资源较大), 否则后续资源分配易失败
|
||||
vgClearPath (path, VG_PATH_CAPABILITY_ALL);
|
||||
vgDestroyPath( path );
|
||||
|
||||
vgSetPaint (VG_INVALID_HANDLE, VG_FILL_PATH);
|
||||
vgPaintPattern(maskPaint, VG_INVALID_HANDLE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//size: 490.000000 x 490.000000
|
||||
static const VGubyte pointer_2_polygon_0_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat pointer_2_polygon_0_coordinates[] = {
|
||||
243.998993f, 333.000000f, 241.500000f, 309.584015f, 245.050995f, 7.000000f, 247.951004f, 7.000000f,
|
||||
251.500000f, 309.584015f, 249.001007f, 333.000000f
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const VGubyte pointer_2_path_1_commands[] = {
|
||||
VG_MOVE_TO, VG_LINE_TO, VG_LINE_TO, VG_HLINE_TO, VG_LINE_TO, VG_LINE_TO, VG_HLINE_TO, VG_CLOSE_PATH, VG_MOVE_TO,
|
||||
VG_HLINE_TO, VG_LINE_TO, VG_LINE_TO, VG_HLINE_TO, VG_LINE_TO, VG_LINE_TO, VG_LINE_TO, VG_CLOSE_PATH
|
||||
|
||||
};
|
||||
|
||||
static const VGfloat pointer_2_path_1_coordinates[] = {
|
||||
247.951004f, 7.000000f, 251.500000f, 309.584015f, 249.001007f, 333.000000f, 243.999008f, 241.500015f,
|
||||
309.583984f, 245.050995f, 7.000000f, 247.951004f, 247.951004f, 4.000000f, 245.051010f, 238.500000f,
|
||||
309.549011f, 241.015991f, 333.319031f, 249.000992f, 254.482986f, 309.903015f, 250.951004f, 6.965000f,
|
||||
247.951004f, 4.000000f
|
||||
};
|
||||
|
||||
static const VGubyte pointer_2_circle_2_commands[] = {
|
||||
VG_MOVE_TO, VG_LCCWARC_TO_ABS, VG_SCCWARC_TO_ABS, VG_CLOSE_PATH
|
||||
};
|
||||
|
||||
static const VGfloat pointer_2_circle_2_coordinates[] = {
|
||||
246.500000f, 271.998993f, 27.000000f, 27.000000f, 0.000000f, 273.500000f, 244.998993f, 27.000000f,
|
||||
27.000000f, 0.000000f, 246.500000f, 271.998993f
|
||||
};
|
||||
|
||||
static VGfloat fill_linear_gradient_innerPath[] = {
|
||||
247.951004f, 7.000000f, 251.500000f, 309.584015f + 24,
|
||||
};
|
||||
|
||||
static VGfloat rampStops_innerPath[30] = {
|
||||
0.1857, 0.898f, 0.263f, 0.133f, 1.0f, //<stop offset="0.1857" style="stop-color:#E54322"/>
|
||||
0.4307, 0.898f, 0.012f, 0.129f, 1.0f, //<stop offset="0.4307" style="stop-color:#E50321"/>
|
||||
0.9125, 0.898f, 0.122f, 0.122f, 1.0f, //<stop offset="0.9125" style="stop-color:#E51F1F"/>
|
||||
0.9253, 0.369f, 0.024f, 0.037f, 1.0f, //<stop offset="0.9253" style="stop-color:#5E060C"/>
|
||||
0.9458, 0.129f, 0.016f, 0.043f, 1.0f, //<stop offset="0.9458" style="stop-color:#21040B"/>
|
||||
0.9852, 0.247f, 0.000f, 0.031f, 1.0f, //<stop offset="0.9852" style="stop-color:#3F0008"/>
|
||||
};
|
||||
|
||||
static VGfloat fill_linear_gradient_outerPath[] = {
|
||||
247.951004f, 7.000000f, 251.500000f, 309.584015f + 24,
|
||||
};
|
||||
|
||||
static VGfloat rampStops_outerPath[40] = {
|
||||
0.0040, 0.541f, 0.541f, 0.541f, 1.0f, //<stop offset="0.004" style="stop-color:#8A8A8A"/>
|
||||
0.1669, 0.502f, 0.502f, 0.502f, 1.0f, //<stop offset="0.1669" style="stop-color:#808080"/>
|
||||
0.4818, 0.722f, 0.722f, 0.722f, 1.0f, //<stop offset="0.4818" style="stop-color:#B8B8B8"/>
|
||||
0.9031, 0.800f, 0.800f, 0.800f, 1.0f, //<stop offset="0.9031" style="stop-color:#CCCCCC"/>
|
||||
0.9174, 0.502f, 0.502f, 0.502f, 1.0f, //<stop offset="0.9174" style="stop-color:#808080"/>
|
||||
0.9423, 0.502f, 0.502f, 0.502f, 1.0f, //<stop offset="0.9423" style="stop-color:#808080"/>
|
||||
0.9592, 0.502f, 0.502f, 0.502f, 1.0f, //<stop offset="0.9592" style="stop-color:#808080"/>
|
||||
0.9852, 0.541f, 0.541f, 0.541f, 1.0f, //<stop offset="0.9852" style="stop-color:#8A8A8A"/>
|
||||
};
|
||||
|
||||
|
||||
static void genPointerPaths (void)
|
||||
{
|
||||
innerPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
|
||||
vgAppendPathData(innerPath, 7, pointer_2_polygon_0_commands, pointer_2_polygon_0_coordinates);
|
||||
outerPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
|
||||
vgAppendPathData(outerPath, 17, pointer_2_path_1_commands, pointer_2_path_1_coordinates);
|
||||
circlePath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
|
||||
vgAppendPathData(circlePath, 4, pointer_2_circle_2_commands, pointer_2_circle_2_coordinates);
|
||||
colorPaint = vgCreatePaint();
|
||||
vgSetParameteri(colorPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
|
||||
|
||||
#if 1
|
||||
// 2.1 定义一个完整光晕的背景底板(带有alpha效果)
|
||||
if(maskImage == VG_INVALID_HANDLE)
|
||||
maskImage = vgCreateImage( VG_sRGBA_8888, SCREEN_WIDTH, SCREEN_HEIGHT, VG_IMAGE_QUALITY_BETTER );
|
||||
//vgImageSubData( maskImage, halo + SCREEN_WIDTH * (SCREEN_HEIGHT - 1), -SCREEN_WIDTH*4, VG_sARGB_8888, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
//vgImageSubData( maskImage, halo + 490 * (490 - 1), -490*4, VG_sRGBA_8888, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
vgImageSubData( maskImage, halo + VG_W * (VG_H - 1), -VG_W*4, VG_sARGB_8888, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
|
||||
|
||||
|
||||
#endif
|
||||
maskPaint = vgCreatePaint();
|
||||
vgSetParameteri (maskPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_PATTERN);
|
||||
vgSetParameteri (maskPaint, VG_PAINT_PATTERN_TILING_MODE, VG_TILE_PAD);
|
||||
|
||||
}
|
||||
|
||||
#define POFF_X +1
|
||||
#define POFF_Y +2
|
||||
|
||||
static void drawCursors (float angleExtent)
|
||||
{
|
||||
VGfloat col[4];
|
||||
VGPaint fill;
|
||||
VGPaint stroke;
|
||||
col[0] = 0xc4/255.0f;
|
||||
col[1] = 0x05/255.0f;
|
||||
col[2] = 0x05/255.0f;
|
||||
col[3] = 1.00f;
|
||||
vgSetParameterfv(colorPaint, VG_PAINT_COLOR, 4, col);
|
||||
|
||||
fill = vgCreatePaint();
|
||||
vgSetPaint( fill, VG_FILL_PATH );
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
|
||||
vgLoadIdentity();
|
||||
//vgTranslate(-PT_CENTRE_X, -PT_CENTRE_Y);
|
||||
vgSetParameteri( fill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT );
|
||||
vgSetParameterfv( fill, VG_PAINT_LINEAR_GRADIENT, 4, fill_linear_gradient_innerPath );
|
||||
vgSetParameterfv( fill, VG_PAINT_COLOR_RAMP_STOPS, 30, rampStops_innerPath );
|
||||
vgSetParameteri( fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD );
|
||||
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
vgTranslate(PT_CENTRE_X - POFF_X, PT_CENTRE_Y - POFF_Y);
|
||||
vgRotate(angleExtent);
|
||||
vgTranslate(-(PT_CENTRE_X - POFF_X), -(PT_CENTRE_Y - POFF_Y));
|
||||
|
||||
|
||||
vgDrawPath(innerPath, VG_FILL_PATH);
|
||||
vgSetPaint( VG_INVALID_HANDLE, VG_FILL_PATH );
|
||||
vgDestroyPaint (fill);
|
||||
|
||||
vgSeti ( VG_FILL_RULE, VG_NON_ZERO );
|
||||
fill = vgCreatePaint();
|
||||
vgSetPaint( fill, VG_FILL_PATH|VG_STROKE_PATH );
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);
|
||||
vgLoadIdentity();
|
||||
|
||||
vgSetParameteri( fill, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT );
|
||||
vgSetParameterfv( fill, VG_PAINT_LINEAR_GRADIENT, 4, fill_linear_gradient_outerPath );
|
||||
vgSetParameterfv( fill, VG_PAINT_COLOR_RAMP_STOPS, 40, rampStops_outerPath );
|
||||
vgSetParameteri( fill, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD );
|
||||
//vgSetPaint(colorPaint, VG_FILL_PATH | VG_STROKE_PATH);
|
||||
|
||||
vgDrawPath(outerPath, VG_FILL_PATH|VG_STROKE_PATH);
|
||||
//vgSetPaint(colorPaint, VG_FILL_PATH | VG_STROKE_PATH);
|
||||
vgSetPaint( VG_INVALID_HANDLE, VG_FILL_PATH|VG_STROKE_PATH );
|
||||
vgDestroyPaint (fill);
|
||||
|
||||
// 绘制指针上的圆盘
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
vgTranslate(0, -2);
|
||||
// VGPaint fill;
|
||||
col[0] = 0x2b/255.0f;
|
||||
col[1] = 0x2a/255.0f;
|
||||
col[2] = 0x2e/255.0f;
|
||||
col[3] = 1.00f;
|
||||
vgSetParameterfv(colorPaint, VG_PAINT_COLOR, 4, col);
|
||||
vgSetPaint(colorPaint, VG_FILL_PATH);
|
||||
stroke = vgCreatePaint();
|
||||
vgSetPaint( stroke, VG_STROKE_PATH );
|
||||
col[0] = 0xf8/255.0f;
|
||||
col[1] = 0x40/255.0f;
|
||||
col[2] = 0x00/255.0f;
|
||||
col[3] = 1.00f;
|
||||
vgSetParameterfv(stroke, VG_PAINT_COLOR, 4, col);
|
||||
vgSetf(VG_STROKE_LINE_WIDTH, 4);
|
||||
|
||||
vgDrawPath(circlePath, VG_FILL_PATH|VG_STROKE_PATH);
|
||||
vgSetPaint( VG_INVALID_HANDLE, VG_STROKE_PATH );
|
||||
vgSetPaint( VG_INVALID_HANDLE, VG_FILL_PATH );
|
||||
|
||||
vgSetf(VG_STROKE_LINE_WIDTH, 1);
|
||||
vgDestroyPaint (stroke);
|
||||
|
||||
}
|
||||
|
||||
extern Font arial_font;
|
||||
VGfloat textLineWidth(const Font* font,
|
||||
const char* str) ;
|
||||
|
||||
int xm_vg_get_offset_x (void);
|
||||
int xm_vg_get_offset_y (void);
|
||||
|
||||
// font_w 字形的像素宽度
|
||||
// font_h 字形的像素高度
|
||||
// speed 显示的字符串文本
|
||||
// centre_x centre_y 为效果图中对应的速度文本其显示区域的中心点坐标(相对于效果图左上角原点的偏移)
|
||||
static void DrawSpeed(char *speed, int font_w, int font_h, int centre_x, int centre_y, unsigned int color)
|
||||
{
|
||||
VGfloat col[4];
|
||||
int str_size;
|
||||
VGfloat glyphOrigin[2] = { 0.0f, 0.0f };
|
||||
float speed_scale_x, speed_scale_y;
|
||||
|
||||
// 将效果图中的坐标值转换为VG区域中的坐标值
|
||||
int vg_offset_x = centre_x - xm_vg_get_offset_x();
|
||||
int vg_offset_y = centre_y - xm_vg_get_offset_y();
|
||||
vg_offset_y = xm_vg_get_height() - 1 - vg_offset_y;
|
||||
|
||||
str_size = strlen (speed);
|
||||
|
||||
// 计算数字字符的逻辑宽度/高度(等宽字体)
|
||||
vgTextSize (&arial_font, "2", &speed_scale_x, &speed_scale_y);
|
||||
// 字符串像素宽度
|
||||
float str_width = font_w * str_size;
|
||||
// 字符串像素高度
|
||||
float str_height = font_h / speed_scale_y;
|
||||
|
||||
// 设置车速显示时的文字颜色 (白色)
|
||||
col[0] = ((color >> 0) & 0xff) / 255.0; // R
|
||||
col[1] = ((color >> 8) & 0xff) / 255.0; // G
|
||||
col[2] = ((color >> 16) & 0xff) / 255.0; // B
|
||||
col[3] = 1.00f;
|
||||
vgSetParameterfv(colorPaint, VG_PAINT_COLOR, 4, col);
|
||||
vgSetPaint( colorPaint, VG_FILL_PATH|VG_STROKE_PATH );
|
||||
|
||||
vgSeti(VG_FILL_RULE, VG_NON_ZERO);
|
||||
vgSetfv(VG_GLYPH_ORIGIN, 2, glyphOrigin);
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
// 定位显示的原点
|
||||
vgTranslate(vg_offset_x - str_width / 2, vg_offset_y - str_height/2 );
|
||||
// 计算字形的放大倍数
|
||||
vgScale(font_w / speed_scale_x , font_h / speed_scale_y);
|
||||
// arial_font为车速显示使用的字形数据
|
||||
vgTextOut (&arial_font, speed, VG_FILL_PATH);
|
||||
|
||||
vgSetPaint( VG_INVALID_HANDLE, VG_FILL_PATH|VG_STROKE_PATH );
|
||||
}
|
||||
|
||||
|
||||
#define RGB(r,g,b) ((r) | ((g) << 8) | ((b) << 16))
|
||||
|
||||
|
||||
float startAngle = 212.0f;
|
||||
|
||||
|
||||
|
||||
static void draw_speed_level (int speed_level)
|
||||
{
|
||||
char text[8];
|
||||
|
||||
sprintf (text, "%d", speed_level);
|
||||
DrawSpeed (text, 42, 42, 514, 498, RGB(255,255,255));
|
||||
|
||||
}
|
||||
|
||||
// 绘制表盘上的刻度值 (0, 30, ... 330, 360)
|
||||
static void draw_scale_value (void)
|
||||
{
|
||||
// 字体大小
|
||||
int fw, fh;
|
||||
fw = 16;
|
||||
fh = 20;
|
||||
// 以下坐标为LCD屏幕坐标
|
||||
DrawSpeed ( "0", fw, fh, 328 + 16, 398 + 8, RGB(255,255,255));
|
||||
DrawSpeed ("30", fw, fh, 306 + 16, 322 + 18, RGB(255,255,255));
|
||||
DrawSpeed ("60", fw, fh, 306 + 16, 254 + 14, RGB(255,255,255));
|
||||
DrawSpeed ("90", fw, fh, 329 + 16, 195 + 10, RGB(255,255,255));
|
||||
DrawSpeed ("120", fw, fh, 375 + 16, 146 + 10, RGB(255,255,255));
|
||||
DrawSpeed ("150", fw, fh, 419 + 20, 111 + 14, RGB(255,255,255));
|
||||
DrawSpeed ("180", fw, fh, 494 + 16, 98 + 6, RGB(255,255,255));
|
||||
DrawSpeed ("210", fw, fh, 562 + 16, 111 + 14, RGB(255,255,255));
|
||||
DrawSpeed ("240", fw, fh, 613 + 20, 146 + 10, RGB(255,0,0));
|
||||
DrawSpeed ("270", fw, fh, 646 + 20, 192 + 10, RGB(255,0,0));
|
||||
DrawSpeed ("300", fw, fh, 660 + 32, 259 + 14, RGB(255,0,0));
|
||||
DrawSpeed ("330", fw, fh, 661 + 32, 332 + 14, RGB(255,0,0));
|
||||
DrawSpeed ("360", fw, fh, 641 + 36, 393 + 18, RGB(255,0,0));
|
||||
|
||||
}
|
||||
|
||||
extern void* xm_vg_get_gpu_background_image (void);
|
||||
|
||||
void do_paint (float angleExtent, int speed)
|
||||
{
|
||||
//VGImage image;
|
||||
|
||||
// 1 绘制指针仪表的背景图 (仅覆盖VG区域)
|
||||
vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL);
|
||||
void *bkImage = xm_vg_get_gpu_background_image ();
|
||||
//image = vgCreateImage( VG_sRGB_565, SCREEN_WIDTH, SCREEN_HEIGHT, VG_IMAGE_QUALITY_BETTER );
|
||||
//vgDrawImage( image );
|
||||
//vgDestroyImage( image );
|
||||
vgScale (1.0, 1.0);
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
vgWritePixels (bkImage, -SCREEN_WIDTH * VG_BPP / 8, VG_sRGB_565, 0, 0,
|
||||
SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
// 2 叠加光晕效果
|
||||
drawHalo (startAngle, angleExtent);
|
||||
|
||||
//vgDestroyPaint (maskPaint);
|
||||
//vgDestroyImage (maskImage);
|
||||
|
||||
// 3 绘制刻度盘上的刻度值
|
||||
draw_scale_value ();
|
||||
|
||||
// 4 绘制指针
|
||||
drawCursors (startAngle + angleExtent + 90);
|
||||
|
||||
// 5 绘制表盘底部的刻度
|
||||
draw_speed_level (speed);
|
||||
|
||||
}
|
||||
|
||||
/* speed: 0~360 */
|
||||
static void draw_dial(int speed)
|
||||
{
|
||||
float angleExtent = -2.0;
|
||||
|
||||
// 将速度表读数映射为表盘角度
|
||||
angleExtent = -2.0 + (-242.0f - (-2.0)) * speed / 360.0;
|
||||
if(angleExtent > (-2.0))
|
||||
angleExtent = -2.0;
|
||||
else if(angleExtent < (-242.0f))
|
||||
angleExtent = -242.0f;
|
||||
|
||||
do_paint (angleExtent, speed);
|
||||
|
||||
vgFinish();
|
||||
}
|
||||
|
||||
static RomFile *halofile = NULL;
|
||||
int pointer_halo_init (int width, int height)
|
||||
{
|
||||
halofile = RomFileOpen("halo.rgb");
|
||||
//XM_printf ("pointer_halo_init\n");
|
||||
if (!halofile) {
|
||||
printf("open romfile halo.rgb fail.\n");
|
||||
return -1;
|
||||
}
|
||||
RomFileRead(halofile, NULL, halofile->size);
|
||||
halo = (unsigned int *)halofile->buf;
|
||||
#ifndef ROMFILE_USE_SMALL_MEM
|
||||
RomFileClose(halofile);
|
||||
#endif
|
||||
vgFontInit ();
|
||||
genPointerPaths ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 退出并使用资源
|
||||
int pointer_halo_exit (void)
|
||||
{
|
||||
//XM_printf ("pointer_halo_exit\n");
|
||||
if(maskPaint != VG_INVALID_HANDLE)
|
||||
{
|
||||
vgDestroyPaint (maskPaint);
|
||||
maskPaint = VG_INVALID_HANDLE;
|
||||
}
|
||||
/*
|
||||
if(maskImage != VG_INVALID_HANDLE)
|
||||
{
|
||||
vgDestroyImage (maskImage);
|
||||
maskImage = VG_INVALID_HANDLE;
|
||||
}*/
|
||||
if(colorPaint != VG_INVALID_HANDLE)
|
||||
{
|
||||
vgDestroyPaint (colorPaint);
|
||||
colorPaint = VG_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if(circlePath != VG_INVALID_HANDLE)
|
||||
{
|
||||
vgRemovePathCapabilities(circlePath, VG_PATH_CAPABILITY_APPEND_FROM | VG_PATH_CAPABILITY_APPEND_TO |
|
||||
VG_PATH_CAPABILITY_MODIFY | VG_PATH_CAPABILITY_TRANSFORM_FROM |
|
||||
VG_PATH_CAPABILITY_TRANSFORM_TO | VG_PATH_CAPABILITY_INTERPOLATE_FROM |
|
||||
VG_PATH_CAPABILITY_INTERPOLATE_TO);
|
||||
vgClearPath (circlePath, VG_PATH_CAPABILITY_ALL);
|
||||
vgDestroyPath( circlePath );
|
||||
circlePath = VG_INVALID_HANDLE;
|
||||
}
|
||||
if(outerPath != VG_INVALID_HANDLE)
|
||||
{
|
||||
vgRemovePathCapabilities(outerPath, VG_PATH_CAPABILITY_APPEND_FROM | VG_PATH_CAPABILITY_APPEND_TO |
|
||||
VG_PATH_CAPABILITY_MODIFY | VG_PATH_CAPABILITY_TRANSFORM_FROM |
|
||||
VG_PATH_CAPABILITY_TRANSFORM_TO | VG_PATH_CAPABILITY_INTERPOLATE_FROM |
|
||||
VG_PATH_CAPABILITY_INTERPOLATE_TO);
|
||||
vgClearPath (outerPath, VG_PATH_CAPABILITY_ALL);
|
||||
vgDestroyPath( outerPath );
|
||||
outerPath = VG_INVALID_HANDLE;
|
||||
}
|
||||
if(innerPath != VG_INVALID_HANDLE)
|
||||
{
|
||||
vgRemovePathCapabilities(innerPath, VG_PATH_CAPABILITY_APPEND_FROM | VG_PATH_CAPABILITY_APPEND_TO |
|
||||
VG_PATH_CAPABILITY_MODIFY | VG_PATH_CAPABILITY_TRANSFORM_FROM |
|
||||
VG_PATH_CAPABILITY_TRANSFORM_TO | VG_PATH_CAPABILITY_INTERPOLATE_FROM |
|
||||
VG_PATH_CAPABILITY_INTERPOLATE_TO);
|
||||
vgClearPath (innerPath, VG_PATH_CAPABILITY_ALL);
|
||||
vgDestroyPath( innerPath );
|
||||
innerPath = VG_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
vgFontExit();
|
||||
|
||||
#ifdef ROMFILE_USE_SMALL_MEM
|
||||
RomFileClose(halofile);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pointer_halo_draw (int speed)
|
||||
{
|
||||
// 使用VG绘制中间的表盘区域
|
||||
draw_dial (speed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
177
MXC_A27-PCB4.5-270T/app/pointer_halo/vg_font.c
Normal file
177
MXC_A27-PCB4.5-270T/app/pointer_halo/vg_font.c
Normal file
@ -0,0 +1,177 @@
|
||||
#include "vg_font.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef VG_DRIVER
|
||||
#if !defined(VG_ONLY) && !defined(AWTK)
|
||||
|
||||
#define MAX_TEXT_SIZE 32 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ֧<CABE>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
static VGuint tmpGlyphIndices[MAX_TEXT_SIZE];
|
||||
static VGfloat tmpAdjustmentsX[MAX_TEXT_SIZE];
|
||||
static VGfloat tmpAdjustmentsY[MAX_TEXT_SIZE];
|
||||
|
||||
|
||||
// given a character code, return its glyph index
|
||||
VGint glyphIndexFromCharCode(const Font* font,
|
||||
const VGint charCode)
|
||||
{
|
||||
return charCode;
|
||||
}
|
||||
|
||||
// compare two glyphs, by their glyph indices
|
||||
static VGint glyphsCompare(const void* arg0, const void* arg1)
|
||||
{
|
||||
const Glyph* glyph0 = (const Glyph*)arg0;
|
||||
const Glyph* glyph1 = (const Glyph*)arg1;
|
||||
|
||||
return (VGint)glyph0->glyphIndex - (VGint)glyph1->glyphIndex;
|
||||
}
|
||||
|
||||
// given a glyph index, return the associated Glyph structure
|
||||
const Glyph* glyphFromGlyphIndex(const Font* font, const VGint glyphIndex)
|
||||
{
|
||||
Glyph glyph;
|
||||
|
||||
glyph.glyphIndex = glyphIndex;
|
||||
return (const Glyph*)bsearch(&glyph, font->glyphs, font->glyphsCount, sizeof(Glyph), glyphsCompare);
|
||||
}
|
||||
|
||||
// given a character code, return the associated Glyph structure
|
||||
const Glyph* glyphFromCharCode(const Font* font,const VGint charCode)
|
||||
{
|
||||
const VGint glyphIndex = glyphIndexFromCharCode(font, charCode);
|
||||
return (glyphIndex >= 0) ? glyphFromGlyphIndex(font, glyphIndex) : NULL;
|
||||
}
|
||||
|
||||
// compare two kerning entries
|
||||
static VGint kerningsCompare(const void* arg0, const void* arg1)
|
||||
{
|
||||
const KerningEntry* krn0 = (const KerningEntry*)arg0;
|
||||
const KerningEntry* krn1 = (const KerningEntry*)arg1;
|
||||
|
||||
return (VGint)krn0->key - (VGint)krn1->key;
|
||||
}
|
||||
|
||||
// given a couple of glyph indices, return the relative kerning (NULL if kerning is zero)
|
||||
const KerningEntry* kerningFromGlyphIndices(const Font* font,
|
||||
const VGint leftGlyphIndex,
|
||||
const VGint rightGlyphIndex)
|
||||
{
|
||||
const KerningEntry krn =
|
||||
{
|
||||
// the key
|
||||
((VGuint)leftGlyphIndex << 16) + (VGuint)rightGlyphIndex,
|
||||
0.0f, 0.0f
|
||||
};
|
||||
|
||||
return (const KerningEntry*)bsearch(&krn, font->kerningTable, font->kerningTableSize, sizeof(KerningEntry), kerningsCompare);
|
||||
}
|
||||
|
||||
// given a couple of character codes, return the relative kerning (NULL if kerning is zero)
|
||||
const KerningEntry* kerningFromCharCodes(const Font* font,
|
||||
const VGint leftCharCode,
|
||||
const VGint rightCharCode)
|
||||
{
|
||||
const VGint leftGlyphIndex = glyphIndexFromCharCode(font, leftCharCode);
|
||||
const VGint rightGlyphIndex = glyphIndexFromCharCode(font, rightCharCode);
|
||||
|
||||
// if both glyph indices have been found, try searching for the kerning information
|
||||
return ((leftGlyphIndex >= 0) && (rightGlyphIndex >= 0)) ? kerningFromGlyphIndices(font, leftGlyphIndex, rightGlyphIndex) : NULL;
|
||||
}
|
||||
|
||||
static void textLineBuild(const Font* font, const char* str, const size_t strLen)
|
||||
{
|
||||
size_t i;
|
||||
VGint leftGlyphIndex = glyphIndexFromCharCode(font, str[0]);
|
||||
|
||||
// first glyph index
|
||||
tmpGlyphIndices[0] = leftGlyphIndex;
|
||||
for (i = 1; i < strLen; ++i)
|
||||
{
|
||||
const VGint rightGlyphIndex = glyphIndexFromCharCode(font, str[i]);
|
||||
const KerningEntry* krn = kerningFromGlyphIndices(font, leftGlyphIndex, rightGlyphIndex);
|
||||
// append glyph index
|
||||
tmpGlyphIndices[i] = rightGlyphIndex;
|
||||
// initialize adjustment
|
||||
tmpAdjustmentsX[i - 1] = 0.0f;
|
||||
tmpAdjustmentsY[i - 1] = 0.0f;
|
||||
// add kerning info
|
||||
if (krn != NULL)
|
||||
{
|
||||
tmpAdjustmentsX[i - 1] += krn->x;
|
||||
tmpAdjustmentsY[i - 1] += krn->y;
|
||||
}
|
||||
leftGlyphIndex = rightGlyphIndex;
|
||||
}
|
||||
// last adjustment entry
|
||||
tmpAdjustmentsX[strLen - 1] = 0.0f;
|
||||
tmpAdjustmentsY[strLen - 1] = 0.0f;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ߴ<EFBFBD>
|
||||
int vgTextSize(const Font* font, const char* str, VGfloat *cx, VGfloat *cy)
|
||||
{
|
||||
VGfloat glyphOrigin[2] = { 0.0f, 0.0f };
|
||||
size_t strLen;
|
||||
|
||||
if(font == NULL || str == NULL)
|
||||
return -1;
|
||||
strLen = strlen(str);
|
||||
if(strLen == 0)
|
||||
return -1;
|
||||
|
||||
// build the sequence of glyph indices and kerning data
|
||||
textLineBuild(font, str, strLen);
|
||||
// calculate the metrics of the glyph sequence
|
||||
vgSetfv(VG_GLYPH_ORIGIN, 2, glyphOrigin);
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
vgDrawGlyphs(font->openvgHandle, (VGint)strLen, tmpGlyphIndices, tmpAdjustmentsX, tmpAdjustmentsY, 0, VG_FALSE);
|
||||
vgGetfv(VG_GLYPH_ORIGIN, 2, glyphOrigin);
|
||||
*cx = glyphOrigin[0];
|
||||
*cy = 1.0; // <20>߶<EFBFBD>Ϊ1.0
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
VGErrorCode arialFontInit(void);
|
||||
void arialFontDestroy(void);
|
||||
|
||||
int vgFontInit (void)
|
||||
{
|
||||
arialFontInit ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vgFontExit (void)
|
||||
{
|
||||
arialFontDestroy ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// draw a line of text
|
||||
int vgTextOut (const Font* font,
|
||||
const char* str,
|
||||
const VGbitfield paintModes)
|
||||
{
|
||||
size_t strLen;
|
||||
if(font == NULL || str == NULL)
|
||||
return -1;
|
||||
strLen = strlen(str);
|
||||
if(strLen == 0)
|
||||
return 0;
|
||||
if(strLen > MAX_TEXT_SIZE)
|
||||
strLen = MAX_TEXT_SIZE;
|
||||
|
||||
// build the sequence of glyph indices and kerning data
|
||||
textLineBuild (font, str, strLen);
|
||||
// draw glyphs
|
||||
vgDrawGlyphs (font->openvgHandle, (VGint)strLen, tmpGlyphIndices, tmpAdjustmentsX, tmpAdjustmentsY, paintModes, VG_FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
86
MXC_A27-PCB4.5-270T/app/pointer_halo/vg_font.h
Normal file
86
MXC_A27-PCB4.5-270T/app/pointer_halo/vg_font.h
Normal file
@ -0,0 +1,86 @@
|
||||
#ifndef VG_FONT_H
|
||||
#define VG_FONT_H
|
||||
|
||||
#include <VG/openvg.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
// glyph index within the OpenVG font object
|
||||
VGuint glyphIndex;
|
||||
// the advance width for this glyph
|
||||
VGfloat escapement[2];
|
||||
// OpenVG path commands defining the glyph geometry
|
||||
VGint commandsCount;
|
||||
const VGubyte* commands;
|
||||
// OpenVG path coordinates defining the glyph geometry
|
||||
VGint coordinatesCount;
|
||||
const VGfloat* coordinates;
|
||||
// fill rule of glyph geometry
|
||||
VGFillRule fillRule;
|
||||
} Glyph;
|
||||
|
||||
typedef struct {
|
||||
// the key representing two glyph indices ((leftGlyphIndex << 16) + rightGlyphIndex)
|
||||
VGuint key;
|
||||
// the kerning amount relative to the chars couple
|
||||
VGfloat x;
|
||||
VGfloat y;
|
||||
} KerningEntry;
|
||||
|
||||
typedef struct {
|
||||
// OpenVG font object
|
||||
VGFont openvgHandle;
|
||||
// glyphs data
|
||||
const Glyph* glyphs;
|
||||
// number of glyphs
|
||||
const VGuint glyphsCount;
|
||||
// kerning table
|
||||
const KerningEntry* kerningTable;
|
||||
// number of kerning entries
|
||||
const VGuint kerningTableSize;
|
||||
} Font;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// given a character code, return its glyph index
|
||||
VGint glyphIndexFromCharCode(const Font* font,
|
||||
const VGint charCode);
|
||||
|
||||
// given a glyph index, return the associated Glyph structure
|
||||
const Glyph* glyphFromGlyphIndex(const Font* font,
|
||||
const VGint glyphIndex);
|
||||
|
||||
// given a character code, return the associated Glyph structure
|
||||
const Glyph* glyphFromCharCode(const Font* font,
|
||||
const VGint charCode);
|
||||
|
||||
// given a couple of glyph indices, return the relative kerning (NULL if kerning is zero)
|
||||
const KerningEntry* kerningFromGlyphIndices(const Font* font,
|
||||
const VGint leftGlyphIndex,
|
||||
const VGint rightGlyphIndex);
|
||||
|
||||
// given a couple of character codes, return the relative kerning (NULL if kerning is zero)
|
||||
const KerningEntry* kerningFromCharCodes(const Font* font,
|
||||
const VGint leftCharCode,
|
||||
const VGint rightCharCode);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ߴ<EFBFBD>
|
||||
int vgTextSize(const Font* font, const char* str, VGfloat *cx, VGfloat *cy);
|
||||
|
||||
|
||||
int vgTextOut (const Font* font,
|
||||
const char* str,
|
||||
const VGbitfield paintModes);
|
||||
|
||||
int vgFontInit (void);
|
||||
|
||||
int vgFontExit (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VG_FONT_H */
|
Reference in New Issue
Block a user