use of com.ait.lienzo.client.core.types.DashArray in project kie-wb-common by kiegroup.
the class AuthorityRequirementView method createLine.
private static Object[] createLine(final double x1, final double y1, final double x2, final double y2) {
final MultiPath head = new MultiPath();
final MultiPath tail = new MultiPath().M(DECORATOR_RADIUS, -DECORATOR_RADIUS).circle(DECORATOR_RADIUS).setFillColor(ColorName.BLACK).setFillAlpha(1);
final DirectionalLine line = new DirectionalLine(x1, y1, x2, y2);
line.setDashArray(new DashArray(4, 4));
line.setDraggable(true);
line.setSelectionStrokeOffset(SELECTION_OFFSET);
line.setHeadOffset(head.getBoundingBox().getHeight());
line.setTailOffset(tail.getBoundingBox().getHeight());
final MultiPathDecorator headDecorator = new MultiPathDecorator(head);
final MultiPathDecorator tailDecorator = new MultiPathDecorator(tail);
return new Object[] { line, headDecorator, tailDecorator };
}
use of com.ait.lienzo.client.core.types.DashArray in project lienzo-core by ahome-it.
the class LienzoCore method examineNativeLineDashSupported.
private final boolean examineNativeLineDashSupported() {
if (IS_CANVAS_SUPPORTED) {
try {
final ScratchPad scratch = new ScratchPad(20, 10);
final Context2D context = scratch.getContext();
context.setStrokeWidth(10);
context.setLineCap(LineCap.BUTT);
context.setStrokeColor(ColorName.BLUE);
context.beginPath();
context.moveTo(0, 5);
context.lineTo(20, 5);
context.stroke();
context.setStrokeColor(ColorName.RED);
context.setLineDash(new DashArray(5, 5));
context.beginPath();
context.moveTo(0, 5);
context.lineTo(20, 5);
context.stroke();
final ImageData backing = context.getImageData(0, 0, 20, 10);
if (null != backing) {
if ((backing.getRedAt(3, 5) == 255) && (backing.getBlueAt(3, 5) == 0) && (backing.getGreenAt(3, 5) == 0)) {
if ((backing.getRedAt(8, 5) == 0) && (backing.getBlueAt(8, 5) == 255) && (backing.getGreenAt(8, 5) == 0)) {
return true;
}
}
}
} catch (final Exception e) {
// FF 22 dev mode does not like line dashes
error("Line Dash test failed ", e);
}
}
return false;
}
Aggregations