From 740634d0f30a3b76e9da166ac2fa8835fcc073ab Mon Sep 17 00:00:00 2001
From: Justin Novosad When authors use the canvas
element, they must also provide content that, when
presented to the user, conveys essentially the same function or purpose as the
- canvas
' bitmap. This content may be placed as content of the canvas
+ canvas
's bitmap. This content may be placed as content of the canvas
element. The contents of the canvas
element, if any, are the element's fallback
content.canvas
also has a canvas context mode, which is initially none but can be changed to either direct-2d, direct-webgl, indirect, or proxied by algorithms defined in this specification.
When its canvas context mode is none, a canvas
element has no rendering context,
@@ -59575,11 +59570,9 @@ callback BlobCallback = void (Blob? blob);
data-x="attr-canvas-height">height content attributes are set, removed, changed, or
redundantly set to the value they already have, if the canvas context mode is direct-2d, the user agent must set bitmap dimensions to the numeric values of
- the width
and 2d, the user agent must set bitmap dimensions to the numeric values
+ of the
width
and height
content attributes.
The width
and height
IDL attributes must reflect the
@@ -59609,11 +59602,6 @@ callback BlobCallback = void (Blob? blob);
data-x="canvas-context-2d">2d" context after getting a "webgl
" context).
Throws an InvalidStateError
exception if the setContext()
or transferControlToProxy()
methods have been
- used.
probablySupportsContext
(contextId [, ... ] )Throws an InvalidStateError
exception if the setContext()
or transferControlToProxy()
methods have been
- used.
setContext
(context)Sets the canvas
' rendering context to the given object.
Throws an InvalidStateError
exception if the getContext()
or transferControlToProxy()
methods have been
- used.
There are two ways for a canvas
element to acquire a rendering context: the
- canvas
element can provide one via the getContext()
method, and one can be assigned to it via the
- setContext()
method. In addition, the whole issue of a
- rendering context can be taken out of the canvas
element's hands and passed to a
- CanvasProxy
object, which itself can then be assigned a rendering context using its
- setContext()
method.
These three methods are mutually exclusive; calling any of the three makes the other two start
- throwing InvalidStateError
exceptions when called.
Each rendering context has a context bitmap - mode, which is one of fixed, unbound, or bound. - Initially, rendering contexts must be in the unbound - mode.
- -The getContext(contextId, arguments...)
method of the canvas
element, when invoked,
must run the steps in the cell of the following table whose column header describes the
- canvas
element's canvas context mode
- and whose row header describes the method's first argument.
canvas
element's canvas context
+ mode and whose row header describes the method's first argument.
none - | direct-2d - | direct-webgl - | indirect - | proxied + | 2d + | webgl | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
"2d "
@@ -59691,23 +59640,17 @@ callback BlobCallback = void (Blob? blob);
Follow the 2D
context creation algorithm defined in the section below, passing it the
- canvas element and the method's arguments..., to obtain a CanvasRenderingContext2D object;
- if this does not throw an exception, then
+ canvas element and the method's arguments..., to obtain a
+ CanvasRenderingContext2D object; if this does not throw an exception, then
set the canvas element's context
- mode to direct-2d, set
- the CanvasRenderingContext2D object's context bitmap mode to
- fixed, and return the
- CanvasRenderingContext2D object
+ mode to 2d, and return the
+ CanvasRenderingContext2D object.
| Return the same object as was return the last time the method was invoked with this same first argument. | Return null. - |
- Throw an InvalidStateError exception.
- |
- Throw an InvalidStateError exception.
| ||||||||
"webgl ", if the user agent supports the WebGL feature in its current configuration
@@ -59715,12 +59658,9 @@ callback BlobCallback = void (Blob? blob);
Follow the instructions given in the WebGL specification's Context Creation section to
obtain either a WebGLRenderingContext or null; if the returned value is null,
- then return null and abort these steps, otherwise, set the canvas element's context mode to direct-webgl, set the new
- WebGLRenderingContext object's context bitmap mode to fixed, and return the WebGLRenderingContext
+ then return null and abort these steps, otherwise, set the canvas element's
+ context mode to webgl, and return the WebGLRenderingContext
object
@@ -59728,10 +59668,6 @@ callback BlobCallback = void (Blob? blob);
|
Return the same object as was return the last time the method was invoked with this same
first argument.
- |
- Throw an | InvalidStateError exception.
-
- Throw an | InvalidStateError exception.
A vendor-specific extension*
@@ -59741,10 +59677,6 @@ callback BlobCallback = void (Blob? blob);
Behave as defined for the extension.
|
Behave as defined for the extension.
- |
- Throw an | InvalidStateError exception.
-
- Throw an | InvalidStateError exception.
An unsupported value†
@@ -59754,10 +59686,6 @@ callback BlobCallback = void (Blob? blob);
Return null.
|
Return null.
- |
- Throw an | InvalidStateError exception.
-
- Throw an | InvalidStateError exception.
|
The setContext(context)
method of the canvas
element, when invoked, must
- run the following steps:
If the canvas
element's canvas
- context mode is neither none nor indirect, throw an InvalidStateError
- exception and abort these steps.
If context's context
- bitmap mode is fixed, then throw an
- InvalidStateError
exception and abort these steps.
If context's context - bitmap mode is bound, then run context's unbinding steps and - set its context's context - bitmap mode to unbound.
Run context's binding
- steps to bind it to this canvas
element.
Set the canvas
element's context
- mode to indirect and the context's context bitmap
- mode to bound.
Since DOM nodes cannot be accessed across worker boundaries, a proxy object is needed to enable
- workers to render to canvas
elements in Document
s.
[Exposed=(Window,Worker)] -interface CanvasProxy { - void setContext(RenderingContext context); -};- -
transferControlToProxy
()Returns a CanvasProxy
object that can be used to transfer control for this
- canvas over to another document (e.g. an iframe
from another origin)
- or to a worker.
Throws an InvalidStateError
exception if the getContext()
or setContext()
methods have been used.
setContext
(context)Sets the CanvasProxy
object's canvas
element's rendering context to
- the given object.
Throws an InvalidStateError
exception if the CanvasProxy
has been
- transferred.
The transferControlToProxy()
- method of the canvas
element, when invoked, must run the following steps:
If the canvas
element's canvas
- context mode is not none, throw an
- InvalidStateError
exception and abort these steps.
Set the canvas
element's context
- mode to proxied.
Return a CanvasProxy
object bound to this canvas
- element.
Each CanvasProxy
object has a [[Detached]] internal slot (like any
- transferable object).
Each CanvasProxy
object can be disabled, meaning it can no longer be bound to
- rendering contexts. When first created, a CanvasProxy
object must not be disabled.
A CanvasProxy
is created with a link to a canvas
element. A
- CanvasProxy
object that has not been disabled must have a strong reference to its canvas
- element.
The setContext(context)
method of CanvasProxy
objects, when invoked,
- must run the following steps:
If the CanvasProxy
object has been disabled, throw an InvalidStateError
- exception and abort these steps.
Set CanvasProxy
object's [[Detached]] internal slot value to
- true.
If context's context
- bitmap mode is fixed, then throw an
- InvalidStateError
exception and abort these steps.
If context's context - bitmap mode is bound, then run context's unbinding steps and - set its context's context - bitmap mode to unbound.
Run context's binding
- steps to bind it to this CanvasProxy
object's canvas
- element.
Set the context's context bitmap mode to bound.
Each CanvasProxy
object's [[Transfer]]
- internal method, given a targetRealm, must run these steps:
Let new be a new CanvasProxy
object in targetRealm,
- linked to the same canvas
element as this.
Set this's [[Detached]] internal slot value to true.
Disable this.
Return new.
Here is a clock implemented on a worker. First, the main page:
- -<!DOCTYPE HTML> -<title>Clock</title> -<canvas></canvas> -<script> - var canvas = document.getElementsByTagName('canvas')[0]; - var proxy = canvas.transferControlToProxy(); - var worker = new Worker('clock.js'); - worker.postMessage(proxy, [proxy]); -</script>- -
Second, the worker:
- -onmessage = function (event) { - var context = new CanvasRenderingContext2D(); - event.data.setContext(context); // event.data is the CanvasProxy object - setInterval(function () { - context.clearRect(0, 0, context.width, context.height); - context.fillText(new Date(), 0, 100); - context.commit(); - }, 1000); -};- -
CanvasRenderingContext2D
( [ width, height ] )Returns an unbound CanvasRenderingContext2D
object with an implied bitmap with
- the given dimensions in CSS pixels (300x150, if the arguments are omitted).
canvas
Returns the canvas
element, if the rendering context was obtained using the
- getContext()
method.
Returns the canvas
element.
Return the dimensions of the bitmap, in CSS pixels.
-Can be set, to update the bitmap's dimensions. If the rendering context is bound to a canvas, - this will also update the canvas' intrinsic dimensions.
- - - -commit
()If the rendering context is bound to a canvas
, display the current frame.
Can be set, to update the bitmap's dimensions. This will also update the canvas's + intrinsic dimensions.
A CanvasRenderingContext2D
object can be obtained in two ways: the getContext()
method on a canvas
element (which
- invokes the 2D context creation algorithm), and the CanvasRenderingContext2D()
constructor.
A CanvasRenderingContext2D
object has a scratch bitmap and can be bound
- to an output bitmap. These are initialised when the object is created, and can be
- subsequently adjusted when the rendering context is bound or unbound. In some cases, these bitmaps are the same
- underlying bitmap. In general, the scratch bitmap is what scripts interact with, and
- the output bitmap is what is being displayed. These bitmaps always have the same
- dimensions.
A CanvasRenderingContext2D
object has an output bitmap that
+ is initialised when the object is created.
Each such bitmap has an origin-clean flag, - which can be set to true or false. Initially, when one of these bitmaps is created, its The output bitmap has an origin-clean flag, which can be set to true or false. + Initially, when one of these bitmaps is created, its origin-clean flag must be set to true.
-These bitmaps also have a hit region list, which is described in a later section. - Initially, this list is empty.
- -Scratch bitmaps have a - list of pending interface actions, which can contain instructions to draw the user's - attention to a location on the bitmap, and instructions to scroll to a location on the bitmap. - Initially, this list is also empty.
- -Scratch bitmaps also have an alpha flag, which can be set to true or false. Initially, when - one of these bitmaps is created, its alpha flag must be - set to true. When a scratch bitmap has its alpha flag set to false, then its alpha channel must be fixed - to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must - be silently ignored.
- -Thus, such a bitmap starts off as fully-opaque black instead of fully-transparent
- black; clearRect()
always results in fully-opaque
- black pixels, every fourth byte from The
CanvasRenderingContext2D
object also has a hit region list,
+ which is described in a later section. Initially, this list is empty.
The CanvasRenderingContext2D
object also has an alpha flag, which can be set to true or false. Initially,
+ when the context is created, its alpha flag must be
+ set to true. When a CanvasRenderingContext2D
object has its alpha flag set to false, then its alpha channel must be
+ fixed to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any
+ pixel must be silently ignored.
Thus, the bitmap of such a context starts off as fully-opaque black instead of
+ fully-transparent black; clearRect()
always
+ results in fully-opaque black pixels, every fourth byte from getImageData()
is always 255, the putImageData()
method effectively ignores every fourth
- byte in its input, and so on. However, the alpha component of styles and images drawn onto the
- canvas are still honoured up to the point where they would impact the scratch
+ data-x="dom-context-2d-putImageData">putImageData() method effectively ignores every
+ fourth byte in its input, and so on. However, the alpha component of styles and images drawn
+ onto the canvas are still honoured up to the point where they would impact the output
bitmap's alpha channel; for instance, drawing a 50% transparent white square on a freshly
- created scratch bitmap with its alpha flag
- set to false will result in a fully-opaque gray square.
The size of the coordinate space does not necessarily represent the size of the actual bitmaps that the user agent will use internally or during rendering. On high-definition displays, for @@ -60508,7 +60207,8 @@ interface Path2D {
The 2D context creation algorithm, which is passed a target (a
- canvas
element) and optionally some arguments, consists of running the following steps:
canvas
element) and optionally some arguments, consists of running the following
+ steps:
Initialise its canvas
attribute to point to
target.
Let the new CanvasRenderingContext2D
object's output bitmap and
- scratch bitmap both be the same bitmap as target's bitmap (so
- that they are shared).
Let the new CanvasRenderingContext2D
object's output bitmap be
+ the same bitmap as target's bitmap (so that they are shared).
Set bitmap dimensions to the
numeric values of target's width
and
@@ -60552,35 +60251,6 @@ interface Path2D {
The CanvasRenderingContext2D()
constructor, when
- invoked, must run the following steps:
Create a new CanvasRenderingContext2D
object.
Initialise its canvas
attribute to
- null.
Let the new CanvasRenderingContext2D
object's scratch bitmap be
- a new bitmap.
If the constructor was called with arguments, let width and height be the first and second arguments, respectively. Otherwise, let width and height be 300 and 150, respectively.
Set bitmap dimensions to width and height.
Let the new CanvasRenderingContext2D
object have no output
- bitmap.
Return the new CanvasRenderingContext2D
object.
When a user agent is required to coerce context arguments for 2D, it must run the @@ -60604,111 +60274,6 @@ interface Path2D {
When the user agent is required to commit the scratch bitmap for a rendering - context, it must run the following steps: - -
Let bitmap copy be a copy of the rendering context's scratch - bitmap.
Let origin-clean flag copy be a copy of the rendering context's - scratch bitmap's origin-clean - flag.
Let hit region list copy be a copy of the rendering context's - scratch bitmap's hit region list.
Let list of pending interface actions copy be a copy of the rendering - context's scratch bitmap's list of pending interface actions.
Empty the scratch bitmap's list of pending interface actions.
If the rendering context has no output bitmap, abort these steps.
Let output bitmap be the rendering context's output - bitmap.
Let canvas be the canvas
element to which the rendering
- context was most recently bound.
Queue a task associated with canvas' Document
- to perform the following substeps:
Overwrite output bitmap with bitmap - copy.
Overwrite output bitmap's origin-clean flag with origin-clean - flag copy.
Overwrite output bitmap's hit region list with hit region list copy.
Follow the directions in the list of pending interface actions - copy.
The algorithm above must use the canvas updating task source (which is just used by - this algorithm).
- - - -The commit()
method must run the
- following steps:
If the rendering context's context bitmap
- mode is fixed, throw an
- InvalidStateError
exception and abort these steps.
Commit the scratch bitmap for the rendering context.
The scratch bitmap is only committed when the commit()
method is
- called. (This doesn't matter for canvas
elements in direct-2d mode, since there the scratch
- bitmap is also the canvas
element's bitmap so every drawing operation is
- immediately drawn.)
When the user agent is to set bitmap dimensions to width and height, it must run the following steps:
@@ -60717,43 +60282,23 @@ interface Path2D {Reset the rendering context to its default state.
Clear the scratch bitmap's hit region list and its list of - pending interface actions.
Resize the scratch bitmap to the new width and height and clear it to fully transparent black.
Clear the rendering context's hit region list.
If the rendering context has an output bitmap, and the scratch - bitmap is a different bitmap than the output bitmap, then resize the - output bitmap to the new width and height +
Resize the output bitmap to the new width and height and clear it to fully transparent black.
If the rendering context's context bitmap - mode is fixed, then run these substeps:
- -Let canvas be the canvas
element to which the rendering
- context's canvas
attribute was initialised.
If the rendering context's context
- bitmap mode is fixed and the numeric value of
- the canvas' width
content attribute
- differs from width, then set canvas' width
content attribute to the shortest possible string
- representing width as a valid non-negative integer.
If the rendering context's context
- bitmap mode is fixed and the numeric value of
- the canvas' height
content attribute
- differs from height, then set canvas' height
content attribute to the shortest possible string
- representing height as a valid non-negative integer.
Let canvas be the canvas
element to which the rendering
+ context's canvas
attribute was initialised.
If the numeric value of canvas's width
+ content attribute differs from width, then set canvas's width
content attribute to the shortest possible string
+ representing width as a valid non-negative integer.
If the numeric value of canvas's height
+ content attribute differs from height, then set canvas's height
content attribute to the shortest possible string
+ representing height as a valid non-negative integer.
Reset the rendering context to its default state.
Clear the scratch bitmap's hit region list and its list of - pending interface actions.
Clear the CanvasRenderingContext2D
object's hit region
+ list.
Clear the CanvasRenderingContext2D
object's scratch bitmap to a
+
Clear the CanvasRenderingContext2D
object's output bitmap to a
transparent black.
Set the Set the CanvasRenderingContext2D
object's scratch bitmap's CanvasRenderingContext2D
object's origin-clean flag to true.
Reset the rendering context to its default state.
Clear the scratch bitmap's hit region list and its list of - pending interface actions.
Clear the CanvasRenderingContext2D
object's hit region
+ list.
Resize the CanvasRenderingContext2D
object's scratch bitmap to
- the dimensions of target's bitmap and clear it to fully transparent
- black.
Resize the CanvasRenderingContext2D
object's output bitmap to
+ the dimensions of target's bitmap and clear it to fully transparent black.
Set the Set the CanvasRenderingContext2D
object's scratch bitmap's CanvasRenderingContext2D
object's origin-clean flag to true.
The width
attribute, on getting, must
- return the width of the rendering context's scratch bitmap, in CSS pixels. On
+ return the width of the rendering context's output bitmap, in CSS pixels. On
setting, it must set bitmap dimensions
- to the new value and the current height of the rendering context's scratch bitmap in
+ to the new value and the current height of the rendering context's output bitmap in
CSS pixels, respectively.
The height
attribute, on getting, must
- return the height of the rendering context's scratch bitmap, in CSS pixels. On
+ return the height of the rendering context's output bitmap, in CSS pixels. On
setting, it must set bitmap dimensions
- to the current width of the rendering context's scratch bitmap in CSS pixels and the
+ to the current width of the rendering context's output bitmap in CSS pixels and the
new value, respectively.
canvas
- element is being renderedcanvas
element is being renderedThe "computed value of the 'color' property" for the purposes of determining
the computed value of the currentColor
keyword is the
computed value of the 'color' property on the canvas
element at the
- time that the colour is specified (e.g. when the appropriate attribute is set, or when the method
- is called; not when the colour is rendered or otherwise used).
canvas
element is not being renderedThe "computed value of the 'color' property" for the purposes of determining
the computed value of the currentColor
keyword is fully
@@ -60944,19 +60487,12 @@ context.fillRect(100,0,50,50); // only this square remains
-
Although the way the specification is written it might sound like an implementation needs to
- track up to four bitmaps per canvas or rendering context — one scratch bitmap,
- one output bitmap for the rendering context, one bitmap for the canvas
,
- and one bitmap for the actually currently rendered image — user agents can in fact generally
- optimise this to only one or two.
The scratch bitmap, when it isn't the same bitmap as the output
- bitmap, is only directly observable if it is read, and therefore implementations can,
- instead of updating this bitmap, merely remember the sequence of drawing operations that have been
- applied to it until such time as the bitmap's actual data is needed (for example because of a call
- to commit()
, drawImage()
, or the createImageBitmap()
- factory method). In many cases, this will be more memory efficient.
The output bitmap, when it is not directly displayed by the user agent,
+ implementations can, instead of updating this bitmap, merely remember the sequence of drawing
+ operations that have been applied to it until such time as the bitmap's actual data is needed
+ (for example because of a call to drawImage()
, or
+ the createImageBitmap()
factory method). In many
+ cases, this will be more memory efficient.
The bitmap of a canvas
element is the one bitmap that's pretty much always going
to be needed in practice. The output bitmap of a rendering context, when it has one,
@@ -60964,11 +60500,8 @@ context.fillRect(100,0,50,50); // only this square remains
Additional bitmaps are sometimes needed, e.g. to enable fast drawing when the canvas is being painted at a different size than its intrinsic size, - or to enable double buffering so that the rendering commands from the scratch bitmap - can be applied without the rendering being updated midway.
- - - + or to enable double buffering so that graphics updates, like page scrolling for example, can be + processed concurrently while canvas draw commands are being executed.Objects that implement the CanvasTextDrawingStyles
interface have attributes
(defined in this section) that control how text is laid out (rasterised or outlined) by the
object. Such objects can also have a font style source object. For
- CanvasRenderingContext2D
objects whose context bitmap mode is fixed, this is their canvas
element; for other
- CanvasRenderingContext2D
objects, if the object lives in a window, the object's
- font style source object is the
- Window
object's newest Document
object; otherwise the object
- lives in a worker and the font style source object is the worker.
CanvasRenderingContext2D
objects, this is the canvas
element
+ referenced by the context's canvas property.
+
+
The font
IDL attribute, on setting, must
be parsed as a CSS <'font'> value (but without supporting property-independent
@@ -62928,8 +62459,9 @@ try {
When a CanvasImageSource
object represents an HTMLCanvasElement
, the
element's bitmap must be used as the source image.
When a CanvasImageSource
object represents a CanvasRenderingContext2D
, the
- object's scratch bitmap must be used as the source image.
When a CanvasImageSource
object represents a
+ CanvasRenderingContext2D
, the object's output bitmap must be used as
+ the source image.
When a CanvasImageSource
object represents an element that is being
rendered and that element has been resized, the original image data of the source image
@@ -62947,7 +62479,7 @@ try {
the same as the origin specified by the entry
settings object, or if it is an HTMLCanvasElement
whose bitmap's origin-clean flag is false, or if it is a
- CanvasRenderingContext2D
object whose scratch bitmap's CanvasRenderingContext2D object whose origin-clean flag is false.
CanvasPattern
object that is marked as not origin-clean, then the scratch
- bitmap's origin-clean flag must be set to
- false.
+ data-x="concept-canvas-pattern-not-origin-clean">not origin-clean, then the
+ CanvasRenderingContext2D
's origin-clean flag must be set to false.
@@ -63401,7 +62933,7 @@ try {
previous image.
Clear regions that cover the pixels in pixels on the - scratch bitmap.
If the text preparation algorithm used a font that has an origin that is not the same as the origin specified by the entry settings object (even if "using a font" means just checking if that font - has a particular glyph in it before falling back to another font), then set the scratch - bitmap's origin-clean flag to - false.
Optionally, run the appropriate step from the following list:
- -CanvasRenderingContext2D
object's context bitmap mode is fixedInform the user that the focus is at the location given by the - intended path. User agents may wait until the next time the event loop reaches its - update the rendering step to optionally inform the user.
Add instructions to the scratch bitmap's list of pending interface - actions that inform the user that the focus is at the location of - the bitmap given by the intended path.
Inform the user that the focus is at the location given by the + intended path. User agents may wait until the next time the event loop reaches its + update the rendering step to optionally inform the user.
The scrollPathIntoView()
- method, when invoked, if the CanvasRenderingContext2D
object's context bitmap mode is fixed, must run the following steps; and otherwise, must add
- instructions to the scratch bitmap's list of pending interface actions
- that run the following steps:
Optionally, inform the user that the caret or selection (or both)
- cover the specified rectangle of the canvas. If the
- CanvasRenderingContext2D
object's context bitmap mode was fixed when the method was invoked, the user agent may wait
- until the next time the event loop reaches its update the rendering step to
+ cover the specified rectangle of the canvas. The user agent may wait until the next
+ time the event loop reaches its update the rendering step to
optionally inform the user.
If not specified, the dw and dh arguments must default to the values of sw and sh, interpreted such that one CSS pixel in the image is treated as - one unit in the scratch bitmap's coordinate space. If the sx, + one unit in the output bitmap's coordinate space. If the sx, sy, sw, and sh arguments are omitted, they must default to 0, 0, the image's intrinsic width in image pixels, and the image's intrinsic height in image pixels, respectively. If the image has no intrinsic @@ -64270,7 +63776,7 @@ v6DVT (also check for '- -' bits in the part above) --> the CSS "Concrete Object Size Resolution" algorithm, with the specified size having neither a definite width nor height, nor any additional constraints, the object's intrinsic properties being those of the image - argument, and the default object size being the size of the scratch + argument, and the default object size being the size of the output bitmap.
The source rectangle is the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), @@ -64283,9 +63789,9 @@ v6DVT (also check for '- -' bits in the part above) --> to the source image and the destination rectangle must be clipped in the same proportion.
When the destination rectangle is outside the destination image (the - scratch bitmap), the pixels that land outside the scratch bitmap are + output bitmap), the pixels that land outside the output bitmap are discarded, as if the destination was an infinite canvas whose rendering was clipped to the - dimensions of the scratch bitmap.
+ dimensions of the output bitmap. @@ -64295,7 +63801,7 @@ v6DVT (also check for '- -' bits in the part above) -->Paint the region of the image argument specified by the source rectangle - on the region of the rendering context's scratch bitmap specified by the + on the region of the rendering context's output bitmap specified by the destination rectangle, after applying the current transformation matrix to the destination rectangle.
@@ -64319,7 +63825,7 @@ v6DVT (also check for '- -' bits in the part above) -->When a canvas
or CanvasRenderingContext2D
object is
drawn onto itself, the drawing model requires the source to be copied before the
- image is drawn, so it is possible to copy parts of a canvas
or scratch
+ image is drawn, so it is possible to copy parts of a canvas
or output
bitmap onto overlapping parts of itself.
If the original image data is a bitmap image, the value painted at a point in the destination @@ -64350,8 +63856,8 @@ v6DVT (also check for '- -' bits in the part above) -->
If the image argument is not origin-clean, set the - scratch bitmap's origin-clean flag - to false.
CanvasRenderingContext2D
's origin-clean flag to false.
@@ -64660,8 +64166,7 @@ v6DVT (also check for '- -' bits in the part above) -->
Adding a new region and calling clearRect()
are the two ways this clearing algorithm can
be invoked. The hit region list itself is also reset when the rendering context is
- reset, e.g. when a CanvasRenderingContext2D
object is bound to or unbound from a
- canvas
, or when the dimensions of the bitmap are changed.
If the arguments object's id
member is not null, then let previous
region for this ID be the region identified by the ID given by the id
member's value in this scratch bitmap, if
- any. If the id
member is null or no such region
- currently exists, let previous region for this ID be null.
CanvasRenderingContext2D
, if any. If the id
member is null or no such region currently exists, let previous region for this ID be null.
If the arguments object's parentID
member is the empty string, let it be null
@@ -64758,10 +64263,10 @@ v6DVT (also check for '- -' bits in the part above) -->
If the arguments object's parentID
member is not null, then let parent region be the region identified by the ID given by the parentID
member's value in the scratch
- bitmap, if any. If the parentID
member
- is null or no such region currently exists, let parent region be
- null.
CanvasRenderingContext2D
, if any. If the parentID
member is null or no such region
+ currently exists, let parent region be null.
If the arguments object's label
member is the empty string, let it be null
@@ -64928,19 +64433,20 @@ v6DVT (also check for '- -' bits in the part above) -->
If there is a previous region with this ID, remove it, and all hit regions for which it is an ancestor region, from the - scratch bitmap's hit region list; then, if it had a parent region, decrement that hit region's child count by - one.
CanvasRenderingContext2D
's hit region list; then, if it had a parent region, decrement that hit region's child
+ count by one.
If there is a parent region, increment its hit region's child count by one.
Clear regions that cover the pixels in region's set of pixels on this scratch - bitmap.
CanvasRenderingContext2D
.
+
- Add region to the scratch bitmap's element's hit - region list.
Add region to the CanvasRenderingContext2D
's hit region
+ list.
Let region be the region identified by the ID given by the - method's argument in the rendering context's scratch bitmap. If no such region - currently exists, abort these steps.
+ method's argument in theCanvasRenderingContext2D
's hit region list.
+ If no such region currently exists, abort these steps.
If the method's argument is the empty string, then no region will match.
Remove region, and all hit regions for - which it is an ancestor region, from the rendering context's scratch - bitmap's hit region list; then, if it had a parent region, decrement that hit region's child count by - one.
CanvasRenderingContext2D
's
+ hit region list; then, if it had a parent
+ region, decrement that hit region's child count by one.
+
- Garbage-collect the regions of the rendering context's scratch - bitmap.
Garbage-collect the regions of the
+ CanvasRenderingContext2D
.
When the clearHitRegions()
- method is invoked, the user agent must remove all the hit regions
- from the rendering context's scratch bitmap's hit region list.
CanvasRenderingContext2D
's hit region list.
IndexSizeError
exception; otherwise,
- if the scratch bitmap's origin-clean
- flag is set to false, it must throw a SecurityError
exception;
+ if the CanvasRenderingContext2D
's origin-clean flag is set to false, it must throw a
+ SecurityError
exception;
otherwise, it must create an ImageData
object, with parameter
pixelsPerRow set to sw, and parameter rows set to sh.
Set the pixel values of the image data of the newly created ImageData
object to
- represent the scratch bitmap for the area of that bitmap denoted by the rectangle
+ represent the output bitmap for the area of that bitmap denoted by the rectangle
whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx,
sy+sh), in the bitmap's coordinate space units.
- Pixels outside the scratch bitmap must be set to transparent black. Pixel values
+ Pixels outside the output bitmap must be set to transparent black. Pixel values
must not be premultiplied by alpha.
When the user agent is required to create an ImageData
object, given
@@ -65434,8 +64941,9 @@ partial dictionary MouseEventInit {
component.
The putImageData()
method writes
- data from ImageData
structures back to the rendering context's scratch
- bitmap. Its arguments are: imagedata, dx, dy, dirtyX, dirtyY, dirtyWidth, and dirtyHeight.
ImageData
structures back to the rendering context's output
+ bitmap. Its arguments are: imagedata, dx, dy,
+ dirtyX, dirtyY, dirtyWidth, and dirtyHeight.
When the last four arguments to this method are omitted, they must be assumed to have the
values 0, 0, the width
member of the imagedata structure, and the height
@@ -65499,7 +65007,7 @@ partial dictionary MouseEventInit {
the imagedata data structure's Canvas Pixel
ArrayBuffer
to the pixel with coordinate (dx+x, dy+y)
- in the rendering context's scratch bitmap.
The globalAlpha
attribute gives an
- alpha value that is applied to shapes and images before they are composited onto the scratch
- bitmap. The value must be in the range from 0.0 (fully transparent) to 1.0 (no additional
- transparency). If an attempt is made to set the attribute to a value outside this range, including
- Infinity and Not-a-Number (NaN) values, the attribute must retain its previous value. When the
- context is created, the globalAlpha
attribute must
- initially have the value 1.0.
globalAlpha
attribute must initially have the value
+ 1.0.
The globalCompositeOperation
attribute
sets the current composition operator, which controls how shapes and images are drawn onto the
- scratch bitmap, once they have had output bitmap
globalAlpha
and the current transformation matrix
applied. The possible values are those defined in the Compositing and Blending specification, and
include the values
When shadows are drawn, multiply the alpha component of every pixel in B by globalAlpha
.
When shadows are drawn, composite B within the
- clipping region over the current scratch bitmap using the current
+ clipping region over the current output bitmap using the current
composition operator.
Multiply the alpha component of every pixel in A by globalAlpha
.
Composite A within the clipping region over the current
- scratch bitmap using the current composition operator.
+ output bitmap using the current composition operator.
- When compositing onto the scratch bitmap, pixels that would fall outside of the
- scratch bitmap must be discarded.
+ When compositing onto the output bitmap, pixels that would fall outside of the
+ output bitmap must be discarded.
@@ -90802,21 +90311,21 @@ interface ImageBitmapFactories {
If either the sw or sh arguments are specified
but zero, return a promise rejected with an IndexSizeError
exception and abort these steps.
- If the CanvasRenderingContext2D
object's scratch bitmap has
- either a horizontal dimension or a vertical dimension equal to zero, then return a promise rejected with an
- InvalidStateError
exception and abort these steps.
+ If the CanvasRenderingContext2D
object's output bitmap has
+ either a horizontal dimension or a vertical dimension equal to zero, then return a promise
+ rejected with an InvalidStateError
exception and abort these steps.
Create a new ImageBitmap
object.
Let the ImageBitmap
object's bitmap data be a copy of the
- CanvasRenderingContext2D
object's scratch bitmap, cropped to
+ CanvasRenderingContext2D
object's output bitmap, cropped to
the source rectangle with formatting.
Set the origin-clean flag of the
ImageBitmap
object's bitmap to the same value as the origin-clean flag of the
- CanvasRenderingContext2D
object's scratch bitmap
+ CanvasRenderingContext2D
object.
Return a new promise, but continue running these steps
in parallel.
@@ -107704,8 +107213,8 @@ br[clear=all i], br[clear=both i] { clear: both; }
described in the non-normative note to this effect in CSS2.1.
The initial value for the 'color' property is expected to be black. The initial value for the
- 'background-color' property is expected to be 'transparent'. The canvas' background is expected to
- be white.
+ 'background-color' property is expected to be 'transparent'. The canvas's background is expected
+ to be white.