PDA

View Full Version : A problem about the VG_STROKE_CAP_STYLE.



akaiwall
04-14-2009, 02:13 AM
When i drawn a path with the code below:


VGPath path;
VGfloat m[9];
VGfloat color[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
VGint pattern[] = { 50, 30, 20, 10 };

VGfloat colorpaint[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
VGPaint paint;
VGubyte segments[] = { VG_MOVE_TO_ABS, VG_LINE_TO_ABS};
VGfloat coords[] = { 40.0f, 20.0f, 40.0f, 200.0f};

paint = vgCreatePaint();
vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
vgSetParameterfv(paint, VG_PAINT_COLOR, 4, colorpaint);
vgSetPaint(paint, VG_STROKE_PATH);
vgSetf(VG_STROKE_LINE_WIDTH, 20.0f);

vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();

path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VG_PATH_CAPABILITY_ALL);
vgAppendPathData( path, 2, segments, coords );

vgSeti(VG_STROKE_CAP_STYLE, VG_CAP_SQUARE);
vgDrawPath( path, VG_STROKE_PATH);


Why there is a gap between the line and the cap?

Xmas
04-14-2009, 06:07 AM
Which OpenVG implementation are you using?

akaiwall
04-14-2009, 05:45 PM
Which OpenVG implementation are you using?
OpenVG 1.1, released by Khronos Group.