Rotated text with OpenVG
I've noticed that the OpenVG transformation matrix is ignored by the text rendering routine at all and I cannot control the text position with it manually with VG_GLYPH_ORIGIN parameter
.
I'm implementing a scene graph. I found out that I can use vgGetMatrix
, read components 6 and 7 of the current 3x3 transform matrix and set VG_GLYPH_ORIGIN
to those values before drawing a block of text. This allows the text origin to be placed in correct place, but the text is still always displayed left-to-right.
However, this itself doesn't enable me to do any other transformations, li开发者_如何学JAVAke rotation. I'm surprised because the text is composed from VGPath
s and they are indeed transformed
Is there a way to make the text rotated with OpenVG 1.1? Or should I ignore the text functionality from OpenVG 1.1 and draw the letters as individual paths or images manually?
All the draw functions use a different user->surface matrix:
vgDrawPath
usesVG_MATRIX_PATH_USER_TO_SURFACE
vgDrawImage
usesVG_MATRIX_IMAGE_USER_TO_SURFACE
vgDrawGlyph
/vgDrawGlyphs
useVG_MATRIX_GLYPH_USER_TO_SURFACE
By default, all of the matrix functions (vgTranslate
, vgRotate
, vgLoadMatrix
, etc) operate on VG_MATRIX_PATH_USER_TO_SURFACE
. To change the active matrix, call vgSeti
with VG_MATRIX_MODE
as the first argument:
vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE);
/* now vgTranslate, vgRotate, etc will operate on VG_MATRIX_GLYPH_USER_TO_SURFACE */
精彩评论