use of com.ait.lienzo.client.core.types.ImageData in project lienzo-core by ahome-it.
the class EdgeDetectImageDataFilter method filter.
@Override
public ImageData filter(ImageData source, final boolean copy) {
if (null == source) {
return null;
}
if (copy) {
source = source.copy();
}
if (false == isActive()) {
return source;
}
final CanvasPixelArray data = source.getData();
if (null == data) {
return source;
}
final ImageData result = source.create();
filter_(data, result.getData(), source.getWidth(), source.getHeight());
return result;
}
use of com.ait.lienzo.client.core.types.ImageData 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