diff -r 69c81bdaf193 -r 5bf850c5b7f1 javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Fri May 24 12:29:58 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Mon May 27 08:30:18 2013 +0200 @@ -132,17 +132,20 @@ graphicsEnvironmentImpl.scale(x, y); } -//// public void drawImage(ImageData image, double x, double y){ -//// graphicsEnvironmentImpl.drawImage(image, x, y); -//// } -//// -//// public void drawImage(ImageData image, double x, double y, double width, double height){ -//// graphicsEnvironmentImpl.drawImage(image, x, y, width, height); -//// } -//// -//// public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){ -//// graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height); -//// } + public void paintImage(Image image, double x, double y){ + Object nativeImage = graphicsEnvironmentImpl.drawImage(image, x, y, image.getCached()); + image.cache(nativeImage); + } + + public void paintImage(Image image, double x, double y, double width, double height){ + Object nativeImage = graphicsEnvironmentImpl.drawImage(image, x, y, width, height, image.getCached()); + image.cache(nativeImage); + } + + public void paintImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){ + Object nativeImage = graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height, image.getCached()); + image.cache(nativeImage); + } public void setShadowColor(String color){ graphicsEnvironmentImpl.setShadowColor(color); @@ -262,25 +265,25 @@ graphicsEnvironmentImpl.strokeText(text, x, y, maxWidth); } -//// public ImageData createImageData(double x, double y){ -//// return graphicsEnvironmentImpl.createImageData(x, y); -//// } -//// -//// public ImageData createImageData(ImageData imageData){ -//// return graphicsEnvironmentImpl.createImageData(imageData); -//// } -//// -//// public ImageData getImageData(double x, double y, double width, double height){ -//// return graphicsEnvironmentImpl.getImageData(x, y, width, height); -//// } -//// -//// public void putImageData(ImageData imageData, double x, double y){ -//// graphicsEnvironmentImpl.putImageData(imageData, x, y); -//// } -//// -//// public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight){ -//// graphicsEnvironmentImpl.putImageData(imageData, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight); -//// } + public ImageData createPixelMap(double x, double y){ + return graphicsEnvironmentImpl.createPixelMap(x, y); + } + + public ImageData createPixelMap(ImageData pixelMap){ + return graphicsEnvironmentImpl.createPixelMap(pixelMap); + } + + public ImageData getSnapshot(double x, double y, double width, double height){ + return graphicsEnvironmentImpl.getPixelMap(x, y, width, height); + } + + public void paintPixelMap(ImageData pixelMap, double x, double y){ + graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y); + } + + public void paintPixelMap(ImageData pixelMap, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight){ + graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight); + } public void setGlobalAlpha(double alpha){ graphicsEnvironmentImpl.setGlobalAlpha(alpha); @@ -302,17 +305,17 @@ return new LinearGradient(x0, y0, x1, y1); } -//// public Pattern createPattern(ImageData image, String repeat){ -//// return new Pattern(image, repeat); -//// } + public Pattern createPattern(Image image, String repeat){ + return new Pattern(image, repeat); + } public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1){ return new RadialGradient(x0, y0, r0, x1, y1, r1); } -//// public ImageData getImageDataForPath(String path){ -//// return graphicsEnvironmentImpl.getImageForPath(path); -//// } + public Image getImageForPath(String path){ + return graphicsEnvironmentImpl.getImageForPath(path); + } public int getHeight(){ return graphicsEnvironmentImpl.getHeight();