Skip to content

Commit 3ce846f

Browse files
committed
Merge remote-tracking branch 'Automattic/master' into static
# Conflicts: # .gitignore # .npmignore # binding.gyp # util/has_lib.js
2 parents 569f5b8 + c025143 commit 3ce846f

File tree

121 files changed

+7478
-3178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+7478
-3178
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!----------------------------------- STOP! ----------------------------------->
21
<!---
32
Having trouble installing node-canvas? Please make sure you have read
43
the installation instructions located here before asking for help:
@@ -15,11 +14,11 @@ Still having problems, found a bug or want a feature? Fill out the form below.
1514
<!--- For bugs, provide a short, complete code example to reproduce the issue. -->
1615
```js
1716
var Canvas = require('canvas');
18-
var canvas = new Canvas(200, 200);
17+
var canvas = Canvas.createCanvas(200, 200);
1918
var ctx = canvas.getContext('2d');
2019
// etc.
2120
```
2221

2322
## Your Environment
24-
* Version of node-canvas (e.g. 1.4.0):
25-
* Environment (e.g. node 4.2.0 on Mac OS X 10.8):
23+
* Version of node-canvas (output of `npm list canvas` or `yarn list canvas`):
24+
* Environment (e.g. node 4.2.0 on Mac OS X 10.8):

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Thanks for contributing!
2+
3+
- [ ] Have you updated CHANGELOG.md?

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ out.svg
1212
node_modules
1313
deps/
1414
npm-debug.log
15+
package-lock.json
1516

1617
# Vim cruft
1718
*.swp
1819
*.un~
19-
npm-debug.log

.travis.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
language: node_js
2+
install:
3+
- npm install --build-from-source
24
node_js:
3-
- '7'
5+
- '13'
6+
- '12'
7+
- '10'
8+
- '8'
49
- '6'
5-
- '4'
610
addons:
711
apt:
812
sources:
@@ -12,7 +16,10 @@ addons:
1216
- libjpeg8-dev
1317
- libpango1.0-dev
1418
- libgif-dev
19+
- librsvg2-dev
1520
- g++-4.9
1621
env:
1722
- CXX=g++-4.9
18-
sudo: false
23+
script:
24+
- node_version=$(node -v); if [ ${node_version:1:2} = 10 ]; then npm run dtslint; fi
25+
- npm test

History.md renamed to CHANGELOG.md

Lines changed: 288 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,295 @@
1-
Unreleased / patch
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
6+
project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
(Unreleased)
29
==================
10+
### Changed
11+
### Added
12+
### Fixed
13+
* Fix BMP issues. (#1497)
14+
* Update typings to support jpg and addPage on NodeCanvasRenderingContext2D (#1509)
315

16+
2.6.1
17+
==================
18+
### Fixed
19+
* Ignore `maxWidth` in `fillText` and `strokeText` if it is undefined
20+
* Fix crash (assertion failure) in Node.js 12.x when patterns or gradients are used
21+
* Fix crash (check failure) in Node.js 12.x when using RGB16_565 format. (The
22+
underlying arraybuffer was incorrectly sized.)
23+
* Fix rendering error when applying shadow width line style (lineCap lineJoin lineDash)
24+
25+
2.6.0
26+
==================
27+
### Changed
28+
* Allow larger buffers to be returned from `toBuffer('raw')`.
29+
### Added
30+
* Support for various BMP headers and color depths (#1435)
31+
### Fixed
32+
* Fix crash when changing canvas width/height while `fillStyle` or `strokeStyle`
33+
was set to a `CanvasPattern` or `CanvasGradient` (#1357).
34+
* Fix crash when changing width/height of SVG canvases (#1380).
35+
* Fix crash when using `toBuffer('raw')` with large canvases (#1158).
36+
* Clarified meaning of byte ordering for `toBuffer('raw')` in readme. (#1416)
37+
* Fix package.json Typings field to point to Declaration file (#1432)
38+
* Properly check return value from `Set` and `Call`. (#1415)
39+
* Use `Get` version from `Nan` instead of `v8`. (#1415)
40+
41+
2.5.0
42+
==================
43+
### Added
44+
* Support redirects when fetching images (using [simple-get](https://github.com/feross/simple-get)) (#1398)
45+
* Support Node.js v12
46+
### Fixed
47+
* Fix object literal & arrow function syntax usage for IE.
48+
49+
2.4.1
50+
==================
51+
### Fixed
52+
* Guard JPEG width/height against maximum supported (#1385)
53+
* Fix electron 5 and node 12 compatibility
54+
* Fix encoding options (quality) parameter in `canvas.toDataURL()`
55+
56+
2.4.0
57+
==================
58+
### Added
59+
* (Actually) added `resolution` option for `canvas.toBuffer("image/png")` and
60+
`canvas.createPNGStream()`. This was documented since 2.0.0 but not working.
61+
* Add typescript definitions.
62+
### Fixed
63+
* PDF metadata (added in 2.3.0) wasn't being set with `canvas.createPDFStream()`
64+
* Fix custom "inspect" function deprecation warnings (#1326)
65+
66+
2.3.1
67+
==================
68+
### Fixed
69+
* Fix `canvas.toBuffer()` for JPEGs (#1350)
70+
71+
2.3.0
72+
==================
73+
### Added
74+
* Add support for multiple PDF page sizes
75+
* Add support for embedding document metadata in PDFs
76+
77+
### Fixed
78+
* Don't crash when font string is invalid (bug since 2.2.0) (#1328)
79+
* Fix memory leak in `canvas.toBuffer()` (#1202, #1296)
80+
* Fix memory leak in `ctx.font=` (#1202)
81+
82+
2.2.0
83+
==================
84+
### Added
85+
* BMP support
86+
87+
### Fixed
88+
* Reset context on resurface (#1292)
89+
* Support Jest test framework (#1311)
90+
91+
2.1.0
92+
==================
93+
### Added
94+
* Warn when building with old, unsupported versions of cairo or libjpeg.
95+
96+
2.0.0
97+
==================
98+
99+
**Upgrading from 1.x**
100+
```js
101+
// (1) The Canvas constructor is no longer the default export from the module.
102+
/* old: */
103+
const Canvas = require('canvas')
104+
const mycanvas = new Canvas(width, height)
105+
/* new: */
106+
const { createCanvas, Canvas } = require('canvas')
107+
const mycanvas = createCanvas(width, height)
108+
mycanvas instanceof Canvas // true
109+
110+
/* old: */
111+
const Canvas = require('canvas')
112+
const myimg = new Canvas.Image()
113+
/* new: */
114+
const { Image } = require('canvas')
115+
const myimg = new Image()
116+
117+
// (2) The quality argument for canvas.createJPEGStream/canvas.jpegStream now
118+
// goes from 0 to 1 instead of from 0 to 100:
119+
canvas.createJPEGStream({ quality: 50 }) // old
120+
canvas.createJPEGStream({ quality: 0.5 }) // new
121+
122+
// (3) The ZLIB compression level and PNG filter options for canvas.toBuffer are
123+
// now named instead of positional arguments:
124+
canvas.toBuffer(undefined, 3, canvas.PNG_FILTER_NONE) // old
125+
canvas.toBuffer(undefined, { compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) // new
126+
// or specify the mime type explicitly:
127+
canvas.toBuffer('image/png', { compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) // new
128+
129+
// (4) #2 also applies for canvas.pngStream, although these arguments were not
130+
// documented:
131+
canvas.pngStream(3, canvas.PNG_FILTER_NONE) // old
132+
canvas.pngStream({ compressionLevel: 3, filters: canvas.PNG_FILTER_NONE }) // new
133+
134+
// (5) canvas.syncPNGStream() and canvas.syncJPEGStream() have been removed:
135+
canvas.syncPNGStream() // old
136+
canvas.createSyncPNGStream() // old
137+
canvas.createPNGStream() // new
138+
139+
canvas.syncJPEGStream() // old
140+
canvas.createSyncJPEGStream() // old
141+
canvas.createJPEGStream() // new
142+
143+
// (6) Context2d.filter has been renamed to context2d.quality to avoid a
144+
// conflict with the new standard 'filter' property.
145+
context.filter = 'best' // old
146+
context.quality = 'best' // new
147+
```
148+
149+
### Breaking
150+
* Drop support for Node.js <6.x
151+
* Remove sync stream functions (bc53059). Note that most streams are still
152+
synchronous (run in the main thread); this change just removed `syncPNGStream`
153+
and `syncJPEGStream`.
154+
* Pango is now *required* on all platforms (7716ae4).
155+
* Make the `quality` argument for JPEG output go from 0 to 1 to match HTML spec.
156+
* Make the `compressionLevel` and `filters` arguments for `canvas.toBuffer()`
157+
named instead of positional. Same for `canvas.pngStream()`, although these
158+
arguments were not documented.
159+
* See also: *Correct some of the `globalCompositeOperator` types* under
160+
**Fixed**. These changes were bug-fixes, but will break existing code relying
161+
on the incorrect types.
162+
* Rename `context2d.filter` to `context2d.quality` to avoid a conflict with the
163+
new standard 'filter' property. Note that the standard 'filter' property is
164+
not yet implemented.
165+
166+
### Fixed
167+
* Fix build with SVG support enabled (#1123)
168+
* Prevent segfaults caused by loading invalid fonts (#1105)
169+
* Fix memory leak in font loading
4170
* Port has_lib.sh to javascript (#872)
5-
* Support canvas.getContext("2d", {alpha: boolean}) and
6-
canvas.getContext("2d", {pixelFormat: "..."})
171+
* Correctly sample the edge of images when scaling (#1084)
172+
* Detect CentOS libjpeg path (b180ea5)
173+
* Improve measureText accuracy (2bbfec5)
174+
* Fix memory leak when image callbacks reference the image (1f4b646)
175+
* Fix putImageData(data, negative, negative) (2102e25)
176+
* Fix SVG recognition when loading from buffer (77749e6)
177+
* Re-rasterize SVG when drawing to a context and dimensions changed (79bf232)
178+
* Prevent JPEG errors from crashing process (#1124)
179+
* Improve handling of invalid arguments (#1129)
180+
* Fix repeating patterns when drawing a canvas to itself (#1136)
181+
* Prevent segfaults caused by creating a too large canvas
182+
* Fix parse-font regex to allow for whitespaces.
183+
* Allow assigning non-string values to fillStyle and strokeStyle
184+
* Fix drawing zero-width and zero-height images.
185+
* Fix DEP0005 deprecation warning
186+
* Don't assume `data:` URIs assigned to `img.src` are always base64-encoded
187+
* Fix formatting of color strings (e.g. `ctx.fillStyle`) on 32-bit platforms
188+
* Explicitly export symbols for the C++ API
189+
* Named CSS colors should match case-insensitive
190+
* Correct some of the `globalCompositeOperator` types to match the spec:
191+
* "hsl-hue" is now "hue"
192+
* "hsl-saturation" is now "saturation"
193+
* "hsl-color" is now "color"
194+
* "hsl-luminosity" is now "luminosity"
195+
* "darker" is now "darken"
196+
* "dest" is now "destination"
197+
* "add" is removed (but is the same as "lighter")
198+
* "source" is now "copy"
199+
* Provide better, Node.js core-style coded errors for failed sys calls. (For
200+
example, provide an error with code 'ENOENT' if setting `img.src` to a path
201+
that does not exist.)
202+
* Support reading CMYK, YCCK JPEGs.
203+
* Hide `Image.prototype.source`
204+
* Fix behavior of maxWidth (#1088)
205+
* Fix behavior of textAlignment with maxWidth (#1253)
206+
207+
### Added
208+
* Prebuilds (#992) with different libc versions to the prebuilt binary (#1140)
209+
* Support `canvas.getContext("2d", {alpha: boolean})` and
210+
`canvas.getContext("2d", {pixelFormat: "..."})`
7211
* Support indexed PNG encoding.
212+
* Support `currentTransform` (d6714ee)
213+
* Export `CanvasGradient` (6a4c0ab)
214+
* Support #RGBA , #RRGGBBAA hex colors (10a82ec)
215+
* Support maxWidth arg for fill/strokeText (175b40d)
216+
* Support image.naturalWidth/Height (a5915f8)
217+
* Render SVG img elements when librsvg is available (1baf00e)
218+
* Support ellipse method (4d4a726)
219+
* Browser-compatible API (6a29a23)
220+
* Support for jpeg on Windows (42e9a74)
221+
* Support for backends (1a6dffe)
222+
* Support for `canvas.toBuffer("image/jpeg")`
223+
* Unified configuration options for `canvas.toBuffer()`, `canvas.pngStream()`
224+
and `canvas.jpegStream()`
225+
* ~~Added `resolution` option for `canvas.toBuffer("image/png")` and
226+
`canvas.createPNGStream()`~~ this was not working
227+
* Support for `canvas.toDataURI("image/jpeg")` (sync)
228+
* Support for `img.src = <url>` to match browsers
229+
* Support reading data URL on `img.src`
230+
* Readme: add dependencies command for OpenBSD
231+
* Throw error if calling jpegStream when canvas was not built with JPEG support
232+
* Emit error if trying to load GIF, SVG or JPEG image when canvas was not built
233+
with support for that format
234+
235+
1.6.x (unreleased)
236+
==================
237+
### Fixed
238+
* Make setLineDash able to handle full zeroed dashes (b8cf1d7)
239+
* Fix reading fillStyle after setting it from gradient to color (a84b2bc)
240+
241+
### Added
242+
* Support for pattern repeat and no-repeat (#1066)
243+
* Support for context globalAlpha for gradients and patterns (#1064)
244+
245+
1.6.9 / 2017-12-20
246+
==================
247+
### Fixed
248+
* Fix some instances of crashes (7c9ec58, 8b792c3)
249+
* Fix node 0.x compatibility (dca33f7)
250+
251+
1.6.8 / 2017-12-12
252+
==================
253+
### Fixed
254+
* Faster, more compliant parseFont (4625efa, 37cd969)
255+
256+
1.6.7 / 2017-09-08
257+
==================
258+
### Fixed
259+
* Minimal backport of #985 (rotated text baselines) (c19edb8)
260+
261+
1.6.6 / 2017-05-03
262+
==================
263+
### Fixed
264+
* Use .node extension for requiring native module so webpack works (1b05599)
265+
* Correct text baseline calculation (#1037)
266+
267+
1.6.5 / 2017-03-18
268+
==================
269+
### Changed
270+
* Parse font using parse-css-font and units-css (d316416)
271+
272+
1.6.4 / 2017-02-26
273+
==================
274+
### Fixed
275+
* Make sure Canvas#toDataURL is always async if callback is passed (8586d72)
276+
277+
1.6.3 / 2017-02-14
278+
==================
279+
### Fixed
280+
* Fix isnan() and isinf() on clang (5941e13)
281+
282+
1.6.2 / 2016-10-30
283+
==================
284+
### Fixed
285+
* Fix deprecation warnings (c264879)
286+
* Bump nan (e4aea20)
287+
288+
1.6.1 / 2016-10-23
289+
==================
290+
291+
### Fixed
292+
* Make has_lib.sh work on BSD OSes (1727d66)
8293

9294
1.6.0 / 2016-10-16
10295
==================

0 commit comments

Comments
 (0)