Skip to content

Releases: kyranet/canvas-constructor

canvas-constructor@4.0.0

01 Aug 09:22
Compare
Choose a tag to compare

Very large update with many changes, tl;dr on changes, all methods prefixed with print render an element to the canvas, *Rect is renamed to *Rectangle, *Beveled is renamed to *Rounded, and removed support for Buffer in all methods that previously accepted this, instead, you must use loadImage (from canvas or canvas-constructor).

Also new website! https://canvasconstructor.js.org

Added

  • Added hex util to format hexadecimal strings into a valid color string.
  • Added rgb util to format the parameters into a valid color string.
  • Added rgba util to format the parameters into a valid color string.
  • Added hsl util to format the parameters into a valid color string.
  • Added hsla util to format the parameters into a valid color string.
  • Added color util to provide type safety when picking colors.
  • Added Canvas#createEllipseClip.
  • Added better types for Canvas#process.
  • Added better types for Canvas#toBuffer{Async}.
  • Added better types for Canvas#toDataURL{Async}.
  • Added better types for Canvas#toBlob{Async}.
  • Added ESM support.
  • Added treeshaking support for web bundles.
  • Added lots of documentation and examples.

Changed

  • Renamed createRectClip to createRectangleClip.
  • Renamed clearPixels to clearRectangle.
  • Renamed addRect to printRectangle.
  • Renamed addStrokeRect to printStrokeRectangle.
  • Renamed addCircle to printCircle.
  • Renamed addText to printText.
  • Renamed addStrokeText to printStrokeText.
  • Renamed addWrappedText to printWrappedText.
  • Renamed addResponsiveText to printResponsiveText.
  • Renamed addBeveledRect to printRoundedRectangle.
  • Renamed addCircularImage to printCircularImage.
  • Renamed addBeveledImage to printRoundedImage.
  • Renamed addPattern to printPattern.
  • Renamed createRoundPath to createCircularPath.
  • Renamed createRoundClip to createCircularClip.
  • Renamed createRectPath to createRectanglePath.
  • Renamed createRectClip to createRectangleClip.
  • Renamed createBeveledPath to createRoundedPath.
  • Renamed createBeveledClip to createRoundedClip.
  • Renamed addLinearColorGradient to printLinearColorGradient.
  • Renamed addLinearStrokeGradient to printLinearStrokeGradient.
  • Renamed addRadialColorGradient to printRadialColorGradient.
  • Renamed addRadialStrokeGradient to printRadialStrokeGradient.
  • Renamed createEllipse to createEllipsePath.
  • Renamed addImage to printImage.
  • Modified addImage to take Image | Canvas instead of Buffer | Image, you must use loadImage.
  • Modified addCircularImage to take Image | Canvas instead of Buffer | Image, you must use loadImage.
  • Modified addBeveledImage to take Image | Canvas instead of Buffer | Image, you must use loadImage.
  • Modified addPattern to take Image | Canvas instead of Buffer | Image, you must use loadImage.
  • Modified createPattern to take Image | Canvas instead of Buffer | Image, you must use loadImage.
  • Modified printPattern to take Image | Canvas instead of Buffer | Image, you must use loadImage.
  • Changed website, we are now using a typedoc generated one rather than the half-broken one.
  • Changed bundler from webpack to rollup.
  • Rewritten the library to strict TypeScript.

Fixed

  • Browser support is now fully operational.
  • Fixed typing conflicts with canvas, since they added typings recently.
  • Fixed interface callback types, the this parameter is now typed.

Removed

  • Removed options in addImage. Use printCircularImage or printRoundedImage instead.
  • Removed addRoundImage. Use printCircularImage instead, beware that (x, y) is the centre and not top-left.
  • Removed registerFont from Canvas, use the export from canvas instead.
  • Removed support for canvas-prebuilt. canvas already comes with them.

canvas-constructor@3.2.0

03 Apr 15:07
Compare
Choose a tag to compare

Added

  • edge utility filter.

Fixed

  • blur utility filter not working properly.
  • sharpen utility filter not working properly.
  • convolute utility filter mutating the data it was reading from, resulting on glitches.
  • Many security warnings from sub-dependencies.

canvas-constructor@3.1.0

27 Jun 12:47
Compare
Choose a tag to compare

This is mostly a documentation change, bumped minor as missing overloads (implemented via code but not documented) were added.

canvas-constructor@3.0.3

05 Jun 16:01
Compare
Choose a tag to compare

Fixed

  • Resolved security vulnerability by upgrading to handlebars@4.1.2.

canvas-constructor@3.0.2

05 Jun 11:30
Compare
Choose a tag to compare

This release also adds the missing changelogs from 2.0.0 and newer into the CHANGELOG.md file, keeping it up-to-date.

Fixed

  • Canvas#resetShadows() not clearing shadows.

canvas-constructor@3.0.0

25 Feb 21:12
1e67392
Compare
Choose a tag to compare

Added:

  • Added Canvas#wrapText().

Changed:

  • Make Canvas#addMultilineText() not wrap lines.
  • Renamed Canvas.getCanvas() to Canvas.internalCanvas.
  • Renamed Canvas.fromCanvas() to Canvas.from().
  • Changed the word wrap algorithm to respect newlines while also being slightly faster.
  • Changed callback return types in typings from void to unknown for strict rules to allow return.

canvas-constructor@2.1.1

26 Jan 22:10
Compare
Choose a tag to compare

Fixed

  • Webpack builds in unpkg

canvas-constructor@2.1.0

28 Dec 20:14
Compare
Choose a tag to compare

Added

  • Canvas#{toBlob,toBlobAsync} for browser support
  • Canvas.fromCanvas() for browser support (this is a must in browsers as you can't construct HTMLCanvasElement)
  • Examples for usage in web

Fixed

  • Webpack builds
  • Guides being stale

canvas-constructor@2.0.0

30 Oct 00:22
Compare
Choose a tag to compare

Changed

  • The restore argument now default to true instead of false, the previous default kept functionality from pre-releases and 1.x but I couldn't change it under a minor version, only with a major one. But now I decided it's enough, and made it default to the intuitive, and very often most-wanted choice: true.

Fixed

  • Fixed addCircularImage() adding the circular clip in the wrong center.
  • Fixed text not rendering in canvas@2.x.
  • Typings

Removed

  • addBevelImage has been removed. As per the deprecation added over 2 months ago, it has been renamed to addBeveledImage

canvas-constructor@1.1.2

13 Sep 11:09
Compare
Choose a tag to compare

Fixed

  • Fixed addCircularImage() adding the circular clip in the wrong center.