diff -r 4613a6fe2862 -r 2dc980517b36 javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Wed May 22 16:37:51 2013 +0200 @@ -0,0 +1,346 @@ +/** + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach + * + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. Look for COPYING file in the top folder. If not, see + * http://opensource.org/licenses/GPL-2.0. + */ +package net.java.html.canvas; + +import java.awt.Dimension; + +/** + * + * @author antonepple + */ +public final class GraphicsContext { + + GraphicsEnvironment graphicsEnvironmentImpl; + + public GraphicsContext(GraphicsEnvironment graphicsEnvironment) { + this.graphicsEnvironmentImpl = graphicsEnvironment; + } + + public void arc(double centerX, + double centerY, + double startAngle, + double radius, + double endAngle, + boolean ccw) { + graphicsEnvironmentImpl.arc(centerX, centerY, startAngle, radius, endAngle, ccw); + } + + public void arcTo(double x1, + double y1, + double x2, + double y2, + double r) { + graphicsEnvironmentImpl.arcTo(x1, y1, x2, y2, r); + } + + public boolean isPointInPath(double x, double y) { + return graphicsEnvironmentImpl.isPointInPath(x, y); + } + + public void fill() { + graphicsEnvironmentImpl.fill(); + } + + public void stroke() { + graphicsEnvironmentImpl.stroke(); + } + + public void beginPath() { + graphicsEnvironmentImpl.beginPath(); + } + + public void closePath(){ + graphicsEnvironmentImpl.closePath(); + } + + public void clip(){ + graphicsEnvironmentImpl.clip(); + } + + public void moveTo(double x, double y){ + graphicsEnvironmentImpl.moveTo(x, y); + } + + public void lineTo(double x, double y){ + graphicsEnvironmentImpl.lineTo(x, y); + } + + public void quadraticCurveTo(double cpx, double cpy, double x, double y){ + graphicsEnvironmentImpl.quadraticCurveTo(cpx, cpy, x, y); + } + + public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y){ + graphicsEnvironmentImpl.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y); + } + + public void fillRect(double x, double y, double width, double height){ + graphicsEnvironmentImpl.fillRect(x, y, width, height); + } + + public void strokeRect(double x, double y, double width, double height){ + graphicsEnvironmentImpl.strokeRect(x, y, width, height); + } + + public void clearRect(double x, double y, double width, double height){ + graphicsEnvironmentImpl.clearRect(x, y, width, height); + } + + public void rect(double x, double y, double width, double height){ + graphicsEnvironmentImpl.rect(x, y, width, height); + } + + public void save(){ + graphicsEnvironmentImpl.save(); + } + + public void restore(){ + graphicsEnvironmentImpl.restore(); + } + + public void rotate(double angle){ + graphicsEnvironmentImpl.rotate(angle); + } + + public void transform(double a, double b, double c, double d, double e, double f){ + graphicsEnvironmentImpl.transform(a, b, c, d, e, f); + } + + public void setTransform(double a, double b, double c, double d, double e, double f){ + graphicsEnvironmentImpl.setTransform(a, b, c, d, e, f); + } + + public void translate(double x, double y){ + graphicsEnvironmentImpl.translate(x, y); + } + + public void scale(double x, double y){ + 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 setFillStyle(String style){ + graphicsEnvironmentImpl.setFillStyle(style); + } + + public String getFillStyle(){ + return graphicsEnvironmentImpl.getFillStyle(); + } + + public void setFillStyle(Pattern style){ + graphicsEnvironmentImpl.setFillStyle(style); + } + + public void setStrokeStyle(String style){ + graphicsEnvironmentImpl.setStrokeStyle(style); + } + + public void setStrokeStyle(Pattern style){ + graphicsEnvironmentImpl.setStrokeStyle(style); + } + + public void setShadowColor(String color){ + graphicsEnvironmentImpl.setShadowColor(color); + } + + public void setShadowBlur(double blur){ + graphicsEnvironmentImpl.setShadowBlur(blur); + } + + public void setShadowOffsetX(double x){ + graphicsEnvironmentImpl.setShadowOffsetX(x); + } + + public void setShadowOffsetY(double y){ + graphicsEnvironmentImpl.setShadowOffsetY(y); + } + + public String getStrokeStyle(){ + return graphicsEnvironmentImpl.getStrokeStyle(); + } + + public String getShadowColor(){ + return graphicsEnvironmentImpl.getShadowColor(); + } + + public double getShadowBlur(){ + return graphicsEnvironmentImpl.getShadowBlur(); + } + + public double getShadowOffsetX(){ + return graphicsEnvironmentImpl.getShadowOffsetX(); + } + + public double getShadowOffsetY(){ + return graphicsEnvironmentImpl.getShadowOffsetY(); + } + + public String getLineCap(){ + return graphicsEnvironmentImpl.getLineCap(); + } + + public void setLineCap(String style){ + graphicsEnvironmentImpl.setLineCap(style); + } + + public String getLineJoin(){ + return graphicsEnvironmentImpl.getLineJoin(); + } + + public void setLineJoin(String style){ + graphicsEnvironmentImpl.setLineJoin(style); + } + + public double getLineWidth(){ + return graphicsEnvironmentImpl.getLineWidth(); + } + + public void setLineWidth(double width){ + graphicsEnvironmentImpl.setLineWidth(width); + } + + public double getMiterLimit(){ + return graphicsEnvironmentImpl.getMiterLimit(); + } + + public void setMiterLimit(double limit){ + graphicsEnvironmentImpl.setMiterLimit(limit); + } + + public String getFont(){ + return graphicsEnvironmentImpl.getFont(); + } + + public void setFont(String font){ + graphicsEnvironmentImpl.setFont(font); + } + + public String getTextAlign(){ + return graphicsEnvironmentImpl.getTextAlign(); + } + + public void setTextAlign(String textAlign){ + graphicsEnvironmentImpl.setTextAlign(textAlign); + } + + public String getTextBaseline(){ + return graphicsEnvironmentImpl.getTextBaseline(); + } + + public void setTextBaseline(String textbaseline){ + graphicsEnvironmentImpl.setTextBaseline(textbaseline); + } + + public void fillText(String text, double x, double y){ + graphicsEnvironmentImpl.fillText(text, x, y); + } + + public void fillText(String text, double x, double y, double maxWidth){ + graphicsEnvironmentImpl.fillText(text, x, y, maxWidth); + } + + public Dimension measureText(String text){ + return graphicsEnvironmentImpl.measureText(text); + } + + public void strokeText(String text, double x, double y){ + graphicsEnvironmentImpl.strokeText(text, x, y); + } + + public void strokeText(String text, double x, double y, double maxWidth){ + 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 void setGlobalAlpha(double alpha){ + graphicsEnvironmentImpl.setGlobalAlpha(alpha); + } + + public double getGlobalAlpha(){ + return graphicsEnvironmentImpl.getGlobalAlpha(); + } + + public void setGlobalCompositeOperation(String operation){ + graphicsEnvironmentImpl.setGlobalCompositeOperation(operation); + } + + public String getGlobalCompositeOperation(){ + return graphicsEnvironmentImpl.getGlobalCompositeOperation(); + } + + public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1){ + return graphicsEnvironmentImpl.createLinearGradient(x0, y0, x1, y1); + } + + public Pattern createPattern(ImageData image, String repeat){ + return graphicsEnvironmentImpl.createPattern(image, repeat); + } + + public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1){ + return graphicsEnvironmentImpl.createRadialGradient(x0, y0, r0, x1, y1, r1); + } + + public ImageData getImageForPath(String path){ + return graphicsEnvironmentImpl.getImageForPath(path); + } + + public int getHeight(){ + return graphicsEnvironmentImpl.getHeight(); + } + + public int getWidth(){ + return graphicsEnvironmentImpl.getWidth(); + } + + public void setHeight(int height){ + graphicsEnvironmentImpl.setHeight(height); + } + + public void setWidth(int width){ + graphicsEnvironmentImpl.setWidth(width); + } +}