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.