VGLite draw text example

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

VGLite draw text example

3,988件の閲覧回数
Flo1989
Contributor III

Hi,

i try to use the VGlite in an FreeRTOS application. I can display and prozess raster pictures without problems. But now i want to use the "vg_lite_draw_text" function to write a text. I do not find any documentation how to use it.

When i understand the code in a right Way i had to first register the font with "vg_lite_register_font". What i am missin here is how the structure of the "void *data" in vg_lite_font_params has to look like.

typedef struct vg_lite_font_params
{
    char name[MAX_FONT_NAME_LEN]; /*! font-family name */
    eFontType_t    font_type;     /*! Raster/Vector font */
    eFontWeight_t   font_weight;  /*! Font weight enum value */
    eFontStretch_t  font_stretch; /*! Font stretch enum value */
    eFontStyle_t    font_style;   /*! Font style enum value */
    int font_height;              /*! Font height in pixels */
    int data_len;                 /*! Font data buffer length */
    void *data; /*! the address where the actual font data is stored; it is the
                 * responsibility of the user/application to load it there */
} vg_lite_font_params_t;

 

Is there any documentation about this?

 

Best Regards,

Florian

0 件の賞賛
返信
14 返答(返信)

3,757件の閲覧回数
howard_liu
NXP Employee
NXP Employee

@Flo1989 Hi Florian, 

To use VGLite draw text API, you must have a SVG file containing an embedded font. Please reference to the SVGTiny 1.2 for the embedded font in a SVG.

There is a vectorFontConverter tool that extracts font data from SVG files  and saves it in an intermediate data format known asVFT-VectorFont. Then it can be registered with the VGLite driver to enable applications to draw text. This tool will be released as one tool of VGLite toolkit soon.

3,203件の閲覧回数
howardliu
Contributor II

I attached an example to show how to use VGLite draw text API for your reference (Only passing IAR tool). The vectorFontConverter tool can be found from NXP.

Usage: vft_create  input_svg   output_vft

After creating a VFT file, you can use the xxd tool (Linux tool, available in the msys on windows) to create a header file:

xxd -i output_vft > output.h

0 件の賞賛
返信

1,344件の閲覧回数
radoslawp
Contributor III

Where this vft_create tool can be found ? I cannot find it anywhere...

タグ(1)
0 件の賞賛
返信

1,327件の閲覧回数
howard_liu
NXP Employee
NXP Employee

You can search "vglite toolkit" on nxp.com.

VGLite Toolkit (nxp.com)

 

0 件の賞賛
返信

1,293件の閲覧回数
radoslawp
Contributor III

Well apparently there is no vft_create tool in this package, there is svgConverter and eboConverter but no vft_create although there is a manual for that but binary itself is not present. How can I get it than ? Was this package wrongly created that it lacks it ?

0 件の賞賛
返信

3,752件の閲覧回数
maglash64
Contributor II

Thank you for this reply, was looking for the same for some time,

Can you also shed some light on why the vg_lite_prerspective() transform function was removed from the API? using it makes the GPU stop rendering.

0 件の賞賛
返信

3,744件の閲覧回数
howard_liu
NXP Employee
NXP Employee

Now vg_lite_get_transform_matrix() is used to create a perspective matrix. It's easier than vg_lite_prerspective().

0 件の賞賛
返信

3,710件の閲覧回数
maglash64
Contributor II

Hi, can you give an example on how to use vg_lite_get_transform_matrix() API function?

I used it the following way but it did nothing.

the image is stored in the vg_lite_buffer_t image_buffer and has size 256x256 and format VG_LITE_RGBX8888,

target buffer rt is the main frame buffer.

vg_lite_point4_t src={0,0,256,256};
vg_lite_point4_t dst = {0,0,256,300};

vg_lite_identity(&matrix);

vg_lite_get_transform_matrix(src, dst, &matrix);

vg_lite_blit(&rt, &image_buffer, &matrix, VG_LITE_BLEND_MULTIPLY, 0, VG_LITE_FILTER_BI_LINEAR);

 

0 件の賞賛
返信

3,699件の閲覧回数
howardliu
Contributor II

@maglash64 You need to give 4-point location for src and 4-point location for dst. 

vg_lite_point4_t src={{x0, y0}, {x1, y1}, {x2, y2}, {x3, y3}};

You can reference to the code of VGLiteBlit under boards\evkmimxrt1170\vglite_appnote_samples. Below's the download link:

https://www.nxp.com/docs/en/application-note-software/AN13075SW.zip

3,971件の閲覧回数
Flo1989
Contributor III

Hi,

sry but i have no access to that link.

Flo1989_0-1681895985169.png

Best Regards,

Florian

0 件の賞賛
返信

3,963件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

this couldn't be shared on the public community, I will mail to you later

0 件の賞賛
返信

2,716件の閲覧回数
svoulaz_ik
Contributor III

Hello @joanxie ,

trying to access the link too, as we are interested in the offline tool to convert SVG to elementary structures - specifically for vector fonts. Also, a "VGLite Toolkit" is mentioned in AN13778, but I cannot find any resource. Could you help? Thanks in advance.

Stefano

0 件の賞賛
返信

3,977件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport
0 件の賞賛
返信

3,902件の閲覧回数
maglash64
Contributor II

Hi, I am also facing a similar problem, did you find the solution? What is the format of font to be placed in memory?

0 件の賞賛
返信