use of com.google.gwt.canvas.dom.client.CanvasPixelArray in project lienzo-core by ahome-it.
the class InvertColorImageDataFilter 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;
}
filter_(data, FilterCommonOps.getLength(source));
return source;
}
use of com.google.gwt.canvas.dom.client.CanvasPixelArray in project lienzo-core by ahome-it.
the class LightnessGrayScaleImageDataFilter 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;
}
filter_(data, FilterCommonOps.getLength(source));
return source;
}
use of com.google.gwt.canvas.dom.client.CanvasPixelArray in project playn by threerings.
the class HtmlImage method getRgb.
@Override
public void getRgb(int startX, int startY, int width, int height, int[] rgbArray, int offset, int scanSize) {
assert isReady() : "Cannot getRgb() a non-ready image";
if (canvas == null) {
canvas = img.getOwnerDocument().createCanvasElement();
canvas.setHeight(img.getHeight());
canvas.setWidth(img.getWidth());
canvas.getContext2d().drawImage(img, 0, 0);
// img.getOwnerDocument().getBody().appendChild(canvas);
}
Context2d ctx = canvas.getContext2d();
ImageData imageData = ctx.getImageData(startX, startY, width, height);
CanvasPixelArray pixelData = imageData.getData();
int i = 0;
int dst = offset;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int r = pixelData.get(i++);
int g = pixelData.get(i++);
int b = pixelData.get(i++);
int a = pixelData.get(i++);
rgbArray[dst + x] = a << 24 | r << 16 | g << 8 | b;
}
dst += scanSize;
}
}
use of com.google.gwt.canvas.dom.client.CanvasPixelArray in project lienzo-core by ahome-it.
the class AbstractTransformImageDataFilter 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 FilterTransformFunction transform = getTransform();
if (null == transform) {
return source;
}
final ImageData result = source.create();
FilterCommonOps.doFilterTransform(data, result.getData(), transform, source.getWidth(), source.getHeight());
return result;
}
use of com.google.gwt.canvas.dom.client.CanvasPixelArray in project lienzo-core by ahome-it.
the class AbstractValueTableImageDataFilter 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;
}
FilterCommonOps.doFilterTable(data, getTable(getValue()), source.getWidth(), source.getHeight());
return source;
}
Aggregations