Results 1 to 2 of 2

Thread: Problem getting visually correct stroke

  1. #1
    Newbie
    Join Date
    Feb 2018
    Posts
    1

    Problem getting visually correct stroke

    I have a problem with setting proper stroke attributes when drawing with OpenVG.
    Currently - whatever path is drawn - including standard ellipse and rect in example below - there are artifacts appearing on the shape's edge which look like the stroke isn't solid and has gaps.
    What I'd like to achieve are shapes without those artifacts at all - smooth and clean.

    Code used:

    Code :
    vgSeti(VG_RENDERING_QUALITY, VG_RENDERING_QUALITY_BETTER);
     
    // set fill color
    float colorFill[4] = { 0.6f, 0.6f, 0.6f, 1.0f };
    VGPaint fillPaint = vgCreatePaint();
    vgSetParameteri(fillPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
    vgSetParameterfv(fillPaint, VG_PAINT_COLOR, 4, colorFill);
    vgSetPaint(fillPaint, VG_FILL_PATH);
    vgDestroyPaint(fillPaint);
     
    // set stroke color
    float colorStroke[4] = { 0.0f, 0.0f, 0.5f, 1.0f };
    VGPaint strokePaint = vgCreatePaint();
    vgSetParameteri(strokePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
    vgSetParameterfv(strokePaint, VG_PAINT_COLOR, 4, colorStroke);
    vgSetPaint(strokePaint, VG_STROKE_PATH);
    vgSetf(VG_STROKE_LINE_WIDTH, 30.0f);
    vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
    vgSeti(VG_STROKE_JOIN_STYLE, VG_JOIN_ROUND);
    vgDestroyPaint(strokePaint);
     
    VGPath path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
        256.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
     
    vguEllipse(path, 400.0f, 600.0f, 400.0f, 200.0f);
    vguRect(path, 200.0f, 200.0f, 400.0f, 200.0f);
     
    vgDrawPath(path, VG_STROKE_PATH | VG_FILL_PATH);

    The result I'm getting is visible here:
    https://i.stack.imgur.com/JxWRA.png

    Can anybody point out if I am missing any setting relevant for rendering?

  2. #2
    What's the name of the vendor of OpenVG ?
    Normally, It is not correct result of OpenVG.

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