Results 1 to 4 of 4

Thread: Dashed path issues

  1. #1
    Senior Member
    Join Date
    Feb 2006
    Posts
    115

    Dashed path issues

    I was playing around a bit with the reference implementation and was wondering what the correct handling is for Stroked paths when dashing is enabled. An example is:

    Code :
    unsigned char cmds[] = {VG_MOVE_TO_ABS, VG_LINE_TO_ABS, VG_LINE_TO_ABS, VG_CLOSE_PATH};
    float pathdata[] = {100,50,  100,150, 200,150};
    float dashpattern[] = {100,25,25,25};

    The end caps should be set to VG_CAP_SQUARE (and dash phase=0).

    At the bottom of the first vertical stroke, the spec is pretty clear that it (the initial vertex) is supposed to be a "JOIN" vertex (p.78-79), but clearly the end cap has been applied in the reference implementation (if the dashing is set such that the final part of the close path line connects to the starting point, the reference implementation creates a JOIN vertex as expected).

    The other issue is the top of the first stroke. The first stroke is exactly as long as the dashing phase. What is the correct behavior in this case? The reference implementation first creates the join, then adds the end cap in the direction of the next path element. Or is a 0-length "ON" path supposed to be created at the start of the second line (are 0 length paths ever supposed to be created during dashing?)?

    Thanks in advance

  2. #2
    Senior Member
    Join Date
    Feb 2006
    Posts
    115
    Any insights would still be greatly appriciated.

  3. #3

    Re: Dashed path issues

    Quote Originally Posted by Ivo Moravec
    The other issue is the top of the first stroke. The first stroke is exactly as long as the dashing phase. What is the correct behavior in this case? The reference implementation first creates the join, then adds the end cap in the direction of the next path element. Or is a 0-length "ON" path supposed to be created at the start of the second line (are 0 length paths ever supposed to be created during dashing?)?
    Hi Ivo,

    from my point of view you can't really define a correct behavior in this case. The exact length of a line segment can't be really calculated using floating point arithmetic. There are always some rounding errors, order of instructions and optimization-options involved.

    It may be very likely that the reference code calculates a line length of 100 + (some very very small number) and correctly decided that a join + end-cap is required in this case.

    Maybe it would be a good idea to eliminate path segments with a length less than the expected roundoff error range after dashing to avoid such inconsistencies.

    (but that's just my personal opinion)
    Nils Pipenbrinck

  4. #4
    Senior Member
    Join Date
    Feb 2006
    Posts
    115
    That makes sense.

    Thank you.

Similar Threads

  1. Programmer's learning path question.
    By Jessy Kernigan in forum Developers Coding:Beginner
    Replies: 2
    Last Post: 06-15-2010, 12:53 PM
  2. how to get out path data from a vgPath
    By akaiwall in forum OpenVG and VGU
    Replies: 1
    Last Post: 06-02-2009, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •