Class pwlib.tools.cbucket
The color bucket tool.
The implementation here is based on the seed fill algorithm of Paul S.
Heckbert (1990).
Defined in: cbucket.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
pwlib.tools.cbucket(app)
|
| Method Attributes | Method Name and Description |
|---|---|
|
activate()
The
activate event handler. |
|
|
click(ev)
The
click and contextmenu event handler. |
|
|
The
deactivate event handler. |
|
| <private> <inner> |
fill(x, y, pixelOld)
Fill the image with the current fill color, starting from the x
and y coordinates.
|
| <inner> |
pixelRead(x)
|
| <inner> |
pixelWrite(x)
|
|
The
preActivate event handler. |
|
| <inner> |
pushLine(y, xl, xr, dy)
|
Class Detail
pwlib.tools.cbucket(app)
- Parameters:
- {PaintWeb} app
- Reference to the main paint application object.
Method Detail
activate()
The
activate event handler. Canvas shadow rendering is
disabled.
{Boolean}
click(ev)
The
click and contextmenu event handler. This
method performs the flood fill operation.
- Parameters:
- {Event} ev
- The DOM Event object.
- Returns:
- {Boolean} True if the image was modified, or false otherwise.
deactivate()
The
deactivate event handler. Canvas shadow rendering is
allowed once again.
<private> <inner>
fill(x, y, pixelOld)
Fill the image with the current fill color, starting from the x
and y coordinates.
- Parameters:
- {Number} x
- The x coordinate for the starting point.
- {Number} y
- The y coordinate for the starting point.
- {String} pixelOld
- The old pixel value.
<inner>
pixelRead(x)
- Parameters:
- x
<inner>
pixelWrite(x)
- Parameters:
- x
{Boolean}
preActivate()
The
preActivate event handler. This method checks if the
browser implements the getImageData() and
putImageData() context methods. If not, the color bucket tool
cannot be used.
- Returns:
- {Boolean} True if the drawing tool can be activated, or false otherwise.
<inner>
pushLine(y, xl, xr, dy)
- Parameters:
- y
- xl
- xr
- dy