/** * 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)); }
/** * Convenience method to set the context's strokeStyle to a {@link CssColor}. * * @param strokeStyleColor the stroke color as a String * @see #getStrokeStyle() */ public final void setStrokeStyle(String strokeStyleColor) { setStrokeStyle(CssColor.make(strokeStyleColor)); }
/** * 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()); }
/** * 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()); }
/** * Sets the text baseline. * * @param baseline a the baseline setting as a {@link TextBaseline} value * @see #getTextBaseline() */ public final void setTextBaseline(TextBaseline baseline) { setTextBaseline(baseline.getValue()); }
/** * 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()); }
/** * Sets the global composite operation. * * @param composite a {@link Composite} value * @see #getGlobalCompositeOperation() */ public final void setGlobalCompositeOperation(Composite composite) { setGlobalCompositeOperation(composite.getValue()); }
/** * Sets the text alignment. * * @param align the alignment setting as a {@link TextAlign} value * @see #getTextAlign() */ public final void setTextAlign(TextAlign align) { setTextAlign(align.getValue()); }
/** * Sets the context's fillStyle. * * @param fillStyle the fill style to set. * @see #getFillStyle() * @see CssColor */ public final void setFillStyle(FillStrokeStyle fillStyle) { if (GWT.isScript()) { setFillStyleWeb(fillStyle); } else { setFillStyleDev(fillStyle); } }
/** * Sets the context's stroke style. * * @param strokeStyle the stroke style to set * @see #getStrokeStyle() * @see CssColor */ public final void setStrokeStyle(FillStrokeStyle strokeStyle) { if (GWT.isScript()) { setStrokeStyleWeb(strokeStyle); } else { setStrokeStyleDev(strokeStyle); } }
/** * Sets the RGB color value. * * @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 + ")"); }
/** * Sets the blue value at position (x,y). * * @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); }
/** * Returns the red value at position (x,y). * * @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 * @see #setRedAt(int, int, int) * @see #getColorAt(int, int, int) */ public final int getRedAt(int x, int y) { return getColorAt(x, y, OFFSET_RED); }
/** * 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()); }
/** * Sets the green value at position (x,y). * * @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); }
/** * Returns the alpha value at position (x,y). * * @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 * @see #setAlphaAt(int, int, int) * @see #getColorAt(int, int, int) */ public final int getAlphaAt(int x, int y) { return getColorAt(x, y, OFFSET_ALPHA); }
/** * Sets the red value at position (x,y). * * @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); }
/** * Returns the blue value at position (x,y). * * @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 * @see #setBlueAt(int, int, int) * @see #getColorAt(int, int, int) */ public final int getBlueAt(int x, int y) { return getColorAt(x, y, OFFSET_BLUE); }
/** * Sets the alpha value at position (x,y). * * @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); }
/** * Returns the green value at position (x,y). * * @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 * @see #setGreenAt(int, int, int) * @see #getColorAt(int, int, int) */ public final int getGreenAt(int x, int y) { return getColorAt(x, y, OFFSET_GREEN); }