com.gargoylesoftware.htmlunit.javascript.host.canvas
Class CanvasRenderingContext2D

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.canvas.CanvasRenderingContext2D
All Implemented Interfaces:
Serializable, Cloneable, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class CanvasRenderingContext2D
extends SimpleScriptable

A JavaScript object for a CanvasRenderingContext2D.

Version:
$Revision: 8931 $
Author:
Ahmed Ashour, Marc Guillemot, Frank Danek
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
CanvasRenderingContext2D()
           
 
Method Summary
 void arc(double x, double y, double radius, double startAngle, double endAngle, boolean anticlockwise)
          Draws an arc.
 void arcTo(double x1, double y1, double x2, double y2, double radius)
          Draws an arc.
 void beginPath()
          Begins the subpaths.
 void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)
          Draws a cubic Bézier curve.
 void clearRect(double x, double y, double w, double h)
          Clears the specified rectangular area.
 void clip()
          Creates a new clipping region.
 void closePath()
          Closes the subpaths.
 void createImageData()
          Creates a new, blank ImageData object with the specified dimensions.
 void createLinearGradient(double x0, double y0, double r0, double x1, Object y1, Object r1)
          Creates linear gradient.
 void createPattern()
          Creates a pattern.
 void createRadialGradient()
          Creates a gradient.
static void drawImage(net.sourceforge.htmlunit.corejs.javascript.Context context, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, net.sourceforge.htmlunit.corejs.javascript.Function function)
          Draws images onto the canvas.
 void fill()
          Fills the shape.
 void fillRect(double x, double y, double w, double h)
          Paints the specified rectangular area.
 void fillText()
          Dummy placeholder.
 Object getFillStyle()
          Returns the "fillStyle" property.
 double getGlobalAlpha()
          Returns the "globalAlpha" property.
 void getImageData()
          Dummy placeholder.
 void getLineDash()
          Dummy placeholder.
 void getLineData()
          Dummy placeholder.
 double getLineWidth()
          Returns the "lineWidth" property.
 Object getStrokeStyle()
          Returns the "strokeStyle" property.
 void isPointInPath()
          Dummy placeholder.
 void lineTo(double x, double y)
          Connect the last point to the given point.
 void measureText()
          Dummy placeholder.
 void moveTo(double x, double y)
          Creates a new subpath.
 void putImageData()
          Dummy placeholder.
 void quadraticCurveTo(double controlPointX, double controlPointY, double endPointX, double endPointY)
          Draws a quadratic Bézier curve.
 void rect()
          Dummy placeholder.
 void restore()
          Pops state stack and restore state.
 void rotate()
          Dummy placeholder.
 void save()
          Pushes state on state stack.
 void scale(Object x, Object y)
          Changes the transformation matrix to apply a scaling transformation with the given characteristics.
 void setFillStyle(Object fillStyle)
          Sets the "fillStyle" property.
 void setGlobalAlpha(Object globalAlpha)
          Sets the "globalAlpha" property.
 void setLineDash()
          Dummy placeholder.
 void setLineWidth(Object lineWidth)
          Sets the "lineWidth" property.
 void setStrokeStyle(Object strokeStyle)
          Sets the "strokeStyle" property.
 void setTransform()
          Dummy placeholder.
 void stroke()
          Calculates the strokes of all the subpaths of the current path.
 void strokeRect(double x, double y, double w, double h)
          Strokes the specified rectangular area.
 void strokeText()
          Dummy placeholder.
 void transform()
          Dummy placeholder.
 void translate(Object x, Object y)
          Changes the transformation matrix to apply a translation transformation with the given characteristics.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElement, setParentScope
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setPrototype, size
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanvasRenderingContext2D

public CanvasRenderingContext2D()
Method Detail

getFillStyle

public Object getFillStyle()
Returns the "fillStyle" property.

Returns:
the "fillStyle" property

setFillStyle

public void setFillStyle(Object fillStyle)
Sets the "fillStyle" property.

Parameters:
fillStyle - the "fillStyle" property

getStrokeStyle

public Object getStrokeStyle()
Returns the "strokeStyle" property.

Returns:
the "strokeStyle" property

setStrokeStyle

public void setStrokeStyle(Object strokeStyle)
Sets the "strokeStyle" property.

Parameters:
strokeStyle - the "strokeStyle" property

getLineWidth

public double getLineWidth()
Returns the "lineWidth" property.

Returns:
the "lineWidth" property

setLineWidth

public void setLineWidth(Object lineWidth)
Sets the "lineWidth" property.

Parameters:
lineWidth - the "lineWidth" property

getGlobalAlpha

public double getGlobalAlpha()
Returns the "globalAlpha" property.

Returns:
the "globalAlpha" property

setGlobalAlpha

public void setGlobalAlpha(Object globalAlpha)
Sets the "globalAlpha" property.

Parameters:
globalAlpha - the "globalAlpha" property

arc

public void arc(double x,
                double y,
                double radius,
                double startAngle,
                double endAngle,
                boolean anticlockwise)
Draws an arc.

Parameters:
x - the x
y - the y
radius - the radius
startAngle - the start angle
endAngle - the end angle
anticlockwise - is anti-clockwise

arcTo

public void arcTo(double x1,
                  double y1,
                  double x2,
                  double y2,
                  double radius)
Draws an arc.

Parameters:
x1 - the x1
y1 - the y1
x2 - the x2
y2 - the y2
radius - the radius

beginPath

public void beginPath()
Begins the subpaths.


bezierCurveTo

public void bezierCurveTo(double cp1x,
                          double cp1y,
                          double cp2x,
                          double cp2y,
                          double x,
                          double y)
Draws a cubic Bézier curve.

Parameters:
cp1x - the cp1x
cp1y - the cp1y
cp2x - the cp2x
cp2y - the cp2y
x - the x
y - the y

clearRect

public void clearRect(double x,
                      double y,
                      double w,
                      double h)
Clears the specified rectangular area.

Parameters:
x - the x
y - the y
w - the width
h - the height

clip

public void clip()
Creates a new clipping region.


closePath

public void closePath()
Closes the subpaths.


createImageData

public void createImageData()
Creates a new, blank ImageData object with the specified dimensions.


createLinearGradient

public void createLinearGradient(double x0,
                                 double y0,
                                 double r0,
                                 double x1,
                                 Object y1,
                                 Object r1)
Creates linear gradient.

Parameters:
x0 - the x0
y0 - the y0
r0 - the r0
x1 - the x1
y1 - the y1
r1 - the r1

createPattern

public void createPattern()
Creates a pattern.


createRadialGradient

public void createRadialGradient()
Creates a gradient.


drawImage

public static void drawImage(net.sourceforge.htmlunit.corejs.javascript.Context context,
                             net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj,
                             Object[] args,
                             net.sourceforge.htmlunit.corejs.javascript.Function function)
Draws images onto the canvas.

Parameters:
context - the JavaScript context
thisObj - the scriptable
args - the arguments passed into the method
function - the function

fill

public void fill()
Fills the shape.


fillRect

public void fillRect(double x,
                     double y,
                     double w,
                     double h)
Paints the specified rectangular area.

Parameters:
x - the x
y - the y
w - the width
h - the height

fillText

public void fillText()
Dummy placeholder.


getImageData

public void getImageData()
Dummy placeholder.


getLineDash

public void getLineDash()
Dummy placeholder.


getLineData

public void getLineData()
Dummy placeholder.


isPointInPath

public void isPointInPath()
Dummy placeholder.


lineTo

public void lineTo(double x,
                   double y)
Connect the last point to the given point.

Parameters:
x - the x
y - the y

measureText

public void measureText()
Dummy placeholder.


moveTo

public void moveTo(double x,
                   double y)
Creates a new subpath.

Parameters:
x - the x
y - the y

putImageData

public void putImageData()
Dummy placeholder.


quadraticCurveTo

public void quadraticCurveTo(double controlPointX,
                             double controlPointY,
                             double endPointX,
                             double endPointY)
Draws a quadratic Bézier curve.

Parameters:
controlPointX - the x-coordinate of the control point
controlPointY - the y-coordinate of the control point
endPointX - the x-coordinate of the end point
endPointY - the y-coordinate of the end point

rect

public void rect()
Dummy placeholder.


restore

public void restore()
Pops state stack and restore state.


rotate

public void rotate()
Dummy placeholder.


save

public void save()
Pushes state on state stack.


scale

public void scale(Object x,
                  Object y)
Changes the transformation matrix to apply a scaling transformation with the given characteristics.

Parameters:
x - the scale factor in the horizontal direction
y - the scale factor in the vertical direction

setLineDash

public void setLineDash()
Dummy placeholder.


setTransform

public void setTransform()
Dummy placeholder.


stroke

public void stroke()
Calculates the strokes of all the subpaths of the current path.


strokeRect

public void strokeRect(double x,
                       double y,
                       double w,
                       double h)
Strokes the specified rectangular area.

Parameters:
x - the x
y - the y
w - the width
h - the height

strokeText

public void strokeText()
Dummy placeholder.


transform

public void transform()
Dummy placeholder.


translate

public void translate(Object x,
                      Object y)
Changes the transformation matrix to apply a translation transformation with the given characteristics.

Parameters:
x - the translation distance in the horizontal direction
y - the translation distance in the vertical direction


Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.