public class CanvasRenderingContext2D extends SimpleScriptable
CanvasRenderingContext2D
.Constructor and Description |
---|
CanvasRenderingContext2D()
Default constructor.
|
CanvasRenderingContext2D(HTMLCanvasElement canvas)
Constructs in association with
HTMLCanvasElement . |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
drawImage(Object image,
int sx,
int sy,
Object sWidth,
Object sHeight,
Object dx,
Object dy,
Object dWidth,
Object dHeight)
Draws images onto the canvas.
|
void |
ellipse(double x,
double y,
double radiusX,
double radiusY,
double rotation,
double startAngle,
double endAngle,
boolean anticlockwise)
Paints the specified ellipse.
|
void |
fill()
Fills the shape.
|
void |
fillRect(int x,
int y,
int w,
int h)
Paints the specified rectangular area.
|
void |
fillText()
Dummy placeholder.
|
HTMLCanvasElement |
getCanvas()
Returns the associated
HTMLCanvasElement . |
Object |
getFillStyle()
Returns the "fillStyle" property.
|
double |
getGlobalAlpha()
Returns the "globalAlpha" property.
|
ImageData |
getImageData(int sx,
int sy,
int sw,
int sh)
Returns the
ImageData object. |
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(String 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.
|
String |
toDataURL(String type)
Returns the Data URL.
|
void |
transform()
Dummy placeholder.
|
void |
translate(Object x,
Object y)
Changes the transformation matrix to apply a translation transformation with the given characteristics.
|
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setClassName, setDomNode, setDomNode, setHtmlElement, setParentScope
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, getExternalArrayData, getExternalArrayLength, 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, setExternalArrayData, setGetterOrSetter, setPrototype, size
public CanvasRenderingContext2D()
public CanvasRenderingContext2D(HTMLCanvasElement canvas)
HTMLCanvasElement
.canvas
- the HTMLCanvasElement
public Object getFillStyle()
public void setFillStyle(String fillStyle)
fillStyle
- the "fillStyle" propertypublic Object getStrokeStyle()
public void setStrokeStyle(Object strokeStyle)
strokeStyle
- the "strokeStyle" propertypublic double getLineWidth()
public void setLineWidth(Object lineWidth)
lineWidth
- the "lineWidth" propertypublic double getGlobalAlpha()
public void setGlobalAlpha(Object globalAlpha)
globalAlpha
- the "globalAlpha" propertypublic void arc(double x, double y, double radius, double startAngle, double endAngle, boolean anticlockwise)
x
- the xy
- the yradius
- the radiusstartAngle
- the start angleendAngle
- the end angleanticlockwise
- is anti-clockwisepublic void arcTo(double x1, double y1, double x2, double y2, double radius)
x1
- the x1y1
- the y1x2
- the x2y2
- the y2radius
- the radiuspublic void beginPath()
public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)
cp1x
- the cp1xcp1y
- the cp1ycp2x
- the cp2xcp2y
- the cp2yx
- the xy
- the ypublic void clearRect(double x, double y, double w, double h)
x
- the xy
- the yw
- the widthh
- the heightpublic void clip()
public void closePath()
public void createImageData()
public void createLinearGradient(double x0, double y0, double r0, double x1, Object y1, Object r1)
x0
- the x0y0
- the y0r0
- the r0x1
- the x1y1
- the y1r1
- the r1public void createPattern()
public void createRadialGradient()
public void drawImage(Object image, int sx, int sy, Object sWidth, Object sHeight, Object dx, Object dy, Object dWidth, Object dHeight)
image
- an element to draw into the contextsx
- the X coordinate of the top left corner of the sub-rectangle of the source image
to draw into the destination contextsy
- the Y coordinate of the top left corner of the sub-rectangle of the source image
to draw into the destination contextsWidth
- the width of the sub-rectangle of the source image to draw into the destination contextsHeight
- the height of the sub-rectangle of the source image to draw into the destination contextdx
- the X coordinate in the destination canvas at which to place the top-left corner of the source imagedy
- the Y coordinate in the destination canvas at which to place the top-left corner of the source imagedWidth
- the width to draw the image in the destination canvas. This allows scaling of the drawn imagedHeight
- the height to draw the image in the destination canvas. This allows scaling of the drawn imagepublic String toDataURL(String type)
type
- an optional typepublic void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, boolean anticlockwise)
x
- the xy
- the yradiusX
- the radiusXradiusY
- the radiusYrotation
- the rotationstartAngle
- the startAngleendAngle
- the endAngleanticlockwise
- the anticlockwisepublic void fill()
public void fillRect(int x, int y, int w, int h)
x
- the xy
- the yw
- the widthh
- the heightpublic void fillText()
public ImageData getImageData(int sx, int sy, int sw, int sh)
ImageData
object.sx
- xsy
- ysw
- widthsh
- heightImageData
objectpublic void getLineDash()
public void getLineData()
public void isPointInPath()
public void lineTo(double x, double y)
x
- the xy
- the ypublic void measureText()
public void moveTo(double x, double y)
x
- the xy
- the ypublic void putImageData()
public void quadraticCurveTo(double controlPointX, double controlPointY, double endPointX, double endPointY)
controlPointX
- the x-coordinate of the control pointcontrolPointY
- the y-coordinate of the control pointendPointX
- the x-coordinate of the end pointendPointY
- the y-coordinate of the end pointpublic void rect()
public void restore()
public void rotate()
public void save()
public void scale(Object x, Object y)
x
- the scale factor in the horizontal directiony
- the scale factor in the vertical directionpublic void setLineDash()
public void setTransform()
public void stroke()
public void strokeRect(double x, double y, double w, double h)
x
- the xy
- the yw
- the widthh
- the heightpublic void strokeText()
public void transform()
public void translate(Object x, Object y)
x
- the translation distance in the horizontal directiony
- the translation distance in the vertical directionpublic HTMLCanvasElement getCanvas()
HTMLCanvasElement
.HTMLCanvasElement
Copyright © 2002–2015 Gargoyle Software Inc.. All rights reserved.