Releases: kyranet/canvas-constructor
Releases · kyranet/canvas-constructor
canvas-constructor@4.0.0
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
tocreateRectangleClip
. - Renamed
clearPixels
toclearRectangle
. - Renamed
addRect
toprintRectangle
. - Renamed
addStrokeRect
toprintStrokeRectangle
. - Renamed
addCircle
toprintCircle
. - Renamed
addText
toprintText
. - Renamed
addStrokeText
toprintStrokeText
. - Renamed
addWrappedText
toprintWrappedText
. - Renamed
addResponsiveText
toprintResponsiveText
. - Renamed
addBeveledRect
toprintRoundedRectangle
. - Renamed
addCircularImage
toprintCircularImage
. - Renamed
addBeveledImage
toprintRoundedImage
. - Renamed
addPattern
toprintPattern
. - Renamed
createRoundPath
tocreateCircularPath
. - Renamed
createRoundClip
tocreateCircularClip
. - Renamed
createRectPath
tocreateRectanglePath
. - Renamed
createRectClip
tocreateRectangleClip
. - Renamed
createBeveledPath
tocreateRoundedPath
. - Renamed
createBeveledClip
tocreateRoundedClip
. - Renamed
addLinearColorGradient
toprintLinearColorGradient
. - Renamed
addLinearStrokeGradient
toprintLinearStrokeGradient
. - Renamed
addRadialColorGradient
toprintRadialColorGradient
. - Renamed
addRadialStrokeGradient
toprintRadialStrokeGradient
. - Renamed
createEllipse
tocreateEllipsePath
. - Renamed
addImage
toprintImage
. - Modified
addImage
to takeImage | Canvas
instead ofBuffer | Image
, you must useloadImage
. - Modified
addCircularImage
to takeImage | Canvas
instead ofBuffer | Image
, you must useloadImage
. - Modified
addBeveledImage
to takeImage | Canvas
instead ofBuffer | Image
, you must useloadImage
. - Modified
addPattern
to takeImage | Canvas
instead ofBuffer | Image
, you must useloadImage
. - Modified
createPattern
to takeImage | Canvas
instead ofBuffer | Image
, you must useloadImage
. - Modified
printPattern
to takeImage | Canvas
instead ofBuffer | Image
, you must useloadImage
. - 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
. UseprintCircularImage
orprintRoundedImage
instead. - Removed
addRoundImage
. UseprintCircularImage
instead, beware that (x, y) is the centre and not top-left. - Removed
registerFont
fromCanvas
, use the export fromcanvas
instead. - Removed support for
canvas-prebuilt
.canvas
already comes with them.
canvas-constructor@3.2.0
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
This is mostly a documentation change, bumped minor as missing overloads (implemented via code but not documented) were added.
canvas-constructor@3.0.3
Fixed
- Resolved security vulnerability by upgrading to
handlebars@4.1.2
.
canvas-constructor@3.0.2
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
Added:
- Added
Canvas#wrapText()
.
Changed:
- Make
Canvas#addMultilineText()
not wrap lines. - Renamed
Canvas.getCanvas()
toCanvas.internalCanvas
. - Renamed
Canvas.fromCanvas()
toCanvas.from()
. - Changed the word wrap algorithm to respect newlines while also being slightly faster.
- Changed callback return types in typings from
void
tounknown
for strict rules to allow return.
canvas-constructor@2.1.1
Fixed
- Webpack builds in unpkg
canvas-constructor@2.1.0
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
Changed
- The
restore
argument now default totrue
instead offalse
, 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 toaddBeveledImage
canvas-constructor@1.1.2
Fixed
- Fixed
addCircularImage()
adding the circular clip in the wrong center.