Package com.google.gwt.canvas.dom.client
Class Context2d
- java.lang.Object
 - 
- com.google.gwt.core.client.JavaScriptObject
 - 
- com.google.gwt.canvas.dom.client.Context2d
 
 
 
- 
- All Implemented Interfaces:
 Context
public class Context2d extends JavaScriptObject implements Context
Rendering interface used to draw on aCanvasElement.- See Also:
 - W3C HTML 5 Specification
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContext2d.CompositeEnum for composite style.static classContext2d.LineCapEnum for line-cap style.static classContext2d.LineJoinEnum for line-join style.static classContext2d.RepetitionEnum for the repetition values.static classContext2d.TextAlignEnum for text align style.static classContext2d.TextBaselineEnum for text baseline style. 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTEXT_IDSpecifies the context id property used in creating a Context. 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedContext2d() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidarc(double x, double y, double radius, double startAngle, double endAngle)Draws an arc.voidarc(double x, double y, double radius, double startAngle, double endAngle, boolean anticlockwise)Draws an arc.voidarcTo(double x1, double y1, double x2, double y2, double radius)Adds an arc to the current subpath, connecting it to the current point with a line segment.voidbeginPath()Begins a new path.voidbezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)Draws a cubic Bézier curve from the current point to the point (x, y), with control points (cp1x, cp1y) and (cp2x, cp2y).voidclearRect(double x, double y, double w, double h)Clears a rectangle.voidclip()Creates a new clipping region from the current path.voidclosePath()Closes the current path.ImageDatacreateImageData(int w, int h)Creates an image data object of the given size.ImageDatacreateImageData(ImageData imagedata)Creates an image data object of the same size as the given object.CanvasGradientcreateLinearGradient(double x0, double y0, double x1, double y1)Creates a linear gradient.CanvasPatterncreatePattern(CanvasElement image, Context2d.Repetition repetition)Creates a pattern from another canvas.CanvasPatterncreatePattern(CanvasElement image, java.lang.String repetition)Creates a pattern from another canvas.CanvasPatterncreatePattern(ImageElement image, Context2d.Repetition repetition)Creates a pattern from an image.CanvasPatterncreatePattern(ImageElement image, java.lang.String repetition)Creates a pattern from an image.CanvasGradientcreateRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1)Creates a radial gradient.voiddrawImage(CanvasElement image, double dx, double dy)Draws an image.voiddrawImage(CanvasElement image, double dx, double dy, double dw, double dh)Draws a scaled image.voiddrawImage(CanvasElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)Draws a scaled subset of an image.voiddrawImage(ImageElement image, double dx, double dy)Draws an image.voiddrawImage(ImageElement image, double dx, double dy, double dw, double dh)Draws a scaled image.voiddrawImage(ImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)Draws a scaled subset of an image.voiddrawImage(VideoElement image, double dx, double dy)Draws a video's current frame.voiddrawImage(VideoElement image, double dx, double dy, double dw, double dh)Draws a scaled video's current frame.voiddrawImage(VideoElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)Draws a scaled subset of a video's current frame.voidfill()Fills the current path.voidfillRect(double x, double y, double w, double h)Fills a rectangle.voidfillText(java.lang.String text, double x, double y)Draws filled text.voidfillText(java.lang.String text, double x, double y, double maxWidth)Draws filled text squeezed into the given max width.CanvasElementgetCanvas()Gets this context's canvas.FillStrokeStylegetFillStyle()Returns the context's fillStyle.java.lang.StringgetFont()Gets this context's font.doublegetGlobalAlpha()Gets the global alpha value.java.lang.StringgetGlobalCompositeOperation()Gets the global composite operation.ImageDatagetImageData(double sx, double sy, double sw, double sh)Returns an image data object for the screen area denoted by sx, sy, sw and sh.java.lang.StringgetLineCap()Gets the current line-cap style.java.lang.StringgetLineJoin()Gets the current line-join style.doublegetLineWidth()Gets the current line-width.doublegetMiterLimit()Gets the current miter-limit.doublegetShadowBlur()Gets the current shadow-blur.java.lang.StringgetShadowColor()Gets the current shadow color.doublegetShadowOffsetX()Gets the current x-shadow-offset.doublegetShadowOffsetY()Gets the current y-shadow-offset.FillStrokeStylegetStrokeStyle()Returns the context's strokeStyle.java.lang.StringgetTextAlign()Gets the current text align.java.lang.StringgetTextBaseline()Gets the current text baseline.booleanisPointInPath(double x, double y)Returns true if the given point is in the current path.voidlineTo(double x, double y)Adds a line from the current point to the point (x, y) to the current path.TextMetricsmeasureText(java.lang.String text)Returns the metrics for the given text.voidmoveTo(double x, double y)Terminates the current path and sets the current path position to the point (x, y).voidputImageData(ImageData imagedata, double x, double y)Draws the given image data at the given screen position.voidquadraticCurveTo(double cpx, double cpy, double x, double y)Draws a quadratic Bézier curve from the current point to the point (x, y), with control point (cpx, cpy).voidrect(double x, double y, double w, double h)Creates a new rectangular path.voidrestore()Restores the context's state.voidrotate(double angle)Applies rotation to the current transform.voidsave()Saves the context's state.voidscale(double x, double y)Applies scale to the current transform.voidsetFillStyle(FillStrokeStyle fillStyle)Sets the context's fillStyle.voidsetFillStyle(java.lang.String fillStyleColor)Convenience method to set the context's fillStyle to aCssColor, specified in String form.voidsetFont(java.lang.String f)Sets the font.voidsetGlobalAlpha(double alpha)Sets the global alpha value.voidsetGlobalCompositeOperation(Context2d.Composite composite)Sets the global composite operation.voidsetGlobalCompositeOperation(java.lang.String globalCompositeOperation)Sets the global composite operation.voidsetLineCap(Context2d.LineCap lineCap)Sets the line-cap style.voidsetLineCap(java.lang.String lineCap)Sets the line-cap style.voidsetLineJoin(Context2d.LineJoin lineJoin)Sets the line-join style.voidsetLineJoin(java.lang.String lineJoin)Sets the line-join style.voidsetLineWidth(double lineWidth)Sets the line-width.voidsetMiterLimit(double miterLimit)Sets the miter-limit.voidsetShadowBlur(double shadowBlur)Sets the shadow-blur.voidsetShadowColor(java.lang.String shadowColor)Sets the shadow-color.voidsetShadowOffsetX(double shadowOffsetX)Sets the x-shadow-offset.voidsetShadowOffsetY(double shadowOffsetY)Sets the y-shadow-offset.voidsetStrokeStyle(FillStrokeStyle strokeStyle)Sets the context's stroke style.voidsetStrokeStyle(java.lang.String strokeStyleColor)Convenience method to set the context's strokeStyle to aCssColor.voidsetTextAlign(Context2d.TextAlign align)Sets the text alignment.voidsetTextAlign(java.lang.String align)Sets the text alignment.voidsetTextBaseline(Context2d.TextBaseline baseline)Sets the text baseline.voidsetTextBaseline(java.lang.String baseline)Sets the text baseline.voidsetTransform(double m11, double m12, double m21, double m22, double dx, double dy)Sets the 2D transformation matrix.voidstroke()Draws the current path with the current stroke style.voidstrokeRect(double x, double y, double w, double h)Draws the outline of a rectangle with the current stroke style.voidstrokeText(java.lang.String text, double x, double y)Draws the text outline.voidstrokeText(java.lang.String text, double x, double y, double maxWidth)Draws the text outline, squeezing the text into the given max width by compressing the font.voidtransform(double m11, double m12, double m21, double m22, double dx, double dy)Multiplies the current transform by the given matrix.voidtranslate(double x, double y)Applies a translation to the current transform.- 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString 
 - 
 
 - 
 
- 
- 
Field Detail
- 
CONTEXT_ID
public static final java.lang.String CONTEXT_ID
Specifies the context id property used in creating a Context.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
arc
public final void arc(double x, double y, double radius, double startAngle, double endAngle)Draws an arc. If a current subpath exists, a line segment is added from the current point to the starting point of the arc. IfendAngle - startAngleis equal to or greater than2 * Math.Pi, the arc is the whole circumference of the circle.- Parameters:
 x- the x coordinate of the center of the arcy- the y coordinate of the center of the arcradius- the radius of the arcstartAngle- the start angle, measured in radians clockwise from the positive x-axisendAngle- the end angle, measured in radians clockwise from the positive x-axis
 
- 
arc
public final void arc(double x, double y, double radius, double startAngle, double endAngle, boolean anticlockwise)Draws an arc. If a current subpath exists, a line segment is added from the current point to the starting point of the arc. Ifanticlockwiseis false andendAngle - startAngleis equal to or greater than2 * Math.PI, or ifanticlockwiseistrueandstartAngle - endAngleis equal to or greater than2 * Math.PI, then the arc is the whole circumference of the circle.- Parameters:
 x- the x coordinate of the center of the arcy- the y coordinate of the center of the arcradius- the radius of the arcstartAngle- the start angle, measured in radians clockwise from the positive x-axisendAngle- the end angle, measured in radians clockwise from the positive x-axisanticlockwise- iftrue, the arc is drawn in an anticlockwise direction
 
- 
arcTo
public final void arcTo(double x1, double y1, double x2, double y2, double radius)Adds an arc to the current subpath, connecting it to the current point with a line segment.- Parameters:
 x1- the x coordinate of the starting point of the arcy1- the y coordinate of the starting point of the arcx2- the x coordinate of the ending point of the arcy2- the y coordinate of the ending point of the arcradius- the radius of a circle containing the arc
 
- 
beginPath
public final void beginPath()
Begins a new path. 
- 
bezierCurveTo
public final void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)Draws a cubic Bézier curve from the current point to the point (x, y), with control points (cp1x, cp1y) and (cp2x, cp2y).- Parameters:
 cp1x- the x coordinate of the first control pointcp1y- the y coordinate of the first control pointcp2x- the x coordinate of the second control pointcp2y- the y coordinate of the second control pointx- the x coordinate of the end pointy- the y coordinate of the end point
 
- 
clearRect
public final void clearRect(double x, double y, double w, double h)Clears a rectangle.- Parameters:
 x- the x coordinate of the rectangle's upper-left cornery- the y coordinate of the rectangle's upper-left cornerw- the width of the rectangleh- the height of the rectangle
 
- 
clip
public final void clip()
Creates a new clipping region from the current path. 
- 
closePath
public final void closePath()
Closes the current path. 
- 
createImageData
public final ImageData createImageData(ImageData imagedata)
Creates an image data object of the same size as the given object. 
- 
createImageData
public final ImageData createImageData(int w, int h)
Creates an image data object of the given size.- Parameters:
 w- the width of the imageh- the height of the image- Returns:
 - an 
ImageDataobject 
 
- 
createLinearGradient
public final CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1)
Creates a linear gradient.- Parameters:
 x0- the x coordinate of the starting point of the gradienty0- the y coordinate of the starting point of the gradientx1- the x coordinate of the ending point of the gradienty1- the y coordinate of the ending point of the gradient- Returns:
 - a 
CanvasGradientobject 
 
- 
createPattern
public final CanvasPattern createPattern(CanvasElement image, Context2d.Repetition repetition)
Creates a pattern from another canvas.- Parameters:
 image- anCanvasElementobjectrepetition- aContext2d.Repetitionobject- Returns:
 - a 
CanvasPatternobject 
 
- 
createPattern
public final CanvasPattern createPattern(CanvasElement image, java.lang.String repetition)
Creates a pattern from another canvas.- Parameters:
 image- anCanvasElementobjectrepetition- the repetition type as a String- Returns:
 - a 
CanvasPatternobject 
 
- 
createPattern
public final CanvasPattern createPattern(ImageElement image, Context2d.Repetition repetition)
Creates a pattern from an image.- Parameters:
 image- anImageElementobjectrepetition- aContext2d.Repetitionobject- Returns:
 - a 
CanvasPatternobject 
 
- 
createPattern
public final CanvasPattern createPattern(ImageElement image, java.lang.String repetition)
Creates a pattern from an image.- Parameters:
 image- anImageElementobjectrepetition- the repetition type as a String- Returns:
 - a 
CanvasPatternobject 
 
- 
createRadialGradient
public final CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1)
Creates a radial gradient.- Parameters:
 x0- the x coordinate of the center of the start circle of the gradienty0- the y coordinate of the center of the start circle of the gradientr0- the radius of the start circle of the gradientx1- the x coordinate of the center of the end circle of the gradienty1- the y coordinate of the center of the end circle of the gradientr1- the radius of the end circle of the gradient- Returns:
 - a 
CanvasGradientobject 
 
- 
drawImage
public final void drawImage(CanvasElement image, double dx, double dy)
Draws an image.- Parameters:
 image- anCanvasElementobjectdx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangle
 
- 
drawImage
public final void drawImage(CanvasElement image, double dx, double dy, double dw, double dh)
Draws a scaled image.- Parameters:
 image- anCanvasElementobjectdx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangledw- the width of the destination rectangledh- the height of the destination rectangle
 
- 
drawImage
public final void drawImage(CanvasElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
Draws a scaled subset of an image.- Parameters:
 image- anCanvasElementobjectsx- the x coordinate of the upper-left corner of the source rectanglesy- the y coordinate of the upper-left corner of the source rectanglesw- the width of the source rectanglesh- the width of the source rectangledx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangledw- the width of the destination rectangledh- the height of the destination rectangle
 
- 
drawImage
public final void drawImage(ImageElement image, double dx, double dy)
Draws an image.- Parameters:
 image- anImageElementobjectdx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangle
 
- 
drawImage
public final void drawImage(ImageElement image, double dx, double dy, double dw, double dh)
Draws a scaled image.- Parameters:
 image- anImageElementobjectdx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangledw- the width of the destination rectangledh- the height of the destination rectangle
 
- 
drawImage
public final void drawImage(ImageElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
Draws a scaled subset of an image.- Parameters:
 image- anImageElementobjectsx- the x coordinate of the upper-left corner of the source rectanglesy- the y coordinate of the upper-left corner of the source rectanglesw- the width of the source rectanglesh- the width of the source rectangledx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangledw- the width of the destination rectangledh- the height of the destination rectangle
 
- 
drawImage
public final void drawImage(VideoElement image, double dx, double dy)
Draws a video's current frame.- Parameters:
 image- aVideoElementobjectdx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangle
 
- 
drawImage
public final void drawImage(VideoElement image, double dx, double dy, double dw, double dh)
Draws a scaled video's current frame.- Parameters:
 image- aVideoElementobjectdx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangledw- the width of the destination rectangledh- the height of the destination rectangle
 
- 
drawImage
public final void drawImage(VideoElement image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
Draws a scaled subset of a video's current frame.- Parameters:
 image- aVideoElementobjectsx- the x coordinate of the upper-left corner of the source rectanglesy- the y coordinate of the upper-left corner of the source rectanglesw- the width of the source rectanglesh- the width of the source rectangledx- the x coordinate of the upper-left corner of the destination rectangledy- the y coordinate of the upper-left corner of the destination rectangledw- the width of the destination rectangledh- the height of the destination rectangle
 
- 
fill
public final void fill()
Fills the current path. 
- 
fillRect
public final void fillRect(double x, double y, double w, double h)Fills a rectangle.- Parameters:
 x- the x coordinate of the rectangle's upper-left cornery- the y coordinate of the rectangle's upper-left cornerw- the width of the rectangleh- the height of the rectangle
 
- 
fillText
public final void fillText(java.lang.String text, double x, double y)Draws filled text.- Parameters:
 text- the text as a Stringx- the x coordinate of the text positiony- the y coordinate of the text position
 
- 
fillText
public final void fillText(java.lang.String text, double x, double y, double maxWidth)Draws filled text squeezed into the given max width.- Parameters:
 text- the text as a Stringx- the x coordinate of the text positiony- the y coordinate of the text positionmaxWidth- the maximum width for the text
 
- 
getCanvas
public final CanvasElement getCanvas()
Gets this context's canvas.- Returns:
 - a 
CanvasElementobject 
 
- 
getFillStyle
public final FillStrokeStyle getFillStyle()
Returns the context's fillStyle. In dev mode, the returned object will be wrapped in a JavaScript array.- Returns:
 - a 
FillStrokeStyleobject - See Also:
 setFillStyle(FillStrokeStyle),setFillStyle(String),CssColor
 
- 
getFont
public final java.lang.String getFont()
Gets this context's font.- Returns:
 - the font name as a String
 - See Also:
 setFont(String)
 
- 
getGlobalAlpha
public final double getGlobalAlpha()
Gets the global alpha value.- Returns:
 - the global alpha value as a double
 - See Also:
 setGlobalAlpha(double)
 
- 
getGlobalCompositeOperation
public final java.lang.String getGlobalCompositeOperation()
Gets the global composite operation.- Returns:
 - the global composite operation as a String
 - See Also:
 setGlobalCompositeOperation(Composite),setGlobalCompositeOperation(String)
 
- 
getImageData
public final ImageData getImageData(double sx, double sy, double sw, double sh)
Returns an image data object for the screen area denoted by sx, sy, sw and sh.- Parameters:
 sx- the x coordinate of the upper-left corner of the desired areasy- the y coordinate of the upper-left corner of the desired areasw- the width of the desired areash- the height of the desired area- Returns:
 - an 
ImageDataobject containing screen pixel data 
 
- 
getLineCap
public final java.lang.String getLineCap()
Gets the current line-cap style.- Returns:
 - the line cap style as a String
 - See Also:
 setLineCap(LineCap),setLineCap(String)
 
- 
getLineJoin
public final java.lang.String getLineJoin()
Gets the current line-join style.- Returns:
 - the line join style as a String
 - See Also:
 setLineJoin(LineJoin),setLineJoin(String)
 
- 
getLineWidth
public final double getLineWidth()
Gets the current line-width.- Returns:
 - the line width as a double
 - See Also:
 setLineWidth(double)
 
- 
getMiterLimit
public final double getMiterLimit()
Gets the current miter-limit.- Returns:
 - the miter limit as a double
 - See Also:
 setMiterLimit(double)
 
- 
getShadowBlur
public final double getShadowBlur()
Gets the current shadow-blur.- Returns:
 - the shadow blur amount as a double
 - See Also:
 setShadowBlur(double)
 
- 
getShadowColor
public final java.lang.String getShadowColor()
Gets the current shadow color.- Returns:
 - the shadow color as a String
 - See Also:
 setShadowColor(String)
 
- 
getShadowOffsetX
public final double getShadowOffsetX()
Gets the current x-shadow-offset.- Returns:
 - the shadow x offset as a double
 - See Also:
 setShadowOffsetX(double),getShadowOffsetY()
 
- 
getShadowOffsetY
public final double getShadowOffsetY()
Gets the current y-shadow-offset.- Returns:
 - the shadow y offset as a double
 - See Also:
 setShadowOffsetY(double),getShadowOffsetX()
 
- 
getStrokeStyle
public final FillStrokeStyle getStrokeStyle()
Returns the context's strokeStyle. In dev mode, the returned object will be wrapped in a JavaScript array.- Returns:
 - the stroke style as a 
FillStrokeStyleobject - See Also:
 setStrokeStyle(FillStrokeStyle),setStrokeStyle(String),CssColor
 
- 
getTextAlign
public final java.lang.String getTextAlign()
Gets the current text align.- Returns:
 - the text align as a String
 - See Also:
 setTextAlign(TextAlign),setTextAlign(String)
 
- 
getTextBaseline
public final java.lang.String getTextBaseline()
Gets the current text baseline.- Returns:
 - the text baseline as a String
 - See Also:
 setTextBaseline(TextBaseline),setTextBaseline(String)
 
- 
isPointInPath
public final boolean isPointInPath(double x, double y)Returns true if the given point is in the current path.- Parameters:
 x- the x coordinate of the point to test.y- the y coordinate of the point to test.- Returns:
 trueif the given point is in the current path.
 
- 
lineTo
public final void lineTo(double x, double y)Adds a line from the current point to the point (x, y) to the current path.- Parameters:
 x- the x coordinate of the line endpointy- the y coordinate of the line endpoint
 
- 
measureText
public final TextMetrics measureText(java.lang.String text)
Returns the metrics for the given text.- Parameters:
 text- the text to measure, as a String- Returns:
 - a 
TextMetricsobject 
 
- 
moveTo
public final void moveTo(double x, double y)Terminates the current path and sets the current path position to the point (x, y).- Parameters:
 x- the x coordinate of the new positiony- the y coordinate of the new position
 
- 
putImageData
public final void putImageData(ImageData imagedata, double x, double y)
Draws the given image data at the given screen position.- Parameters:
 imagedata- anImageDatainstance to be written to the screenx- the x coordinate of the upper-left corner at which to drawy- the y coordinate of the upper-left corner at which to draw
 
- 
quadraticCurveTo
public final void quadraticCurveTo(double cpx, double cpy, double x, double y)Draws a quadratic Bézier curve from the current point to the point (x, y), with control point (cpx, cpy).- Parameters:
 cpx- the x coordinate of the control pointcpy- the y coordinate of the control pointx- the x coordinate of the end pointy- the y coordinate of the end point
 
- 
rect
public final void rect(double x, double y, double w, double h)Creates a new rectangular path.- Parameters:
 x- the x coordinate of the rectangle's upper-left cornery- the y coordinate of the rectangle's upper-left cornerw- the width of the rectangleh- the height of the rectangle
 
- 
restore
public final void restore()
Restores the context's state. 
- 
rotate
public final void rotate(double angle)
Applies rotation to the current transform.- Parameters:
 angle- the clockwise rotation angle, in radians
 
- 
save
public final void save()
Saves the context's state. 
- 
scale
public final void scale(double x, double y)Applies scale to the current transform.- Parameters:
 x- the scale factor along the x-axisy- the scale factor along the y-axis
 
- 
setFillStyle
public final void setFillStyle(FillStrokeStyle fillStyle)
Sets the context's fillStyle.- Parameters:
 fillStyle- the fill style to set.- See Also:
 getFillStyle(),CssColor
 
- 
setFillStyle
public final void setFillStyle(java.lang.String fillStyleColor)
Convenience method to set the context's fillStyle to aCssColor, specified in String form.- Parameters:
 fillStyleColor- the color as a String- See Also:
 getFillStyle()
 
- 
setFont
public final void setFont(java.lang.String f)
Sets the font.- Parameters:
 f- the font name as a String- See Also:
 getFont()
 
- 
setGlobalAlpha
public final void setGlobalAlpha(double alpha)
Sets the global alpha value.- Parameters:
 alpha- the global alpha value as a double- See Also:
 getGlobalAlpha()
 
- 
setGlobalCompositeOperation
public final void setGlobalCompositeOperation(Context2d.Composite composite)
Sets the global composite operation.- Parameters:
 composite- aContext2d.Compositevalue- See Also:
 getGlobalCompositeOperation()
 
- 
setGlobalCompositeOperation
public final void setGlobalCompositeOperation(java.lang.String globalCompositeOperation)
Sets the global composite operation.- Parameters:
 globalCompositeOperation- the operation as a String- See Also:
 getGlobalCompositeOperation()
 
- 
setLineCap
public final void setLineCap(Context2d.LineCap lineCap)
Sets the line-cap style.- Parameters:
 lineCap- the line cap style as aContext2d.LineCapvalue- See Also:
 getLineCap()
 
- 
setLineCap
public final void setLineCap(java.lang.String lineCap)
Sets the line-cap style.- Parameters:
 lineCap- the line cap style as a String- See Also:
 getLineCap()
 
- 
setLineJoin
public final void setLineJoin(Context2d.LineJoin lineJoin)
Sets the line-join style.- Parameters:
 lineJoin- the line join style as aContext2d.LineJoinvalue- See Also:
 getLineJoin()
 
- 
setLineJoin
public final void setLineJoin(java.lang.String lineJoin)
Sets the line-join style.- Parameters:
 lineJoin- the ling join style as a String- See Also:
 getLineJoin()
 
- 
setLineWidth
public final void setLineWidth(double lineWidth)
Sets the line-width.- Parameters:
 lineWidth- the line width as a double- See Also:
 getMiterLimit(),getLineWidth()
 
- 
setMiterLimit
public final void setMiterLimit(double miterLimit)
Sets the miter-limit.- Parameters:
 miterLimit- the miter limit as a double- See Also:
 getMiterLimit()
 
- 
setShadowBlur
public final void setShadowBlur(double shadowBlur)
Sets the shadow-blur.- Parameters:
 shadowBlur- the amount of blur as a double- See Also:
 getShadowBlur()
 
- 
setShadowColor
public final void setShadowColor(java.lang.String shadowColor)
Sets the shadow-color.- Parameters:
 shadowColor- the shadow color as a String- See Also:
 getShadowColor()
 
- 
setShadowOffsetX
public final void setShadowOffsetX(double shadowOffsetX)
Sets the x-shadow-offset.- Parameters:
 shadowOffsetX- the x shadow offset- See Also:
 getShadowOffsetX(),getShadowOffsetY()
 
- 
setShadowOffsetY
public final void setShadowOffsetY(double shadowOffsetY)
Sets the y-shadow-offset.- Parameters:
 shadowOffsetY- the y shadow offset- See Also:
 getShadowOffsetX(),getShadowOffsetY()
 
- 
setStrokeStyle
public final void setStrokeStyle(FillStrokeStyle strokeStyle)
Sets the context's stroke style.- Parameters:
 strokeStyle- the stroke style to set- See Also:
 getStrokeStyle(),CssColor
 
- 
setStrokeStyle
public final void setStrokeStyle(java.lang.String strokeStyleColor)
Convenience method to set the context's strokeStyle to aCssColor.- Parameters:
 strokeStyleColor- the stroke color as a String- See Also:
 getStrokeStyle()
 
- 
setTextAlign
public final void setTextAlign(java.lang.String align)
Sets the text alignment.- Parameters:
 align- the alignment setting as a String- See Also:
 getTextAlign()
 
- 
setTextAlign
public final void setTextAlign(Context2d.TextAlign align)
Sets the text alignment.- Parameters:
 align- the alignment setting as aContext2d.TextAlignvalue- See Also:
 getTextAlign()
 
- 
setTextBaseline
public final void setTextBaseline(java.lang.String baseline)
Sets the text baseline.- Parameters:
 baseline- the baseline setting as a String- See Also:
 getTextBaseline()
 
- 
setTextBaseline
public final void setTextBaseline(Context2d.TextBaseline baseline)
Sets the text baseline.- Parameters:
 baseline- a the baseline setting as aContext2d.TextBaselinevalue- See Also:
 getTextBaseline()
 
- 
setTransform
public final void setTransform(double m11, double m12, double m21, double m22, double dx, double dy)Sets the 2D transformation matrix.- Parameters:
 m11- the value at position (1, 1) of the matrixm12- the value at position (1, 2) of the matrixm21- the value at position (2, 1) of the matrixm22- the value at position (2, 2) of the matrixdx- the x translation valuedy- the y translation value
 
- 
stroke
public final void stroke()
Draws the current path with the current stroke style. 
- 
strokeRect
public final void strokeRect(double x, double y, double w, double h)Draws the outline of a rectangle with the current stroke style.- Parameters:
 x- the x coordinate of the rectangle's upper-left cornery- the y coordinate of the rectangle's upper-left cornerw- the width of the rectangleh- the height of the rectangle
 
- 
strokeText
public final void strokeText(java.lang.String text, double x, double y)Draws the text outline.- Parameters:
 text- the text as a Stringx- the x coordinate of the text positiony- the y coordinate of the text position
 
- 
strokeText
public final void strokeText(java.lang.String text, double x, double y, double maxWidth)Draws the text outline, squeezing the text into the given max width by compressing the font.- Parameters:
 text- the text as a Stringx- the x coordinate of the text positiony- the y coordinate of the text positionmaxWidth- the maximum width for the text
 
- 
transform
public final void transform(double m11, double m12, double m21, double m22, double dx, double dy)Multiplies the current transform by the given matrix.- Parameters:
 m11- the value at position (1, 1) of the matrixm12- the value at position (1, 2) of the matrixm21- the value at position (2, 1) of the matrixm22- the value at position (2, 2) of the matrixdx- the x translation valuedy- the y translation value
 
- 
translate
public final void translate(double x, double y)Applies a translation to the current transform.- Parameters:
 x- the amount of translation along the x-axisy- the amount of translation along the y-axis
 
 - 
 
 -