Revision: 9341
Author: gwt.mirror...@gmail.com
Date: Thu Dec 2 09:52:19 2010
Log: Improve Canvas 2D documentation
Review at http://gwt-code-reviews.appspot.com/1165801
Review by: p...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9341
Added:
/trunk/user/src/com/google/gwt/canvas/client/package-info.java
/trunk/user/src/com/google/gwt/canvas/dom/client/package-info.java
Modified:
/trunk/user/src/com/google/gwt/canvas/client/Canvas.java
/trunk/user/src/com/google/gwt/canvas/dom/client/CanvasGradient.java
/trunk/user/src/com/google/gwt/canvas/dom/client/CanvasPattern.java
/trunk/user/src/com/google/gwt/canvas/dom/client/CanvasPixelArray.java
/trunk/user/src/com/google/gwt/canvas/dom/client/Context.java
/trunk/user/src/com/google/gwt/canvas/dom/client/Context2d.java
/trunk/user/src/com/google/gwt/canvas/dom/client/CssColor.java
/trunk/user/src/com/google/gwt/canvas/dom/client/FillStrokeStyle.java
/trunk/user/src/com/google/gwt/canvas/dom/client/ImageData.java
/trunk/user/src/com/google/gwt/canvas/dom/client/TextMetrics.java
/trunk/user/src/com/google/gwt/dom/client/CanvasElement.java
/trunk/user/src/com/google/gwt/dom/client/Document.java
/trunk/user/src/com/google/gwt/user/client/IsSupported.java
=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/canvas/client/package-info.java Thu Dec
2 09:52:19 2010
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
+ * use this file except in compliance with the License. You may obtain a
copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+/**
+ * Classes for HTML Canvas 2D support.
+ */
+...@com.google.gwt.util.preventspuriousrebuilds
+package com.google.gwt.canvas.client;
=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/package-info.java Thu
Dec 2 09:52:19 2010
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
not
+ * use this file except in compliance with the License. You may obtain a
copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+/**
+ * Classes for HTML Canvas 2D support.
+ */
+...@com.google.gwt.util.preventspuriousrebuilds
+package com.google.gwt.canvas.dom.client;
=======================================
--- /trunk/user/src/com/google/gwt/canvas/client/Canvas.java Tue Nov 30
06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/client/Canvas.java Thu Dec 2
09:52:19 2010
@@ -34,6 +34,7 @@
* This widget may not be supported on all browsers, see {...@link
IsSupported}
*/
public class Canvas extends FocusWidget implements IsSupported {
+
/**
* Runtime check for whether the canvas element is supported in this
browser.
* See {...@link IsSupported}
@@ -63,6 +64,7 @@
/**
* Gets the rendering context that may be used to draw on this canvas.
*
+ * @param contextId the context id as a String
* @return the canvas rendering context
*/
public Context getContext(String contextId) {
@@ -72,7 +74,7 @@
/**
* Returns a 2D rendering context.
*
- * This is a convenience method, @see {...@link #getContext(String)}
+ * This is a convenience method, see {...@link #getContext(String)}.
*
* @return a 2D canvas rendering context
*/
@@ -84,6 +86,7 @@
* Gets the height of the internal canvas coordinate space.
*
* @return the height, in pixels
+ * @see #setCoordinateSpaceHeight(int)
*/
public int getCoordinateSpaceHeight() {
return getCanvasElement().getHeight();
@@ -93,6 +96,7 @@
* Gets the width of the internal canvas coordinate space.
*
* @return the width, in pixels
+ * @see #setCoordinateSpaceWidth(int)
*/
public int getCoordinateSpaceWidth() {
return getCanvasElement().getWidth();
@@ -102,6 +106,7 @@
* Sets the height of the internal canvas coordinate space.
*
* @param height the height, in pixels
+ * @see #getCoordinateSpaceHeight()
*/
public void setCoordinateSpaceHeight(int height) {
getCanvasElement().setHeight(height);
@@ -111,6 +116,7 @@
* Sets the width of the internal canvas coordinate space.
*
* @param width the width, in pixels
+ * @see #getCoordinateSpaceWidth()
*/
public void setCoordinateSpaceWidth(int width) {
getCanvasElement().setWidth(width);
@@ -126,10 +132,12 @@
}
/**
- * Returns a data URL for the current content of the canvas element,
with a specified type.
+ * Returns a data URL for the current content of the canvas element,
with a
+ * specified type.
*
* @param type the type of the data url, e.g., image/jpeg or image/png.
- * @return a data URL for the current content of this element with the
specified type.
+ * @return a data URL for the current content of this element with the
+ * specified type.
*/
public String toDataUrl(String type) {
return getCanvasElement().toDataUrl(type);
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/CanvasGradient.java
Tue Nov 30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/CanvasGradient.java
Thu Dec 2 09:52:19 2010
@@ -24,9 +24,10 @@
* </span>
* </p>
*
- * This class serves as a reference to a gradient created using {...@link
Context2d#createPattern}
+ * This class serves as a reference to a gradient created using
+ * {...@link Context2d#createPattern}.
*
- * @see <a
href="http://www.w3.org/TR/2dcontext/#canvasgradient">CanvasGradient</a>
+ * @see <a href="http://www.w3.org/TR/2dcontext/#canvasgradient">HTML
Canvas 2D CanvasGradient</a>
*/
public class CanvasGradient extends FillStrokeStyle {
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/CanvasPattern.java Tue
Nov 30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/CanvasPattern.java Thu
Dec 2 09:52:19 2010
@@ -27,7 +27,7 @@
* Note that this class has no methods. It simply serves as a reference to
a
* pattern created using {...@link Context2d#createPattern}.
*
- * @see <a
href="http://www.w3.org/TR/2dcontext/#canvaspattern">CanvasPattern</a>
+ * @see <a href="http://www.w3.org/TR/2dcontext/#canvaspattern">HTML
Canvas 2D CanvasPattern</a>
*/
public class CanvasPattern extends FillStrokeStyle {
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/CanvasPixelArray.java
Tue Nov 30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/CanvasPixelArray.java
Thu Dec 2 06:15:06 2010
@@ -18,15 +18,17 @@
import com.google.gwt.core.client.JavaScriptObject;
/**
- * Array-like object holding the actual image data for an ImageData
object. For each pixel,
+ * Array-like object holding the actual image data for an ImageData
object. For each pixel,
* this object contains a red, green, blue and alpha value between 0 and
255 (in this order).
* Note that we use ints here to represent the data to avoid complexities
stemming from
* bytes being signed in Java.
- *
+ *
* <p>
* <span style="color:red">Experimental API: This class is still under
rapid
* development, and is very likely to be deleted. Use it at your own risk.
* </span>
+ *
+ * @see <a href="http://www.w3.org/TR/2dcontext/#canvaspixelarray">HTML
Canvas 2D CanvasPixelArray</a>
* </p>
*/
public class CanvasPixelArray extends JavaScriptObject {
@@ -36,6 +38,9 @@
/**
* Returns the data value at index i.
+ *
+ * @param i the data index
+ * @return the data value
*/
public final native int get(int i) /*-{
return this[i] || 0;
@@ -43,6 +48,8 @@
/**
* Returns the length of the array.
+ *
+ * @return the array length
*/
public final native int getLength() /*-{
return this.length;
@@ -50,10 +57,10 @@
/**
* Sets the data value at position i to the given value.
- *
- * Most browsers will clamp this value to the range 0...255 that is not
enforced in this
- * implementation.
- *
+ *
+ * Most browsers will clamp this value to the range 0...255, but that is
not
+ * enforced in this implementation.
+ *
* @param i index to set.
* @param value value to set (use values from 0 to 255)
*/
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/Context.java Tue Nov
30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/Context.java Thu Dec
2 06:15:06 2010
@@ -16,7 +16,8 @@
package com.google.gwt.canvas.dom.client;
/**
- * Rendering Context interface used to draw on a {...@link CanvasElement}.
+ * Rendering Context interface used to draw on a
+ * {...@link com.google.gwt.dom.client.CanvasElement}.
*
* <p>
* <span style="color:red">Experimental API: This class is still under
rapid
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/Context2d.java Tue Nov
30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/Context2d.java Thu
Dec 2 06:15:06 2010
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not
* use this file except in compliance with the License. You may obtain a
copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -22,34 +22,92 @@
/**
* Rendering interface used to draw on a {...@link CanvasElement}.
- *
+ *
* <p>
* <span style="color:red">Experimental API: This class is still under
rapid
* development, and is very likely to be deleted. Use it at your own risk.
* </span>
* </p>
- *
+ *
* @see <a
href="http://www.w3.org/TR/2dcontext/#canvasrenderingcontext2d">W3C
* HTML 5 Specification</a>
*/
public class Context2d extends JavaScriptObject implements Context {
/**
- * Specifies the context id property used in creating a Context.
+ * Enum for composite style.
+ *
+ * @see Context2d#setGlobalCompositeOperation(Composite)
*/
- public static final String CONTEXT_ID = "2d";
-
- /**
- * Enum for the repetition values.
- *
- * @see Context2d#createPattern(ImageElement, Repetition)
- * @see Context2d#createPattern(CanvasElement, Repetition)
- */
- public enum Repetition {
- REPEAT("repeat"), REPEAT_X("repeat-x"), REPEAT_Y("repeat-y"),
NO_REPEAT("no-repeat");
+ public enum Composite {
+ /**
+ * A (B is ignored). Display the source image instead of the
destination
+ * image.
+ */
+ COPY("copy"),
+
+ /**
+ * B atop A. Same as source-atop but using the destination image
instead of
+ * the source image and vice versa.
+ */
+ DESTINATION_ATOP("destination-atop"),
+
+ /**
+ * B in A. Same as source-in but using the destination image instead
of the
+ * source image and vice versa.
+ */
+ DESTINATION_IN("destination-in"),
+
+ /**
+ * B out A. Same as source-out but using the destination image instead
of the
+ * source image and vice versa.
+ */
+ DESTINATION_OUT("destination-out"),
+
+ /**
+ * B over A. Same as source-over but using the destination image
instead of
+ * the source image and vice versa.
+ */
+ DESTINATION_OVER("destination-over"),
+
+ /**
+ * A plus B. Display the sum of the source image and destination
image, with
+ * color values approaching 1 as a limit.
+ */
+ LIGHTER("lighter"),
+
+ /**
+ * A atop B. Display the source image wherever both images are opaque.
Display
+ * the destination image wherever the destination image is opaque but
the
+ * source image is transparent. Display transparency elsewhere.
+ */
+ SOURCE_ATOP("source-atop"),
+
+ /**
+ * A in B. Display the source image wherever both the source image and
+ * destination image are opaque. Display transparency elsewhere.
+ */
+ SOURCE_IN("source-in"),
+
+ /**
+ * A out B. Display the source image wherever the source image is
opaque and
+ * the destination image is transparent. Display transparency
elsewhere.
+ */
+ SOURCE_OUT("source-out"),
+
+ /**
+ * A over B. Display the source image wherever the source image is
opaque.
+ * Display the destination image elsewhere.
+ */
+ SOURCE_OVER("source-over"),
+
+ /**
+ * A xor B. Exclusive OR of the source image and destination image.
+ */
+ XOR("xor");
private final String value;
- private Repetition(String value) {
+ private Composite(String value) {
this.value = value;
}
@@ -60,7 +118,7 @@
/**
* Enum for line-cap style.
- *
+ *
* @see Context2d#setLineCap(LineCap)
*/
public enum LineCap {
@@ -79,11 +137,11 @@
/**
* Enum for line-join style.
- *
+ *
* @see Context2d#setLineJoin(LineJoin)
*/
public enum LineJoin {
- ROUND("round"), BEVEL("bevel"), MITER("miter");
+ BEVEL("bevel"), MITER("miter"), ROUND("round");
private final String value;
@@ -97,80 +155,17 @@
}
/**
- * Enum for composite style.
- *
- * @see Context2d#setGlobalCompositeOperation(Composite)
+ * Enum for the repetition values.
+ *
+ * @see Context2d#createPattern(ImageElement, Repetition)
+ * @see Context2d#createPattern(CanvasElement, Repetition)
*/
- public enum Composite {
- /**
- * A atop B. Display the source image wherever both images are opaque.
Display
- * the destination image wherever the destination image is opaque but
the
- * source image is transparent. Display transparency elsewhere.
- */
- SOURCE_ATOP("source-atop"),
-
- /**
- * A in B. Display the source image wherever both the source image and
- * destination image are opaque. Display transparency elsewhere.
- */
- SOURCE_IN("source-in"),
-
- /**
- * A out B. Display the source image wherever the source image is
opaque and
- * the destination image is transparent. Display transparency
elsewhere.
- */
- SOURCE_OUT("source-out"),
-
- /**
- * A over B. Display the source image wherever the source image is
opaque.
- * Display the destination image elsewhere.
- */
- SOURCE_OVER("source-over"),
-
- /**
- * B atop A. Same as source-atop but using the destination image
instead of
- * the source image and vice versa.
- */
- DESTINATION_ATOP("destination-atop"),
-
- /**
- * B in A. Same as source-in but using the destination image instead
of the
- * source image and vice versa.
- */
- DESTINATION_IN("destination-in"),
-
- /**
- * B out A. Same as source-out but using the destination image instead
of the
- * source image and vice versa.
- */
- DESTINATION_OUT("destination-out"),
-
- /**
- * B over A. Same as source-over but using the destination image
instead of
- * the source image and vice versa.
- */
- DESTINATION_OVER("destination-over"),
-
- /**
- * A plus B. Display the sum of the source image and destination
image, with
- * color values approaching 1 as a limit.
- */
- LIGHTER("lighter"),
-
- /**
- * A (B is ignored). Display the source image instead of the
destination
- * image.
- */
- COPY("copy"),
-
- /**
- * A xor B. Exclusive OR of the source image and destination image.
- */
- XOR("xor");
+ public enum Repetition {
+ NO_REPEAT("no-repeat"), REPEAT("repeat"), REPEAT_X("repeat-x"),
REPEAT_Y("repeat-y");
private final String value;
- private Composite(String value) {
+ private Repetition(String value) {
this.value = value;
}
@@ -181,11 +176,11 @@
/**
* Enum for text align style.
- *
+ *
* @see Context2d#setTextAlign(TextAlign)
*/
public enum TextAlign {
- START("start"), END("end"), LEFT("left"), RIGHT("right"),
CENTER("center");
+ CENTER("center"), END("end"), LEFT("left"), RIGHT("right"),
START("start");
private final String value;
@@ -200,12 +195,12 @@
/**
* Enum for text baseline style.
- *
+ *
* @see Context2d#setTextBaseline(TextBaseline)
*/
public enum TextBaseline {
- TOP("top"), HANGING("hanging"), MIDDLE("middle"),
ALPHABETIC("alphabetic"),
- IDEOGRAPHIC("ideographic"), BOTTOM("bottom");
+ ALPHABETIC("alphabetic"), BOTTOM("bottom"), HANGING("hanging"),
IDEOGRAPHIC("ideographic"),
+ MIDDLE("middle"), TOP("top");
private final String value;
@@ -217,20 +212,51 @@
return value;
}
}
+
+ /**
+ * Specifies the context id property used in creating a Context.
+ */
+ public static final String CONTEXT_ID = "2d";
protected Context2d() {
}
/**
- * Draws an arc.
+ * Draws an arc. If a current subpath exists, a line segment is added
from the
+ * current point to the starting point of the arc. If {...@code endAngle -
+ * startAngle} is equal to or greater than {...@code 2 * Math.Pi}, the arc
is the
+ * whole circumference of the circle.
+ *
+ * @param x the x coordinate of the center of the arc
+ * @param y the y coordinate of the center of the arc
+ * @param radius the radius of the arc
+ * @param startAngle the start angle, measured in radians clockwise from
the
+ * positive x-axis
+ * @param endAngle the end angle, measured in radians clockwise from the
+ * positive x-axis
*/
- public final native void arc(float x, float y, float radius, float
startAngle,
+ public final native void arc(float x, float y, float radius, float
startAngle,
float endAngle) /*-{
this.arc(x, y, radius, startAngle, endAngle);
}-*/;
/**
- * Draws an arc.
+ * Draws an arc. If a current subpath exists, a line segment is added
from the
+ * current point to the starting point of the arc. If {...@code
anticlockwise} is
+ * false and {...@code endAngle - startAngle} is equal to or greater than
{...@code
+ * 2 * Math.PI}, or if {...@code anticlockwise} is {...@code true} and
{...@code
+ * startAngle - endAngle} is equal to or greater than {...@code 2 *
Math.PI},
+ * then the arc is the whole circumference of the circle.
+ *
+ * @param x the x coordinate of the center of the arc
+ * @param y the y coordinate of the center of the arc
+ * @param radius the radius of the arc
+ * @param startAngle the start angle, measured in radians clockwise from
the
+ * positive x-axis
+ * @param endAngle the end angle, measured in radians clockwise from the
+ * positive x-axis
+ * @param anticlockwise if {...@code true}, the arc is drawn in an
anticlockwise
+ * direction
*/
public final native void arc(float x, float y, float radius, float
startAngle, float endAngle,
boolean anticlockwise) /*-{
@@ -238,7 +264,14 @@
}-*/;
/**
- * Draws an arc.
+ * Adds an arc to the current subpath, connecting it to the current point
+ * with a line segment.
+ *
+ * @param x1 the x coordinate of the starting point of the arc
+ * @param y1 the y coordinate of the starting point of the arc
+ * @param x2 the x coordinate of the ending point of the arc
+ * @param y2 the y coordinate of the ending point of the arc
+ * @param radius the radius of a circle containing the arc
*/
public final native void arcTo(float x1, float y1, float x2, float y2,
float radius) /*-{
this.arcTo(x1, y1, x2, y2, radius);
@@ -252,15 +285,28 @@
}-*/;
/**
- * Draws a Bezier curve.
+ * Draws a cubic B\u00e9zier curve from the current point to the point
+ * (x, y), with control points (cp1x, cp1y) and (cp2x, cp2y).
+ *
+ * @param cp1x the x coordinate of the first control point
+ * @param cp1y the y coordinate of the first control point
+ * @param cp2x the x coordinate of the second control point
+ * @param cp2y the y coordinate of the second control point
+ * @param x the x coordinate of the end point
+ * @param y the y coordinate of the end point
*/
- public final native void bezierCurveTo(float cp1x, float cp1y, float
cp2x, float cp2y, float x,
- float y) /*-{
+ public final native void bezierCurveTo(float cp1x, float cp1y,
+ float cp2x, float cp2y, float x, float y) /*-{
this.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
}-*/;
/**
* Clears a rectangle.
+ *
+ * @param x the x coordinate of the rectangle's upper-left corner
+ * @param y the y coordinate of the rectangle's upper-left corner
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
*/
public final native void clearRect(float x, float y, float w, float h)
/*-{
this.clearRect(x, y, w, h);
@@ -281,29 +327,46 @@
}-*/;
/**
- * Creates and image data object of the given size.
+ * Creates an image data object of the same size as the given object.
+ *
+ * @param imagedata an {...@link ImageData} object
+ * @return a new {...@link ImageData} object
*/
- public final native ImageData createImageData(int w, int h) /*-{
- return this.createImageData(w, h);
+ public final native ImageData createImageData(ImageData imagedata) /*-{
+ return this.createImageData(imagedata);
}-*/;
/**
- * Creates an image data object of the same size as the given object.
+ * Creates an image data object of the given size.
+ *
+ * @param w the width of the image
+ * @param h the height of the image
+ * @return an {...@link ImageData} object
*/
- public final native ImageData createImageData(ImageData imagedata) /*-{
- return this.createImageData(imagedata);
+ public final native ImageData createImageData(int w, int h) /*-{
+ return this.createImageData(w, h);
}-*/;
/**
* Creates a linear gradient.
+ *
+ * @param x0 the x coordinate of the starting point of the gradient
+ * @param y0 the y coordinate of the starting point of the gradient
+ * @param x1 the x coordinate of the ending point of the gradient
+ * @param y1 the y coordinate of the ending point of the gradient
+ * @return a {...@link CanvasGradient} object
*/
- public final native CanvasGradient createLinearGradient(float x0, float
y0, float x1,
+ public final native CanvasGradient createLinearGradient(float x0, float
y0, float x1,
float y1) /*-{
return this.createLinearGradient(x0, y0, x1, y1);
}-*/;
/**
* Creates a pattern from another canvas.
+ *
+ * @param image an {...@link CanvasElement} object
+ * @param repetition a {...@link Repetition} object
+ * @return a {...@link CanvasPattern} object
*/
public final CanvasPattern createPattern(CanvasElement image, Repetition
repetition) {
return createPattern(image, repetition.getValue());
@@ -311,6 +374,10 @@
/**
* Creates a pattern from another canvas.
+ *
+ * @param image an {...@link CanvasElement} object
+ * @param repetition the repetition type as a String
+ * @return a {...@link CanvasPattern} object
*/
public final native CanvasPattern createPattern(CanvasElement image,
String repetition) /*-{
return this.createPattern(image, repetition);
@@ -318,6 +385,10 @@
/**
* Creates a pattern from an image.
+ *
+ * @param image an {...@link ImageElement} object
+ * @param repetition a {...@link Repetition} object
+ * @return a {...@link CanvasPattern} object
*/
public final CanvasPattern createPattern(ImageElement image, Repetition
repetition) {
return createPattern(image, repetition.getValue());
@@ -325,6 +396,10 @@
/**
* Creates a pattern from an image.
+ *
+ * @param image an {...@link ImageElement} object
+ * @param repetition the repetition type as a String
+ * @return a {...@link CanvasPattern} object
*/
public final native CanvasPattern createPattern(ImageElement image,
String repetition) /*-{
return this.createPattern(image, repetition);
@@ -332,9 +407,14 @@
/**
* Creates a radial gradient.
- *
- * Due to needing to wrap the contained gradient when in devmode, we
create an array containing
- * the CanvasGradient in devmode (when isScript == false.) @see
FillStrokeStyle
+ *
+ * @param x0 the x coordinate of the center of the start circle of the
gradient
+ * @param y0 the y coordinate of the center of the start circle of the
gradient
+ * @param r0 the radius of the start circle of the gradient
+ * @param x1 the x coordinate of the center of the end circle of the
gradient
+ * @param y1 the y coordinate of the center of the end circle of the
gradient
+ * @param r1 the radius of the end circle of the gradient
+ * @return a {...@link CanvasGradient} object
*/
public final native CanvasGradient createRadialGradient(float x0, float
y0, float r0, float x1,
float y1, float r1) /*-{
@@ -343,6 +423,10 @@
/**
* Draws an image.
+ *
+ * @param image an {...@link CanvasElement} object
+ * @param dx the x coordinate of the upper-left corner of the
destination rectangle
+ * @param dy the y coordinate of the upper-left corner of the
destination rectangle
*/
public final native void drawImage(CanvasElement image, float dx, float
dy) /*-{
this.drawImage(image, dx, dy);
@@ -350,14 +434,30 @@
/**
* Draws a scaled image.
+ *
+ * @param image an {...@link CanvasElement} object
+ * @param dx the x coordinate of the upper-left corner of the
destination rectangle
+ * @param dy the y coordinate of the upper-left corner of the
destination rectangle
+ * @param dw the width of the destination rectangle
+ * @param dh the height of the destination rectangle
*/
- public final native void drawImage(CanvasElement image, float dx, float
dy, float dw,
+ public final native void drawImage(CanvasElement image, float dx, float
dy, float dw,
float dh) /*-{
this.drawImage(image, dx, dy, dw, dh);
}-*/;
/**
* Draws a scaled subset of an image.
+ *
+ * @param image an {...@link CanvasElement} object
+ * @param sx the x coordinate of the upper-left corner of the source
rectangle
+ * @param sy the y coordinate of the upper-left corner of the source
rectangle
+ * @param sw the width of the source rectangle
+ * @param sh the width of the source rectangle
+ * @param dx the x coordinate of the upper-left corner of the
destination rectangle
+ * @param dy the y coordinate of the upper-left corner of the
destination rectangle
+ * @param dw the width of the destination rectangle
+ * @param dh the height of the destination rectangle
*/
public final native void drawImage(CanvasElement image, float sx, float
sy, float sw, float sh,
float dx, float dy, float dw, float dh) /*-{
@@ -366,6 +466,10 @@
/**
* Draws an image.
+ *
+ * @param image an {...@link ImageElement} object
+ * @param dx the x coordinate of the upper-left corner of the
destination rectangle
+ * @param dy the y coordinate of the upper-left corner of the
destination rectangle
*/
public final native void drawImage(ImageElement image, float dx, float
dy) /*-{
this.drawImage(image, dx, dy);
@@ -373,14 +477,30 @@
/**
* Draws a scaled image.
+ *
+ * @param image an {...@link ImageElement} object
+ * @param dx the x coordinate of the upper-left corner of the
destination rectangle
+ * @param dy the y coordinate of the upper-left corner of the
destination rectangle
+ * @param dw the width of the destination rectangle
+ * @param dh the height of the destination rectangle
*/
- public final native void drawImage(ImageElement image, float dx, float
dy, float dw,
+ public final native void drawImage(ImageElement image, float dx, float
dy, float dw,
float dh) /*-{
this.drawImage(image, dx, dy, dw, dh);
}-*/;
/**
* Draws a scaled subset of an image.
+ *
+ * @param image an {...@link ImageElement} object
+ * @param sx the x coordinate of the upper-left corner of the source
rectangle
+ * @param sy the y coordinate of the upper-left corner of the source
rectangle
+ * @param sw the width of the source rectangle
+ * @param sh the width of the source rectangle
+ * @param dx the x coordinate of the upper-left corner of the
destination rectangle
+ * @param dy the y coordinate of the upper-left corner of the
destination rectangle
+ * @param dw the width of the destination rectangle
+ * @param dh the height of the destination rectangle
*/
public final native void drawImage(ImageElement image, float sx, float
sy, float sw, float sh,
float dx, float dy, float dw, float dh) /*-{
@@ -396,13 +516,22 @@
/**
* Fills a rectangle.
+ *
+ * @param x the x coordinate of the rectangle's upper-left corner
+ * @param y the y coordinate of the rectangle's upper-left corner
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
*/
public final native void fillRect(float x, float y, float w, float h)
/*-{
this.fillRect(x, y, w, h);
}-*/;
/**
- * Draw text.
+ * Draws filled text.
+ *
+ * @param text the text as a String
+ * @param x the x coordinate of the text position
+ * @param y the y coordinate of the text position
*/
public final native void fillText(String text, float x, float y) /*-{
// FF3.0 does not implement this method.
@@ -412,7 +541,12 @@
}-*/;
/**
- * Draw text squeezed into the given max width.
+ * Draws filled text squeezed into the given max width.
+ *
+ * @param text the text as a String
+ * @param x the x coordinate of the text position
+ * @param y the y coordinate of the text position
+ * @param maxWidth the maximum width for the text
*/
public final native void fillText(String text, float x, float y, float
maxWidth) /*-{
this.fillText(text, x, y, maxWidth);
@@ -420,16 +554,21 @@
/**
* Gets this context's canvas.
+ *
+ * @return a {...@link CanvasElement} object
*/
public final native CanvasElement getCanvas() /*-{
return this.canvas;
}-*/;
/**
- * Returns the context's fillStyle.
- *
- * Due to needing to wrap CssColor when in devmode, we use different
methods
- * depending on whether we are in devmode (when isScript == false) or
not. @see CssColor
+ * Returns the context's fillStyle. In dev mode, the returned object will
+ * be wrapped in a JavaScript array.
+ *
+ * @return a {...@link FillStrokeStyle} object
+ * @see #setFillStyle(FillStrokeStyle)
+ * @see #setFillStyle(String)
+ * @see CssColor
*/
public final FillStrokeStyle getFillStyle() {
if (GWT.isScript()) {
@@ -441,6 +580,9 @@
/**
* Gets this context's font.
+ *
+ * @return the font name as a String
+ * @see #setFont(String)
*/
public final native String getFont() /*-{
return this.font;
@@ -448,6 +590,9 @@
/**
* Gets the global alpha value.
+ *
+ * @return the global alpha value as a float
+ * @see #setGlobalAlpha(float)
*/
public final native float getGlobalAlpha() /*-{
return this.globalAlpha;
@@ -455,6 +600,10 @@
/**
* Gets the global composite operation.
+ *
+ * @return the global composite operation as a String
+ * @see #setGlobalCompositeOperation(Composite)
+ * @see #setGlobalCompositeOperation(String)
*/
public final native String getGlobalCompositeOperation() /*-{
return this.globalCompositeOperation;
@@ -463,6 +612,12 @@
/**
* Returns an image data object for the screen area denoted by
* sx, sy, sw and sh.
+ *
+ * @param sx the x coordinate of the upper-left corner of the desired
area
+ * @param sy the y coordinate of the upper-left corner of the desired
area
+ * @param sw the width of the desired area
+ * @param sh the height of the desired area
+ * @return an {...@link ImageData} object containing screen pixel data
*/
public final native ImageData getImageData(float sx, float sy, float sw,
float sh) /*-{
return this.getImageData(sx, sy, sw, sh);
@@ -470,6 +625,10 @@
/**
* Gets the current line-cap style.
+ *
+ * @return the line cap style as a String
+ * @see #setLineCap(LineCap)
+ * @see #setLineCap(String)
*/
public final native String getLineCap() /*-{
return this.lineCap;
@@ -477,6 +636,10 @@
/**
* Gets the current line-join style.
+ *
+ * @return the line join style as a String
+ * @see #setLineJoin(LineJoin)
+ * @see #setLineJoin(String)
*/
public final native String getLineJoin() /*-{
return this.lineJoin;
@@ -484,6 +647,9 @@
/**
* Gets the current line-width.
+ *
+ * @return the line width as a float
+ * @see #setLineWidth(float)
*/
public final native float getLineWidth() /*-{
return this.lineWidth;
@@ -491,6 +657,9 @@
/**
* Gets the current miter-limit.
+ *
+ * @return the miter limit as a float
+ * @see #setMiterLimit(float)
*/
public final native float getMiterLimit() /*-{
return this.miterLimit;
@@ -498,6 +667,9 @@
/**
* Gets the current shadow-blur.
+ *
+ * @return the shadow blur amount as a float
+ * @see #setShadowBlur(float)
*/
public final native float getShadowBlur() /*-{
return this.shadowBlur;
@@ -505,6 +677,9 @@
/**
* Gets the current shadow color.
+ *
+ * @return the shadow color as a String
+ * @see #setShadowColor(String)
*/
public final native String getShadowColor() /*-{
return this.shadowColor;
@@ -512,6 +687,10 @@
/**
* Gets the current x-shadow-offset.
+ *
+ * @return the shadow x offset as a float
+ * @see #setShadowOffsetX(float)
+ * @see #getShadowOffsetY()
*/
public final native float getShadowOffsetX() /*-{
return this.shadowOffsetX;
@@ -519,16 +698,23 @@
/**
* Gets the current y-shadow-offset.
+ *
+ * @return the shadow y offset as a float
+ * @see #setShadowOffsetY(float)
+ * @see #getShadowOffsetX()
*/
public final native float getShadowOffsetY() /*-{
return this.shadowOffsetY;
}-*/;
/**
- * Returns the context's strokeStyle.
- *
- * Due to needing to wrap CssColor when in devmode, we use different
methods
- * depending on whether we are in devmode (when isScript == false) or
not. @see CssColor
+ * Returns the context's strokeStyle. In dev mode, the returned object
will
+ * be wrapped in a JavaScript array.
+ *
+ * @return the stroke style as a {...@link FillStrokeStyle} object
+ * @see #setStrokeStyle(FillStrokeStyle)
+ * @see #setStrokeStyle(String)
+ * @see CssColor
*/
public final FillStrokeStyle getStrokeStyle() {
if (GWT.isScript()) {
@@ -540,6 +726,10 @@
/**
* Gets the current text align.
+ *
+ * @return the text align as a String
+ * @see #setTextAlign(TextAlign)
+ * @see #setTextAlign(String)
*/
public final native String getTextAlign() /*-{
return this.textAlign;
@@ -547,6 +737,10 @@
/**
* Gets the current text baseline.
+ *
+ * @return the text baseline as a String
+ * @see #setTextBaseline(TextBaseline)
+ * @see #setTextBaseline(String)
*/
public final native String getTextBaseline() /*-{
return this.textBaseline;
@@ -554,17 +748,21 @@
/**
* Returns true if the given point is in the current path.
- *
- * @param x x coordinate of the point to test.
- * @param y y coordinate of the point to test.
- * @return true if the given point is in the current path.
+ *
+ * @param x the x coordinate of the point to test.
+ * @param y the y coordinate of the point to test.
+ * @return {...@code true} if the given point is in the current path.
*/
public final native boolean isPointInPath(float x, float y) /*-{
return this.isPointInPath(x, y);
}-*/;
/**
- * Draws a line.
+ * Adds a line from the current point to the point (x, y) to the current
+ * path.
+ *
+ * @param x the x coordinate of the line endpoint
+ * @param y the y coordinate of the line endpoint
*/
public final native void lineTo(float x, float y) /*-{
this.lineTo(x, y);
@@ -572,31 +770,44 @@
/**
* Returns the metrics for the given text.
+ *
+ * @param text the text to measure, as a String
+ * @return a {...@link TextMetrics} object
*/
public final native TextMetrics measureText(String text) /*-{
return this.measureText(text);
}-*/;
/**
- * Sets the current path position.
+ * Terminates the current path and sets the current path position to the
point
+ * (x, y).
+ *
+ * @param x the x coordinate of the new position
+ * @param y the y coordinate of the new position
*/
public final native void moveTo(float x, float y) /*-{
this.moveTo(x, y);
}-*/;
/**
- * Write the given image data to the given screen position.
- *
- * @param imagedata The image data to be written to the screen.
- * @param x the x-position of the image data.
- * @param y the y-position of the image data.
+ * Draws the given image data at the given screen position.
+ *
+ * @param imagedata an {...@link ImageData} instance to be written to the
screen
+ * @param x the x coordinate of the upper-left corner at which to draw
+ * @param y the y coordinate of the upper-left corner at which to draw
*/
public final native void putImageData(ImageData imagedata, float x,
float y) /*-{
return this.putImageData(imagedata, x, y);
}-*/;
/**
- * Draws a quadratic curve.
+ * Draws a quadratic B\u00e9zier curve from the current point to the
point
+ * (x, y), with control point (cpx, cpy).
+ *
+ * @param cpx the x coordinate of the control point
+ * @param cpy the y coordinate of the control point
+ * @param x the x coordinate of the end point
+ * @param y the y coordinate of the end point
*/
public final native void quadraticCurveTo(float cpx, float cpy, float x,
float y) /*-{
this.quadraticCurveTo(cpx, cpy, x, y);
@@ -604,6 +815,11 @@
/**
* Creates a new rectangular path.
+ *
+ * @param x the x coordinate of the rectangle's upper-left corner
+ * @param y the y coordinate of the rectangle's upper-left corner
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
*/
public final native void rect(float x, float y, float w, float h) /*-{
this.rect(x, y, w, h);
@@ -618,6 +834,8 @@
/**
* Applies rotation to the current transform.
+ *
+ * @param angle the clockwise rotation angle, in radians
*/
public final native void rotate(float angle) /*-{
this.rotate(angle);
@@ -632,6 +850,9 @@
/**
* Applies scale to the current transform.
+ *
+ * @param x the scale factor along the x-axis
+ * @param y the scale factor along the y-axis
*/
public final native void scale(float x, float y) /*-{
this.scale(x, y);
@@ -640,10 +861,9 @@
/**
* Sets the context's fillStyle.
*
- * Due to needing to wrap CssColor when in devmode, we use different
methods
- * depending on whether we are in devmode (when isScript == false) or
not. @see CssColor
- *
* @param fillStyle the fill style to set.
+ * @see #getFillStyle()
+ * @see CssColor
*/
public final void setFillStyle(FillStrokeStyle fillStyle) {
if (GWT.isScript()) {
@@ -654,7 +874,11 @@
}
/**
- * Convenience method to set the context's fillStyle to a CssColor.
+ * Convenience method to set the context's fillStyle to a {...@link
CssColor},
+ * specified in String form.
+ *
+ * @param fillStyleColor the color as a String
+ * @see #getFillStyle()
*/
public final void setFillStyle(String fillStyleColor) {
setFillStyle(CssColor.make(fillStyleColor));
@@ -662,6 +886,9 @@
/**
* Sets the font.
+ *
+ * @param f the font name as a String
+ * @see #getFont()
*/
public final native void setFont(String f) /*-{
this.font = f;
@@ -669,6 +896,9 @@
/**
* Sets the global alpha value.
+ *
+ * @param alpha the global alpha value as a float
+ * @see #getGlobalAlpha()
*/
public final native void setGlobalAlpha(float alpha) /*-{
this.globalAlpha = alpha;
@@ -676,6 +906,9 @@
/**
* Sets the global composite operation.
+ *
+ * @param composite a {...@link Composite} value
+ * @see #getGlobalCompositeOperation()
*/
public final void setGlobalCompositeOperation(Composite composite) {
setGlobalCompositeOperation(composite.getValue());
@@ -683,6 +916,9 @@
/**
* Sets the global composite operation.
+ *
+ * @param globalCompositeOperation the operation as a String
+ * @see #getGlobalCompositeOperation()
*/
public final native void setGlobalCompositeOperation(String
globalCompositeOperation) /*-{
this.globalCompositeOperation = globalCompositeOperation;
@@ -690,6 +926,9 @@
/**
* Sets the line-cap style.
+ *
+ * @param lineCap the line cap style as a {...@link LineCap} value
+ * @see #getLineCap()
*/
public final void setLineCap(LineCap lineCap) {
setLineCap(lineCap.getValue());
@@ -697,6 +936,9 @@
/**
* Sets the line-cap style.
+ *
+ * @param lineCap the line cap style as a String
+ * @see #getLineCap()
*/
public final native void setLineCap(String lineCap) /*-{
this.lineCap = lineCap;
@@ -704,6 +946,9 @@
/**
* Sets the line-join style.
+ *
+ * @param lineJoin the line join style as a {...@link LineJoin} value
+ * @see #getLineJoin()
*/
public final void setLineJoin(LineJoin lineJoin) {
setLineJoin(lineJoin.getValue());
@@ -711,6 +956,9 @@
/**
* Sets the line-join style.
***The diff for this file has been truncated for email.***
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/CssColor.java Tue Nov
30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/CssColor.java Thu Dec
2 06:15:06 2010
@@ -25,8 +25,9 @@
* </p>
*
* <p>
- * To handle devmode we must wrap JSO strings in an array. Therefore, when
in devmode, CssColor is
- * actually an array with one element that is the JSO. In webmode, this is
not needed.
+ * To handle dev mode we must wrap JSO strings in an array. Therefore,
when in
+ * dev mode, CssColor is actually an array with one element that is the
JSO. In
+ * web mode, this is not needed.
* </p>
*
* @see <a href="http://www.w3.org/TR/CSS1/#color">Cascading Style Sheets,
level 1</a>
@@ -36,9 +37,10 @@
/**
* Sets the RGB color value.
*
- * @param r red, int between 0 and 255
- * @param g green, int between 0 and 255
- * @param b blue, int between 0 and 255
+ * @param r red, integer between 0 and 255
+ * @param g green, integer between 0 and 255
+ * @param b blue, integer between 0 and 255
+ * @return a {...@link CssColor} object
*/
public static final CssColor make(int r, int g, int b) {
return make("rgb(" + r + "," + g + "," + b + ")");
@@ -50,10 +52,9 @@
* Examples: blue, #ff0000, #f00, rgb(255,0,0)
*
* @param cssColor the CSS color
+ * @return a {...@link CssColor} object
*/
public static final native CssColor make(String cssColor) /*-{
- // Due to needing to wrap CssColor when in devmode, we check whether
the we are in devmode and
- // wrap the String in an array if necessary.
return @com.google.gwt.core.client.GWT::isScript()() ? cssColor :
[cssColor];
}-*/;
@@ -66,8 +67,6 @@
* @return the value of the color, as a String.
*/
public final native String value() /*-{
- // Due to needing to wrap CssColor when in devmode, we check whether
the we are in devmode and
- // unwrap the String if necessary.
return @com.google.gwt.core.client.GWT::isScript()() ? this : this[0];
}-*/;
}
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/FillStrokeStyle.java
Tue Nov 30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/FillStrokeStyle.java
Thu Dec 2 06:15:06 2010
@@ -19,7 +19,8 @@
import com.google.gwt.core.client.JavaScriptObject;
/**
- * Represents a CssColor, a CanvasGradient, or a CanvasPattern that is
used for stroke and fill.
+ * Represents a {...@link CssColor}, {...@link CanvasGradient}, or
+ * {...@link CanvasPattern} that is used for stroke and fill.
*
* <p>
* <span style="color:red">Experimental API: This class is still under
rapid
@@ -28,7 +29,21 @@
* </p>
*/
public class FillStrokeStyle extends JavaScriptObject {
- public static final int TYPE_CSSCOLOR = 0, TYPE_GRADIENT = 1,
TYPE_PATTERN = 2;
+
+ /**
+ * Constant for CssColor style.
+ */
+ public static final int TYPE_CSSCOLOR = 0;
+
+ /**
+ * Constant for Gradient style.
+ */
+ public static final int TYPE_GRADIENT = 1;
+
+ /**
+ * Constant for Pattern style.
+ */
+ public static final int TYPE_PATTERN = 2;
protected FillStrokeStyle() { }
@@ -38,8 +53,7 @@
* @return The type of the object.
*/
public final native int getType() /*-{
- // Due to needing to wrap the contained CssColor when in devmode, we
must unwrap the color to
- // check its type when in devmode (when isScript == false.) @see
CssColor
+ // Unwrap the color to check its type when in dev mode (when isScript
== false)
var unwrappedColor = @com.google.gwt.core.client.GWT::isScript()() ?
this : this[0];
if (unwrappedColor && typeof(unwrappedColor) == 'string') {
return
@com.google.gwt.canvas.dom.client.FillStrokeStyle::TYPE_CSSCOLOR;
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/ImageData.java Tue Nov
30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/ImageData.java Thu
Dec 2 06:15:06 2010
@@ -25,8 +25,11 @@
* development, and is very likely to be deleted. Use it at your own risk.
* </span>
* </p>
+ *
+ * @see <a href="http://www.w3.org/TR/2dcontext/#imagedata">HTML Canvas 2D
ImageData</a>
*/
public class ImageData extends JavaScriptObject {
+
/**
* Number of colors at each location in the array.
*
@@ -51,7 +54,9 @@
*
* @param x the x coordinate
* @param y the y coordinate
- * @return the alpha value at position (x,y), or 0 if not in the image.
+ * @return the alpha value at position (x,y), or 0 if not in the image
+ * @see #setAlphaAt(int, int, int)
+ * @see #getColorAt(int, int, int)
*/
public final int getAlphaAt(int x, int y) {
return getColorAt(x, y, OFFSET_ALPHA);
@@ -62,14 +67,18 @@
*
* @param x the x coordinate
* @param y the y coordinate
- * @return the blue value at position (x,y), or 0 if not in the image.
+ * @return the blue value at position (x,y), or 0 if not in the image
+ * @see #setBlueAt(int, int, int)
+ * @see #getColorAt(int, int, int)
*/
public final int getBlueAt(int x, int y) {
return getColorAt(x, y, OFFSET_BLUE);
}
/**
- * Returns a canvas pixel array of the size width * height * 4.
+ * Returns a canvas pixel array of size width * height * 4.
+ *
+ * @return a {...@link CanvasPixelArray} object
*/
public final native CanvasPixelArray getData() /*-{
return this.data;
@@ -80,7 +89,9 @@
*
* @param x the x coordinate
* @param y the y coordinate
- * @return the green value at position (x,y), or 0 if not in the image.
+ * @return the green value at position (x,y), or 0 if not in the image
+ * @see #setGreenAt(int, int, int)
+ * @see #getColorAt(int, int, int)
*/
public final int getGreenAt(int x, int y) {
return getColorAt(x, y, OFFSET_GREEN);
@@ -88,6 +99,8 @@
/**
* Returns the height of this image data object.
+ *
+ * @return the image height as an int
*/
public final native int getHeight() /*-{
return this.height;
@@ -98,7 +111,9 @@
*
* @param x the x coordinate
* @param y the y coordinate
- * @return the red value at position (x,y), or 0 if not in the image.
+ * @return the red value at position (x,y), or 0 if not in the image
+ * @see #setRedAt(int, int, int)
+ * @see #getColorAt(int, int, int)
*/
public final int getRedAt(int x, int y) {
return getColorAt(x, y, OFFSET_RED);
@@ -106,6 +121,8 @@
/**
* Returns the width of this image data object.
+ *
+ * @return the image width as an int
*/
public final native int getWidth() /*-{
return this.width;
@@ -117,6 +134,8 @@
* @param alpha the alpha value
* @param x the x coordinate
* @param y the y coordinate
+ * @see #getAlphaAt(int, int)
+ * @see #getColorAt(int, int, int)
*/
public final void setAlphaAt(int alpha, int x, int y) {
setColorAt(alpha, x, y, OFFSET_ALPHA);
@@ -128,6 +147,8 @@
* @param blue the blue value
* @param x the x coordinate
* @param y the y coordinate
+ * @see #getBlueAt(int, int)
+ * @see #getColorAt(int, int, int)
*/
public final void setBlueAt(int blue, int x, int y) {
setColorAt(blue, x, y, OFFSET_BLUE);
@@ -139,6 +160,8 @@
* @param green the green value
* @param x the x coordinate
* @param y the y coordinate
+ * @see #getGreenAt(int, int)
+ * @see #getColorAt(int, int, int)
*/
public final void setGreenAt(int green, int x, int y) {
setColorAt(green, x, y, OFFSET_GREEN);
@@ -150,6 +173,8 @@
* @param red the red value
* @param x the x coordinate
* @param y the y coordinate
+ * @see #getRedAt(int, int)
+ * @see #getColorAt(int, int, int)
*/
public final void setRedAt(int red, int x, int y) {
setColorAt(red, x, y, OFFSET_RED);
@@ -158,14 +183,15 @@
/**
* Returns the color value at position (x,y) with the specified offset.
*
- * Colors are stored in RGBA format, where the offset determines the
color (R, G, B, or A.) The
- * values are stored in row-major order. If the specified location is
not in the image, 0 is
- * returned.
+ * Colors are stored in RGBA format, where the offset determines the
color
+ * channel (R, G, B, or A). The values are stored in row-major order. If
the
+ * specified location is not in the image, 0 is returned.
*
* @param x the x coordinate
* @param y the y coordinate
* @param offset the color offset
- * @return the color value at position (x,y), or 0 if not in the image.
+ * @return the color value at position (x,y), or 0 if not in the image
+ * @see #setColorAt(int, int, int, int)
*/
private native int getColorAt(int x, int y, int offset) /*-{
return
this.da...@com.google.gwt.canvas.dom.client.imagedata::NUM_COLORS *
@@ -175,13 +201,14 @@
/**
* Sets the color value at position (x,y) with the specified offset.
*
- * Colors are stored in RGBA format, where the offset determines the
color (R, G, B, or A.) The
- * values are stored in row-major order.
+ * Colors are stored in RGBA format, where the offset determines the
color
+ * (R, G, B, or A.) The values are stored in row-major order.
*
* @param color the color (in the range 0...255)
* @param x the x coordinate
* @param y the y coordinate
* @param offset the color offset
+ * @see #getColorAt(int, int, int)
*/
private native void setColorAt(int color, int x, int y, int offset) /*-{
this.da...@com.google.gwt.canvas.dom.client.imagedata::NUM_COLORS *
=======================================
--- /trunk/user/src/com/google/gwt/canvas/dom/client/TextMetrics.java Tue
Nov 30 06:11:17 2010
+++ /trunk/user/src/com/google/gwt/canvas/dom/client/TextMetrics.java Thu
Dec 2 06:15:06 2010
@@ -25,6 +25,8 @@
* development, and is very likely to be deleted. Use it at your own risk.
* </span>
* </p>
+ *
+ * @see <a href="http://www.w3.org/TR/2dcontext/#textmetrics">HTML Canvas
2D TextMetrics</a>
*/
public class TextMetrics extends JavaScriptObject {
=======================================
--- /trunk/user/src/com/google/gwt/dom/client/CanvasElement.java Tue Nov 30
06:11:17 2010
+++ /trunk/user/src/com/google/gwt/dom/client/CanvasElement.java Thu Dec 2
06:15:06 2010
@@ -32,6 +32,9 @@
@TagName(CanvasElement.TAG)
public class CanvasElement extends Element {
+ /**
+ * The tag for this element.
+ */
public static final String TAG = "canvas";
protected CanvasElement() {
@@ -39,7 +42,8 @@
/**
* Gets the rendering context that may be used to draw on this canvas.
- *
+ *
+ * @param contextId the context id as a String
* @return the canvas rendering context
*/
public final native Context getContext(String contextId) /*-{
@@ -49,7 +53,7 @@
/**
* Returns a 2D rendering context.
*
- * This is a convenience method, @see {...@link #getContext(String)}
+ * This is a convenience method, see {...@link #getContext(String)}.
*
* @return a 2D canvas rendering context
*/
@@ -61,6 +65,7 @@
* Gets the height of the canvas.
*
* @return the height, in pixels
+ * @see #setHeight(int)
*/
public final native int getHeight() /*-{
return this.height;
@@ -70,6 +75,7 @@
* Gets the width of the canvas.
*
* @return the width, in pixels
+ * @see #setWidth(int)
*/
public final native int getWidth() /*-{
return this.width;
@@ -79,6 +85,7 @@
* Sets the height of the canvas.
*
* @param height the height, in pixels
+ * @see #getHeight()
*/
public final native void setHeight(int height) /*-{
this.height = height;
@@ -88,6 +95,7 @@
* Sets the width of the canvas.
*
* @param width the width, in pixels
+ * @see #getWidth()
*/
public final native void setWidth(int width) /*-{
this.width = width;
=======================================
--- /trunk/user/src/com/google/gwt/dom/client/Document.java Tue Nov 30
06:11:17 2010
+++ /trunk/user/src/com/google/gwt/dom/client/Document.java Thu Dec 2
06:15:06 2010
@@ -114,7 +114,7 @@
}
/**
- * Creates an <canvas> element.
+ * Creates a <canvas> element.
*
* @return the newly created element
*/
=======================================
--- /trunk/user/src/com/google/gwt/user/client/IsSupported.java Tue Nov 30
06:11:17 2010
+++ /trunk/user/src/com/google/gwt/user/client/IsSupported.java Thu Dec 2
06:15:06 2010
@@ -19,8 +19,9 @@
/**
* Interface for classes that are only supported on a limited set of
browsers.
*
- * By convention, classes that implement IsSupported will provide a static
method
- * <code>boolean isSupported()</code> that checks whether the feature is
supported at runtime.
+ * By convention, classes that implement IsSupported will provide a static
+ * method <code>boolean isSupported()</code> that checks whether the
feature is
+ * supported at runtime.
*/
public interface IsSupported {
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors