PCanvasHTML class

Inheritance

Constructors

PCanvasHTML(int width, int height, PCanvasPainter painter, {PCanvasPixels? initialPixels})

Properties

area num
The area of this dimension.
no setterinherited
asPCanvas PCanvas
Returns this instance casted to PCanvas if it's possible.
no setteroverride
asPCanvasElement PCanvasElement?
Returns this instance casted to PCanvasElement if it's possible.
no setteroverride
aspectRation double
The aspect ration of this dimension (width / height).
no setterinherited
boundingBox PRectangle
The bounding box of this element container.
no setteroverride
canvasNative CanvasElement
The native canvas of this instance implementation.
no setteroverride
center Point
The center point of this dimension.
no setterinherited
clip PRectangle?
Returns the current drawing clip.
getter/setter pairoverride
cursor PCanvasCursor
The PCanvas cursor.
getter/setter pairinherited
devicePixelRatio num
The pixels ratio of the device of the canvasNative.
no setteroverride
dimension PDimension
The dimension of this canvas.
no setterinherited
elementDimension PDimension
The dimension of the visual element of this canvas.
no setterinherited
elementHeight num
The height of the visual element. See elementDimension.
no setteroverride
elements UnmodifiableListView<PCanvasElement>
All the PCanvasElements of this instance.
no setterinherited
elementsLength int
Returns elements length.
no setterinherited
elementWidth num
The width of the visual element. See elementDimension.
no setteroverride
hasElements bool
Returns true if this instances has elements.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
height num
The pixels height of this canvas.
no setteroverride
info Map<String, Object?>
PCanvas information.
no setterinherited
isPaintRequested bool
Returns true if requestRepaint was called and not processed yet.
no setteroverride
isZeroDimension bool
Returns true if the area of this dimension is zero.
no setterinherited
onPaint Stream<PCanvas>
no setterinherited
painter PCanvasPainter
The painter of this canvas.
final
pCanvas PCanvas
Returns the root PCanvas.
no setteroverride
pixelRatio num
The current pixel ration of this canvas. See devicePixelRatio.
getter/setter pairoverride
pixels PCanvasPixels
Returns the pixels of this canvas. See PCanvasPixels.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PCanvasState
The current drawing state.
no setterinherited
stateExtra PCanvasStateExtra
The platform specific extra states.
no setteroverride
subClip PRectangle?
Sets clip merging the coordinates of clip2 with the previous clip.
no getteroverride
subTransform PcanvasTransform
Sets transform to a sub-transformation, merging the current transform with transform2.
no getterinherited
transform PcanvasTransform
The current transformation of the canvas operation.
getter/setter pairinherited
width num
The pixels width of this canvas.
no setteroverride

Methods

addAllElements(Iterable<PCanvasElement> elements) → void
Adds all the entries in elements to this instances.
inherited
addElement(PCanvasElement element) → void
Adds an element to this instances.
inherited
angleToRadians(num angle) double
Converts angle in degrees to arcs.
inherited
callPainter() FutureOr<bool>
Calls the painter, forcing a render operation.
inherited
callWithGuardedState<R>(R call()) → R
Executes call preserving the internal drawing state.
inherited
callWithGuardedStateAsync<R>(FutureOr<R> call()) FutureOr<R>
Executes call preserving the internal drawing state, accepting Future as return value.
inherited
canvasPoint(Point p) Point
inherited
canvasX(num x) num
inherited
canvasXD(num x) double
inherited
canvasY(num y) num
inherited
canvasYD(num y) double
inherited
centered(void paint(PCanvas pCanvas, Point point, PDimension size), {num? x, num? y, Point? point, PDimension? area, num? width, num? height, PDimension? dimension, PDimension sizer()?, double? scale}) → void
A helper funtion to center draw operations.
inherited
checkDimension() → void
Checks if the canvas dimension has changed.
override
checkImageLoaded(PCanvasImage image) → void
Checks if image is already loaded.
inherited
clear({PStyle? style}) → void
Clears the canvas.
override
clearElements() → void
Clears the elements of this instance.
inherited
clearRect(num x, num y, num width, num height, {PStyle? style}) → void
Clears a part of the canvas.
override
createCanvasImage(Object source, {int? width, int? height}) PCanvasImage
Creates a PCanvasImage instance compatible to this canvas and its painter.
override
dispatchOnClick(PCanvasClickEvent event) PCanvasClickEvent
Processes event and calls onClick on clicked elements.
inherited
dispatchOnClickDown(PCanvasClickEvent event) PCanvasClickEvent
Processes event and calls onClickDown on clicked elements.
inherited
dispatchOnClickMove(PCanvasClickEvent event) PCanvasClickEvent
Processes event and calls onClickMove on clicked elements.
inherited
dispatchOnClickUp(PCanvasClickEvent event) PCanvasClickEvent
Processes event and calls onClickUp on clicked elements.
inherited
dispatchOnKey(PCanvasKeyEvent event) PCanvasKeyEvent
Processes event and calls onKey on elements.
inherited
dispatchOnKeyDown(PCanvasKeyEvent event) PCanvasKeyEvent
Processes event and calls onKeyDown on elements.
inherited
dispatchOnKeyUp(PCanvasKeyEvent event) PCanvasKeyEvent
Processes event and calls onKeyUp on elements.
inherited
drawImage(PCanvasImage image, num x, num y) → void
Draw an image at (x,y) using the original dimension of the image.
override
drawImageArea(PCanvasImage image, int srcX, int srcY, int srcWidth, int srcHeight, num dstX, num dstY, num dstWidth, num dstHeight) → void
Draw an image part (srcX,srcY , srcWidth x srcHeight) to a destiny area (dstX,dstY , dstWidth x dstHeight).
override
drawImageFitted(PCanvasImage image, num dstX, num dstY, num dstWidth, num dstHeight) → void
Draw an image fitting a destiny area (dstX,dstY , dstWidth x dstHeight).
inherited
drawImageScaled(PCanvasImage image, num x, num y, num width, num height) → void
Draw an image at (x,y) scaling it to the dimension width x height.
override
drawText(String text, num x, num y, PFont font, PStyle style) → void
Draw a text at position (x,y).
override
fillBottomUpGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void
Fill a rectangle (x,y , width x height) with a bottom up linear gradient. See fillTopDownGradient.
inherited
fillCircle(num x, num y, num radius, PStyle style, {num startAngle = 0, num endAngle = 360}) → void
Fill a circle at (x,y) with radius.
override
fillLeftRightGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void
Fill a rectangle (x,y , width x height) with a left right linear gradient. See fillRightLeftGradient.
override
fillPath(List path, PStyle style, {bool closePath = false}) → void
Fill a path of points.
override
fillRect(num x, num y, num width, num height, PStyle style) → void
Fill a rectangle (x,y , width x height).
override
fillRightLeftGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void
Fill a rectangle (x,y , width x height) with a right left linear gradient. See fillLeftRightGradient.
inherited
fillTopDownGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void
Fill a rectangle (x,y , width x height) with a top down linear gradient. See fillBottomUpGradient.
override
getCursor() PCanvasCursor
Returns the PCanvas cursor.
override
getElement(int index) PCanvasElement
Returns the element at elements index.
inherited
log(Object? o) → void
Logs a debugging message.
override
measureText(String text, PFont font, {num? pixelRatio}) PTextMetric
Measure the text dimension.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onPosPaint() → void
override
onPrePaint() → void
inherited
preventEventDefault(PCanvasEvent event) bool
Prevents PCanvasEvent.nativeEvent default behavior.
override
refresh() Future<bool>
Refreshes the canvas asynchronously.
inherited
removeAllElements(Iterable<PCanvasElement> elements) → void
Removes all entries in elements from this instances.
inherited
removeElement(PCanvasElement element) bool
Removes element from this instance.
inherited
requestRepaint() Future<bool>
Requests a refresh (repaint).
override
requestRepaintDelayed(Duration delay) Future<bool>
Same as requestRepaint but ensures a delay before refresh.
override
restoreState({PCanvasState? expectedState}) PCanvasState?
Restores the drawing state.
override
saveState() PCanvasState
Saves the drawing state (PCanvasState).
inherited
selectElementAtPoint<T extends PCanvasElement>(Point point, {bool recursive = false}) List<T>
inherited
selectElementByID<T extends PCanvasElement>(String? id, {bool recursive = false}) List<T>
Returns a list of PCanvasElement of type T with a matching id.
inherited
selectElementByType<T extends PCanvasElement>({bool recursive = false}) List<T>
Returns a list of PCanvasElement of type T.
inherited
selectElementWhere<T extends PCanvasElement>(bool selector(T elem), {bool recursive = false}) List<T>
Returns a list of PCanvasElement of type T filtered by selector.
inherited
setClip(num x, num y, num width, num height) → void
Sets the drawing clip.
inherited
setCursor(PCanvasCursor cursor) → void
Sets the PCanvas cursor.
override
setPixels(PCanvasPixels pixels, {int x = 0, int y = 0, int? width, int? height}) → void
Sets the canvas pixels.
override
setSubClip(num x, num y, num width, num height) → void
Sets clip merging the passed coordinates with the previous clip.
inherited
strokeCircle(num x, num y, num radius, PStyle style, {num startAngle = 0, num endAngle = 360}) → void
Stroke a circle at (x,y) with radius.
override
strokePath(List path, PStyle style, {bool closePath = false}) → void
Stroke a path of points.
override
strokeRect(num x, num y, num width, num height, PStyle style) → void
Stroke a rectangle (x,y , width x height).
override
toDataUrl() String
Returns a data URI containing the canvas data in PNG format. See toPNG.
override
toInnerClickEvent(PCanvasClickEvent event, {PCanvasElement? targetElement, PCanvas? pCanvas}) PCanvasClickEvent
Returns an event translated to the internal coordinates of this element.
override
toPNG() Future<Uint8List>
Returns the pixels of this as a PNG data.
override
toString() String
A string representation of this object.
override
waitLoading() FutureOr<bool>
Waits the loading of the canvas and also the painter.loadResources.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited