1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Wed Feb 12 14:43:38 2014 +0100
1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Wed Feb 12 14:46:40 2014 +0100
1.3 @@ -188,7 +188,7 @@
1.4 * @param x the X position of the upper left corner of the rectangle.
1.5 * @param y the Y position of the upper left corner of the rectangle.
1.6 * @param width the width of the rectangle.
1.7 - * @param height the height of the rectangle.
1.8 + * @param height the height of the rectangle.
1.9 */
1.10 public void fillRect(double x, double y, double width, double height) {
1.11 graphicsEnvironmentImpl.fillRect(x, y, width, height);
1.12 @@ -344,7 +344,7 @@
1.13 * Draws an image at the given x, y position using the width and height of
1.14 * the given image.
1.15 *
1.16 - * @param image the image to be drawn.
1.17 + * @param image the image to be drawn.
1.18 * @param x the X coordinate on the destination for the upper left of the
1.19 * image.
1.20 * @param y the Y coordinate on the destination for the upper left of the
1.21 @@ -359,7 +359,7 @@
1.22 * Draws an image into the given destination rectangle of the canvas. The
1.23 * Image is scaled to fit into the destination rectagnle.
1.24 *
1.25 - * @param image the image to be drawn.
1.26 + * @param image the image to be drawn.
1.27 * @param x the X coordinate on the destination for the upper left of the
1.28 * image.
1.29 * @param y the Y coordinate on the destination for the upper left of the
1.30 @@ -376,7 +376,7 @@
1.31 * Draws the current source rectangle of the given image to the given
1.32 * destination rectangle of the Canvas.
1.33 *
1.34 - * @param image the image to be drawn.
1.35 + * @param image the image to be drawn.
1.36 * @param sx the source rectangle's X coordinate position.
1.37 * @param sy the source rectangle's Y coordinate position.
1.38 * @param sw the source rectangle's width.
1.39 @@ -443,20 +443,19 @@
1.40 // public double getShadowOffsetY() {
1.41 // return graphicsEnvironmentImpl.getShadowOffsetY();
1.42 // }
1.43 -
1.44 /**
1.45 - * Gets the current stroke line cap attribute.
1.46 - *
1.47 - * @return a value of butt, round, or square.
1.48 - */
1.49 + * Gets the current stroke line cap attribute.
1.50 + *
1.51 + * @return a value of butt, round, or square.
1.52 + */
1.53 public String getLineCap() {
1.54 return graphicsEnvironmentImpl.getLineCap();
1.55 }
1.56 -
1.57 +
1.58 /**
1.59 * Sets the current stroke line cap attribute.
1.60 - *
1.61 - * @param style a value of miter, bevel, or round.
1.62 + *
1.63 + * @param style a value of miter, bevel, or round.
1.64 */
1.65 public void setLineCap(String style) {
1.66 graphicsEnvironmentImpl.setLineCap(style);
1.67 @@ -465,7 +464,7 @@
1.68 /**
1.69 * Gets the current stroke line join attribute.
1.70 *
1.71 - * @return a value of miter, bevel, or round.
1.72 + * @return a value of miter, bevel, or round.
1.73 */
1.74 public String getLineJoin() {
1.75 return graphicsEnvironmentImpl.getLineJoin();
1.76 @@ -474,8 +473,7 @@
1.77 /**
1.78 * Sets the current stroke line join attribute.
1.79 *
1.80 - * @param style a value of miter, bevel, or
1.81 - * round.
1.82 + * @param style a value of miter, bevel, or round.
1.83 */
1.84 public void setLineJoin(String style) {
1.85 graphicsEnvironmentImpl.setLineJoin(style);
1.86 @@ -672,25 +670,65 @@
1.87 graphicsEnvironmentImpl.strokeText(text, x, y, maxWidth);
1.88 }
1.89
1.90 + /**
1.91 + * Get a pixel array that you can manipulate, e.g. apply effects /
1.92 + * transparency
1.93 + *
1.94 + * @param x width
1.95 + * @param y height
1.96 + * @return a PixelMap
1.97 + */
1.98 public ImageData createPixelMap(double x, double y) {
1.99 return graphicsEnvironmentImpl.createPixelMap(x, y);
1.100 }
1.101
1.102 + /**
1.103 + * Create a new ImageData object with the same dimensions as the object
1.104 + * specified by imageData (this does not copy the image data)
1.105 + *
1.106 + * @param pixelMap
1.107 + * @return
1.108 + */
1.109 public ImageData createPixelMap(ImageData pixelMap) {
1.110 return graphicsEnvironmentImpl.createPixelMap(pixelMap);
1.111 }
1.112 -
1.113 +
1.114 + /**
1.115 + * Get the pixels for a region of your GraphicsContext
1.116 + * @param x start x coordinate
1.117 + * @param y start y coordinate
1.118 + * @param width width
1.119 + * @param height height
1.120 + * @return
1.121 + */
1.122 public ImageData getSnapshot(double x, double y, double width, double height) {
1.123 return graphicsEnvironmentImpl.getPixelMap(x, y, width, height);
1.124 }
1.125 -
1.126 +
1.127 + /**
1.128 + * Render an ImageData Object at the specified position
1.129 + * @param pixelMap the Pixel array
1.130 + * @param x start x coordinate
1.131 + * @param y start y coordinate
1.132 + */
1.133 public void drawPixelMap(ImageData pixelMap, double x, double y) {
1.134 graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y);
1.135 }
1.136
1.137 + /**
1.138 + * Render an ImageData Object at the specified position
1.139 + * @param pixelMap the Pixel array to draw
1.140 + * @param x start x coordinate
1.141 + * @param y start y coordinate
1.142 + * @param dirtyx The horizontal (x) value, in pixels, where to place the image on the canvas
1.143 + * @param dirtyy The vertical (y) value, in pixels, where to place the image on the canvas
1.144 + * @param dirtywidth The width to use to draw the image on the canvas
1.145 + * @param dirtyheight The height to use to draw the image on the canvas
1.146 + */
1.147 public void drawPixelMap(ImageData pixelMap, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight) {
1.148 graphicsEnvironmentImpl.putPixelMap(pixelMap, x, y, dirtyx, dirtyy, dirtywidth, dirtyheight);
1.149 }
1.150 +
1.151 /**
1.152 * Sets the global alpha of the current state.
1.153 *