vgAppendPathData and vgModifyPathCoords, how to change visibility of path segments

Hello,

I have a question regarding changing visibility of path segments via VG_LINE_TO_ABS and VG_MOVE_TO_ABS

First, I’ve been told it’s resource expensive to create and destroy OpenVg paths, and it’s much fast to create a path, then modify it

Therefore, in my Initfunction I have

[b]vg3DPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, seg_pts, seg_pts * 2, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(vg3DPath, seg_pts, (const VGubyte *)vg3DPathSegments, points);[/b]

And in my Drawfunction I have,

[b]vgModifyPathCoords(vg3DPath, 0, seg_pts, points);[/b]

The number of points, seg_pts does not change, only the location of points, stored in the points array (defined as 2*seg_pts in size for X and Y coordinates of each point) .

This works fine.

My issue is that vgModifyPathCoords() does not take the segment description array, vg3DPathSegments
(defined as seg_pts+1 in size, for VG_MOVE_TO_ABS, VG_LINE_TO_ABS … VG_LINE_TO_ABS, VG_CLOSE_PATH)

If I want to change visibility of some segments. i. e. change some of the VG_LINE_TO_ABS to VG_MOVE_TO_ABS, I cannot pass this into vgModifyPathCoords(…)

My initial thinking was to make vg3DPathSegments, a class private variable, and changing values in it would automatically change those properties in the path, but it’s passed as a const, so this does not work.

How can I change these properties of the path?
Is there any better approach?

The language is C++11
The platform is Imx6, Yocto

Thank you very much
-D

[QUOTE=kennethone;39715]Hello,

I have a question regarding changing visibility of path segments via VG_LINE_TO_ABS and VG_MOVE_TO_ABS

First, I’ve been told it’s resource expensive to create and destroy OpenVg paths, and it’s much fast to create a path, then modify it

Therefore, in my Initfunction I have

[b]vg3DPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, seg_pts, seg_pts * 2, VG_PATH_CAPABILITY_ALL);
vgAppendPathData(vg3DPath, seg_pts, (const VGubyte *)vg3DPathSegments, points);[/b]

And in my Drawfunction I have,

[b]vgModifyPathCoords(vg3DPath, 0, seg_pts, points);[/b]

The number of points, seg_pts does not change, only the location of points, stored in the points array (defined as 2*seg_pts in size for X and Y coordinates of each point) .

This works fine.

My issue is that vgModifyPathCoords() does not take the segment description array, vg3DPathSegments
(defined as seg_pts+1 in size, for VG_MOVE_TO_ABS, VG_LINE_TO_ABS … VG_LINE_TO_ABS, VG_CLOSE_PATH)

If I want to change visibility of some segments. i. e. change some of the VG_LINE_TO_ABS to VG_MOVE_TO_ABS, I cannot pass this into vgModifyPathCoords(…)

My initial thinking was to make vg3DPathSegments, a class private variable, and changing values in it would automatically change those properties in the path, but it’s passed as a const, so this does not work.

How can I change these properties of the path?
Is there any better approach?

The language is C++11
The platform is Imx6, Yocto

Thank you very much
-D[/QUOTE]

You can’t change the segment types, you need to create a new path. Think what would happen if it allowed you to change a segment from VG_LINE_TO_ABS to VG_CUBIC_TO_ABS - it would mess up big time as the coordinates from there on would all be wrong.