Skip to content

Commit 7953571

Browse files
author
EC2 Default User
committed
Update to Canvas 2.0
1 parent d1c0233 commit 7953571

File tree

704 files changed

+87400
-5
lines changed

Some content is hidden

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

704 files changed

+87400
-5
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
node_modules
21
package-lock.json

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Charoite L.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
Due to the size of dependencies, i.e. node_modules folder, it is no longer available to edit any serverless app based on this blueprint using AWS Lambda inline editor with node-canvas version 2.0+. So, I update this repository as resource space for those who would like to use node-canvas in their AWS Lambda functions.
44

5-
In order to use node-canvas on AWS Lambda, there is an official guide from @Automattic. For native dependencies like libcairo.so.2 and others, you may use the files I uploaded to this repostory.
5+
In order to use node-canvas on AWS Lambda, there is an official guide from [Automattic](https://github.com/Automattic). For native dependencies like libcairo.so.2 and others, you may use the files I uploaded to this repostory.
66

77
# Getting node-canvas works on AWS Lambda
88

9-
Node canvas is a Cairo backed Canvas implementation for NodeJS by @Automattic. Following is the snapshot of Installation Guide from [official wiki](https://github.com/Automattic/node-canvas) last updated on Sep 3, 2018.
9+
Node canvas is a Cairo backed Canvas implementation for NodeJS by [Automattic](https://github.com/Automattic). Following is the snapshot of Installation Guide from [official wiki](https://github.com/Automattic/node-canvas) last updated on Sep 3, 2018.
1010

1111
**Canvas 2.0 and 1.6 works out-of-the-box on AWS Lambda thanks to prebuilds. However, you must build your Lambda ZIP file on Linux (or a Linux Docker container) so that the correct prebuilt binary is included.** See https://github.com/Automattic/node-canvas/issues/1231 for more info.
1212

index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
let {createCanvas} = require("canvas");
2+
3+
function hello(event, context, callback) {
4+
let canvas = createCanvas(200, 200),
5+
ctx = canvas.getContext('2d');
6+
7+
// Write "Awesome!"
8+
ctx.font = '30px Impact';
9+
ctx.rotate(0.1);
10+
ctx.fillText('Awesome!', 50, 100);
11+
12+
// Draw line under text
13+
let text = ctx.measureText('Awesome!');
14+
ctx.strokeStyle = 'rgba(0,0,0,0.5)';
15+
ctx.beginPath();
16+
ctx.lineTo(50, 102);
17+
ctx.lineTo(50 + text.width, 102);
18+
ctx.stroke();
19+
20+
callback(null, '<img src="' + canvas.toDataURL() + '" />');
21+
}
22+
23+
module.exports = {hello};

lib/libblkid.so.1

300 KB
Binary file not shown.

lib/libcairo.so.2

1.19 MB
Binary file not shown.

lib/libfreetype.so.6

741 KB
Binary file not shown.

lib/libjpeg.so.62

267 KB
Binary file not shown.

lib/libmount.so.1

340 KB
Binary file not shown.

lib/libpango-1.0.so.0

273 KB
Binary file not shown.

0 commit comments

Comments
 (0)