The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Text on Image

Given I'm very new to OpenVG, and I have had no luck finding documentation or samples that give me pointers, I decided I should try his place.

My problem is divided into two issues:

1) Draw text
2) Draw that text on an Open VG Image.

For #1 I'm not finding anything that fully shows how to render text. I have seen a lot of talk of the glyphs, fonts and what not, but no code sample that show all steps required to paint a string at a certain position with a certain formatting.

For #2 I have read on the OpenVG 1.1 Specifications that you can target an image for your painting, but I'm not able to understand how this is done, and I can't find a sample where you paint on an image and then paint that "edited" image onto the screen.

What I'm trying to achieve is writing text onto an image and then display that image.

Re: Text on Image

1)
- Get Freetype. Use it to read ttf files.
- make OpenVG path data out of that with Hybrid's old font2openvg.cpp code (or write your own). This will generate the glyph data in a format you can use (it will make a .c or .h file you can include in whatever project you need it in).

- Then, in the program you're rendering in, create the font object and populate the glyphs with the path data. Then it's just a matter of calling the vg funtions to render text.

2)
If you're using EGL, then you can use eglCreatePbufferFromClientBuffer(). Just use eglMakeCurrent() to switch to the pbuffer, and after you switch back the image will be populated. (Caution: you might want to use eglMakeCurrent() with NULL to disconnect from the current context before making a new one current).

If eglCreatePbufferFromClientBuffer() is not available, use any off-screen surface (or, if the screen is double buffered, and trashing the contents of the frame buffer is not an issue, just use the normal window surface), and use vgGetPixels()/vgReadPixels() to transfer it into your image.