Results 1 to 2 of 2

Thread: vgAppendPathData and vgModifyPathCoords, how to change visibility of path segments

  1. #1
    Newbie
    Join Date
    Jan 2016
    Posts
    1

    Question 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

    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);


    And in my Drawfunction I have,

    vgModifyPathCoords(vg3DPath, 0, seg_pts, points);


    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

  2. #2
    Newbie
    Join Date
    Jan 2016
    Posts
    1
    Quote Originally Posted by kennethone View Post
    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

    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);


    And in my Drawfunction I have,

    vgModifyPathCoords(vg3DPath, 0, seg_pts, points);


    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
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean