PCanvas class abstract
Portable Canvas.
- Mixed-in types
- Implementers
Constructors
- PCanvas(int width, int height, PCanvasPainter painter, {PCanvasPixels? initialPixels})
- 
          
            factory
- PCanvas.impl()
Properties
- area → num
- 
  The area of this dimension.
  no setterinherited
- asPCanvas → PCanvas?
- 
  Returns this instance casted to PCanvas if it's possible.
  no setterinherited
- asPCanvasElement → PCanvasElement?
- 
  Returns this instance casted to PCanvasElement if it's possible.
  no setterinherited
- aspectRation → double
- 
  The aspect ration of this dimension (width / height).
  no setterinherited
- boundingBox → PRectangle
- 
  The bounding box of this element container.
  no setterinherited
- canvasNative → dynamic
- 
  The native canvas of this instance implementation.
  no setter
- center → Point
- 
  The center pointof this dimension.no setterinherited
- clip ↔ PRectangle?
- 
  Returns the current drawing clip.
  getter/setter pair
- cursor ↔ PCanvasCursor
- 
  The PCanvas cursor.
  getter/setter pair
- devicePixelRatio → num
- 
  The pixels ratio of the device of the canvasNative.
  no setter
- dimension → PDimension
- 
  The dimension of this canvas.
  no setteroverride
- elementDimension → PDimension
- 
  The dimension of the visual element of this canvas.
  no setter
- elementHeight → num
- 
  The height of the visual element.
See elementDimension.
  no setter
- 
  elements
  → UnmodifiableListView<PCanvasElement> 
- 
  All the PCanvasElements of this instance.no setteroverride
- elementsLength → int
- 
  Returns elements length.
  no setteroverride
- elementWidth → num
- 
  The width of the visual element.
See elementDimension.
  no setter
- hasElements → bool
- 
  Returns trueif this instances has elements.no setteroverride
- 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 setter
- isPaintRequested → bool
- 
  Returns trueif requestRepaint was called and not processed yet.no setter
- isZeroDimension → bool
- 
  Returns trueif the area of this dimension is zero.no setterinherited
- 
  onPaint
  → Stream<PCanvas> 
- 
  
  no setter
- painter → PCanvasPainter
- 
  The painter of this canvas.
  no setter
- pCanvas → PCanvas?
- 
  Returns the root PCanvas.
  no setterinherited
- pixelRatio ↔ num
- 
  The current pixel ration of this canvas.
See devicePixelRatio.
  getter/setter pair
- 
  pixels
  → FutureOr<PCanvasPixels> 
- 
  Returns the pixels of this canvas.
See PCanvasPixels.
  no setter
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
- state → PCanvasState
- 
  The current drawing state.
  no setter
- stateExtra → PCanvasStateExtra?
- 
  The platform specific extra states.
  no setter
- subClip ← PRectangle?
- 
  Sets clip merging the coordinates of clip2with the previous clip.no getter
- subTransform ← PcanvasTransform
- 
  Sets transform to a sub-transformation, merging the current transform
with transform2.no getter
- transform ↔ PcanvasTransform
- 
  The current transformation of the canvas operation.
  getter/setter pair
- width → num
- 
  The pixels width of this canvas.
  no setteroverride
Methods
- 
  addAllElements(Iterable< PCanvasElement> elements) → void
- 
  Adds all the entries in elementsto this instances.inherited
- 
  addElement(PCanvasElement element) → void 
- 
  Adds an elementto this instances.override
- 
  angleToRadians(num angle) → double 
- 
  Converts anglein degrees to arcs.
- 
  callPainter() → FutureOr< bool> 
- Calls the painter, forcing a render operation.
- 
  callWithGuardedState<R> (R call()) → R 
- 
  Executes callpreserving the internal drawing state.
- 
  callWithGuardedStateAsync<R> (FutureOr< R> call()) → FutureOr<R> 
- 
  Executes callpreserving the internal drawing state, accepting Future as return value.
- 
  canvasPoint(Point p) → Point 
- 
  canvasX(num x) → num 
- 
  canvasXD(num x) → double 
- 
  canvasY(num y) → num 
- 
  canvasYD(num y) → double 
- 
  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.
- 
  checkDimension() → void 
- Checks if the canvas dimension has changed.
- 
  checkImageLoaded(PCanvasImage image) → void 
- 
  Checks if imageis already loaded.
- 
  clear({PStyle? style}) → void 
- Clears the canvas.
- 
  clearElements() → void 
- 
  Clears the elements of this instance.
  override
- 
  clearRect(num x, num y, num width, num height, {PStyle? style}) → void 
- Clears a part of the canvas.
- 
  createCanvasImage(Object source, {int? width, int? height}) → PCanvasImage 
- Creates a PCanvasImage instance compatible to this canvas and its painter.
- 
  dispatchOnClick(PCanvasClickEvent event) → PCanvasClickEvent 
- 
  Processes eventand callsonClickon clicked elements.inherited
- 
  dispatchOnClickDown(PCanvasClickEvent event) → PCanvasClickEvent 
- 
  Processes eventand callsonClickDownon clicked elements.inherited
- 
  dispatchOnClickMove(PCanvasClickEvent event) → PCanvasClickEvent 
- 
  Processes eventand callsonClickMoveon clicked elements.inherited
- 
  dispatchOnClickUp(PCanvasClickEvent event) → PCanvasClickEvent 
- 
  Processes eventand callsonClickUpon clicked elements.inherited
- 
  dispatchOnKey(PCanvasKeyEvent event) → PCanvasKeyEvent 
- 
  Processes eventand callsonKeyon elements.inherited
- 
  dispatchOnKeyDown(PCanvasKeyEvent event) → PCanvasKeyEvent 
- 
  Processes eventand callsonKeyDownon elements.inherited
- 
  dispatchOnKeyUp(PCanvasKeyEvent event) → PCanvasKeyEvent 
- 
  Processes eventand callsonKeyUpon elements.inherited
- 
  drawImage(PCanvasImage image, num x, num y) → void 
- 
  Draw an imageat (x,y) using the original dimension of theimage.
- 
  drawImageArea(PCanvasImage image, int srcX, int srcY, int srcWidth, int srcHeight, num dstX, num dstY, num dstWidth, num dstHeight) → void 
- 
  Draw an imagepart (srcX,srcY,srcWidthxsrcHeight) to a destiny area (dstX,dstY,dstWidthxdstHeight).
- 
  drawImageFitted(PCanvasImage image, num dstX, num dstY, num dstWidth, num dstHeight) → void 
- 
  Draw an imagefitting a destiny area (dstX,dstY,dstWidthxdstHeight).
- 
  drawImageScaled(PCanvasImage image, num x, num y, num width, num height) → void 
- 
  Draw an imageat (x,y) scaling it to the dimensionwidthxheight.
- 
  drawText(String text, num x, num y, PFont font, PStyle style) → void 
- 
  Draw a text at position (x,y).
- 
  fillBottomUpGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void 
- 
  Fill a rectangle (x,y,widthxheight) with a bottom up linear gradient. See fillTopDownGradient.
- 
  fillCircle(num x, num y, num radius, PStyle style, {num startAngle = 0, num endAngle = 360}) → void 
- 
  Fill a circle at (x,y) withradius.
- 
  fillLeftRightGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void 
- 
  Fill a rectangle (x,y,widthxheight) with a left right linear gradient. See fillRightLeftGradient.
- 
  fillPath(List path, PStyle style, {bool closePath = false}) → void 
- 
  Fill a pathof points.
- 
  fillRect(num x, num y, num width, num height, PStyle style) → void 
- 
  Fill a rectangle (x,y,widthxheight).
- 
  fillRightLeftGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void 
- 
  Fill a rectangle (x,y,widthxheight) with a right left linear gradient. See fillLeftRightGradient.
- 
  fillTopDownGradient(num x, num y, num width, num height, PColor colorFrom, PColor colorTo) → void 
- 
  Fill a rectangle (x,y,widthxheight) with a top down linear gradient. See fillBottomUpGradient.
- 
  getCursor() → PCanvasCursor 
- Returns the PCanvas cursor.
- 
  getElement(int index) → PCanvasElement 
- 
  Returns the element at elements index.override
- 
  log(Object? o) → void 
- Logs a debugging message.
- 
  measureText(String text, PFont font) → PTextMetric 
- 
  Measure the textdimension.
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  onPosPaint() → void 
- 
  onPrePaint() → void 
- 
  preventEventDefault(PCanvasEvent event) → bool 
- Prevents PCanvasEvent.nativeEvent default behavior.
- 
  refresh() → Future< bool> 
- Refreshes the canvas asynchronously.
- 
  removeAllElements(Iterable< PCanvasElement> elements) → void
- 
  Removes all entries in elementsfrom this instances.inherited
- 
  removeElement(PCanvasElement element) → bool 
- 
  Removes elementfrom this instance.override
- 
  requestRepaint() → Future< bool> 
- Requests a refresh (repaint).
- 
  requestRepaintDelayed(Duration delay) → Future< bool> 
- 
  Same as requestRepaint but ensures a delaybefore refresh.
- 
  restoreState({PCanvasState? expectedState}) → PCanvasState? 
- Restores the drawing state.
- 
  saveState() → PCanvasState 
- Saves the drawing state (PCanvasState).
- 
  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 Twith a matchingid.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 Tfiltered byselector.inherited
- 
  setClip(num x, num y, num width, num height) → void 
- Sets the drawing clip.
- 
  setCursor(PCanvasCursor cursor) → void 
- Sets the PCanvas cursor.
- 
  setPixels(PCanvasPixels pixels, {int x = 0, int y = 0, int? width, int? height}) → void 
- Sets the canvas pixels.
- 
  setSubClip(num x, num y, num width, num height) → void 
- Sets clip merging the passed coordinates with the previous clip.
- 
  strokeCircle(num x, num y, num radius, PStyle style, {num startAngle = 0, num endAngle = 360}) → void 
- 
  Stroke a circle at (x,y) withradius.
- 
  strokePath(List path, PStyle style, {bool closePath = false}) → void 
- 
  Stroke a pathof points.
- 
  strokeRect(num x, num y, num width, num height, PStyle style) → void 
- 
  Stroke a rectangle (x,y,widthxheight).
- 
  toDataUrl() → FutureOr< String> 
- Returns a data URI containing the canvas data in PNG format. See toPNG.
- 
  toInnerClickEvent(PCanvasClickEvent event, {PCanvasElement? targetElement, PCanvas? pCanvas}) → PCanvasClickEvent 
- 
  Returns an eventtranslated to the internal coordinates of this element.inherited
- 
  toPNG() → FutureOr< Uint8List> 
- Returns the pixels of this as a PNG data.
- 
  toString() → String 
- 
  A string representation of this object.
  inherited
- 
  waitLoading() → FutureOr< bool> 
- 
  Waits the loading of the canvas and also the painter.loadResources.
Operators
- 
  operator ==(Object other) → bool 
- 
  The equality operator.
  inherited