# HG changeset patch # User Anton Epple # Date 1392191800 -3600 # Node ID 619f507713a21e98566352ab7b4e27b5e57d5753 # Parent 493cae4fd458458372850af6b91148b53e83a166 More JavaDoc improvements. diff -r 493cae4fd458 -r 619f507713a2 javaquery/canvas/src/main/java/net/java/html/canvas/Style.java --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Wed Feb 12 08:43:07 2014 +0100 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Wed Feb 12 08:56:40 2014 +0100 @@ -1,23 +1,22 @@ /** - * Back 2 Browser Bytecode Translator - * Copyright (C) 2012 Jaroslav Tulach + * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach + * * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2 of the License. + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 2 of the License. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. * - * You should have received a copy of the GNU General Public License - * along with this program. Look for COPYING file in the top folder. - * If not, see http://opensource.org/licenses/GPL-2.0. + * You should have received a copy of the GNU General Public License along with + * this program. Look for COPYING file in the top folder. If not, see + * http://opensource.org/licenses/GPL-2.0. */ package net.java.html.canvas; -import java.util.Collection; import java.util.HashMap; import java.util.Objects; @@ -51,9 +50,9 @@ } /** - * A Fill Pattern using an Image Resource to create a fill style supporting - * different repeat styles repeat, repeat-x, repeat-y, or no-repeat. - * Default is repeat. + * A Fill Pattern using an Image Resource to create a fill style supporting + * different repeat styles repeat, repeat-x, repeat-y, or no-repeat. Default + * is repeat. */ public static final class Pattern extends Style { @@ -61,9 +60,10 @@ private final String repeat; /** - * + * * @param imageResource the base image of thsi pattern - * @param repeat the repeat pattern, possible values are repeat, repeat-x, repeat-y, or no-repeat. + * @param repeat the repeat pattern, possible values are repeat, + * repeat-x, repeat-y, or no-repeat. */ public Pattern(Image imageResource, String repeat) { this.imageResource = imageResource; @@ -72,6 +72,7 @@ /** * Get the base image of this pattern + * * @return the base image of this pattern */ public Image getImageResource() { @@ -80,6 +81,7 @@ /** * Get the repeat style for this pattern + * * @return return the repeat style */ public String getRepeat() { @@ -88,6 +90,9 @@ } + /** + * An RGB color + */ public static final class Color extends Style { private String web; @@ -102,8 +107,8 @@ } /** - * - * + * + * * @return the Color value as a Web Color (e.g. #ff0000) */ public String getAsString() { @@ -112,8 +117,8 @@ } /** - * A Linear Gradient. The GRadient has a direction defined by two coordinates - * and stops defining the Color at a specific position. + * A Linear Gradient. The Gradient has a direction defined by two + * coordinates and stops defining the Color at a specific position. */ public static class LinearGradient extends Style { @@ -121,7 +126,7 @@ private double x0, y0, x1, y1; /** - * + * * @param x0 the x coordinate of the start point for this gradient * @param y0 the y coordinate of the start point for this gradient * @param x1 the x coordinate of the end point for this gradient @@ -135,10 +140,11 @@ } /** - * Add a new Color stop. A color stop defines a fixed color at a position - * along the coordinates. + * Add a new Color stop. A color stop defines a fixed color at a + * position along the coordinates. + * * @param position the position of this stop in percent [0.0-1.0] - * @param color A Color defined in web format (e.g. #ff0000) + * @param color A Color defined in web format (e.g. #ff0000) */ void addColorStop(double position, String color) { if (stops == null) { @@ -148,50 +154,91 @@ } /** - * Get the stops of this gradient. + * Get the stops of this gradient. + * * @return the stops of this gradient */ - public HashMap getStops(){ + public HashMap getStops() { return new HashMap<>(stops); } - + /** - * Set the stops as Position/Color pairs + * Set the stops as Position/Color pairs + * * @param stops the stops for thsi Gradient */ - public void setStops(HashMap stops) { + public void setStops(HashMap stops) { this.stops = new HashMap<>(stops); } - + /** + * Get the X coordinate of the Gradients start point + * + * @return x coordinate + */ public double getX0() { return x0; } + /** + * Set the X coordinate of the Gradients start point + * + * @param x0 x coordinate + */ public void setX0(double x0) { this.x0 = x0; } + /** + * Get the Y coordinate of the Gradients start point + * + * @return y coordinate + */ public double getY0() { return y0; } + /** + * Set the Y coordinate of the Gradients start point + * + * @param y0 y coordinate + */ public void setY0(double y0) { this.y0 = y0; } + /** + * Set the X coordinate of the Gradients end point + * + * @return x coordinate + */ public double getX1() { return x1; } + /** + * Set the X coordinate of the Gradients end point + * + * @param X coordinate + */ public void setX1(double x1) { this.x1 = x1; } + /** + * Get the Y coordinate of the Gradients end point + * + * @return y coordinate + */ public double getY1() { return y1; } + /** + * Set the Y coordinate of the Gradients end point + * + * @param y1 coordinate + */ public void setY1(double y1) { this.y1 = y1; } @@ -235,28 +282,59 @@ } } + /** + * A Radial Gradient. Radial gradients are defined with two imaginary + * circles, a starting circle and an ending circle. The gradient starts with + * the start circle and moves towards the end circle. + */ public static final class RadialGradient extends LinearGradient { private double r0, r1; + /** + * Create a new RadialGradient + * + * @param x0 x Coordinate of starting circle + * @param y0 y Coordinate of starting circle + * @param r0 radius of starting circle + * @param x1 x coordinate of ending circle + * @param y1 y coordinate of ending circle + * @param r1 radius of ending circle + */ RadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) { super(x0, y0, x1, y1); this.r0 = r0; this.r1 = r1; } + /** + * get the radius of the start circle. + * @return the radius + */ public double getR0() { return r0; } + /** + * set the radius of the start circle. + * @param r0 the radius + */ public void setR0(double r0) { this.r0 = r0; } + /** + * get the radius of the end circle + * @return the radius + */ public double getR1() { return r1; } + /** + * set the radius of the end circle. + * @param r1 the radius. + */ public void setR1(double r1) { this.r1 = r1; }