//generate the define sprite for the stroke object with no clipping
ShapeWithStyle swsStroke = new ShapeWithStyle(strokeStyles);
// Consider linestyle stroke widths with bounds calculation
AbstractStrokeNode strokeNode = (AbstractStrokeNode) stroke;
LineStyle ls = createGenericLineStyle(strokeNode);
Rect shapeBounds = node.getBounds(shapeRecords2, ls);
LineStyle lineStyle = createLineStyle(stroke, shapeBounds);
swsStroke.getLineStyles().add(lineStyle);