# HG changeset patch # User Anton Epple # Date 1369316202 -7200 # Node ID 591d06d8e06f33d5748e665bf3d0fdde2afa30fb # Parent 836bc1845c65e56f6c592dbb27f76669aed67da8 moved GRaphicsEnvironment to SPI package diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Thu May 23 15:33:14 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Thu May 23 15:36:42 2013 +0200 @@ -17,6 +17,7 @@ */ package net.java.html.canvas; +import net.java.html.canvas.spi.GraphicsEnvironment; import java.awt.Dimension; /** @@ -132,15 +133,15 @@ graphicsEnvironmentImpl.scale(x, y); } - public void drawImage(Image image, double x, double y){ + public void drawImage(ImageData image, double x, double y){ graphicsEnvironmentImpl.drawImage(image, x, y); } - public void drawImage(Image image, double x, double y, double width, double height){ + public void drawImage(ImageData image, double x, double y, double width, double height){ graphicsEnvironmentImpl.drawImage(image, x, y, width, height); } - public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double 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); } @@ -272,7 +273,7 @@ // return graphicsEnvironmentImpl.createImageData(x, y); // } // -// public ImageData createImageData(Image imageData){ +// public ImageData createImageData(ImageData imageData){ // return graphicsEnvironmentImpl.createImageData(imageData); // } // @@ -308,7 +309,7 @@ return new LinearGradient(x0, y0, x1, y1); } - public Pattern createPattern(Image image, String repeat){ + public Pattern createPattern(ImageData image, String repeat){ return new Pattern(image, repeat); } @@ -316,9 +317,9 @@ return new RadialGradient(x0, y0, r0, x1, y1, r1); } - public Image getImageDataForPath(String path){ - return graphicsEnvironmentImpl.getImageForPath(path); - } +// public ImageData getImageDataForPath(String path){ +// return graphicsEnvironmentImpl.getImageForPath(path); +// } public int getHeight(){ return graphicsEnvironmentImpl.getHeight(); diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsEnvironment.java Thu May 23 15:33:14 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/** - * 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 interface GraphicsEnvironment { - - public void arc(double centerX, - double centerY, - double startAngle, - double radius, - double endAngle, - boolean ccw); - - public void arcTo(double x1, - double y1, - double x2, - double y2, - double r); - - public boolean isPointInPath(double x, double y); - - public void fill(); - - public void stroke(); - - public void beginPath(); - - public void closePath(); - - public void clip(); - - public void moveTo(double x, double y); - - public void lineTo(double x, double y); - - public void quadraticCurveTo(double cpx, double cpy, double x, double y); - - public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); - - public void fillRect(double x, double y, double width, double height); - - public void strokeRect(double x, double y, double width, double height); - - public void clearRect(double x, double y, double width, double height); - - public void rect(double x, double y, double width, double height); - - public void save(); - - public void restore(); - - public void rotate(double angle); - - public void transform(double a, double b, double c, double d, double e, double f); - - public void setTransform(double a, double b, double c, double d, double e, double f); - - public void translate(double x, double y); - - public void scale(double x, double y); - - public void drawImage(Image image, double x, double y); - - public void drawImage(Image image, double x, double y, double width, double height); - - public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height); - - public void setFillStyle(String style); - - public String getFillStyle(); - - public void setFillStyle(Style style); - - public void setStrokeStyle(String style); - - public void setStrokeStyle(Style style); - - public void setShadowColor(String color); - - public void setShadowBlur(double blur); - - public void setShadowOffsetX(double x); - - public void setShadowOffsetY(double y); - - public String getStrokeStyle(); - - public String getShadowColor(); - - public double getShadowBlur(); - - public double getShadowOffsetX(); - - public double getShadowOffsetY(); - - public String getLineCap(); - - public void setLineCap(String style); - - public String getLineJoin(); - - public void setLineJoin(String style); - - public double getLineWidth(); - - public void setLineWidth(double width); - - public double getMiterLimit(); - - public void setMiterLimit(double limit); - - public String getFont(); - - public void setFont(String font); - - public String getTextAlign(); - - public void setTextAlign(String textAlign); - - public String getTextBaseline(); - - public void setTextBaseline(String textbaseline); - - public void fillText(String text, double x, double y); - - public void fillText(String text, double x, double y, double maxWidth); - - public Dimension measureText(String text); - - public void strokeText(String text, double x, double y); - - public void strokeText(String text, double x, double y, double maxWidth); - -// public ImageData createImageData(double x, double y); -// -// public ImageData createImageData(Image imageData); -// -// public ImageData getImageData(double x, double y, double width, double height); -// -// public void putImageData(ImageData imageData, double x, double y); -// -// public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight); - - public void setGlobalAlpha(double alpha); - - public double getGlobalAlpha(); - - public void setGlobalCompositeOperation(String operation); - - public String getGlobalCompositeOperation(); - - public Image getImageForPath(String path); - - public int getHeight(); - - public int getWidth(); - - public void setHeight(int height); - - public void setWidth(int width); -} diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/Image.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Image.java Thu May 23 15:33:14 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/** - * 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; - -/** - * - * @author antonepple - */ -public interface Image { - - public double getHeight(); - - public double getWidth(); - - -} diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java Thu May 23 15:36:42 2013 +0200 @@ -0,0 +1,31 @@ +/** + * 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; + +/** + * + * @author antonepple + */ +public interface ImageData { + + public double getHeight(); + + public double getWidth(); + + +} diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java Thu May 23 15:33:14 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Pattern.java Thu May 23 15:36:42 2013 +0200 @@ -23,19 +23,19 @@ */ public final class Pattern extends Style{ - Image imageData; + ImageData imageData; String repeat; - Pattern(Image imageData, String repeat) { + Pattern(ImageData imageData, String repeat) { this.imageData = imageData; this.repeat = repeat; } - public Image getImageData() { + public ImageData getImageData() { return imageData; } - public void setImageData(Image imageData) { + public void setImageData(ImageData imageData) { this.imageData = imageData; } diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/Style.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Thu May 23 15:33:14 2013 +0200 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Thu May 23 15:36:42 2013 +0200 @@ -34,7 +34,7 @@ return new LinearGradient(x0, y0, x1, y1); } - public static final Pattern createPattern(Image imageData, String repeat){ + public static final Pattern createPattern(ImageData imageData, String repeat){ return new Pattern(imageData, repeat); } diff -r 836bc1845c65 -r 591d06d8e06f javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java Thu May 23 15:36:42 2013 +0200 @@ -0,0 +1,184 @@ +/** + * 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.spi; + +import java.awt.Dimension; +import net.java.html.canvas.ImageData; +import net.java.html.canvas.Style; + +/** + * Provider API for Canvas. Implement this to add support for your platform. + * @author antonepple + */ +public interface GraphicsEnvironment { + + public void arc(double centerX, + double centerY, + double startAngle, + double radius, + double endAngle, + boolean ccw); + + public void arcTo(double x1, + double y1, + double x2, + double y2, + double r); + + public boolean isPointInPath(double x, double y); + + public void fill(); + + public void stroke(); + + public void beginPath(); + + public void closePath(); + + public void clip(); + + public void moveTo(double x, double y); + + public void lineTo(double x, double y); + + public void quadraticCurveTo(double cpx, double cpy, double x, double y); + + public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y); + + public void fillRect(double x, double y, double width, double height); + + public void strokeRect(double x, double y, double width, double height); + + public void clearRect(double x, double y, double width, double height); + + public void rect(double x, double y, double width, double height); + + public void save(); + + public void restore(); + + public void rotate(double angle); + + public void transform(double a, double b, double c, double d, double e, double f); + + public void setTransform(double a, double b, double c, double d, double e, double f); + + public void translate(double x, double y); + + public void scale(double x, double y); + + public void drawImage(ImageData image, double x, double y); + + public void drawImage(ImageData image, double x, double y, double width, double height); + + public void drawImage(ImageData image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height); + + public void setFillStyle(String style); + + public String getFillStyle(); + + public void setFillStyle(Style style); + + public void setStrokeStyle(String style); + + public void setStrokeStyle(Style style); + + public void setShadowColor(String color); + + public void setShadowBlur(double blur); + + public void setShadowOffsetX(double x); + + public void setShadowOffsetY(double y); + + public String getStrokeStyle(); + + public String getShadowColor(); + + public double getShadowBlur(); + + public double getShadowOffsetX(); + + public double getShadowOffsetY(); + + public String getLineCap(); + + public void setLineCap(String style); + + public String getLineJoin(); + + public void setLineJoin(String style); + + public double getLineWidth(); + + public void setLineWidth(double width); + + public double getMiterLimit(); + + public void setMiterLimit(double limit); + + public String getFont(); + + public void setFont(String font); + + public String getTextAlign(); + + public void setTextAlign(String textAlign); + + public String getTextBaseline(); + + public void setTextBaseline(String textbaseline); + + public void fillText(String text, double x, double y); + + public void fillText(String text, double x, double y, double maxWidth); + + public Dimension measureText(String text); + + public void strokeText(String text, double x, double y); + + public void strokeText(String text, double x, double y, double maxWidth); + +// public ImageData createImageData(double x, double y); +// +// public ImageData createImageData(ImageData imageData); +// +// public ImageData getImageData(double x, double y, double width, double height); +// +// public void putImageData(ImageData imageData, double x, double y); +// +// public void putImageData(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight); + + public void setGlobalAlpha(double alpha); + + public double getGlobalAlpha(); + + public void setGlobalCompositeOperation(String operation); + + public String getGlobalCompositeOperation(); + +// public ImageData getImageForPath(String path); + + public int getHeight(); + + public int getWidth(); + + public void setHeight(int height); + + public void setWidth(int width); +}