All notable changes to this project will be documented in this file.
7.0.2 - (2024-05-22)
- Resolve cairo issues (34129f4)
- Improve readme and add Stackblitz (cf3fc9b)
7.0.1 - (2023-05-19)
- Update tslib dependency (0ad6c4c)
- browser: Access from
globalThis
(#560) (a83af48) - Update dependencies (#553) (f043125)
7.0.0 - (2022-09-01)
- Re-export async
loadImage
from@napi-rs/canvas
(#516) (c5ad068)- 💥 BREAKING CHANGE: When using @napi/rs loader the
loadImage
function is now an async function returning aPromise
- 💥 BREAKING CHANGE: When using @napi/rs loader the
6.0.2 - (2022-07-12)
- Export loadFont for /cairo (#497) (74d3e81)
6.0.1 - (2022-06-06)
- Re-add export files (#486) (d27a04a)
- Resolved infinite recursion in
resetTransform
(352a24e) - browser: Export
loadImage
rather thanresolveImage
(ef0be31)
6.0.0 - (2022-06-01)
- Add
@note
s defining which methods are engine-specific (54dcb08)
-
skia: Added
svgAsync()
(ff40a27) -
skia: Added
pngAsync()
(7b78a77) -
skia: Added
pdfAsync()
(dbe42de) -
skia: Added
jpegAsync()
(8eed23c) -
cairo: Added
pngAsync()
(1b83681) -
cairo: Added
png()
(1f6d30f) -
cairo: Added
pdfAsync()
(d799c0e) -
cairo: Added
pdf()
(f6759c4) -
cairo: Added
jpegAsync()
(0073dce) -
cairo: Added
jpeg()
(6f023f9) -
Added
printConicStrokeGradient()
(955f8ba) -
Added
printConicColorGradient()
(e50a13e) -
Added
createConicGradient()
(90ccf01) -
Added
createImageData()
(1783a3a) -
Added
/napi-rs
engine (#480) (22047df)- removed
cb
parameter ingetImageData()
- removed
cb
parameter inmeasureText()
- removed
cb
parameter increatePattern()
- removed
cb
parameter inwrapText()
- renamed
createJPEGStream()
tojpegStream()
- renamed
createPDFStream()
topdfStream()
- renamed
createPNGStream()
topngStream()
- renamed
setAntiAliasing()
tosetAntialiasMode()
jpg()
now returns a synchronous responsepdf()
now returns a synchronous responsepng()
now returns a synchronous responsesvg()
now returns a synchronous response- removed
cb
parameter ingetFontVariant()
- removed
cb
parameter ingetTextTracking()
- removed
cb
parameter ingetTextWrap()
- renamed
getPages()
toget pages
- renamed
jpg()
tojpeg()
- renamed
newPages()
toaddPage()
- removed
5.0.2 (2022-01-22)
- deps: ensure compatibility with latest skia-canvas (#439) (481ba6f)
- restore state in
printResponsiveText
(#388) (08c3418)
5.0.1 (2021-07-30)
5.0.0 (2021-07-27)
-
Removed main export at
canvas-constructor
. -
Dropped Node 8, 10, and 12 support
-
specify breaking changes (3a2aece)
- Added
options.fit
inCanvas#printCircularImage
.
- 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.
- 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.
- 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 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.
- Resolved security vulnerability by upgrading to
[email protected]
.
Canvas#resetShadows()
not clearing shadows.
- Publish not running the browser build, thus missing it sometimes or deploying old versions.
- Added
Canvas#wrapText()
.
- 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.
- Webpack builds in unpkg.
Canvas#{toBlob,toBlobAsync}
for browser support.Canvas.fromCanvas()
for browser support (this is a must in browsers as you can't constructHTMLCanvasElement
).- Examples for usage in web.
- Webpack builds.
- Guides being stale.
- 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
addCircularImage()
adding the circular clip in the wrong center. - Fixed text not rendering in
[email protected]
. - Typings.
addBevelImage
has been removed. As per the deprecation added over 2 months ago, it has been renamed toaddBeveledImage
.
- Fixed
addCircularImage()
adding the circular clip in the wrong center.
- Fixed
addCircularImage()
not adding a circular clip before adding the image.
- Added
toDataURL()
andtoDataURLAsync()
. - Added
addCircularImage()
, similar toaddCircle()
. - Added
setTextSize()
, similar tosetTextFont()
but changes the font size only (not the font itself). - Added all overloads for
addImage()
. - (Documentation) Added MDN link for
addImage()
.
createBeveledPath()
now accepts an object typeBeveledRadiusOptions
.- Renamed
addBevelImage()
toaddBeveledImage()
to prevent confusions (naming inconsistency). The old method is still available but it's deprecated and will be removed in the next major update.
- Support for canvas 1.6.x and 2.x.
addTextFont()
for canvas 1.6.x compatibility.
METHODS.md
in favor of the new docs.
addMultilineText()
to print texts that are too long to be displayed.
- Both
printLinearGradient()
andprintRadialGradient()
to have chainable methods. - Added a new parameter for both
createLinearGradient()
andcreateRadialGradient()
, steps, which is typeofGradientStep[]
.
- Both
createLinearGradient()
andcreateRadialGradient()
are not longer chainable, they'll returnCanvasGradient
instead.
- Typings. This package will also work in TypeScript.
createBeveledPath()
same usage ascreateBeveledClip()
, but does not create clips (so you can use shadows and fill to colorize it).createRoundPath()
same usage ascreateRoundClip()
, but does not create clips (so you can use shadows and fill to colorize it).clip()
(how come this was not implemented?).
- Canvas has been moved from dependency to peer dependency.
addResponsiveText()
changed the parser to be passive, faster, and more accurate.
- Two private methods that were being used in
setTextFont()
.
changeCanvasSize()
to change the canvas' width/height.changeCanvasWidth()
to change the canvas' width.changeCanvasHeigth()
to change the canvas' height.
registerTextFont()
as canvas-constructor relies on[email protected]
, this method is useless.
setStrokeWidth()
to change stroke/line's width.beginPath()
to start making paths.closePath()
to start closing paths.createLinearGradient()
to create linear gradients.createRadialGradient()
to create radial gradients.arc()
andarcTo()
, to create arcs.quadraticCurveTo()
to create quadratic Bèzier curves.bezierCurveTo()
to create cubic Bèzier curves.lineTo()
to connect lines.moveTo()
to move the starting point of a path to any (x, y) coordinates.
- Added default
'#000000'
for thesetStroke()
method. addImage()
removedthis.save()
andthis.restore()
so users can use their own paths.
- Examples for
measureText()
.
save()
To save the current state onto a stack.rotate()
To add a rotation to the transformation matrix.scale()
To perform scaling transformations.traslate()
To perform translating transformations.fill()
To fill the current/given path.stroke()
To stroke the current/given path.addStrokeText()
To add stroked text.measureText()
To measure in pixels a text. Be careful, if you do not provide a callback (second argument), this method will return an Integer value instead of being chainable.setTextBaseline()
To set the text's baseline.setShadowOffsetX()
To set the shadow offset for the axis X.setShadowOffsetY()
To set the shadow offset for the axis Y.setGlobalAlpha()
To set the global alpha value for the next elements.clearCircle()
To clear the pixels with a circle shape.clearPixels()
To clear the pixels with a rectangle shape. (Usage is identical toaddRect()
).
- Breaking |
fillRect()
->addRect()
| To keep consistency. addText()
now accepts a third argument:maxWidth
.addImage()
now saves and restores the context.
addRoundImage()
now points toaddImage()
with the correct arguments.addBevelImage()
now points toaddImage()
with the correct arguments.
- Updated
README.md
.
- Fix a weird bug with the
in
operator inaddImage()
- Added
addFont()
method for retro-compatibility with old versions of Canvas. (Thanks to York in PR#1)
- Better
README.md
.
- Bugs in the
options
argument foraddImage()
.