Releases: kyranet/canvas-constructor
Releases · kyranet/canvas-constructor
[email protected]
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
hexutil to format hexadecimal strings into a valid color string. - Added
rgbutil to format the parameters into a valid color string. - Added
rgbautil to format the parameters into a valid color string. - Added
hslutil to format the parameters into a valid color string. - Added
hslautil to format the parameters into a valid color string. - Added
colorutil 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
createRectCliptocreateRectangleClip. - Renamed
clearPixelstoclearRectangle. - Renamed
addRecttoprintRectangle. - Renamed
addStrokeRecttoprintStrokeRectangle. - Renamed
addCircletoprintCircle. - Renamed
addTexttoprintText. - Renamed
addStrokeTexttoprintStrokeText. - Renamed
addWrappedTexttoprintWrappedText. - Renamed
addResponsiveTexttoprintResponsiveText. - Renamed
addBeveledRecttoprintRoundedRectangle. - Renamed
addCircularImagetoprintCircularImage. - Renamed
addBeveledImagetoprintRoundedImage. - Renamed
addPatterntoprintPattern. - Renamed
createRoundPathtocreateCircularPath. - Renamed
createRoundCliptocreateCircularClip. - Renamed
createRectPathtocreateRectanglePath. - Renamed
createRectCliptocreateRectangleClip. - Renamed
createBeveledPathtocreateRoundedPath. - Renamed
createBeveledCliptocreateRoundedClip. - Renamed
addLinearColorGradienttoprintLinearColorGradient. - Renamed
addLinearStrokeGradienttoprintLinearStrokeGradient. - Renamed
addRadialColorGradienttoprintRadialColorGradient. - Renamed
addRadialStrokeGradienttoprintRadialStrokeGradient. - Renamed
createEllipsetocreateEllipsePath. - Renamed
addImagetoprintImage. - Modified
addImageto takeImage | Canvasinstead ofBuffer | Image, you must useloadImage. - Modified
addCircularImageto takeImage | Canvasinstead ofBuffer | Image, you must useloadImage. - Modified
addBeveledImageto takeImage | Canvasinstead ofBuffer | Image, you must useloadImage. - Modified
addPatternto takeImage | Canvasinstead ofBuffer | Image, you must useloadImage. - Modified
createPatternto takeImage | Canvasinstead ofBuffer | Image, you must useloadImage. - Modified
printPatternto takeImage | Canvasinstead 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
thisparameter is now typed.
Removed
- Removed options in
addImage. UseprintCircularImageorprintRoundedImageinstead. - Removed
addRoundImage. UseprintCircularImageinstead, beware that (x, y) is the centre and not top-left. - Removed
registerFontfromCanvas, use the export fromcanvasinstead. - Removed support for
canvas-prebuilt.canvasalready comes with them.
[email protected]
Added
edgeutility filter.
Fixed
blurutility filter not working properly.sharpenutility filter not working properly.convoluteutility filter mutating the data it was reading from, resulting on glitches.- Many security warnings from sub-dependencies.
[email protected]
This is mostly a documentation change, bumped minor as missing overloads (implemented via code but not documented) were added.
[email protected]
Fixed
- Resolved security vulnerability by upgrading to
[email protected].
[email protected]
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.
[email protected]
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
voidtounknownfor strict rules to allow return.
[email protected]
Fixed
- Webpack builds in unpkg
[email protected]
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
[email protected]
Changed
- The
restoreargument now default totrueinstead 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 [email protected].
- Typings
Removed
addBevelImagehas been removed. As per the deprecation added over 2 months ago, it has been renamed toaddBeveledImage
[email protected]
Fixed
- Fixed
addCircularImage()adding the circular clip in the wrong center.