refactoring for API review canvas
authorAnton Epple <toni.epple@eppleton.de>
Thu, 26 Sep 2013 14:20:18 -0700
branchcanvas
changeset 1302e67363288df1
parent 1297 2960a1d37277
child 1303 3d62ad46d744
refactoring for API review
javaquery/canvas/pom.xml
javaquery/canvas/src/main/java/net/java/html/canvas/Dimension.java
javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java
javaquery/canvas/src/main/java/net/java/html/canvas/Image.java
javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java
javaquery/canvas/src/main/java/net/java/html/canvas/Style.java
javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java
javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsUtils.java
javaquery/canvas/src/main/java/org/apidesign/html/canvas/impl/CnvsAccssr.java
javaquery/canvas/src/main/resources/net/java/html/canvas/package.html
javaquery/canvas/src/main/resources/net/java/html/canvas/spi/package.html
     1.1 --- a/javaquery/canvas/pom.xml	Mon Sep 23 07:52:41 2013 -0700
     1.2 +++ b/javaquery/canvas/pom.xml	Thu Sep 26 14:20:18 2013 -0700
     1.3 @@ -4,12 +4,12 @@
     1.4      <parent>
     1.5          <artifactId>javaquery</artifactId>
     1.6          <groupId>org.apidesign.bck2brwsr</groupId>
     1.7 -        <version>0.8-SNAPSHOT</version>
     1.8 +        <version>0.9-SNAPSHOT</version>
     1.9      </parent>
    1.10    
    1.11      <groupId>net.java.html</groupId>
    1.12      <artifactId>canvas</artifactId>
    1.13 -    <version>0.8-SNAPSHOT</version>
    1.14 +    <version>0.9-SNAPSHOT</version>
    1.15      <packaging>jar</packaging>
    1.16      <name>canvas</name>
    1.17      <url>http://maven.apache.org</url>
     2.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Dimension.java	Mon Sep 23 07:52:41 2013 -0700
     2.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Dimension.java	Thu Sep 26 14:20:18 2013 -0700
     2.3 @@ -1,3 +1,20 @@
     2.4 +/**
     2.5 + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     2.6 + * <jaroslav.tulach@apidesign.org>
     2.7 + *
     2.8 + * This program is free software: you can redistribute it and/or modify it under
     2.9 + * the terms of the GNU General Public License as published by the Free Software
    2.10 + * Foundation, version 2 of the License.
    2.11 + *
    2.12 + * This program is distributed in the hope that it will be useful, but WITHOUT
    2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.14 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    2.15 + * details.
    2.16 + *
    2.17 + * You should have received a copy of the GNU General Public License along with
    2.18 + * this program. Look for COPYING file in the top folder. If not, see
    2.19 + * http://opensource.org/licenses/GPL-2.0.
    2.20 + */
    2.21  /*
    2.22   * To change this template, choose Tools | Templates
    2.23   * and open the template in the editor.
    2.24 @@ -5,35 +22,35 @@
    2.25  package net.java.html.canvas;
    2.26  
    2.27  /**
    2.28 - * Just a simple class to replace the need of java.awt.Dimension, since we only 
    2.29 + * Just a simple class to replace the need of java.awt.Dimension, since we only
    2.30   * want to use Java core APIs to keep porting simple.
    2.31 + *
    2.32   * @author antonepple
    2.33   */
    2.34 -public class Dimension {
    2.35 -    double width, height;
    2.36 +public final class Dimension {
    2.37 +
    2.38 +    final double width, height;
    2.39  
    2.40      public Dimension(double width, double height) {
    2.41          this.width = width;
    2.42          this.height = height;
    2.43      }
    2.44  
    2.45 -    
    2.46 -    
    2.47 +    /**
    2.48 +     * Returns the height of this Dimension in double precision
    2.49 +     *
    2.50 +     * @return the width of this Dimension.
    2.51 +     */
    2.52      public double getWidth() {
    2.53          return width;
    2.54      }
    2.55  
    2.56 -    public void setWidth(double width) {
    2.57 -        this.width = width;
    2.58 -    }
    2.59 -
    2.60 +    /**
    2.61 +     * Returns the width of this Dimension in double precision.
    2.62 +     *
    2.63 +     * @return the height of this Dimension.
    2.64 +     */
    2.65      public double getHeight() {
    2.66          return height;
    2.67      }
    2.68 -
    2.69 -    public void setHeight(double height) {
    2.70 -        this.height = height;
    2.71 -    }
    2.72 -    
    2.73 -    
    2.74  }
     3.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Mon Sep 23 07:52:41 2013 -0700
     3.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java	Thu Sep 26 14:20:18 2013 -0700
     3.3 @@ -22,20 +22,40 @@
     3.4  import net.java.html.canvas.Style.Pattern;
     3.5  import net.java.html.canvas.Style.RadialGradient;
     3.6  import net.java.html.canvas.spi.GraphicsEnvironment;
     3.7 +import org.apidesign.html.canvas.impl.CnvsAccssr;
     3.8  
     3.9  /**
    3.10 - * A 2D Graphics Context similar to HTML5 or JavaFX GraphicsContext. 
    3.11 - * Use this to paint on your Canvas.s
    3.12 + * A 2D Graphics Context similar to HTML5 or JavaFX GraphicsContext. Use this to
    3.13 + * paint on your Canvas.s
    3.14 + *
    3.15   * @author antonepple
    3.16   */
    3.17  public final class GraphicsContext {
    3.18  
    3.19      GraphicsEnvironment graphicsEnvironmentImpl;
    3.20  
    3.21 -    public GraphicsContext(GraphicsEnvironment graphicsEnvironment) {
    3.22 +    static {
    3.23 +        CnvsAccssr cnvsAccssr = new CnvsAccssr() {
    3.24 +            @Override
    3.25 +            public GraphicsContext create(GraphicsEnvironment environment) {
    3.26 +                return new GraphicsContext(environment);
    3.27 +            }
    3.28 +        };
    3.29 +    }
    3.30 +
    3.31 +    GraphicsContext(GraphicsEnvironment graphicsEnvironment) {
    3.32          this.graphicsEnvironmentImpl = graphicsEnvironment;
    3.33      }
    3.34  
    3.35 +    /**
    3.36 +     * Adds path elements to the current path to make an arc.
    3.37 +     *
    3.38 +     * @param centerX the center x position of the arc.
    3.39 +     * @param centerY the center y position of the arc.
    3.40 +     * @param radius the radius of the arc.
    3.41 +     * @param endAngle teh endAngle of the arc
    3.42 +     * @param ccw the direction of the arc (counterclockwise)
    3.43 +     */
    3.44      public void arc(double centerX,
    3.45              double centerY,
    3.46              double startAngle,
    3.47 @@ -45,328 +65,594 @@
    3.48          graphicsEnvironmentImpl.arc(centerX, centerY, startAngle, radius, endAngle, ccw);
    3.49      }
    3.50  
    3.51 +    /**
    3.52 +     * Adds segments to the current path to make an arc.
    3.53 +     *
    3.54 +     * @param x1 the X coordinate of the first point of the arc.
    3.55 +     * @param y1 the Y coordinate of the first point of the arc.
    3.56 +     * @param x2 the X coordinate of the second point of the arc.
    3.57 +     * @param y2 the Y coordinate of the second point of the arc.
    3.58 +     * @param radius the radius of the arc in the range {0.0-positive infinity}.
    3.59 +     */
    3.60      public void arcTo(double x1,
    3.61              double y1,
    3.62              double x2,
    3.63              double y2,
    3.64 -            double r) {
    3.65 -        graphicsEnvironmentImpl.arcTo(x1, y1, x2, y2, r);
    3.66 +            double radius) {
    3.67 +        graphicsEnvironmentImpl.arcTo(x1, y1, x2, y2, radius);
    3.68      }
    3.69  
    3.70 +    /**
    3.71 +     * Returns true if the the given x,y point is inside the path.
    3.72 +     *
    3.73 +     * @param x the X coordinate to use for the check.
    3.74 +     * @param y the Y coordinate to use for the check.
    3.75 +     * @return true if the point given is inside the path, false otherwise.
    3.76 +     */
    3.77      public boolean isPointInPath(double x, double y) {
    3.78          return graphicsEnvironmentImpl.isPointInPath(x, y);
    3.79      }
    3.80  
    3.81 +    /**
    3.82 +     * Fills the path with the current fill paint.
    3.83 +     */
    3.84      public void fill() {
    3.85          graphicsEnvironmentImpl.fill();
    3.86      }
    3.87  
    3.88 +    /**
    3.89 +     * Strokes the path with the current stroke paint.
    3.90 +     */
    3.91      public void stroke() {
    3.92          graphicsEnvironmentImpl.stroke();
    3.93      }
    3.94  
    3.95 +    /**
    3.96 +     * Starts a Path
    3.97 +     */
    3.98      public void beginPath() {
    3.99          graphicsEnvironmentImpl.beginPath();
   3.100      }
   3.101  
   3.102 -    public void closePath(){
   3.103 +    /**
   3.104 +     * Closes the path.
   3.105 +     */
   3.106 +    public void closePath() {
   3.107          graphicsEnvironmentImpl.closePath();
   3.108      }
   3.109  
   3.110 -    public void clip(){
   3.111 +    /**
   3.112 +     * Clips using the current path
   3.113 +     */
   3.114 +    public void clip() {
   3.115          graphicsEnvironmentImpl.clip();
   3.116      }
   3.117  
   3.118 -    public void moveTo(double x, double y){
   3.119 +    /**
   3.120 +     * Issues a move command for the current path to the given x,y coordinate.
   3.121 +     *
   3.122 +     * @param x0 the X position for the move to command.
   3.123 +     * @param y0 the Y position for the move to command.
   3.124 +     */
   3.125 +    public void moveTo(double x, double y) {
   3.126          graphicsEnvironmentImpl.moveTo(x, y);
   3.127      }
   3.128  
   3.129 -    public void lineTo(double x, double y){
   3.130 +    /**
   3.131 +     * Adds segments to the current path to make a line at the given x,y
   3.132 +     * coordinate.
   3.133 +     *
   3.134 +     * @param x1 the X coordinate of the ending point of the line.
   3.135 +     * @param y1 the Y coordinate of the ending point of the line.
   3.136 +     */
   3.137 +    public void lineTo(double x, double y) {
   3.138          graphicsEnvironmentImpl.lineTo(x, y);
   3.139      }
   3.140  
   3.141 -    public void quadraticCurveTo(double cpx, double cpy, double x, double y){
   3.142 -    graphicsEnvironmentImpl.quadraticCurveTo(cpx, cpy, x, y);
   3.143 +    /**
   3.144 +     * Adds segments to the current path to make a quadratic curve.
   3.145 +     *
   3.146 +     * @param cpx the X coordinate of the control point
   3.147 +     * @param cpy the Y coordinate of the control point
   3.148 +     * @param x the X coordinate of the end point
   3.149 +     * @param y the Y coordinate of the end point
   3.150 +     */
   3.151 +    public void quadraticCurveTo(double cpx, double cpy, double x, double y) {
   3.152 +        graphicsEnvironmentImpl.quadraticCurveTo(cpx, cpy, x, y);
   3.153      }
   3.154  
   3.155 -    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y){
   3.156 +    /**
   3.157 +     * Adds segments to the current path to make a cubic bezier curve.
   3.158 +     *
   3.159 +     * @param cp1x the X coordinate of first bezier control point.
   3.160 +     * @param cp1y the Y coordinate of the first bezier control point.
   3.161 +     * @param cp2x the X coordinate of the second bezier control point.
   3.162 +     * @param cp2y the Y coordinate of the second bezier control point.
   3.163 +     * @param x the X coordinate of the end point.
   3.164 +     * @param y the Y coordinate of the end point.
   3.165 +     */
   3.166 +    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y) {
   3.167          graphicsEnvironmentImpl.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
   3.168      }
   3.169  
   3.170 -    public void fillRect(double x, double y, double width, double height){
   3.171 +    /**
   3.172 +     * Fills a rectangle using the current fill paint.
   3.173 +     *
   3.174 +     * @param x the X position of the upper left corner of the rectangle.
   3.175 +     * @param y the Y position of the upper left corner of the rectangle.
   3.176 +     * @param w the width of the rectangle.
   3.177 +     * @param h the height of the rectangle.
   3.178 +     */
   3.179 +    public void fillRect(double x, double y, double width, double height) {
   3.180          graphicsEnvironmentImpl.fillRect(x, y, width, height);
   3.181      }
   3.182  
   3.183 -    public void strokeRect(double x, double y, double width, double height){
   3.184 -    graphicsEnvironmentImpl.strokeRect(x, y, width, height);
   3.185 +    /**
   3.186 +     * Strokes a rectangle using the current stroke paint.
   3.187 +     *
   3.188 +     * @param x the X position of the upper left corner of the rectangle.
   3.189 +     * @param y the Y position of the upper left corner of the rectangle.
   3.190 +     * @param width the width of the rectangle.
   3.191 +     * @param height the height of the rectangle.
   3.192 +     */
   3.193 +    public void strokeRect(double x, double y, double width, double height) {
   3.194 +        graphicsEnvironmentImpl.strokeRect(x, y, width, height);
   3.195      }
   3.196  
   3.197 -    public void clearRect(double x, double y, double width, double height){
   3.198 +    /**
   3.199 +     * Clears a portion of the canvas with a transparent color value.
   3.200 +     *
   3.201 +     * @param x X position of the upper left corner of the rectangle.
   3.202 +     * @param y Y position of the upper left corner of the rectangle.
   3.203 +     * @param width width of the rectangle.
   3.204 +     * @param height height of the rectangle.
   3.205 +     */
   3.206 +    public void clearRect(double x, double y, double width, double height) {
   3.207          graphicsEnvironmentImpl.clearRect(x, y, width, height);
   3.208      }
   3.209  
   3.210 -    public void rect(double x, double y, double width, double height){
   3.211 +    /**
   3.212 +     * Clears a portion of the canvas with a transparent color value.
   3.213 +     *
   3.214 +     * @param x X position of the upper left corner of the rectangle.
   3.215 +     * @param y Y position of the upper left corner of the rectangle.
   3.216 +     * @param width width of the rectangle.
   3.217 +     * @param height height of the rectangle.
   3.218 +     */
   3.219 +    public void rect(double x, double y, double width, double height) {
   3.220          graphicsEnvironmentImpl.rect(x, y, width, height);
   3.221      }
   3.222  
   3.223 -    public void save(){
   3.224 +    /**
   3.225 +     * Saves the following attributes onto a stack.
   3.226 +     * <ul>
   3.227 +     * <li>Global Alpha</li>
   3.228 +     * <li>Global Blend Operation</li>
   3.229 +     * <li>Transform</li>
   3.230 +     * <li>Fill Paint</li>
   3.231 +     * <li>Stroke Paint</li>
   3.232 +     * <li>Line Width</li>
   3.233 +     * <li>Line Cap</li>
   3.234 +     * <li>Line Join</li>
   3.235 +     * <li>Miter Limit</li>
   3.236 +     * <li>Number of Clip Paths</li>
   3.237 +     * <li>Font</li>
   3.238 +     * <li>Text Align</li>
   3.239 +     * <li>Text Baseline</li>
   3.240 +     * <li>Effect</li>
   3.241 +     * <li>Fill Rule</li>
   3.242 +     * </ul>
   3.243 +     * This method does NOT alter the current state in any way. Also, not that
   3.244 +     * the current path is not saved.
   3.245 +     */
   3.246 +    public void save() {
   3.247          graphicsEnvironmentImpl.save();
   3.248      }
   3.249  
   3.250 -    public void restore(){
   3.251 +    /**
   3.252 +     * Pops the state off of the stack, setting the following attributes to
   3.253 +     * their value at the time when that state was pushed onto the stack. If the
   3.254 +     * stack is empty then nothing is changed.
   3.255 +     *
   3.256 +     * <ul>
   3.257 +     * <li>Global Alpha</li>
   3.258 +     * <li>Global Blend Operation</li>
   3.259 +     * <li>Transform</li>
   3.260 +     * <li>Fill Paint</li>
   3.261 +     * <li>Stroke Paint</li>
   3.262 +     * <li>Line Width</li>
   3.263 +     * <li>Line Cap</li>
   3.264 +     * <li>Line Join</li>
   3.265 +     * <li>Miter Limit</li>
   3.266 +     * <li>Number of Clip Paths</li>
   3.267 +     * <li>Font</li>
   3.268 +     * <li>Text Align</li>
   3.269 +     * <li>Text Baseline</li>
   3.270 +     * <li>Effect</li>
   3.271 +     * <li>Fill Rule</li>
   3.272 +     * </ul>
   3.273 +     */
   3.274 +    public void restore() {
   3.275          graphicsEnvironmentImpl.restore();
   3.276      }
   3.277  
   3.278 -    public void rotate(double angle){
   3.279 +    /**
   3.280 +     * Rotates the current transform in degrees.
   3.281 +     *
   3.282 +     * @param angle value in degrees to rotate the current transform.
   3.283 +     */
   3.284 +    public void rotate(double angle) {
   3.285          graphicsEnvironmentImpl.rotate(angle);
   3.286      }
   3.287  
   3.288 -    public void transform(double a, double b, double c, double d, double e, double f){
   3.289 -        graphicsEnvironmentImpl.transform(a, b, c, d, e, f);
   3.290 +    /**
   3.291 +     * Concatenates the input with the current transform.
   3.292 +     *
   3.293 +     * @param mxx - the X coordinate scaling element of the 3x4 matrix
   3.294 +     * @param myx - the Y coordinate shearing element of the 3x4 matrix
   3.295 +     * @param mxy - the X coordinate shearing element of the 3x4 matrix
   3.296 +     * @param myy - the Y coordinate scaling element of the 3x4 matrix
   3.297 +     * @param mxt - the X coordinate translation element of the 3x4 matrix
   3.298 +     * @param myt - the Y coordinate translation element of the 3x4 matrix
   3.299 +     */
   3.300 +    public void transform(double mxx, double myx, double mxy, double myy, double mxt, double myt) {
   3.301 +        graphicsEnvironmentImpl.transform(mxx, myx, mxy, myy, mxt, myt);
   3.302      }
   3.303  
   3.304 -    public void setTransform(double a, double b, double c, double d, double e, double f){
   3.305 -        graphicsEnvironmentImpl.setTransform(a, b, c, d, e, f);
   3.306 +    /**
   3.307 +     * Concatenates the input with the current transform.
   3.308 +     *
   3.309 +     * @param mxx - the X coordinate scaling element of the 3x4 matrix
   3.310 +     * @param myx - the Y coordinate shearing element of the 3x4 matrix
   3.311 +     * @param mxy - the X coordinate shearing element of the 3x4 matrix
   3.312 +     * @param myy - the Y coordinate scaling element of the 3x4 matrix
   3.313 +     * @param mxt - the X coordinate translation element of the 3x4 matrix
   3.314 +     * @param myt - the Y coordinate translation element of the 3x4 matrix
   3.315 +     */
   3.316 +    public void setTransform(double mxx, double myx, double mxy, double myy, double mxt, double myt) {
   3.317 +        graphicsEnvironmentImpl.setTransform(mxx, myx, mxy, myy, mxt, myt);
   3.318      }
   3.319  
   3.320 -    public void translate(double x, double y){
   3.321 +    /**
   3.322 +     * Translates the current transform by x, y.
   3.323 +     *
   3.324 +     * @param x value to translate along the x axis.
   3.325 +     * @param y value to translate along the y axis.
   3.326 +     */
   3.327 +    public void translate(double x, double y) {
   3.328          graphicsEnvironmentImpl.translate(x, y);
   3.329      }
   3.330  
   3.331 -    public void scale(double x, double y){
   3.332 +    /**
   3.333 +     * Scales the current transform by x, y.
   3.334 +     *
   3.335 +     * @param x value to scale in the x axis.
   3.336 +     * @param y value to scale in the y axis.
   3.337 +     */
   3.338 +    public void scale(double x, double y) {
   3.339          graphicsEnvironmentImpl.scale(x, y);
   3.340      }
   3.341  
   3.342 -    public void drawImage(Image image, double x, double y){
   3.343 +    /**
   3.344 +     * Draws an image at the given x, y position using the width and height of
   3.345 +     * the given image.
   3.346 +     *
   3.347 +     * @param img the image to be drawn.
   3.348 +     * @param x the X coordinate on the destination for the upper left of the
   3.349 +     * image.
   3.350 +     * @param y the Y coordinate on the destination for the upper left of the
   3.351 +     * image.
   3.352 +     */
   3.353 +    public void drawImage(Image image, double x, double y) {
   3.354          Object nativeImage = graphicsEnvironmentImpl.drawImage(image, x, y, image.getCached());
   3.355          image.cache(nativeImage);
   3.356      }
   3.357  
   3.358 -    public void drawImage(Image image, double x, double y, double width, double height){
   3.359 +    /**
   3.360 +     * Draws an image into the given destination rectangle of the canvas. The
   3.361 +     * Image is scaled to fit into the destination rectagnle.
   3.362 +     *
   3.363 +     * @param img the image to be drawn.
   3.364 +     * @param x the X coordinate on the destination for the upper left of the
   3.365 +     * image.
   3.366 +     * @param y the Y coordinate on the destination for the upper left of the
   3.367 +     * image.
   3.368 +     * @param width the width of the destination rectangle.
   3.369 +     * @param height the height of the destination rectangle.
   3.370 +     */
   3.371 +    public void drawImage(Image image, double x, double y, double width, double height) {
   3.372          Object nativeImage = graphicsEnvironmentImpl.drawImage(image, x, y, width, height, image.getCached());
   3.373          image.cache(nativeImage);
   3.374      }
   3.375  
   3.376 -    public void drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height){
   3.377 -        Object nativeImage = graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height, image.getCached());
   3.378 +    /**
   3.379 +     * Draws the current source rectangle of the given image to the given
   3.380 +     * destination rectangle of the Canvas.
   3.381 +     *
   3.382 +     * @param img the image to be drawn.
   3.383 +     * @param sx the source rectangle's X coordinate position.
   3.384 +     * @param sy the source rectangle's Y coordinate position.
   3.385 +     * @param sw the source rectangle's width.
   3.386 +     * @param sh the source rectangle's height.
   3.387 +     * @param dx the destination rectangle's X coordinate position.
   3.388 +     * @param dy the destination rectangle's Y coordinate position.
   3.389 +     * @param dw the destination rectangle's width.
   3.390 +     * @param dh the destination rectangle's height.
   3.391 +     */
   3.392 +    public void drawImage(Image image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) {
   3.393 +        Object nativeImage = graphicsEnvironmentImpl.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh, image.getCached());
   3.394          image.cache(nativeImage);
   3.395      }
   3.396 -    
   3.397 -    public Image merge(Image a, Image b){
   3.398 -        if(a.getCached()==null){
   3.399 +
   3.400 +    /**
   3.401 +     * Merges two images drawing one on top of the other and returning the
   3.402 +     * result.
   3.403 +     *
   3.404 +     * @param a the lower Image
   3.405 +     * @param b the upper Image
   3.406 +     * @return
   3.407 +     */
   3.408 +    public Image merge(Image a, Image b) {
   3.409 +        if (a.getCached() == null) {
   3.410              drawImage(a, 0, 0);
   3.411          }
   3.412 -        if(b.getCached()==null){
   3.413 +        if (b.getCached() == null) {
   3.414              drawImage(b, 0, 0);
   3.415          }
   3.416 -        Object nativeImage = graphicsEnvironmentImpl.mergeImages(a,b,a.getCached(),b.getCached());
   3.417 +        Object nativeImage = graphicsEnvironmentImpl.mergeImages(a, b, a.getCached(), b.getCached());
   3.418          Image merged = Image.create("should add real path here");
   3.419          merged.cache(nativeImage);
   3.420          return merged;
   3.421      }
   3.422  
   3.423 -    public void setShadowColor(String color){
   3.424 -        graphicsEnvironmentImpl.setShadowColor(color);
   3.425 -    }
   3.426 -
   3.427 -    public void setShadowBlur(double blur){
   3.428 -        graphicsEnvironmentImpl.setShadowBlur(blur);
   3.429 -    }
   3.430 -
   3.431 -    public void setShadowOffsetX(double x){
   3.432 -        graphicsEnvironmentImpl.setShadowOffsetX(x);
   3.433 -    }
   3.434 -
   3.435 -    public void setShadowOffsetY(double y){
   3.436 -        graphicsEnvironmentImpl.setShadowOffsetY(y);
   3.437 -    }
   3.438 -
   3.439 -    public String getShadowColor(){
   3.440 -        return graphicsEnvironmentImpl.getShadowColor();
   3.441 -    }
   3.442 -
   3.443 -    public double getShadowBlur(){
   3.444 -        return graphicsEnvironmentImpl.getShadowBlur();
   3.445 -        }
   3.446 -
   3.447 -    public double getShadowOffsetX(){
   3.448 -        return graphicsEnvironmentImpl.getShadowOffsetX();
   3.449 -    }
   3.450 -
   3.451 -    public double getShadowOffsetY(){
   3.452 -        return graphicsEnvironmentImpl.getShadowOffsetY();
   3.453 -    }
   3.454 -
   3.455 -    public String getLineCap(){
   3.456 +//    public void setShadowColor(String color) {
   3.457 +//        graphicsEnvironmentImpl.setShadowColor(color);
   3.458 +//    }
   3.459 +//
   3.460 +//    public void setShadowBlur(double blur) {
   3.461 +//        graphicsEnvironmentImpl.setShadowBlur(blur);
   3.462 +//    }
   3.463 +//
   3.464 +//    public void setShadowOffsetX(double x) {
   3.465 +//        graphicsEnvironmentImpl.setShadowOffsetX(x);
   3.466 +//    }
   3.467 +//
   3.468 +//    public void setShadowOffsetY(double y) {
   3.469 +//        graphicsEnvironmentImpl.setShadowOffsetY(y);
   3.470 +//    }
   3.471 +//
   3.472 +//    public String getShadowColor() {
   3.473 +//        return graphicsEnvironmentImpl.getShadowColor();
   3.474 +//    }
   3.475 +//
   3.476 +//    public double getShadowBlur() {
   3.477 +//        return graphicsEnvironmentImpl.getShadowBlur();
   3.478 +//    }
   3.479 +//
   3.480 +//    public double getShadowOffsetX() {
   3.481 +//        return graphicsEnvironmentImpl.getShadowOffsetX();
   3.482 +//    }
   3.483 +//
   3.484 +//    public double getShadowOffsetY() {
   3.485 +//        return graphicsEnvironmentImpl.getShadowOffsetY();
   3.486 +//    }
   3.487 +    public String getLineCap() {
   3.488          return graphicsEnvironmentImpl.getLineCap();
   3.489      }
   3.490  
   3.491 -    public void setLineCap(String style){
   3.492 +    public void setLineCap(String style) {
   3.493          graphicsEnvironmentImpl.setLineCap(style);
   3.494      }
   3.495  
   3.496 -    public String getLineJoin(){
   3.497 +    public String getLineJoin() {
   3.498          return graphicsEnvironmentImpl.getLineJoin();
   3.499      }
   3.500  
   3.501 -    public void setLineJoin(String style){
   3.502 +    public void setLineJoin(String style) {
   3.503          graphicsEnvironmentImpl.setLineJoin(style);
   3.504      }
   3.505  
   3.506 -    public double getLineWidth(){
   3.507 +    public double getLineWidth() {
   3.508          return graphicsEnvironmentImpl.getLineWidth();
   3.509      }
   3.510  
   3.511 -    public void setLineWidth(double width){
   3.512 +    public void setLineWidth(double width) {
   3.513          graphicsEnvironmentImpl.setLineWidth(width);
   3.514      }
   3.515  
   3.516 -    public double getMiterLimit(){
   3.517 +    public double getMiterLimit() {
   3.518          return graphicsEnvironmentImpl.getMiterLimit();
   3.519      }
   3.520  
   3.521 -    public void setMiterLimit(double limit){
   3.522 +    public void setMiterLimit(double limit) {
   3.523          graphicsEnvironmentImpl.setMiterLimit(limit);
   3.524      }
   3.525 -    
   3.526 -    public void setFillStyle(Style style){
   3.527 +
   3.528 +    public void setFillStyle(Style style) {
   3.529          Object nativeFillStyle = graphicsEnvironmentImpl.setFillStyle(style, style.getCached());
   3.530          style.cache(nativeFillStyle);
   3.531      }
   3.532  
   3.533 -    public String getFont(){
   3.534 +    public String getFont() {
   3.535          return graphicsEnvironmentImpl.getFont();
   3.536      }
   3.537  
   3.538 -    public void setFont(String font){
   3.539 +    public void setFont(String font) {
   3.540          graphicsEnvironmentImpl.setFont(font);
   3.541      }
   3.542 -    
   3.543 -    public void setStrokeStyle(Style style){
   3.544 +
   3.545 +    public void setStrokeStyle(Style style) {
   3.546          Object nativeStrokeStyle = graphicsEnvironmentImpl.setStrokeStyle(style, style.getCached());
   3.547          style.cache(nativeStrokeStyle);
   3.548      }
   3.549  
   3.550 -    public String getTextAlign(){
   3.551 +    public String getTextAlign() {
   3.552          return graphicsEnvironmentImpl.getTextAlign();
   3.553      }
   3.554  
   3.555 -    public void setTextAlign(String textAlign){
   3.556 +    public void setTextAlign(String textAlign) {
   3.557          graphicsEnvironmentImpl.setTextAlign(textAlign);
   3.558      }
   3.559  
   3.560 -    public String getTextBaseline(){
   3.561 +    public String getTextBaseline() {
   3.562          return graphicsEnvironmentImpl.getTextBaseline();
   3.563      }
   3.564  
   3.565 -    public void setTextBaseline(String textbaseline){
   3.566 +    public void setTextBaseline(String textbaseline) {
   3.567          graphicsEnvironmentImpl.setTextBaseline(textbaseline);
   3.568      }
   3.569  
   3.570 -    public void fillText(String text, double x, double y){
   3.571 +    public void fillText(String text, double x, double y) {
   3.572          graphicsEnvironmentImpl.fillText(text, x, y);
   3.573      }
   3.574  
   3.575 -    public void fillText(String text, double x, double y, double maxWidth){
   3.576 +    public void fillText(String text, double x, double y, double maxWidth) {
   3.577          graphicsEnvironmentImpl.fillText(text, x, y, maxWidth);
   3.578      }
   3.579  
   3.580 -    public Dimension measureText(String text){
   3.581 +    public Dimension measureText(String text) {
   3.582          return graphicsEnvironmentImpl.measureText(text);
   3.583      }
   3.584  
   3.585 -    public void strokeText(String text, double x, double y){
   3.586 +    public void strokeText(String text, double x, double y) {
   3.587          graphicsEnvironmentImpl.strokeText(text, x, y);
   3.588      }
   3.589  
   3.590 -    public void strokeText(String text, double x, double y, double maxWidth){
   3.591 +    public void strokeText(String text, double x, double y, double maxWidth) {
   3.592          graphicsEnvironmentImpl.strokeText(text, x, y, maxWidth);
   3.593      }
   3.594  
   3.595 -    public ImageData createPixelMap(double x, double y){
   3.596 -        return graphicsEnvironmentImpl.createPixelMap(x, y);
   3.597 -    }
   3.598 -
   3.599 -    public ImageData createPixelMap(ImageData pixelMap){
   3.600 -        return graphicsEnvironmentImpl.createPixelMap(pixelMap);
   3.601 -    }
   3.602 -
   3.603 -    public ImageData getSnapshot(double x, double y, double width, double height){
   3.604 -        return graphicsEnvironmentImpl.getPixelMap(x, y, width, height);
   3.605 -    }
   3.606 -
   3.607 -    public void drawPixelMap(ImageData pixelMap, double x, double y){
   3.608 -        graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y);
   3.609 -    }
   3.610 -
   3.611 -    public void drawPixelMap(ImageData pixelMap, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight){
   3.612 -        graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
   3.613 -    }
   3.614 -
   3.615 -    public void setGlobalAlpha(double alpha){
   3.616 +//    public ImageData createPixelMap(double x, double y) {
   3.617 +//        return graphicsEnvironmentImpl.createPixelMap(x, y);
   3.618 +//    }
   3.619 +//
   3.620 +//    public ImageData createPixelMap(ImageData pixelMap) {
   3.621 +//        return graphicsEnvironmentImpl.createPixelMap(pixelMap);
   3.622 +//    }
   3.623 +//
   3.624 +//    public ImageData getSnapshot(double x, double y, double width, double height) {
   3.625 +//        return graphicsEnvironmentImpl.getPixelMap(x, y, width, height);
   3.626 +//    }
   3.627 +//
   3.628 +//    public void drawPixelMap(ImageData pixelMap, double x, double y) {
   3.629 +//        graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y);
   3.630 +//    }
   3.631 +//
   3.632 +//    public void drawPixelMap(ImageData pixelMap, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
   3.633 +//        graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
   3.634 +//    }
   3.635 +    /**
   3.636 +     * Sets the global alpha of the current state.
   3.637 +     *
   3.638 +     * @param alpha value in the range {@code 0.0-1.0}. The value is clamped if
   3.639 +     * it is out of range.
   3.640 +     */
   3.641 +    public void setGlobalAlpha(double alpha) {
   3.642          graphicsEnvironmentImpl.setGlobalAlpha(alpha);
   3.643      }
   3.644  
   3.645 -    public double getGlobalAlpha(){
   3.646 +    /**
   3.647 +     * Gets the current global alpha.
   3.648 +     *
   3.649 +     * @return the current global alpha.
   3.650 +     */
   3.651 +    public double getGlobalAlpha() {
   3.652          return graphicsEnvironmentImpl.getGlobalAlpha();
   3.653      }
   3.654  
   3.655 -    public void setGlobalCompositeOperation(String operation){
   3.656 +    /**
   3.657 +     * Sets the global blend mode.
   3.658 +     *
   3.659 +     * @param op the BlendMode that will be set.
   3.660 +     */
   3.661 +    public void setGlobalCompositeOperation(String operation) {
   3.662          graphicsEnvironmentImpl.setGlobalCompositeOperation(operation);
   3.663      }
   3.664  
   3.665 -    public String getGlobalCompositeOperation(){
   3.666 +    /**
   3.667 +     * Gets the global blend mode.
   3.668 +     *
   3.669 +     * @return the global BlendMode of the current state.
   3.670 +     */
   3.671 +    public String getGlobalCompositeOperation() {
   3.672          return graphicsEnvironmentImpl.getGlobalCompositeOperation();
   3.673      }
   3.674  
   3.675 -    public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1){
   3.676 +    public LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
   3.677          return new Style.LinearGradient(x0, y0, x1, y1);
   3.678      }
   3.679  
   3.680 -    public Pattern createPattern(Image image, String repeat){
   3.681 +    public Pattern createPattern(Image image, String repeat) {
   3.682          return new Pattern(image, repeat);
   3.683      }
   3.684  
   3.685 -    public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1){
   3.686 +    public RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
   3.687          return new RadialGradient(x0, y0, r0, x1, y1, r1);
   3.688      }
   3.689 -    
   3.690 -    public Color getWebColor(String webColor){
   3.691 +
   3.692 +    public Color getWebColor(String webColor) {
   3.693          return new Style.Color(webColor);
   3.694      }
   3.695  
   3.696 -    public int getHeight(){
   3.697 +    /**
   3.698 +     * Get the height of this GraphicsContext (which should be the same as the
   3.699 +     * enclosing canvas height)
   3.700 +     *
   3.701 +     * @return the height of this GraphicsContext
   3.702 +     */
   3.703 +    public int getHeight() {
   3.704          return graphicsEnvironmentImpl.getHeight();
   3.705      }
   3.706  
   3.707 -    public int getWidth(){
   3.708 +    /**
   3.709 +     * Get the width of this GraphicsContext (which should be the same as the
   3.710 +     * enclosing canvas height)
   3.711 +     *
   3.712 +     * @return the width of this GraphicsContext
   3.713 +     */
   3.714 +    public int getWidth() {
   3.715          return graphicsEnvironmentImpl.getWidth();
   3.716      }
   3.717  
   3.718 -    public void setHeight(int height){
   3.719 -        graphicsEnvironmentImpl.setHeight(height);
   3.720 +//    public void setHeight(int height) {
   3.721 +//        graphicsEnvironmentImpl.setHeight(height);
   3.722 +//    }
   3.723 +//
   3.724 +//    public void setWidth(int width) {
   3.725 +//        graphicsEnvironmentImpl.setWidth(width);
   3.726 +//    }
   3.727 +    /**
   3.728 +     * Fill a circle with a center position of centerX, centerY and the
   3.729 +     * specified radius.
   3.730 +     *
   3.731 +     * @param centerX
   3.732 +     * @param centerY
   3.733 +     * @param radius
   3.734 +     */
   3.735 +    public void fillCircle(float centerX, float centerY, float radius) {
   3.736 +        graphicsEnvironmentImpl.arc(centerX, centerY, radius, 0, Math.PI * 2, false);
   3.737      }
   3.738  
   3.739 -    public void setWidth(int width){
   3.740 -        graphicsEnvironmentImpl.setWidth(width);
   3.741 -    }
   3.742 -
   3.743 -    public void fillCircle(float centerX, float centerY, float radius) {
   3.744 -        graphicsEnvironmentImpl.arc(centerX, centerY, radius, 0, Math.PI*2, false);
   3.745 -    }
   3.746 -
   3.747 +    /**
   3.748 +     * Fills a polygon with the given points using the currently set fill paint.
   3.749 +     *
   3.750 +     * @param x_coord array containing the x coordinates of the polygon's
   3.751 +     * points.
   3.752 +     * @param y_coord array containing the y coordinates of the polygon's
   3.753 +     * points.
   3.754 +     * @param vertexCount the number of points that make the polygon.
   3.755 +     */
   3.756      public void fillPolygon(double[] x_coord, double[] y_coord, int vertexCount) {
   3.757 -        if (vertexCount >=1&&x_coord!=null && x_coord.length>=vertexCount && y_coord!=null && y_coord.length>=vertexCount)
   3.758 -        graphicsEnvironmentImpl.beginPath();
   3.759 +        if (vertexCount >= 1 && x_coord != null && x_coord.length >= vertexCount && y_coord != null && y_coord.length >= vertexCount) {
   3.760 +            graphicsEnvironmentImpl.beginPath();
   3.761 +        }
   3.762          graphicsEnvironmentImpl.moveTo(x_coord[0], y_coord[0]);
   3.763          for (int i = 1; i < vertexCount; i++) {
   3.764              graphicsEnvironmentImpl.lineTo(x_coord[i], y_coord[i]);
   3.765 -            
   3.766 +
   3.767          }
   3.768          graphicsEnvironmentImpl.closePath();
   3.769          graphicsEnvironmentImpl.fill();
   3.770          graphicsEnvironmentImpl.stroke();
   3.771 -        
   3.772 -        
   3.773      }
   3.774  }
     4.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Image.java	Mon Sep 23 07:52:41 2013 -0700
     4.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Image.java	Thu Sep 26 14:20:18 2013 -0700
     4.3 @@ -1,19 +1,19 @@
     4.4  /**
     4.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     4.6 - * <jaroslav.tulach@apidesign.org>
     4.7 + * Back 2 Browser Bytecode Translator
     4.8 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     4.9   *
    4.10 - * This program is free software: you can redistribute it and/or modify it under
    4.11 - * the terms of the GNU General Public License as published by the Free Software
    4.12 - * Foundation, version 2 of the License.
    4.13 + * This program is free software: you can redistribute it and/or modify
    4.14 + * it under the terms of the GNU General Public License as published by
    4.15 + * the Free Software Foundation, version 2 of the License.
    4.16   *
    4.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    4.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.19 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    4.20 - * details.
    4.21 + * This program is distributed in the hope that it will be useful,
    4.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.24 + * GNU General Public License for more details.
    4.25   *
    4.26 - * You should have received a copy of the GNU General Public License along with
    4.27 - * this program. Look for COPYING file in the top folder. If not, see
    4.28 - * http://opensource.org/licenses/GPL-2.0.
    4.29 + * You should have received a copy of the GNU General Public License
    4.30 + * along with this program. Look for COPYING file in the top folder.
    4.31 + * If not, see http://opensource.org/licenses/GPL-2.0.
    4.32   */
    4.33  package net.java.html.canvas;
    4.34  
     5.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java	Mon Sep 23 07:52:41 2013 -0700
     5.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/ImageData.java	Thu Sep 26 14:20:18 2013 -0700
     5.3 @@ -1,19 +1,19 @@
     5.4  /**
     5.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     5.6 - * <jaroslav.tulach@apidesign.org>
     5.7 + * Back 2 Browser Bytecode Translator
     5.8 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     5.9   *
    5.10 - * This program is free software: you can redistribute it and/or modify it under
    5.11 - * the terms of the GNU General Public License as published by the Free Software
    5.12 - * Foundation, version 2 of the License.
    5.13 + * This program is free software: you can redistribute it and/or modify
    5.14 + * it under the terms of the GNU General Public License as published by
    5.15 + * the Free Software Foundation, version 2 of the License.
    5.16   *
    5.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    5.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.19 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    5.20 - * details.
    5.21 + * This program is distributed in the hope that it will be useful,
    5.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.24 + * GNU General Public License for more details.
    5.25   *
    5.26 - * You should have received a copy of the GNU General Public License along with
    5.27 - * this program. Look for COPYING file in the top folder. If not, see
    5.28 - * http://opensource.org/licenses/GPL-2.0.
    5.29 + * You should have received a copy of the GNU General Public License
    5.30 + * along with this program. Look for COPYING file in the top folder.
    5.31 + * If not, see http://opensource.org/licenses/GPL-2.0.
    5.32   */
    5.33  package net.java.html.canvas;
    5.34  
     6.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java	Mon Sep 23 07:52:41 2013 -0700
     6.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java	Thu Sep 26 14:20:18 2013 -0700
     6.3 @@ -1,19 +1,19 @@
     6.4  /**
     6.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     6.6 - * <jaroslav.tulach@apidesign.org>
     6.7 + * Back 2 Browser Bytecode Translator
     6.8 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     6.9   *
    6.10 - * This program is free software: you can redistribute it and/or modify it under
    6.11 - * the terms of the GNU General Public License as published by the Free Software
    6.12 - * Foundation, version 2 of the License.
    6.13 + * This program is free software: you can redistribute it and/or modify
    6.14 + * it under the terms of the GNU General Public License as published by
    6.15 + * the Free Software Foundation, version 2 of the License.
    6.16   *
    6.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    6.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    6.19 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    6.20 - * details.
    6.21 + * This program is distributed in the hope that it will be useful,
    6.22 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.23 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.24 + * GNU General Public License for more details.
    6.25   *
    6.26 - * You should have received a copy of the GNU General Public License along with
    6.27 - * this program. Look for COPYING file in the top folder. If not, see
    6.28 - * http://opensource.org/licenses/GPL-2.0.
    6.29 + * You should have received a copy of the GNU General Public License
    6.30 + * along with this program. Look for COPYING file in the top folder.
    6.31 + * If not, see http://opensource.org/licenses/GPL-2.0.
    6.32   */
    6.33  package net.java.html.canvas;
    6.34  
     7.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java	Mon Sep 23 07:52:41 2013 -0700
     7.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java	Thu Sep 26 14:20:18 2013 -0700
     7.3 @@ -19,7 +19,6 @@
     7.4  
     7.5  import net.java.html.canvas.Dimension;
     7.6  import net.java.html.canvas.Image;
     7.7 -import net.java.html.canvas.ImageData;
     7.8  import net.java.html.canvas.Style;
     7.9  
    7.10  /**
    7.11 @@ -84,19 +83,16 @@
    7.12  
    7.13      public void scale(double x, double y);
    7.14  
    7.15 -    public Object drawImage(Image image,  double x, double y, Object nativeImage);
    7.16 +    public Object drawImage(Image image, double x, double y, Object nativeImage);
    7.17  
    7.18      public Object drawImage(Image image, double x, double y, double width, double height, Object nativeImage);
    7.19  
    7.20      public Object drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height, Object nativeImage);
    7.21  
    7.22 -   
    7.23      public int getWidth(Image image, Object nativeImage);
    7.24 -    
    7.25 +
    7.26      public int getHeight(Image image, Object nativeImage);
    7.27 -    
    7.28 -    
    7.29 -    
    7.30 +
    7.31      /**
    7.32       * When implementing you can return an Object of your choice to enable
    7.33       * caching. Returning null means no caching. When caching is enabled, and
    7.34 @@ -123,70 +119,189 @@
    7.35       */
    7.36      public Object setStrokeStyle(Style style, Object nativeStyle);
    7.37  
    7.38 -    public void setShadowColor(String color);
    7.39 -
    7.40 -    public void setShadowBlur(double blur);
    7.41 -
    7.42 -    public void setShadowOffsetX(double x);
    7.43 -
    7.44 -    public void setShadowOffsetY(double y);
    7.45 -    
    7.46 -    public String getShadowColor();
    7.47 -
    7.48 -    public double getShadowBlur();
    7.49 -
    7.50 -    public double getShadowOffsetX();
    7.51 -
    7.52 -    public double getShadowOffsetY();
    7.53 -
    7.54 +//    public void setShadowColor(String color);
    7.55 +//
    7.56 +//    public void setShadowBlur(double blur);
    7.57 +//
    7.58 +//    public void setShadowOffsetX(double x);
    7.59 +//
    7.60 +//    public void setShadowOffsetY(double y);
    7.61 +//    
    7.62 +//    public String getShadowColor();
    7.63 +//
    7.64 +//    public double getShadowBlur();
    7.65 +//
    7.66 +//    public double getShadowOffsetX();
    7.67 +//
    7.68 +//    public double getShadowOffsetY();
    7.69 +    /**
    7.70 +     * Gets the current stroke line cap.
    7.71 +     *
    7.72 +     * @return {@code StrokeLineCap} with a value of Butt, Round, or Square.
    7.73 +     */
    7.74      public String getLineCap();
    7.75  
    7.76 +    /**
    7.77 +     * Sets the current stroke line cap.
    7.78 +     *
    7.79 +     * @param style a value of Butt, Round, or Square.
    7.80 +     */
    7.81      public void setLineCap(String style);
    7.82  
    7.83 +    /**
    7.84 +     * Gets the current stroke line join.
    7.85 +     *
    7.86 +     * @return a value of Miter, Bevel, or Round.
    7.87 +     */
    7.88      public String getLineJoin();
    7.89  
    7.90 +    /**
    7.91 +     * Sets the current stroke line join.
    7.92 +     *
    7.93 +     * @param style with a value of Miter, Bevel, or Round.
    7.94 +     */
    7.95      public void setLineJoin(String style);
    7.96  
    7.97 +    /**
    7.98 +     * Gets the current line width.
    7.99 +     *
   7.100 +     * @return value between 0 and infinity.
   7.101 +     */
   7.102      public double getLineWidth();
   7.103  
   7.104 +    /**
   7.105 +     * Sets the current line width.
   7.106 +     *
   7.107 +     * @param width value in the range {0-positive infinity}, with any other
   7.108 +     * value being ignored and leaving the value unchanged.
   7.109 +     */
   7.110      public void setLineWidth(double width);
   7.111  
   7.112 +    /**
   7.113 +     * Gets the current miter limit. v
   7.114 +     *
   7.115 +     * @return the miter limit value in the range {@code 0.0-positive infinity}
   7.116 +     */
   7.117      public double getMiterLimit();
   7.118  
   7.119 +    /**
   7.120 +     * Sets the current miter limit.
   7.121 +     *
   7.122 +     * @param limit miter limit value between 0 and positive infinity with any
   7.123 +     * other value being ignored and leaving the value unchanged.
   7.124 +     */
   7.125      public void setMiterLimit(double limit);
   7.126  
   7.127 +    /**
   7.128 +     * Gets the current Font.
   7.129 +     *
   7.130 +     * @return the Font
   7.131 +     */
   7.132      public String getFont();
   7.133  
   7.134 +    /**
   7.135 +     * Sets the current Font.
   7.136 +     *
   7.137 +     */
   7.138      public void setFont(String font);
   7.139  
   7.140 +    /**
   7.141 +     * Gets the current {@code TextAlignment}.
   7.142 +     *
   7.143 +     * @return TextAlignment with values of Left, Center, Right, or Justify.
   7.144 +     */
   7.145      public String getTextAlign();
   7.146  
   7.147 +    /**
   7.148 +     * Defines horizontal text alignment, relative to the text origin.
   7.149 +     *
   7.150 +     * @param textAlign with values of Left, Center, Right.
   7.151 +     */
   7.152      public void setTextAlign(String textAlign);
   7.153  
   7.154 +    /**
   7.155 +     * Sets the current Text Baseline.
   7.156 +     *
   7.157 +     * @param baseline with values of Top, Center, Baseline, or Bottom
   7.158 +     */
   7.159      public String getTextBaseline();
   7.160  
   7.161 -    public void setTextBaseline(String textbaseline);
   7.162 +    /**
   7.163 +     * Sets the current Text Baseline.
   7.164 +     *
   7.165 +     * @param baseline with values of Top, Center, Baseline, or Bottom
   7.166 +     */
   7.167 +    public void setTextBaseline(String baseline);
   7.168  
   7.169 +    /**
   7.170 +     * Fills the given string of text at position x, y (0,0 at top left) with
   7.171 +     * the current fill paint attribute.
   7.172 +     *
   7.173 +     * @param text the string of text.
   7.174 +     * @param x position on the x axis.
   7.175 +     * @param y position on the y axis.
   7.176 +     */
   7.177      public void fillText(String text, double x, double y);
   7.178  
   7.179 +    /**
   7.180 +     * Fills text and includes a maximum width of the string.
   7.181 +     *
   7.182 +     * If the width of the text extends past max width, then it will be sized to
   7.183 +     * fit.
   7.184 +     *
   7.185 +     * @param text the string of text.
   7.186 +     * @param x position on the x axis.
   7.187 +     * @param y position on the y axis.
   7.188 +     * @param maxWidth maximum width the text string can have.
   7.189 +     */
   7.190      public void fillText(String text, double x, double y, double maxWidth);
   7.191  
   7.192 +    /**
   7.193 +     * The Dimension of this text using the current Font settings
   7.194 +     *
   7.195 +     * @param text
   7.196 +     * @return the Dimension of this text using the current Font settings
   7.197 +     */
   7.198      public Dimension measureText(String text);
   7.199  
   7.200 +    /**
   7.201 +     * draws the given string of text at position x, y (0,0 at top left) with
   7.202 +     * the current stroke paint attribute.
   7.203 +     *
   7.204 +     * @param text the string of text.
   7.205 +     * @param x position on the x axis.
   7.206 +     * @param y position on the y axis.
   7.207 +     */
   7.208      public void strokeText(String text, double x, double y);
   7.209  
   7.210 +    /**
   7.211 +     * Draws text with stroke paint and includes a maximum width of the string.
   7.212 +     *
   7.213 +     * If the width of the text extends past max width, then it will be sized to
   7.214 +     * fit.
   7.215 +     *
   7.216 +     * @param text the string of text.
   7.217 +     * @param x position on the x axis.
   7.218 +     * @param y position on the y axis.
   7.219 +     * @param maxWidth maximum width the text string can have.
   7.220 +     */
   7.221      public void strokeText(String text, double x, double y, double maxWidth);
   7.222  
   7.223 -    public ImageData createPixelMap(double x, double y);
   7.224 -
   7.225 -    public ImageData createPixelMap(ImageData imageData);
   7.226 -
   7.227 -    public ImageData getPixelMap(double x, double y, double width, double height);
   7.228 -
   7.229 -    public void putPixelMap(ImageData imageData, double x, double y);
   7.230 -
   7.231 -    public void putPixelMap(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   7.232 -    
   7.233 +//    public ImageData createPixelMap(double x, double y);
   7.234 +//
   7.235 +//    public ImageData createPixelMap(ImageData imageData);
   7.236 +//
   7.237 +//    public ImageData getPixelMap(double x, double y, double width, double height);
   7.238 +//
   7.239 +//    public void putPixelMap(ImageData imageData, double x, double y);
   7.240 +//
   7.241 +//    public void putPixelMap(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
   7.242 +    /**
   7.243 +     * Sets the global alpha of the current state.
   7.244 +     *
   7.245 +     * @param alpha value in the range {@code 0.0-1.0}. The value is clamped if
   7.246 +     * it is out of range.
   7.247 +     */
   7.248      public void setGlobalAlpha(double alpha);
   7.249  
   7.250      public double getGlobalAlpha();
   7.251 @@ -194,14 +309,14 @@
   7.252      public void setGlobalCompositeOperation(String operation);
   7.253  
   7.254      public String getGlobalCompositeOperation();
   7.255 -    
   7.256 +
   7.257      public int getHeight();
   7.258  
   7.259      public int getWidth();
   7.260  
   7.261 -    public void setHeight(int height);
   7.262 -
   7.263 -    public void setWidth(int width);
   7.264 +//    public void setHeight(int height);
   7.265 +//
   7.266 +//    public void setWidth(int width);
   7.267  
   7.268      public Object mergeImages(Image a, Image b, Object cachedA, Object cachedB);
   7.269  }
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsUtils.java	Thu Sep 26 14:20:18 2013 -0700
     8.3 @@ -0,0 +1,24 @@
     8.4 +/*
     8.5 + * To change this template, choose Tools | Templates
     8.6 + * and open the template in the editor.
     8.7 + */
     8.8 +package net.java.html.canvas.spi;
     8.9 +
    8.10 +import net.java.html.canvas.GraphicsContext;
    8.11 +import org.apidesign.html.canvas.impl.CnvsAccssr;
    8.12 +
    8.13 +/**
    8.14 + *
    8.15 + * @author antonepple
    8.16 + */
    8.17 +public class GraphicsUtils {
    8.18 +
    8.19 +    private GraphicsUtils() {
    8.20 +    }
    8.21 +    
    8.22 +    public static GraphicsContext create(GraphicsEnvironment environment){
    8.23 +        return CnvsAccssr.getDefault().create(environment);
    8.24 +    }
    8.25 +    
    8.26 +    
    8.27 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/javaquery/canvas/src/main/java/org/apidesign/html/canvas/impl/CnvsAccssr.java	Thu Sep 26 14:20:18 2013 -0700
     9.3 @@ -0,0 +1,28 @@
     9.4 +/*
     9.5 + * To change this template, choose Tools | Templates
     9.6 + * and open the template in the editor.
     9.7 + */
     9.8 +package org.apidesign.html.canvas.impl;
     9.9 +
    9.10 +import net.java.html.canvas.GraphicsContext;
    9.11 +import net.java.html.canvas.spi.GraphicsEnvironment;
    9.12 +
    9.13 +/**
    9.14 + *
    9.15 + * @author antonepple
    9.16 + */
    9.17 +public abstract class CnvsAccssr {
    9.18 +
    9.19 +    static CnvsAccssr DEFAULT;
    9.20 +
    9.21 +    public CnvsAccssr() {
    9.22 +        if (DEFAULT!=null) throw new IllegalStateException("Already initialized");
    9.23 +        DEFAULT = this;
    9.24 +    }
    9.25 +
    9.26 +    public static CnvsAccssr getDefault() {
    9.27 +        return DEFAULT;
    9.28 +    }
    9.29 +
    9.30 +    public abstract GraphicsContext create(GraphicsEnvironment environment);
    9.31 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/javaquery/canvas/src/main/resources/net/java/html/canvas/package.html	Thu Sep 26 14:20:18 2013 -0700
    10.3 @@ -0,0 +1,5 @@
    10.4 +<html>
    10.5 +    <body>
    10.6 +        Universal, flexible, capable, effective, highly efficient Canvas API for any device on the planet (and beyond). 
    10.7 +    </body>
    10.8 +</html>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/javaquery/canvas/src/main/resources/net/java/html/canvas/spi/package.html	Thu Sep 26 14:20:18 2013 -0700
    11.3 @@ -0,0 +1,5 @@
    11.4 +<html>
    11.5 +    <body>
    11.6 +        SPI for enabling the Canvas API on different platforms.
    11.7 +    </body>
    11.8 +</html>