├── .gitignore ├── README.md ├── dependencies ├── lambda-node-canvas-dependency-4.3 │ ├── cairo │ │ ├── libcairo-trace.a │ │ ├── libcairo-trace.la │ │ ├── libcairo-trace.so │ │ ├── libcairo-trace.so.0 │ │ └── libcairo-trace.so.0.0.0 │ ├── libcairo-script-interpreter.a │ ├── libcairo-script-interpreter.la │ ├── libcairo-script-interpreter.so │ ├── libcairo-script-interpreter.so.2 │ ├── libcairo-script-interpreter.so.2.11200.14 │ ├── libcairo.a │ ├── libcairo.la │ ├── libcairo.so │ ├── libcairo.so.2 │ ├── libcairo.so.2.11200.14 │ ├── libfreetype.a │ ├── libfreetype.la │ ├── libfreetype.so │ ├── libfreetype.so.6 │ ├── libfreetype.so.6.10.0 │ ├── libjpeg.a │ ├── libjpeg.la │ ├── libjpeg.so │ ├── libjpeg.so.8 │ ├── libjpeg.so.8.4.0 │ ├── libpixman-1.a │ ├── libpixman-1.la │ ├── libpixman-1.so │ ├── libpixman-1.so.0 │ ├── libpixman-1.so.0.28.2 │ ├── libpng.a │ ├── libpng.la │ ├── libpng.so │ ├── libpng16.a │ ├── libpng16.la │ ├── libpng16.so │ ├── libpng16.so.16 │ ├── libpng16.so.16.23.0 │ ├── node_modules │ │ └── canvas │ │ │ ├── .npmignore │ │ │ ├── .travis.yml │ │ │ ├── History.md │ │ │ ├── Readme.md │ │ │ ├── binding.gyp │ │ │ ├── build │ │ │ ├── Makefile │ │ │ ├── Release │ │ │ │ ├── .deps │ │ │ │ │ └── Release │ │ │ │ │ │ ├── canvas-postbuild.node.d │ │ │ │ │ │ ├── canvas.node.d │ │ │ │ │ │ └── obj.target │ │ │ │ │ │ ├── canvas-postbuild.node.d │ │ │ │ │ │ ├── canvas.node.d │ │ │ │ │ │ └── canvas │ │ │ │ │ │ └── src │ │ │ │ │ │ ├── Canvas.o.d │ │ │ │ │ │ ├── CanvasGradient.o.d │ │ │ │ │ │ ├── CanvasPattern.o.d │ │ │ │ │ │ ├── CanvasRenderingContext2d.o.d │ │ │ │ │ │ ├── FontFace.o.d │ │ │ │ │ │ ├── Image.o.d │ │ │ │ │ │ ├── ImageData.o.d │ │ │ │ │ │ ├── color.o.d │ │ │ │ │ │ └── init.o.d │ │ │ │ ├── canvas-postbuild.node │ │ │ │ ├── canvas.node │ │ │ │ └── obj.target │ │ │ │ │ ├── canvas-postbuild.node │ │ │ │ │ ├── canvas.node │ │ │ │ │ └── canvas │ │ │ │ │ └── src │ │ │ │ │ ├── Canvas.o │ │ │ │ │ ├── CanvasGradient.o │ │ │ │ │ ├── CanvasPattern.o │ │ │ │ │ ├── CanvasRenderingContext2d.o │ │ │ │ │ ├── FontFace.o │ │ │ │ │ ├── Image.o │ │ │ │ │ ├── ImageData.o │ │ │ │ │ ├── color.o │ │ │ │ │ └── init.o │ │ │ ├── binding.Makefile │ │ │ ├── canvas-postbuild.target.mk │ │ │ ├── canvas.target.mk │ │ │ └── config.gypi │ │ │ ├── index.js │ │ │ ├── lib │ │ │ ├── bindings.js │ │ │ ├── canvas.js │ │ │ ├── context2d.js │ │ │ ├── image.js │ │ │ ├── jpegstream.js │ │ │ └── pngstream.js │ │ │ ├── node_modules │ │ │ └── nan │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ ├── doc │ │ │ │ ├── asyncworker.md │ │ │ │ ├── buffers.md │ │ │ │ ├── callback.md │ │ │ │ ├── converters.md │ │ │ │ ├── errors.md │ │ │ │ ├── maybe_types.md │ │ │ │ ├── methods.md │ │ │ │ ├── new.md │ │ │ │ ├── node_misc.md │ │ │ │ ├── object_wrappers.md │ │ │ │ ├── persistent.md │ │ │ │ ├── scopes.md │ │ │ │ ├── script.md │ │ │ │ ├── string_bytes.md │ │ │ │ ├── v8_internals.md │ │ │ │ └── v8_misc.md │ │ │ │ ├── include_dirs.js │ │ │ │ ├── nan.h │ │ │ │ ├── nan_callbacks.h │ │ │ │ ├── nan_callbacks_12_inl.h │ │ │ │ ├── nan_callbacks_pre_12_inl.h │ │ │ │ ├── nan_converters.h │ │ │ │ ├── nan_converters_43_inl.h │ │ │ │ ├── nan_converters_pre_43_inl.h │ │ │ │ ├── nan_implementation_12_inl.h │ │ │ │ ├── nan_implementation_pre_12_inl.h │ │ │ │ ├── nan_maybe_43_inl.h │ │ │ │ ├── nan_maybe_pre_43_inl.h │ │ │ │ ├── nan_new.h │ │ │ │ ├── nan_object_wrap.h │ │ │ │ ├── nan_persistent_12_inl.h │ │ │ │ ├── nan_persistent_pre_12_inl.h │ │ │ │ ├── nan_string_bytes.h │ │ │ │ ├── nan_typedarray_contents.h │ │ │ │ ├── nan_weak.h │ │ │ │ ├── package.json │ │ │ │ └── tools │ │ │ │ ├── 1to2.js │ │ │ │ ├── README.md │ │ │ │ └── package.json │ │ │ ├── package.json │ │ │ ├── src │ │ │ ├── Canvas.cc │ │ │ ├── Canvas.h │ │ │ ├── CanvasGradient.cc │ │ │ ├── CanvasGradient.h │ │ │ ├── CanvasPattern.cc │ │ │ ├── CanvasPattern.h │ │ │ ├── CanvasRenderingContext2d.cc │ │ │ ├── CanvasRenderingContext2d.h │ │ │ ├── FontFace.cc │ │ │ ├── FontFace.h │ │ │ ├── Image.cc │ │ │ ├── Image.h │ │ │ ├── ImageData.cc │ │ │ ├── ImageData.h │ │ │ ├── JPEGStream.h │ │ │ ├── PNG.h │ │ │ ├── Point.h │ │ │ ├── closure.h │ │ │ ├── color.cc │ │ │ ├── color.h │ │ │ └── init.cc │ │ │ └── util │ │ │ └── has_lib.sh │ └── pkgconfig │ │ ├── cairo-ft.pc │ │ ├── cairo-pdf.pc │ │ ├── cairo-png.pc │ │ ├── cairo-ps.pc │ │ ├── cairo-script.pc │ │ ├── cairo-svg.pc │ │ ├── cairo.pc │ │ ├── freetype2.pc │ │ ├── libpng.pc │ │ ├── libpng16.pc │ │ └── pixman-1.pc └── lambda-node-canvas-dependency │ ├── index.js │ ├── libcairo.so.2 │ ├── libfreetype.so.6 │ ├── libgif.so.7 │ ├── libjpeg.so.8 │ ├── libpixman-1.so.0 │ └── libpng16.so.16 ├── gulpfile.js ├── how-dependencies-were-created ├── index.js ├── main.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | 13 | # Directory for instrumented libs generated by jscoverage/JSCover 14 | lib-cov 15 | 16 | # Coverage directory used by tools like istanbul 17 | coverage 18 | 19 | # nyc test coverage 20 | .nyc_output 21 | 22 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 23 | .grunt 24 | 25 | # node-waf configuration 26 | .lock-wscript 27 | 28 | # Compiled binary addons (http://nodejs.org/api/addons.html) 29 | build/Release 30 | 31 | # Dependency directories 32 | node_modules 33 | jspm_packages 34 | 35 | dist 36 | 37 | # Optional npm cache directory 38 | .npm 39 | 40 | # Optional REPL history 41 | .node_repl_history 42 | 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # aws-lambda-node-canvas 2 | 3 | A gulp plugin to deploy node-canvas in aws lambda. 4 | 5 | ## Prerequisites 6 | 7 | This plugin assumes you have aws-cli installed and configured with proper access rights to use aws lambda. 8 | 9 | ## Installation 10 | 11 | ``` 12 | npm install --save-dev aws-lambda-node-canvas 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```javascript 18 | 19 | 'use strict'; 20 | //This is a sample gulp file that can be used. 21 | //npm install --save gulp gulp-zip gulp-awslambda 22 | const gulp = require('gulp'); 23 | const zip = require('gulp-zip'); 24 | const path = require('path'); 25 | const lambda = require('gulp-awslambda'); 26 | const aws_lambda_node_canvas = require('./'); 27 | 28 | let runtime = 'nodejs4.3' // nodejs or nodejs4.3 29 | 30 | const lambda_params = { 31 | FunctionName: 'NodeCanvas', /* Lambda function name */ 32 | Description: 'Node canvas function in aws lambda', //Description for your lambda function 33 | Handler: 'main.lambda_handler', //Assuming you will provide main.py file with a function called handler. 34 | MemorySize: 128, 35 | Runtime: runtime, 36 | Role : 'ROLE_STRING',//eg:'arn:aws:iam::[Account]:role/lambda_basic_execution' 37 | Timeout: 50 38 | }; 39 | 40 | var opts = { 41 | region : 'ap-southeast-2' 42 | } 43 | 44 | gulp.task('default', () => { 45 | return gulp.src(['main.js', '!node_modules/**/*','!dist/**/*','!node_modules/aws-lambda-node-canvas/**/*']) //Your src files to bundle into aws lambda 46 | .pipe(aws_lambda_node_canvas({runtime : runtime})) //Adds all the required files needed to run node-canvas in aws lambda 47 | .pipe(zip('archive.zip')) 48 | .pipe(lambda(lambda_params, opts)) 49 | .pipe(gulp.dest('dist')); //Also place the uploaded file 50 | }); 51 | 52 | ``` 53 | 54 | ## API 55 | 56 | ### aws-lambda-node-canvas(options) 57 | 58 | #### options 59 | 60 | ##### runtime(mandatory) 61 | 62 | Six lambda available regions. 63 | 64 | Type: `string`
65 | values: `nodejs,nodejs4.3` 66 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.la: -------------------------------------------------------------------------------- 1 | # libcairo-trace.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libcairo-trace.so.0' 9 | 10 | # Names of this library. 11 | library_names='libcairo-trace.so.0.0.0 libcairo-trace.so.0 libcairo-trace.so' 12 | 13 | # The name of the static archive. 14 | old_library='libcairo-trace.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lpthread -lz -ldl -lrt -lm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libcairo-trace. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib/cairo' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.so.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.so.0.0.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/cairo/libcairo-trace.so.0.0.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.la: -------------------------------------------------------------------------------- 1 | # libcairo-script-interpreter.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libcairo-script-interpreter.so.2' 9 | 10 | # Names of this library. 11 | library_names='libcairo-script-interpreter.so.2.11200.14 libcairo-script-interpreter.so.2 libcairo-script-interpreter.so' 12 | 13 | # The name of the static archive. 14 | old_library='libcairo-script-interpreter.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' /home/ec2-user/canvas/lib/libcairo.la -L/home/ec2-user/canvas/lib -lpthread /home/ec2-user/canvas/lib/libpixman-1.la /home/ec2-user/canvas/lib/libfreetype.la /home/ec2-user/canvas/lib/libpng16.la -lz -lrt -lm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libcairo-script-interpreter. 26 | current=11202 27 | age=11200 28 | revision=14 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.so.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.so.2 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.so.2.11200.14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo-script-interpreter.so.2.11200.14 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo.la: -------------------------------------------------------------------------------- 1 | # libcairo.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libcairo.so.2' 9 | 10 | # Names of this library. 11 | library_names='libcairo.so.2.11200.14 libcairo.so.2 libcairo.so' 12 | 13 | # The name of the static archive. 14 | old_library='libcairo.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lpthread -L/home/ec2-user/canvas/lib /home/ec2-user/canvas/lib/libpixman-1.la /home/ec2-user/canvas/lib/libfreetype.la /home/ec2-user/canvas/lib/libpng16.la -lz -lrt -lm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libcairo. 26 | current=11202 27 | age=11200 28 | revision=14 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo.so.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo.so.2 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libcairo.so.2.11200.14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libcairo.so.2.11200.14 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libfreetype.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libfreetype.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libfreetype.la: -------------------------------------------------------------------------------- 1 | # libfreetype.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libfreetype.so.6' 9 | 10 | # Names of this library. 11 | library_names='libfreetype.so.6.10.0 libfreetype.so.6 libfreetype.so' 12 | 13 | # The name of the static archive. 14 | old_library='libfreetype.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lz' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libfreetype. 26 | current=16 27 | age=10 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libfreetype.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libfreetype.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libfreetype.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libfreetype.so.6 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libfreetype.so.6.10.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libfreetype.so.6.10.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libjpeg.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libjpeg.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libjpeg.la: -------------------------------------------------------------------------------- 1 | # libjpeg.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libjpeg.so.8' 9 | 10 | # Names of this library. 11 | library_names='libjpeg.so.8.4.0 libjpeg.so.8 libjpeg.so' 12 | 13 | # The name of the static archive. 14 | old_library='libjpeg.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libjpeg. 26 | current=12 27 | age=4 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libjpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libjpeg.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libjpeg.so.8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libjpeg.so.8 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libjpeg.so.8.4.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libjpeg.so.8.4.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.la: -------------------------------------------------------------------------------- 1 | # libpixman-1.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.2.10 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libpixman-1.so.0' 9 | 10 | # Names of this library. 11 | library_names='libpixman-1.so.0.28.2 libpixman-1.so.0 libpixman-1.so' 12 | 13 | # The name of the static archive. 14 | old_library='libpixman-1.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libpixman-1. 26 | current=28 27 | age=28 28 | revision=2 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.so.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.so.0.28.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpixman-1.so.0.28.2 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpng.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng.la: -------------------------------------------------------------------------------- 1 | # libpng16.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libpng16.so.16' 9 | 10 | # Names of this library. 11 | library_names='libpng16.so.16.23.0 libpng16.so.16 libpng16.so' 12 | 13 | # The name of the static archive. 14 | old_library='libpng16.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lz -lm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libpng16. 26 | current=39 27 | age=23 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpng.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng16.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpng16.a -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng16.la: -------------------------------------------------------------------------------- 1 | # libpng16.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libpng16.so.16' 9 | 10 | # Names of this library. 11 | library_names='libpng16.so.16.23.0 libpng16.so.16 libpng16.so' 12 | 13 | # The name of the static archive. 14 | old_library='libpng16.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lz -lm' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libpng16. 26 | current=39 27 | age=23 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/home/ec2-user/canvas/lib' 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng16.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpng16.so -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng16.so.16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpng16.so.16 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/libpng16.so.16.23.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency-4.3/libpng16.so.16.23.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/.npmignore: -------------------------------------------------------------------------------- 1 | testing 2 | build 3 | benchmarks 4 | examples 5 | support 6 | test 7 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | - "0.12" 6 | - "iojs-v1.8.4" 7 | - "iojs-v2.5.0" 8 | - "iojs-v3.3.0" 9 | - "4" 10 | - "5" 11 | matrix: 12 | allow_failures: 13 | - node_js: "5" 14 | addons: 15 | apt: 16 | sources: 17 | - ubuntu-toolchain-r-test 18 | packages: 19 | - libcairo2-dev 20 | - libjpeg8-dev 21 | - libpango1.0-dev 22 | - libgif-dev 23 | - g++-4.8 24 | env: 25 | - CXX=g++-4.8 26 | before_install: 27 | - if [[ $TRAVIS_NODE_VERSION == 0.8 ]]; then npm install -g npm@1.4.28; fi 28 | - npm explore npm -g -- npm install node-gyp@latest 29 | after_script: 30 | - npm run benchmark 31 | sudo: false 32 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'conditions': [ 3 | ['OS=="win"', { 4 | 'variables': { 5 | 'GTK_Root%': 'C:/GTK', # Set the location of GTK all-in-one bundle 6 | 'with_jpeg%': 'false', 7 | 'with_gif%': 'false', 8 | 'with_pango%': 'false', 9 | 'with_freetype%': 'false' 10 | } 11 | }, { # 'OS!="win"' 12 | 'variables': { 13 | 'with_jpeg%': ' 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var Canvas = require('./bindings') 14 | , Image = Canvas.Image; 15 | 16 | /** 17 | * Src setter. 18 | * 19 | * - convert data uri to `Buffer` 20 | * 21 | * @param {String|Buffer} val filename, buffer, data uri 22 | * @api public 23 | */ 24 | 25 | Image.prototype.__defineSetter__('src', function(val){ 26 | if ('string' == typeof val && 0 == val.indexOf('data:')) { 27 | val = val.slice(val.indexOf(',') + 1); 28 | this.source = new Buffer(val, 'base64'); 29 | } else { 30 | this.source = val; 31 | } 32 | }); 33 | 34 | /** 35 | * Src getter. 36 | * 37 | * TODO: return buffer 38 | * 39 | * @api public 40 | */ 41 | 42 | Image.prototype.__defineGetter__('src', function(){ 43 | return this.source; 44 | }); 45 | 46 | /** 47 | * Inspect image. 48 | * 49 | * TODO: indicate that the .src was a buffer, data uri etc 50 | * 51 | * @return {String} 52 | * @api public 53 | */ 54 | 55 | Image.prototype.inspect = function(){ 56 | return '[Image' 57 | + (this.complete ? ':' + this.width + 'x' + this.height : '') 58 | + (this.src ? ' ' + this.src : '') 59 | + (this.complete ? ' complete' : '') 60 | + ']'; 61 | }; 62 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/lib/jpegstream.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * Canvas - JPEGStream 5 | * Copyright (c) 2010 LearnBoost 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var Stream = require('stream').Stream; 14 | 15 | /** 16 | * Initialize a `JPEGStream` with the given `canvas`. 17 | * 18 | * "data" events are emitted with `Buffer` chunks, once complete the 19 | * "end" event is emitted. The following example will stream to a file 20 | * named "./my.jpeg". 21 | * 22 | * var out = fs.createWriteStream(__dirname + '/my.jpeg') 23 | * , stream = canvas.createJPEGStream(); 24 | * 25 | * stream.pipe(out); 26 | * 27 | * @param {Canvas} canvas 28 | * @param {Boolean} sync 29 | * @api public 30 | */ 31 | 32 | var JPEGStream = module.exports = function JPEGStream(canvas, options, sync) { 33 | var self = this 34 | , method = sync 35 | ? 'streamJPEGSync' 36 | : 'streamJPEG'; 37 | this.options = options; 38 | this.sync = sync; 39 | this.canvas = canvas; 40 | this.readable = true; 41 | // TODO: implement async 42 | if ('streamJPEG' == method) method = 'streamJPEGSync'; 43 | process.nextTick(function(){ 44 | canvas[method](options.bufsize, options.quality, options.progressive, function(err, chunk){ 45 | if (err) { 46 | self.emit('error', err); 47 | self.readable = false; 48 | } else if (chunk) { 49 | self.emit('data', chunk); 50 | } else { 51 | self.emit('end'); 52 | self.readable = false; 53 | } 54 | }); 55 | }); 56 | }; 57 | 58 | /** 59 | * Inherit from `EventEmitter`. 60 | */ 61 | 62 | JPEGStream.prototype.__proto__ = Stream.prototype; 63 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/lib/pngstream.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /*! 4 | * Canvas - PNGStream 5 | * Copyright (c) 2010 LearnBoost 6 | * MIT Licensed 7 | */ 8 | 9 | /** 10 | * Module dependencies. 11 | */ 12 | 13 | var Stream = require('stream').Stream; 14 | 15 | /** 16 | * Initialize a `PNGStream` with the given `canvas`. 17 | * 18 | * "data" events are emitted with `Buffer` chunks, once complete the 19 | * "end" event is emitted. The following example will stream to a file 20 | * named "./my.png". 21 | * 22 | * var out = fs.createWriteStream(__dirname + '/my.png') 23 | * , stream = canvas.createPNGStream(); 24 | * 25 | * stream.pipe(out); 26 | * 27 | * @param {Canvas} canvas 28 | * @param {Boolean} sync 29 | * @api public 30 | */ 31 | 32 | var PNGStream = module.exports = function PNGStream(canvas, sync) { 33 | var self = this 34 | , method = sync 35 | ? 'streamPNGSync' 36 | : 'streamPNG'; 37 | this.sync = sync; 38 | this.canvas = canvas; 39 | this.readable = true; 40 | // TODO: implement async 41 | if ('streamPNG' == method) method = 'streamPNGSync'; 42 | process.nextTick(function(){ 43 | canvas[method](function(err, chunk, len){ 44 | if (err) { 45 | self.emit('error', err); 46 | self.readable = false; 47 | } else if (len) { 48 | self.emit('data', chunk, len); 49 | } else { 50 | self.emit('end'); 51 | self.readable = false; 52 | } 53 | }); 54 | }); 55 | }; 56 | 57 | /** 58 | * Inherit from `EventEmitter`. 59 | */ 60 | 61 | PNGStream.prototype.__proto__ = Stream.prototype; 62 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright (c) 2016 NAN contributors 5 | ----------------------------------- 6 | 7 | *NAN contributors listed at * 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/asyncworker.md: -------------------------------------------------------------------------------- 1 | ## Asynchronous work helpers 2 | 3 | `Nan::AsyncWorker` and `Nan::AsyncProgressWorker` are helper classes that make working with asynchronous code easier. 4 | 5 | - Nan::AsyncWorker 6 | - Nan::AsyncProgressWorker 7 | - Nan::AsyncQueueWorker 8 | 9 | 10 | ### Nan::AsyncWorker 11 | 12 | `Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. 13 | 14 | Definition: 15 | 16 | ```c++ 17 | class AsyncWorker { 18 | public: 19 | explicit AsyncWorker(Callback *callback_); 20 | 21 | virtual ~AsyncWorker(); 22 | 23 | virtual void WorkComplete(); 24 | 25 | void SaveToPersistent(const char *key, const v8::Local &value); 26 | 27 | void SaveToPersistent(const v8::Local &key, 28 | const v8::Local &value); 29 | 30 | void SaveToPersistent(uint32_t index, 31 | const v8::Local &value); 32 | 33 | v8::Local GetFromPersistent(const char *key) const; 34 | 35 | v8::Local GetFromPersistent(const v8::Local &key) const; 36 | 37 | v8::Local GetFromPersistent(uint32_t index) const; 38 | 39 | virtual void Execute() = 0; 40 | 41 | uv_work_t request; 42 | 43 | virtual void Destroy(); 44 | 45 | protected: 46 | Persistent persistentHandle; 47 | 48 | Callback *callback; 49 | 50 | virtual void HandleOKCallback(); 51 | 52 | virtual void HandleErrorCallback(); 53 | 54 | void SetErrorMessage(const char *msg); 55 | 56 | const char* ErrorMessage(); 57 | }; 58 | ``` 59 | 60 | 61 | ### Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker 62 | 63 | `Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. 64 | 65 | Previously the definiton of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `` for compatibility. 66 | 67 | Definition: 68 | 69 | ```c++ 70 | template 71 | class AsyncProgressWorkerBase : public AsyncWorker { 72 | public: 73 | explicit AsyncProgressWorker(Callback *callback_); 74 | 75 | virtual ~AsyncProgressWorker(); 76 | 77 | void WorkProgress(); 78 | 79 | class ExecutionProgress { 80 | public: 81 | void Signal() const; 82 | void Send(const T* data, size_t size) const; 83 | }; 84 | 85 | virtual void Execute(const ExecutionProgress& progress) = 0; 86 | 87 | virtual void HandleProgressCallback(const T *data, size_t size) = 0; 88 | 89 | virtual void Destroy(); 90 | 91 | typedef AsyncProgressWorkerBase AsyncProgressWorker; 92 | ``` 93 | 94 | 95 | ### Nan::AsyncQueueWorker 96 | 97 | `Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. 98 | 99 | Definition: 100 | 101 | ```c++ 102 | void AsyncQueueWorker(AsyncWorker *); 103 | ``` 104 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/buffers.md: -------------------------------------------------------------------------------- 1 | ## Buffers 2 | 3 | NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. 4 | 5 | - Nan::NewBuffer() 6 | - Nan::CopyBuffer() 7 | - Nan::FreeCallback() 8 | 9 | 10 | ### Nan::NewBuffer() 11 | 12 | Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. 13 | 14 | Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. 15 | When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. 16 | You _must not_ free the memory space manually once you have created a `Buffer` in this way. 17 | 18 | Signature: 19 | 20 | ```c++ 21 | Nan::MaybeLocal Nan::NewBuffer(uint32_t size) 22 | Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) 23 | Nan::MaybeLocal Nan::NewBuffer(char *data, 24 | size_t length, 25 | Nan::FreeCallback callback, 26 | void *hint) 27 | ``` 28 | 29 | 30 | 31 | ### Nan::CopyBuffer() 32 | 33 | Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. 34 | 35 | Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. 36 | 37 | Signature: 38 | 39 | ```c++ 40 | Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) 41 | ``` 42 | 43 | 44 | 45 | ### Nan::FreeCallback() 46 | 47 | A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). 48 | The supplied callback will be invoked when the `Buffer` undergoes garbage collection. 49 | 50 | Signature: 51 | 52 | ```c++ 53 | typedef void (*FreeCallback)(char *data, void *hint); 54 | ``` 55 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/callback.md: -------------------------------------------------------------------------------- 1 | ## Nan::Callback 2 | 3 | `Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. 4 | 5 | - Nan::Callback 6 | 7 | 8 | ### Nan::Callback 9 | 10 | ```c++ 11 | class Callback { 12 | public: 13 | Callback(); 14 | 15 | explicit Callback(const v8::Local &fn); 16 | 17 | ~Callback(); 18 | 19 | bool operator==(const Callback &other) const; 20 | 21 | bool operator!=(const Callback &other) const; 22 | 23 | v8::Local operator*() const; 24 | 25 | v8::Local operator()(v8::Local target, 26 | int argc = 0, 27 | v8::Local argv[] = 0) const; 28 | 29 | v8::Local operator()(int argc = 0, 30 | v8::Local argv[] = 0) const; 31 | 32 | void SetFunction(const v8::Local &fn); 33 | 34 | v8::Local GetFunction() const; 35 | 36 | bool IsEmpty() const; 37 | 38 | void Reset(const v8::Local &fn); 39 | 40 | void Reset(); 41 | 42 | v8::Local Call(v8::Local target, 43 | int argc, 44 | v8::Local argv[]) const; 45 | 46 | v8::Local Call(int argc, v8::Local argv[]) const; 47 | }; 48 | ``` 49 | 50 | Example usage: 51 | 52 | ```c++ 53 | v8::Local function; 54 | Nan::Callback callback(function); 55 | callback.Call(0, 0); 56 | ``` 57 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/converters.md: -------------------------------------------------------------------------------- 1 | ## Converters 2 | 3 | NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. 4 | 5 | - Nan::To() 6 | 7 | 8 | ### Nan::To() 9 | 10 | Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. 11 | 12 | See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. 13 | 14 | Signatures: 15 | 16 | ```c++ 17 | // V8 types 18 | Nan::MaybeLocal Nan::To(v8::Local val); 19 | Nan::MaybeLocal Nan::To(v8::Local val); 20 | Nan::MaybeLocal Nan::To(v8::Local val); 21 | Nan::MaybeLocal Nan::To(v8::Local val); 22 | Nan::MaybeLocal Nan::To(v8::Local val); 23 | Nan::MaybeLocal Nan::To(v8::Local val); 24 | Nan::MaybeLocal Nan::To(v8::Local val); 25 | 26 | // Native types 27 | Nan::Maybe Nan::To(v8::Local val); 28 | Nan::Maybe Nan::To(v8::Local val); 29 | Nan::Maybe Nan::To(v8::Local val); 30 | Nan::Maybe Nan::To(v8::Local val); 31 | Nan::Maybe Nan::To(v8::Local val); 32 | ``` 33 | 34 | ### Example 35 | 36 | ```c++ 37 | v8::Local val; 38 | Nan::MaybeLocal str = Nan::To(val); 39 | Nan::Maybe d = Nan::To(val); 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/new.md: -------------------------------------------------------------------------------- 1 | ## New 2 | 3 | NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. 4 | 5 | - Nan::New() 6 | - Nan::Undefined() 7 | - Nan::Null() 8 | - Nan::True() 9 | - Nan::False() 10 | - Nan::EmptyString() 11 | 12 | 13 | 14 | ### Nan::New() 15 | 16 | `Nan::New()` should be used to instantiate new JavaScript objects. 17 | 18 | Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/io.js-3.0/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation. 19 | 20 | Signatures: 21 | 22 | Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local`. The following types will be contained within a `Nan::MaybeLocal`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`. 23 | 24 | Empty objects: 25 | 26 | ```c++ 27 | Nan::New(); 28 | ``` 29 | 30 | Generic single and multiple-argument: 31 | 32 | ```c++ 33 | Nan::New(A0 arg0); 34 | Nan::New(A0 arg0, A1 arg1); 35 | Nan::New(A0 arg0, A1 arg1, A2 arg2); 36 | Nan::New(A0 arg0, A1 arg1, A2 arg2, A3 arg3); 37 | ``` 38 | 39 | For creating `v8::FunctionTemplate` and `v8::Function` objects: 40 | 41 | _The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._ 42 | 43 | ```c++ 44 | Nan::New(Nan::FunctionCallback callback, 45 | v8::Local data = v8::Local()); 46 | Nan::New(Nan::FunctionCallback callback, 47 | v8::Local data = v8::Local(), 48 | A2 a2 = A2()); 49 | ``` 50 | 51 | Native number types: 52 | 53 | ```c++ 54 | v8::Local Nan::New(bool value); 55 | v8::Local Nan::New(int32_t value); 56 | v8::Local Nan::New(uint32_t value); 57 | v8::Local Nan::New(double value); 58 | ``` 59 | 60 | String types: 61 | 62 | ```c++ 63 | Nan::MaybeLocal Nan::New(std::string const& value); 64 | Nan::MaybeLocal Nan::New(const char * value, int length); 65 | Nan::MaybeLocal Nan::New(const char * value); 66 | Nan::MaybeLocal Nan::New(const uint16_t * value); 67 | Nan::MaybeLocal Nan::New(const uint16_t * value, int length); 68 | ``` 69 | 70 | Specialized types: 71 | 72 | ```c++ 73 | v8::Local Nan::New(v8::String::ExternalStringResource * value); 74 | v8::Local Nan::New(Nan::ExternalOneByteStringResource * value); 75 | v8::Local Nan::New(v8::Local pattern, v8::RegExp::Flags flags); 76 | ``` 77 | 78 | Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/io.js-3.0/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8. 79 | 80 | 81 | 82 | ### Nan::Undefined() 83 | 84 | A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8. 85 | 86 | Signature: 87 | 88 | ```c++ 89 | v8::Local Nan::Undefined() 90 | ``` 91 | 92 | 93 | ### Nan::Null() 94 | 95 | A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8. 96 | 97 | Signature: 98 | 99 | ```c++ 100 | v8::Local Nan::Null() 101 | ``` 102 | 103 | 104 | ### Nan::True() 105 | 106 | A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8. 107 | 108 | Signature: 109 | 110 | ```c++ 111 | v8::Local Nan::True() 112 | ``` 113 | 114 | 115 | ### Nan::False() 116 | 117 | A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8. 118 | 119 | Signature: 120 | 121 | ```c++ 122 | v8::Local Nan::False() 123 | ``` 124 | 125 | 126 | ### Nan::EmptyString() 127 | 128 | Call [`v8::String::Empty`](https://v8docs.nodesource.com/io.js-3.0/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8. 129 | 130 | Signature: 131 | 132 | ```c++ 133 | v8::Local Nan::EmptyString() 134 | ``` 135 | 136 | 137 | 138 | ### Nan::NewOneByteString() 139 | 140 | An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/io.js-3.0/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data. 141 | 142 | Signature: 143 | 144 | ```c++ 145 | Nan::MaybeLocal Nan::NewOneByteString(const uint8_t * value, 146 | int length = -1) 147 | ``` 148 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/node_misc.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous Node Helpers 2 | 3 | - Nan::MakeCallback() 4 | - NAN_MODULE_INIT() 5 | - Nan::Export() 6 | 7 | 8 | 9 | ### Nan::MakeCallback() 10 | 11 | Wrappers around `node::MakeCallback()` providing a consistent API across all supported versions of Node. 12 | 13 | Use `MakeCallback()` rather than using `v8::Function#Call()` directly in order to properly process internal Node functionality including domains, async hooks, the microtask queue, and other debugging functionality. 14 | 15 | Signatures: 16 | 17 | ```c++ 18 | v8::Local Nan::MakeCallback(v8::Local target, 19 | v8::Local func, 20 | int argc, 21 | v8::Local* argv); 22 | v8::Local Nan::MakeCallback(v8::Local target, 23 | v8::Local symbol, 24 | int argc, 25 | v8::Local* argv); 26 | v8::Local Nan::MakeCallback(v8::Local target, 27 | const char* method, 28 | int argc, 29 | v8::Local* argv); 30 | ``` 31 | 32 | 33 | 34 | ### NAN_MODULE_INIT() 35 | 36 | Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. 37 | 38 | See example below. 39 | 40 | 41 | ### Nan::Export() 42 | 43 | A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. 44 | 45 | Signature: 46 | 47 | ```c++ 48 | void Export(v8::Local target, const char *name, Nan::FunctionCallback f) 49 | ``` 50 | 51 | Also available as the shortcut `NAN_EXPORT` macro. 52 | 53 | Example: 54 | 55 | ```c++ 56 | NAN_METHOD(Foo) { 57 | ... 58 | } 59 | 60 | NAN_MODULE_INIT(Init) { 61 | NAN_EXPORT(target, Foo); 62 | } 63 | ``` 64 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/scopes.md: -------------------------------------------------------------------------------- 1 | ## Scopes 2 | 3 | A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. 4 | 5 | A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. 6 | 7 | The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. 8 | 9 | - Nan::HandleScope 10 | - Nan::EscapableHandleScope 11 | 12 | Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). 13 | 14 | 15 | ### Nan::HandleScope 16 | 17 | A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/io.js-3.0/d3/d95/classv8_1_1_handle_scope.html). 18 | 19 | Definition: 20 | 21 | ```c++ 22 | class Nan::HandleScope { 23 | public: 24 | Nan::HandleScope(); 25 | static int NumberOfHandles(); 26 | }; 27 | ``` 28 | 29 | Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. 30 | 31 | Example: 32 | 33 | ```c++ 34 | // new object is created, it needs a new scope: 35 | void Pointless() { 36 | Nan::HandleScope scope; 37 | v8::Local obj = Nan::New(); 38 | } 39 | 40 | // JavaScript-accessible method already has a HandleScope 41 | NAN_METHOD(Pointless2) { 42 | v8::Local obj = Nan::New(); 43 | } 44 | ``` 45 | 46 | 47 | ### Nan::EscapableHandleScope 48 | 49 | Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. 50 | 51 | Definition: 52 | 53 | ```c++ 54 | class Nan::EscapableHandleScope { 55 | public: 56 | Nan::EscapableHandleScope(); 57 | static int NumberOfHandles(); 58 | template v8::Local Escape(v8::Local value); 59 | } 60 | ``` 61 | 62 | Use `Escape(value)` to return the object. 63 | 64 | Example: 65 | 66 | ```c++ 67 | v8::Local EmptyObj() { 68 | Nan::EscapableHandleScope scope; 69 | v8::Local obj = Nan::New(); 70 | return scope.Escape(obj); 71 | } 72 | ``` 73 | 74 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/script.md: -------------------------------------------------------------------------------- 1 | ## Script 2 | 3 | NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. 4 | 5 | - Nan::CompileScript() 6 | - Nan::RunScript() 7 | 8 | 9 | 10 | ### Nan::CompileScript() 11 | 12 | A wrapper around [`v8::Script::Compile()`](https://v8docs.nodesource.com/io.js-3.0/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). 13 | 14 | Note that `Nan::BoundScript` is an alias for `v8::Script`. 15 | 16 | Signature: 17 | 18 | ```c++ 19 | Nan::MaybeLocal Nan::CompileScript( 20 | v8::Local s, 21 | const v8::ScriptOrigin& origin); 22 | Nan::MaybeLocal Nan::CompileScript(v8::Local s); 23 | ``` 24 | 25 | 26 | 27 | ### Nan::RunScript() 28 | 29 | Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. 30 | 31 | Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. 32 | 33 | Signature: 34 | 35 | ```c++ 36 | Nan::MaybeLocal Nan::RunScript(v8::Local script) 37 | Nan::MaybeLocal Nan::RunScript(v8::Local script) 38 | ``` 39 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/string_bytes.md: -------------------------------------------------------------------------------- 1 | ## Strings & Bytes 2 | 3 | Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. 4 | 5 | - Nan::Encoding 6 | - Nan::Encode() 7 | - Nan::DecodeBytes() 8 | - Nan::DecodeWrite() 9 | 10 | 11 | 12 | ### Nan::Encoding 13 | 14 | An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. 15 | 16 | Definition: 17 | 18 | ```c++ 19 | enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } 20 | ``` 21 | 22 | 23 | 24 | ### Nan::Encode() 25 | 26 | A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. 27 | 28 | Signature: 29 | 30 | ```c++ 31 | v8::Local Nan::Encode(const void *buf, 32 | size_t len, 33 | enum Nan::Encoding encoding = BINARY); 34 | ``` 35 | 36 | 37 | 38 | ### Nan::DecodeBytes() 39 | 40 | A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. 41 | 42 | Signature: 43 | 44 | ```c++ 45 | ssize_t Nan::DecodeBytes(v8::Local val, 46 | enum Nan::Encoding encoding = BINARY); 47 | ``` 48 | 49 | 50 | 51 | ### Nan::DecodeWrite() 52 | 53 | A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. 54 | 55 | Signature: 56 | 57 | ```c++ 58 | ssize_t Nan::DecodeWrite(char *buf, 59 | size_t len, 60 | v8::Local val, 61 | enum Nan::Encoding encoding = BINARY); 62 | ``` 63 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/doc/v8_misc.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous V8 Helpers 2 | 3 | - Nan::Utf8String 4 | - Nan::GetCurrentContext() 5 | - Nan::SetIsolateData() 6 | - Nan::GetIsolateData() 7 | - Nan::TypedArrayContents 8 | 9 | 10 | 11 | ### Nan::Utf8String 12 | 13 | Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. 14 | 15 | An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/io.js-3.0/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. 16 | 17 | Definition: 18 | 19 | ```c++ 20 | class Nan::Utf8String { 21 | public: 22 | Nan::Utf8String(v8::Local from); 23 | 24 | int length() const; 25 | 26 | char* operator*(); 27 | const char* operator*() const; 28 | }; 29 | ``` 30 | 31 | 32 | ### Nan::GetCurrentContext() 33 | 34 | A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/io.js-3.0/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. 35 | 36 | Signature: 37 | 38 | ```c++ 39 | v8::Local Nan::GetCurrentContext() 40 | ``` 41 | 42 | 43 | ### Nan::SetIsolateData() 44 | 45 | A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/io.js-3.0/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). 46 | 47 | Signature: 48 | 49 | ```c++ 50 | void Nan::SetIsolateData(v8::Isolate *isolate, T *data) 51 | ``` 52 | 53 | 54 | 55 | ### Nan::GetIsolateData() 56 | 57 | A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/io.js-3.0/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). 58 | 59 | Signature: 60 | 61 | ```c++ 62 | T *Nan::GetIsolateData(v8::Isolate *isolate) 63 | ``` 64 | 65 | 66 | ### Nan::TypedArrayContents 67 | 68 | A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. 69 | 70 | Note that you must store a reference to the `array` object while you are accessing its contents. 71 | 72 | Definition: 73 | 74 | ```c++ 75 | template 76 | class Nan::TypedArrayContents { 77 | public: 78 | TypedArrayContents(v8::Local array); 79 | 80 | size_t length() const; 81 | 82 | T* const operator*(); 83 | const T* const operator*() const; 84 | }; 85 | ``` 86 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/include_dirs.js: -------------------------------------------------------------------------------- 1 | console.log(require('path').relative('.', __dirname)); 2 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_callbacks.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CALLBACKS_H_ 10 | #define NAN_CALLBACKS_H_ 11 | 12 | template class FunctionCallbackInfo; 13 | template class PropertyCallbackInfo; 14 | template class Global; 15 | 16 | typedef void(*FunctionCallback)(const FunctionCallbackInfo&); 17 | typedef void(*GetterCallback) 18 | (v8::Local, const PropertyCallbackInfo&); 19 | typedef void(*SetterCallback)( 20 | v8::Local, 21 | v8::Local, 22 | const PropertyCallbackInfo&); 23 | typedef void(*PropertyGetterCallback)( 24 | v8::Local, 25 | const PropertyCallbackInfo&); 26 | typedef void(*PropertySetterCallback)( 27 | v8::Local, 28 | v8::Local, 29 | const PropertyCallbackInfo&); 30 | typedef void(*PropertyEnumeratorCallback) 31 | (const PropertyCallbackInfo&); 32 | typedef void(*PropertyDeleterCallback)( 33 | v8::Local, 34 | const PropertyCallbackInfo&); 35 | typedef void(*PropertyQueryCallback)( 36 | v8::Local, 37 | const PropertyCallbackInfo&); 38 | typedef void(*IndexGetterCallback)( 39 | uint32_t, 40 | const PropertyCallbackInfo&); 41 | typedef void(*IndexSetterCallback)( 42 | uint32_t, 43 | v8::Local, 44 | const PropertyCallbackInfo&); 45 | typedef void(*IndexEnumeratorCallback) 46 | (const PropertyCallbackInfo&); 47 | typedef void(*IndexDeleterCallback)( 48 | uint32_t, 49 | const PropertyCallbackInfo&); 50 | typedef void(*IndexQueryCallback)( 51 | uint32_t, 52 | const PropertyCallbackInfo&); 53 | 54 | namespace imp { 55 | typedef v8::Local Sig; 56 | 57 | static const int kDataIndex = 0; 58 | 59 | static const int kFunctionIndex = 1; 60 | static const int kFunctionFieldCount = 2; 61 | 62 | static const int kGetterIndex = 1; 63 | static const int kSetterIndex = 2; 64 | static const int kAccessorFieldCount = 3; 65 | 66 | static const int kPropertyGetterIndex = 1; 67 | static const int kPropertySetterIndex = 2; 68 | static const int kPropertyEnumeratorIndex = 3; 69 | static const int kPropertyDeleterIndex = 4; 70 | static const int kPropertyQueryIndex = 5; 71 | static const int kPropertyFieldCount = 6; 72 | 73 | static const int kIndexPropertyGetterIndex = 1; 74 | static const int kIndexPropertySetterIndex = 2; 75 | static const int kIndexPropertyEnumeratorIndex = 3; 76 | static const int kIndexPropertyDeleterIndex = 4; 77 | static const int kIndexPropertyQueryIndex = 5; 78 | static const int kIndexPropertyFieldCount = 6; 79 | 80 | } // end of namespace imp 81 | 82 | #if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION 83 | # include "nan_callbacks_12_inl.h" // NOLINT(build/include) 84 | #else 85 | # include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) 86 | #endif 87 | 88 | #endif // NAN_CALLBACKS_H_ 89 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_converters.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_H_ 10 | #define NAN_CONVERTERS_H_ 11 | 12 | namespace imp { 13 | template struct ToFactoryBase { 14 | typedef MaybeLocal return_t; 15 | }; 16 | template struct ValueFactoryBase { typedef Maybe return_t; }; 17 | 18 | template struct ToFactory; 19 | 20 | #define X(TYPE) \ 21 | template<> \ 22 | struct ToFactory : ToFactoryBase { \ 23 | static inline return_t convert(v8::Local val); \ 24 | }; 25 | 26 | X(Boolean) 27 | X(Number) 28 | X(String) 29 | X(Object) 30 | X(Integer) 31 | X(Uint32) 32 | X(Int32) 33 | 34 | #undef X 35 | 36 | #define X(TYPE) \ 37 | template<> \ 38 | struct ToFactory : ValueFactoryBase { \ 39 | static inline return_t convert(v8::Local val); \ 40 | }; 41 | 42 | X(bool) 43 | X(double) 44 | X(int64_t) 45 | X(uint32_t) 46 | X(int32_t) 47 | 48 | #undef X 49 | } // end of namespace imp 50 | 51 | template 52 | inline 53 | typename imp::ToFactory::return_t To(v8::Local val) { 54 | return imp::ToFactory::convert(val); 55 | } 56 | 57 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 58 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 59 | # include "nan_converters_43_inl.h" 60 | #else 61 | # include "nan_converters_pre_43_inl.h" 62 | #endif 63 | 64 | #endif // NAN_CONVERTERS_H_ 65 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_converters_43_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_43_INL_H_ 10 | #define NAN_CONVERTERS_43_INL_H_ 11 | 12 | #define X(TYPE) \ 13 | imp::ToFactory::return_t \ 14 | imp::ToFactory::convert(v8::Local val) { \ 15 | return val->To ## TYPE(GetCurrentContext()); \ 16 | } 17 | 18 | X(Boolean) 19 | X(Number) 20 | X(String) 21 | X(Object) 22 | X(Integer) 23 | X(Uint32) 24 | X(Int32) 25 | 26 | #undef X 27 | 28 | #define X(TYPE, NAME) \ 29 | imp::ToFactory::return_t \ 30 | imp::ToFactory::convert(v8::Local val) { \ 31 | return val->NAME ## Value(GetCurrentContext()); \ 32 | } 33 | 34 | X(bool, Boolean) 35 | X(double, Number) 36 | X(int64_t, Integer) 37 | X(uint32_t, Uint32) 38 | X(int32_t, Int32) 39 | 40 | #undef X 41 | 42 | #endif // NAN_CONVERTERS_43_INL_H_ 43 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_converters_pre_43_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_CONVERTERS_PRE_43_INL_H_ 10 | #define NAN_CONVERTERS_PRE_43_INL_H_ 11 | 12 | #define X(TYPE) \ 13 | imp::ToFactory::return_t \ 14 | imp::ToFactory::convert(v8::Local val) { \ 15 | return MaybeLocal(val->To ## TYPE()); \ 16 | } 17 | 18 | X(Boolean) 19 | X(Number) 20 | X(String) 21 | X(Object) 22 | X(Integer) 23 | X(Uint32) 24 | X(Int32) 25 | 26 | #undef X 27 | 28 | #define X(TYPE, NAME) \ 29 | imp::ToFactory::return_t \ 30 | imp::ToFactory::convert(v8::Local val) { \ 31 | return Just(val->NAME ##Value()); \ 32 | } 33 | 34 | X(bool, Boolean) 35 | X(double, Number) 36 | X(int64_t, Integer) 37 | X(uint32_t, Uint32) 38 | X(int32_t, Int32) 39 | 40 | #undef X 41 | 42 | #endif // NAN_CONVERTERS_PRE_43_INL_H_ 43 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_object_wrap.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_OBJECT_WRAP_H_ 10 | #define NAN_OBJECT_WRAP_H_ 11 | 12 | class ObjectWrap { 13 | public: 14 | ObjectWrap() { 15 | refs_ = 0; 16 | } 17 | 18 | 19 | virtual ~ObjectWrap() { 20 | if (persistent().IsEmpty()) { 21 | return; 22 | } 23 | 24 | assert(persistent().IsNearDeath()); 25 | persistent().ClearWeak(); 26 | persistent().Reset(); 27 | } 28 | 29 | 30 | template 31 | static inline T* Unwrap(v8::Local object) { 32 | assert(!object.IsEmpty()); 33 | assert(object->InternalFieldCount() > 0); 34 | // Cast to ObjectWrap before casting to T. A direct cast from void 35 | // to T won't work right when T has more than one base class. 36 | void* ptr = GetInternalFieldPointer(object, 0); 37 | ObjectWrap* wrap = static_cast(ptr); 38 | return static_cast(wrap); 39 | } 40 | 41 | 42 | inline v8::Local handle() const { 43 | return New(handle_); 44 | } 45 | 46 | 47 | inline Persistent& persistent() { 48 | return handle_; 49 | } 50 | 51 | 52 | protected: 53 | inline void Wrap(v8::Local object) { 54 | assert(persistent().IsEmpty()); 55 | assert(object->InternalFieldCount() > 0); 56 | SetInternalFieldPointer(object, 0, this); 57 | persistent().Reset(object); 58 | MakeWeak(); 59 | } 60 | 61 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 62 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 63 | 64 | inline void MakeWeak() { 65 | persistent().v8::PersistentBase::SetWeak( 66 | this, WeakCallback, v8::WeakCallbackType::kParameter); 67 | persistent().MarkIndependent(); 68 | } 69 | 70 | #elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION 71 | 72 | inline void MakeWeak() { 73 | persistent().v8::PersistentBase::SetWeak(this, WeakCallback); 74 | persistent().MarkIndependent(); 75 | } 76 | 77 | #else 78 | 79 | inline void MakeWeak() { 80 | persistent().persistent.MakeWeak(this, WeakCallback); 81 | persistent().MarkIndependent(); 82 | } 83 | 84 | #endif 85 | 86 | /* Ref() marks the object as being attached to an event loop. 87 | * Refed objects will not be garbage collected, even if 88 | * all references are lost. 89 | */ 90 | virtual void Ref() { 91 | assert(!persistent().IsEmpty()); 92 | persistent().ClearWeak(); 93 | refs_++; 94 | } 95 | 96 | /* Unref() marks an object as detached from the event loop. This is its 97 | * default state. When an object with a "weak" reference changes from 98 | * attached to detached state it will be freed. Be careful not to access 99 | * the object after making this call as it might be gone! 100 | * (A "weak reference" means an object that only has a 101 | * persistant handle.) 102 | * 103 | * DO NOT CALL THIS FROM DESTRUCTOR 104 | */ 105 | virtual void Unref() { 106 | assert(!persistent().IsEmpty()); 107 | assert(!persistent().IsWeak()); 108 | assert(refs_ > 0); 109 | if (--refs_ == 0) 110 | MakeWeak(); 111 | } 112 | 113 | int refs_; // ro 114 | 115 | private: 116 | NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap) 117 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 118 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 119 | 120 | static void 121 | WeakCallback(v8::WeakCallbackInfo const& info) { 122 | ObjectWrap* wrap = info.GetParameter(); 123 | assert(wrap->refs_ == 0); 124 | assert(wrap->handle_.IsNearDeath()); 125 | wrap->handle_.Reset(); 126 | delete wrap; 127 | } 128 | 129 | #elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION 130 | 131 | static void 132 | WeakCallback(v8::WeakCallbackData const& data) { 133 | ObjectWrap* wrap = data.GetParameter(); 134 | assert(wrap->refs_ == 0); 135 | assert(wrap->handle_.IsNearDeath()); 136 | wrap->handle_.Reset(); 137 | delete wrap; 138 | } 139 | 140 | #else 141 | 142 | static void WeakCallback(v8::Persistent value, void *data) { 143 | ObjectWrap *wrap = static_cast(data); 144 | assert(wrap->refs_ == 0); 145 | assert(wrap->handle_.IsNearDeath()); 146 | wrap->handle_.Reset(); 147 | delete wrap; 148 | } 149 | 150 | #endif 151 | Persistent handle_; 152 | }; 153 | 154 | 155 | #endif // NAN_OBJECT_WRAP_H_ 156 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_persistent_12_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_PERSISTENT_12_INL_H_ 10 | #define NAN_PERSISTENT_12_INL_H_ 11 | 12 | template class Persistent : 13 | public v8::Persistent { 14 | public: 15 | inline Persistent() : v8::Persistent() {} 16 | 17 | template inline Persistent(v8::Local that) : 18 | v8::Persistent(v8::Isolate::GetCurrent(), that) {} 19 | 20 | template 21 | inline Persistent(const v8::Persistent &that) : 22 | v8::Persistent(v8::Isolate::GetCurrent(), that) {} 23 | 24 | inline void Reset() { v8::PersistentBase::Reset(); } 25 | 26 | template 27 | inline void Reset(const v8::Local &other) { 28 | v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); 29 | } 30 | 31 | template 32 | inline void Reset(const v8::PersistentBase &other) { 33 | v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); 34 | } 35 | 36 | template 37 | inline void SetWeak( 38 | P *parameter 39 | , typename WeakCallbackInfo

::Callback callback 40 | , WeakCallbackType type); 41 | 42 | private: 43 | inline T *operator*() const { return *PersistentBase::persistent; } 44 | 45 | template 46 | inline void Copy(const Persistent &that) { 47 | TYPE_CHECK(T, S); 48 | 49 | this->Reset(); 50 | 51 | if (!that.IsEmpty()) { 52 | this->Reset(that); 53 | M::Copy(that, this); 54 | } 55 | } 56 | }; 57 | 58 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 59 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 60 | template 61 | class Global : public v8::Global { 62 | public: 63 | inline Global() : v8::Global() {} 64 | 65 | template inline Global(v8::Local that) : 66 | v8::Global(v8::Isolate::GetCurrent(), that) {} 67 | 68 | template 69 | inline Global(const v8::PersistentBase &that) : 70 | v8::Global(v8::Isolate::GetCurrent(), that) {} 71 | 72 | inline void Reset() { v8::PersistentBase::Reset(); } 73 | 74 | template 75 | inline void Reset(const v8::Local &other) { 76 | v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); 77 | } 78 | 79 | template 80 | inline void Reset(const v8::PersistentBase &other) { 81 | v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); 82 | } 83 | 84 | template 85 | inline void SetWeak( 86 | P *parameter 87 | , typename WeakCallbackInfo

::Callback callback 88 | , WeakCallbackType type) { 89 | reinterpret_cast*>(this)->SetWeak( 90 | parameter, callback, type); 91 | } 92 | }; 93 | #else 94 | template 95 | class Global : public v8::UniquePersistent { 96 | public: 97 | inline Global() : v8::UniquePersistent() {} 98 | 99 | template inline Global(v8::Local that) : 100 | v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} 101 | 102 | template 103 | inline Global(const v8::PersistentBase &that) : 104 | v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} 105 | 106 | inline void Reset() { v8::PersistentBase::Reset(); } 107 | 108 | template 109 | inline void Reset(const v8::Local &other) { 110 | v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); 111 | } 112 | 113 | template 114 | inline void Reset(const v8::PersistentBase &other) { 115 | v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); 116 | } 117 | 118 | template 119 | inline void SetWeak( 120 | P *parameter 121 | , typename WeakCallbackInfo

::Callback callback 122 | , WeakCallbackType type) { 123 | reinterpret_cast*>(this)->SetWeak( 124 | parameter, callback, type); 125 | } 126 | }; 127 | #endif 128 | 129 | #endif // NAN_PERSISTENT_12_INL_H_ 130 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_persistent_pre_12_inl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_PERSISTENT_PRE_12_INL_H_ 10 | #define NAN_PERSISTENT_PRE_12_INL_H_ 11 | 12 | template 13 | class PersistentBase { 14 | v8::Persistent persistent; 15 | template 16 | friend v8::Local New(const PersistentBase &p); 17 | template 18 | friend v8::Local New(const Persistent &p); 19 | template 20 | friend v8::Local New(const Global &p); 21 | template friend class ReturnValue; 22 | 23 | public: 24 | inline PersistentBase() : 25 | persistent() {} 26 | 27 | inline void Reset() { 28 | persistent.Dispose(); 29 | persistent.Clear(); 30 | } 31 | 32 | template 33 | inline void Reset(const v8::Local &other) { 34 | TYPE_CHECK(T, S); 35 | 36 | if (!persistent.IsEmpty()) { 37 | persistent.Dispose(); 38 | } 39 | 40 | if (other.IsEmpty()) { 41 | persistent.Clear(); 42 | } else { 43 | persistent = v8::Persistent::New(other); 44 | } 45 | } 46 | 47 | template 48 | inline void Reset(const PersistentBase &other) { 49 | TYPE_CHECK(T, S); 50 | 51 | if (!persistent.IsEmpty()) { 52 | persistent.Dispose(); 53 | } 54 | 55 | if (other.IsEmpty()) { 56 | persistent.Clear(); 57 | } else { 58 | persistent = v8::Persistent::New(other.persistent); 59 | } 60 | } 61 | 62 | inline bool IsEmpty() const { return persistent.IsEmpty(); } 63 | 64 | inline void Empty() { persistent.Clear(); } 65 | 66 | template 67 | inline bool operator==(const PersistentBase &that) const { 68 | return this->persistent == that.persistent; 69 | } 70 | 71 | template 72 | inline bool operator==(const v8::Local &that) const { 73 | return this->persistent == that; 74 | } 75 | 76 | template 77 | inline bool operator!=(const PersistentBase &that) const { 78 | return !operator==(that); 79 | } 80 | 81 | template 82 | inline bool operator!=(const v8::Local &that) const { 83 | return !operator==(that); 84 | } 85 | 86 | template 87 | inline void SetWeak( 88 | P *parameter 89 | , typename WeakCallbackInfo

::Callback callback 90 | , WeakCallbackType type); 91 | 92 | inline void ClearWeak() { persistent.ClearWeak(); } 93 | 94 | inline void MarkIndependent() { persistent.MarkIndependent(); } 95 | 96 | inline bool IsIndependent() const { return persistent.IsIndependent(); } 97 | 98 | inline bool IsNearDeath() const { return persistent.IsNearDeath(); } 99 | 100 | inline bool IsWeak() const { return persistent.IsWeak(); } 101 | 102 | private: 103 | inline explicit PersistentBase(v8::Persistent that) : 104 | persistent(that) { } 105 | inline explicit PersistentBase(T *val) : persistent(val) {} 106 | template friend class Persistent; 107 | template friend class Global; 108 | friend class ObjectWrap; 109 | }; 110 | 111 | template 112 | class NonCopyablePersistentTraits { 113 | public: 114 | typedef Persistent > 115 | NonCopyablePersistent; 116 | static const bool kResetInDestructor = false; 117 | template 118 | inline static void Copy(const Persistent &source, 119 | NonCopyablePersistent *dest) { 120 | Uncompilable(); 121 | } 122 | 123 | template inline static void Uncompilable() { 124 | TYPE_CHECK(O, v8::Primitive); 125 | } 126 | }; 127 | 128 | template 129 | struct CopyablePersistentTraits { 130 | typedef Persistent > CopyablePersistent; 131 | static const bool kResetInDestructor = true; 132 | template 133 | static inline void Copy(const Persistent &source, 134 | CopyablePersistent *dest) {} 135 | }; 136 | 137 | template class Persistent : 138 | public PersistentBase { 139 | public: 140 | inline Persistent() {} 141 | 142 | template inline Persistent(v8::Handle that) 143 | : PersistentBase(v8::Persistent::New(that)) { 144 | TYPE_CHECK(T, S); 145 | } 146 | 147 | inline Persistent(const Persistent &that) : PersistentBase() { 148 | Copy(that); 149 | } 150 | 151 | template 152 | inline Persistent(const Persistent &that) : 153 | PersistentBase() { 154 | Copy(that); 155 | } 156 | 157 | inline Persistent &operator=(const Persistent &that) { 158 | Copy(that); 159 | return *this; 160 | } 161 | 162 | template 163 | inline Persistent &operator=(const Persistent &that) { 164 | Copy(that); 165 | return *this; 166 | } 167 | 168 | inline ~Persistent() { 169 | if (M::kResetInDestructor) this->Reset(); 170 | } 171 | 172 | private: 173 | inline T *operator*() const { return *PersistentBase::persistent; } 174 | 175 | template 176 | inline void Copy(const Persistent &that) { 177 | TYPE_CHECK(T, S); 178 | 179 | this->Reset(); 180 | 181 | if (!that.IsEmpty()) { 182 | this->persistent = v8::Persistent::New(that.persistent); 183 | M::Copy(that, this); 184 | } 185 | } 186 | }; 187 | 188 | template 189 | class Global : public PersistentBase { 190 | struct RValue { 191 | inline explicit RValue(Global* obj) : object(obj) {} 192 | Global* object; 193 | }; 194 | 195 | public: 196 | inline Global() : PersistentBase(0) { } 197 | 198 | template 199 | inline Global(v8::Local that) 200 | : PersistentBase(v8::Persistent::New(that)) { 201 | TYPE_CHECK(T, S); 202 | } 203 | 204 | template 205 | inline Global(const PersistentBase &that) 206 | : PersistentBase(that) { 207 | TYPE_CHECK(T, S); 208 | } 209 | /** 210 | * Move constructor. 211 | */ 212 | inline Global(RValue rvalue) 213 | : PersistentBase(rvalue.object->persistent) { 214 | rvalue.object->Reset(); 215 | } 216 | inline ~Global() { this->Reset(); } 217 | /** 218 | * Move via assignment. 219 | */ 220 | template 221 | inline Global &operator=(Global rhs) { 222 | TYPE_CHECK(T, S); 223 | this->Reset(rhs.persistent); 224 | rhs.Reset(); 225 | return *this; 226 | } 227 | /** 228 | * Cast operator for moves. 229 | */ 230 | inline operator RValue() { return RValue(this); } 231 | /** 232 | * Pass allows returning uniques from functions, etc. 233 | */ 234 | Global Pass() { return Global(RValue(this)); } 235 | 236 | private: 237 | Global(Global &); 238 | void operator=(Global &); 239 | template friend class ReturnValue; 240 | }; 241 | 242 | #endif // NAN_PERSISTENT_PRE_12_INL_H_ 243 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/nan_typedarray_contents.h: -------------------------------------------------------------------------------- 1 | /********************************************************************* 2 | * NAN - Native Abstractions for Node.js 3 | * 4 | * Copyright (c) 2016 NAN contributors 5 | * 6 | * MIT License 7 | ********************************************************************/ 8 | 9 | #ifndef NAN_TYPEDARRAY_CONTENTS_H_ 10 | #define NAN_TYPEDARRAY_CONTENTS_H_ 11 | 12 | template 13 | class TypedArrayContents { 14 | public: 15 | inline explicit TypedArrayContents(v8::Local from) : 16 | length_(0), data_(NULL) { 17 | 18 | size_t length = 0; 19 | void* data = NULL; 20 | 21 | #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ 22 | (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) 23 | 24 | if (from->IsArrayBufferView()) { 25 | v8::Local array = 26 | v8::Local::Cast(from); 27 | 28 | const size_t byte_length = array->ByteLength(); 29 | const ptrdiff_t byte_offset = array->ByteOffset(); 30 | v8::Local buffer = array->Buffer(); 31 | 32 | length = byte_length / sizeof(T); 33 | data = static_cast(buffer->GetContents().Data()) + byte_offset; 34 | } 35 | 36 | #else 37 | 38 | if (from->IsObject() && !from->IsNull()) { 39 | v8::Local array = v8::Local::Cast(from); 40 | 41 | MaybeLocal buffer = Get(array, 42 | New("buffer").ToLocalChecked()); 43 | MaybeLocal byte_length = Get(array, 44 | New("byteLength").ToLocalChecked()); 45 | MaybeLocal byte_offset = Get(array, 46 | New("byteOffset").ToLocalChecked()); 47 | 48 | if (!buffer.IsEmpty() && 49 | !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && 50 | !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { 51 | data = array->GetIndexedPropertiesExternalArrayData(); 52 | if(data) { 53 | length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); 54 | } 55 | } 56 | } 57 | 58 | #endif 59 | 60 | #if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L 61 | assert(reinterpret_cast(data) % alignof (T) == 0); 62 | #elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) 63 | assert(reinterpret_cast(data) % __alignof(T) == 0); 64 | #else 65 | assert(reinterpret_cast(data) % sizeof (T) == 0); 66 | #endif 67 | 68 | length_ = length; 69 | data_ = static_cast(data); 70 | } 71 | 72 | inline size_t length() const { return length_; } 73 | inline T* operator*() { return data_; } 74 | inline const T* operator*() const { return data_; } 75 | 76 | private: 77 | NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) 78 | 79 | //Disable heap allocation 80 | void *operator new(size_t size); 81 | void operator delete(void *, size_t); 82 | 83 | size_t length_; 84 | T* data_; 85 | }; 86 | 87 | #endif // NAN_TYPEDARRAY_CONTENTS_H_ 88 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nan", 3 | "version": "2.4.0", 4 | "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 6 compatibility", 5 | "main": "include_dirs.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/nodejs/nan.git" 9 | }, 10 | "scripts": { 11 | "test": "tap --gc --stderr test/js/*-test.js", 12 | "rebuild-tests": "node-gyp rebuild --msvs_version=2013 --directory test", 13 | "docs": "doc/.build.sh" 14 | }, 15 | "contributors": [ 16 | { 17 | "name": "Rod Vagg", 18 | "email": "r@va.gg", 19 | "url": "https://github.com/rvagg" 20 | }, 21 | { 22 | "name": "Benjamin Byholm", 23 | "email": "bbyholm@abo.fi", 24 | "url": "https://github.com/kkoopa/" 25 | }, 26 | { 27 | "name": "Trevor Norris", 28 | "email": "trev.norris@gmail.com", 29 | "url": "https://github.com/trevnorris" 30 | }, 31 | { 32 | "name": "Nathan Rajlich", 33 | "email": "nathan@tootallnate.net", 34 | "url": "https://github.com/TooTallNate" 35 | }, 36 | { 37 | "name": "Brett Lawson", 38 | "email": "brett19@gmail.com", 39 | "url": "https://github.com/brett19" 40 | }, 41 | { 42 | "name": "Ben Noordhuis", 43 | "email": "info@bnoordhuis.nl", 44 | "url": "https://github.com/bnoordhuis" 45 | }, 46 | { 47 | "name": "David Siegel", 48 | "email": "david@artcom.de", 49 | "url": "https://github.com/agnat" 50 | } 51 | ], 52 | "devDependencies": { 53 | "bindings": "~1.2.1", 54 | "commander": "^2.8.1", 55 | "glob": "^5.0.14", 56 | "node-gyp": "~3.0.1", 57 | "readable-stream": "^2.1.4", 58 | "tap": "~0.7.1", 59 | "xtend": "~4.0.0" 60 | }, 61 | "license": "MIT", 62 | "bugs": { 63 | "url": "https://github.com/nodejs/nan/issues" 64 | }, 65 | "homepage": "https://github.com/nodejs/nan#readme", 66 | "_id": "nan@2.4.0", 67 | "_shasum": "fb3c59d45fe4effe215f0b890f8adf6eb32d2232", 68 | "_resolved": "https://registry.npmjs.org/nan/-/nan-2.4.0.tgz", 69 | "_from": "nan@>=2.3.2 <3.0.0", 70 | "_npmVersion": "3.3.6", 71 | "_nodeVersion": "5.0.0", 72 | "_npmUser": { 73 | "name": "kkoopa", 74 | "email": "bbyholm@abo.fi" 75 | }, 76 | "dist": { 77 | "shasum": "fb3c59d45fe4effe215f0b890f8adf6eb32d2232", 78 | "tarball": "https://registry.npmjs.org/nan/-/nan-2.4.0.tgz" 79 | }, 80 | "maintainers": [ 81 | { 82 | "name": "rvagg", 83 | "email": "rod@vagg.org" 84 | }, 85 | { 86 | "name": "kkoopa", 87 | "email": "bbyholm@abo.fi" 88 | } 89 | ], 90 | "_npmOperationalInternal": { 91 | "host": "packages-16-east.internal.npmjs.com", 92 | "tmp": "tmp/nan-2.4.0.tgz_1468158679820_0.6951719264034182" 93 | }, 94 | "directories": {}, 95 | "readme": "ERROR: No README data found!" 96 | } 97 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/tools/README.md: -------------------------------------------------------------------------------- 1 | 1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, 2 | false positives and missed opportunities. The input files are rewritten in place. Make sure that 3 | you have backups. You will have to manually review the changes afterwards and do some touchups. 4 | 5 | ```sh 6 | $ tools/1to2.js 7 | 8 | Usage: 1to2 [options] 9 | 10 | Options: 11 | 12 | -h, --help output usage information 13 | -V, --version output the version number 14 | ``` 15 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/node_modules/nan/tools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "1to2", 3 | "version": "1.0.0", 4 | "description": "NAN 1 -> 2 Migration Script", 5 | "main": "1to2.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/nodejs/nan.git" 9 | }, 10 | "contributors": [ 11 | "Benjamin Byholm (https://github.com/kkoopa/)", 12 | "Mathias Küsel (https://github.com/mathiask88/)" 13 | ], 14 | "dependencies": { 15 | "glob": "~5.0.10", 16 | "commander": "~2.8.1" 17 | }, 18 | "license": "MIT" 19 | } 20 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "canvas", 3 | "description": "Canvas graphics API backed by Cairo", 4 | "version": "1.4.0", 5 | "author": { 6 | "name": "TJ Holowaychuk", 7 | "email": "tj@learnboost.com" 8 | }, 9 | "contributors": [ 10 | { 11 | "name": "Nathan Rajlich", 12 | "email": "nathan@tootallnate.net" 13 | }, 14 | { 15 | "name": "Rod Vagg", 16 | "email": "r@va.gg" 17 | }, 18 | { 19 | "name": "Juriy Zaytsev", 20 | "email": "kangax@gmail.com" 21 | } 22 | ], 23 | "keywords": [ 24 | "canvas", 25 | "graphic", 26 | "graphics", 27 | "pixman", 28 | "cairo", 29 | "image", 30 | "images", 31 | "pdf" 32 | ], 33 | "homepage": "https://github.com/Automattic/node-canvas", 34 | "repository": { 35 | "type": "git", 36 | "url": "git://github.com/Automattic/node-canvas.git" 37 | }, 38 | "scripts": { 39 | "prebenchmark": "node-gyp build", 40 | "benchmark": "node benchmarks/run.js", 41 | "pretest": "node-gyp build", 42 | "test": "standard examples/*.js && mocha test/*.test.js", 43 | "pretest-server": "node-gyp build", 44 | "test-server": "node test/server.js", 45 | "install": "node-gyp rebuild" 46 | }, 47 | "dependencies": { 48 | "nan": "^2.3.2" 49 | }, 50 | "devDependencies": { 51 | "body-parser": "^1.13.3", 52 | "express": "^4.13.2", 53 | "jade": "^1.11.0", 54 | "mocha": "*", 55 | "standard": "^7.1.1" 56 | }, 57 | "engines": { 58 | "node": ">=0.8.0" 59 | }, 60 | "main": "./lib/canvas.js", 61 | "license": "MIT", 62 | "gypfile": true, 63 | "gitHead": "b470ce81aabe2a78d7cdd53143de2bee46b966a7", 64 | "bugs": { 65 | "url": "https://github.com/Automattic/node-canvas/issues" 66 | }, 67 | "_id": "canvas@1.4.0", 68 | "_shasum": "5071559b39f8a21964486e6e36b1c42b02392d51", 69 | "_from": "canvas@latest", 70 | "_npmVersion": "3.9.3", 71 | "_nodeVersion": "6.2.1", 72 | "_npmUser": { 73 | "name": "linusu", 74 | "email": "linus@folkdatorn.se" 75 | }, 76 | "dist": { 77 | "shasum": "5071559b39f8a21964486e6e36b1c42b02392d51", 78 | "tarball": "https://registry.npmjs.org/canvas/-/canvas-1.4.0.tgz" 79 | }, 80 | "maintainers": [ 81 | { 82 | "name": "tjholowaychuk", 83 | "email": "tj@vision-media.ca" 84 | }, 85 | { 86 | "name": "kangax", 87 | "email": "kangax@gmail.com" 88 | }, 89 | { 90 | "name": "tootallnate", 91 | "email": "nathan@tootallnate.net" 92 | }, 93 | { 94 | "name": "rauchg", 95 | "email": "rauchg@gmail.com" 96 | }, 97 | { 98 | "name": "domenic", 99 | "email": "d@domenic.me" 100 | }, 101 | { 102 | "name": "linusu", 103 | "email": "linus@folkdatorn.se" 104 | } 105 | ], 106 | "_npmOperationalInternal": { 107 | "host": "packages-16-east.internal.npmjs.com", 108 | "tmp": "tmp/canvas-1.4.0.tgz_1466406871722_0.4620345386210829" 109 | }, 110 | "directories": {}, 111 | "_resolved": "https://registry.npmjs.org/canvas/-/canvas-1.4.0.tgz", 112 | "readme": "ERROR: No README data found!" 113 | } 114 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/Canvas.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Canvas.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_CANVAS_H__ 9 | #define __NODE_CANVAS_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #if HAVE_PANGO 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | #include 23 | 24 | using namespace v8; 25 | using namespace node; 26 | 27 | /* 28 | * Maxmimum states per context. 29 | * TODO: remove/resize 30 | */ 31 | 32 | #ifndef CANVAS_MAX_STATES 33 | #define CANVAS_MAX_STATES 64 34 | #endif 35 | 36 | /* 37 | * Canvas types. 38 | */ 39 | 40 | typedef enum { 41 | CANVAS_TYPE_IMAGE, 42 | CANVAS_TYPE_PDF, 43 | CANVAS_TYPE_SVG 44 | } canvas_type_t; 45 | 46 | /* 47 | * Canvas. 48 | */ 49 | 50 | class Canvas: public Nan::ObjectWrap { 51 | public: 52 | int width; 53 | int height; 54 | canvas_type_t type; 55 | static Nan::Persistent constructor; 56 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 57 | static NAN_METHOD(New); 58 | static NAN_METHOD(ToBuffer); 59 | static NAN_GETTER(GetType); 60 | static NAN_GETTER(GetWidth); 61 | static NAN_GETTER(GetHeight); 62 | static NAN_SETTER(SetWidth); 63 | static NAN_SETTER(SetHeight); 64 | static NAN_METHOD(StreamPNGSync); 65 | static NAN_METHOD(StreamJPEGSync); 66 | static Local Error(cairo_status_t status); 67 | #if NODE_VERSION_AT_LEAST(0, 6, 0) 68 | static void ToBufferAsync(uv_work_t *req); 69 | static void ToBufferAsyncAfter(uv_work_t *req); 70 | #else 71 | static 72 | #if NODE_VERSION_AT_LEAST(0, 5, 4) 73 | void 74 | #else 75 | int 76 | #endif 77 | EIO_ToBuffer(eio_req *req); 78 | static int EIO_AfterToBuffer(eio_req *req); 79 | #endif 80 | 81 | inline bool isPDF(){ return CANVAS_TYPE_PDF == type; } 82 | inline bool isSVG(){ return CANVAS_TYPE_SVG == type; } 83 | inline cairo_surface_t *surface(){ return _surface; } 84 | inline void *closure(){ return _closure; } 85 | inline uint8_t *data(){ return cairo_image_surface_get_data(_surface); } 86 | inline int stride(){ return cairo_image_surface_get_stride(_surface); } 87 | Canvas(int width, int height, canvas_type_t type); 88 | void resurface(Local canvas); 89 | 90 | private: 91 | ~Canvas(); 92 | cairo_surface_t *_surface; 93 | void *_closure; 94 | }; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/CanvasGradient.cc: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Gradient.cc 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #include "color.h" 9 | #include "Canvas.h" 10 | #include "CanvasGradient.h" 11 | 12 | Nan::Persistent Gradient::constructor; 13 | 14 | /* 15 | * Initialize CanvasGradient. 16 | */ 17 | 18 | void 19 | Gradient::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { 20 | Nan::HandleScope scope; 21 | 22 | // Constructor 23 | Local ctor = Nan::New(Gradient::New); 24 | constructor.Reset(ctor); 25 | ctor->InstanceTemplate()->SetInternalFieldCount(1); 26 | ctor->SetClassName(Nan::New("CanvasGradient").ToLocalChecked()); 27 | 28 | // Prototype 29 | Nan::SetPrototypeMethod(ctor, "addColorStop", AddColorStop); 30 | Nan::Set(target, Nan::New("CanvasGradient").ToLocalChecked(), ctor->GetFunction()); 31 | } 32 | 33 | /* 34 | * Initialize a new CanvasGradient. 35 | */ 36 | 37 | NAN_METHOD(Gradient::New) { 38 | if (!info.IsConstructCall()) { 39 | return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); 40 | } 41 | 42 | // Linear 43 | if (4 == info.Length()) { 44 | Gradient *grad = new Gradient( 45 | info[0]->NumberValue() 46 | , info[1]->NumberValue() 47 | , info[2]->NumberValue() 48 | , info[3]->NumberValue()); 49 | grad->Wrap(info.This()); 50 | info.GetReturnValue().Set(info.This()); 51 | return; 52 | } 53 | 54 | // Radial 55 | if (6 == info.Length()) { 56 | Gradient *grad = new Gradient( 57 | info[0]->NumberValue() 58 | , info[1]->NumberValue() 59 | , info[2]->NumberValue() 60 | , info[3]->NumberValue() 61 | , info[4]->NumberValue() 62 | , info[5]->NumberValue()); 63 | grad->Wrap(info.This()); 64 | info.GetReturnValue().Set(info.This()); 65 | return; 66 | } 67 | 68 | return Nan::ThrowTypeError("invalid arguments"); 69 | } 70 | 71 | /* 72 | * Add color stop. 73 | */ 74 | 75 | NAN_METHOD(Gradient::AddColorStop) { 76 | if (!info[0]->IsNumber()) 77 | return Nan::ThrowTypeError("offset required"); 78 | if (!info[1]->IsString()) 79 | return Nan::ThrowTypeError("color string required"); 80 | 81 | Gradient *grad = Nan::ObjectWrap::Unwrap(info.This()); 82 | short ok; 83 | String::Utf8Value str(info[1]); 84 | uint32_t rgba = rgba_from_string(*str, &ok); 85 | 86 | if (ok) { 87 | rgba_t color = rgba_create(rgba); 88 | cairo_pattern_add_color_stop_rgba( 89 | grad->pattern() 90 | , info[0]->NumberValue() 91 | , color.r 92 | , color.g 93 | , color.b 94 | , color.a); 95 | } else { 96 | return Nan::ThrowTypeError("parse color failed"); 97 | } 98 | } 99 | 100 | /* 101 | * Initialize linear gradient. 102 | */ 103 | 104 | Gradient::Gradient(double x0, double y0, double x1, double y1) { 105 | _pattern = cairo_pattern_create_linear(x0, y0, x1, y1); 106 | } 107 | 108 | /* 109 | * Initialize radial gradient. 110 | */ 111 | 112 | Gradient::Gradient(double x0, double y0, double r0, double x1, double y1, double r1) { 113 | _pattern = cairo_pattern_create_radial(x0, y0, r0, x1, y1, r1); 114 | } 115 | 116 | /* 117 | * Destroy the pattern. 118 | */ 119 | 120 | Gradient::~Gradient() { 121 | cairo_pattern_destroy(_pattern); 122 | } 123 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/CanvasGradient.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // CanvasGradient.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_GRADIENT_H__ 9 | #define __NODE_GRADIENT_H__ 10 | 11 | #include "Canvas.h" 12 | 13 | class Gradient: public Nan::ObjectWrap { 14 | public: 15 | static Nan::Persistent constructor; 16 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 17 | static NAN_METHOD(New); 18 | static NAN_METHOD(AddColorStop); 19 | Gradient(double x0, double y0, double x1, double y1); 20 | Gradient(double x0, double y0, double r0, double x1, double y1, double r1); 21 | inline cairo_pattern_t *pattern(){ return _pattern; } 22 | 23 | private: 24 | ~Gradient(); 25 | cairo_pattern_t *_pattern; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/CanvasPattern.cc: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Pattern.cc 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #include "Canvas.h" 9 | #include "Image.h" 10 | #include "CanvasPattern.h" 11 | 12 | Nan::Persistent Pattern::constructor; 13 | 14 | /* 15 | * Initialize CanvasPattern. 16 | */ 17 | 18 | void 19 | Pattern::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { 20 | Nan::HandleScope scope; 21 | 22 | // Constructor 23 | Local ctor = Nan::New(Pattern::New); 24 | constructor.Reset(ctor); 25 | ctor->InstanceTemplate()->SetInternalFieldCount(1); 26 | ctor->SetClassName(Nan::New("CanvasPattern").ToLocalChecked()); 27 | 28 | ctor->InstanceTemplate()->SetInternalFieldCount(1); 29 | ctor->SetClassName(Nan::New("CanvasPattern").ToLocalChecked()); 30 | 31 | // Prototype 32 | Nan::Set(target, Nan::New("CanvasPattern").ToLocalChecked(), ctor->GetFunction()); 33 | } 34 | 35 | /* 36 | * Initialize a new CanvasPattern. 37 | */ 38 | 39 | NAN_METHOD(Pattern::New) { 40 | if (!info.IsConstructCall()) { 41 | return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); 42 | } 43 | 44 | int w = 0 45 | , h = 0; 46 | cairo_surface_t *surface; 47 | 48 | Local obj = info[0]->ToObject(); 49 | 50 | // Image 51 | if (Nan::New(Image::constructor)->HasInstance(obj)) { 52 | Image *img = Nan::ObjectWrap::Unwrap(obj); 53 | if (!img->isComplete()) { 54 | return Nan::ThrowError("Image given has not completed loading"); 55 | } 56 | w = img->width; 57 | h = img->height; 58 | surface = img->surface(); 59 | 60 | // Canvas 61 | } else if (Nan::New(Canvas::constructor)->HasInstance(obj)) { 62 | Canvas *canvas = Nan::ObjectWrap::Unwrap(obj); 63 | w = canvas->width; 64 | h = canvas->height; 65 | surface = canvas->surface(); 66 | 67 | // Invalid 68 | } else { 69 | return Nan::ThrowTypeError("Image or Canvas expected"); 70 | } 71 | 72 | Pattern *pattern = new Pattern(surface,w,h); 73 | pattern->Wrap(info.This()); 74 | info.GetReturnValue().Set(info.This()); 75 | } 76 | 77 | 78 | /* 79 | * Initialize linear gradient. 80 | */ 81 | 82 | Pattern::Pattern(cairo_surface_t *surface, int w, int h): 83 | _width(w), _height(h) { 84 | _pattern = cairo_pattern_create_for_surface(surface); 85 | } 86 | 87 | /* 88 | * Destroy the pattern. 89 | */ 90 | 91 | Pattern::~Pattern() { 92 | cairo_pattern_destroy(_pattern); 93 | } 94 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/CanvasPattern.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // CanvasPattern.h 4 | // 5 | // Copyright (c) 2011 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_PATTERN_H__ 9 | #define __NODE_PATTERN_H__ 10 | 11 | #include "Canvas.h" 12 | 13 | class Pattern: public Nan::ObjectWrap { 14 | public: 15 | static Nan::Persistent constructor; 16 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 17 | static NAN_METHOD(New); 18 | Pattern(cairo_surface_t *surface, int w, int h); 19 | inline cairo_pattern_t *pattern(){ return _pattern; } 20 | 21 | private: 22 | ~Pattern(); 23 | int _width, _height; 24 | // TODO REPEAT/REPEAT_X/REPEAT_Y 25 | cairo_pattern_t *_pattern; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/CanvasRenderingContext2d.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // CanvasRenderingContext2d.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_CONTEXT2D_H__ 9 | #define __NODE_CONTEXT2D_H__ 10 | 11 | #include "color.h" 12 | #include "Canvas.h" 13 | #include "CanvasGradient.h" 14 | 15 | #ifdef HAVE_FREETYPE 16 | #include 17 | #include 18 | #include FT_FREETYPE_H 19 | #endif 20 | 21 | #include 22 | using namespace std; 23 | 24 | typedef enum { 25 | TEXT_DRAW_PATHS, 26 | TEXT_DRAW_GLYPHS 27 | } canvas_draw_mode_t; 28 | 29 | /* 30 | * State struct. 31 | * 32 | * Used in conjunction with Save() / Restore() since 33 | * cairo's gstate maintains only a single source pattern at a time. 34 | */ 35 | 36 | typedef struct { 37 | rgba_t fill; 38 | rgba_t stroke; 39 | cairo_filter_t patternQuality; 40 | cairo_pattern_t *fillPattern; 41 | cairo_pattern_t *strokePattern; 42 | cairo_pattern_t *fillGradient; 43 | cairo_pattern_t *strokeGradient; 44 | float globalAlpha; 45 | short textAlignment; 46 | short textBaseline; 47 | rgba_t shadow; 48 | int shadowBlur; 49 | double shadowOffsetX; 50 | double shadowOffsetY; 51 | canvas_draw_mode_t textDrawingMode; 52 | 53 | #if HAVE_PANGO 54 | PangoWeight fontWeight; 55 | PangoStyle fontStyle; 56 | double fontSize; 57 | char *fontFamily; 58 | #endif 59 | 60 | } canvas_state_t; 61 | 62 | #if HAVE_PANGO 63 | void state_assign_fontFamily(canvas_state_t *state, const char *str); 64 | #endif 65 | 66 | class Context2d: public Nan::ObjectWrap { 67 | public: 68 | short stateno; 69 | canvas_state_t *states[CANVAS_MAX_STATES]; 70 | canvas_state_t *state; 71 | Context2d(Canvas *canvas); 72 | static Nan::Persistent constructor; 73 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 74 | static NAN_METHOD(New); 75 | static NAN_METHOD(DrawImage); 76 | static NAN_METHOD(PutImageData); 77 | static NAN_METHOD(Save); 78 | static NAN_METHOD(Restore); 79 | static NAN_METHOD(Rotate); 80 | static NAN_METHOD(Translate); 81 | static NAN_METHOD(Scale); 82 | static NAN_METHOD(Transform); 83 | static NAN_METHOD(ResetTransform); 84 | static NAN_METHOD(IsPointInPath); 85 | static NAN_METHOD(BeginPath); 86 | static NAN_METHOD(ClosePath); 87 | static NAN_METHOD(AddPage); 88 | static NAN_METHOD(Clip); 89 | static NAN_METHOD(Fill); 90 | static NAN_METHOD(Stroke); 91 | static NAN_METHOD(FillText); 92 | static NAN_METHOD(StrokeText); 93 | static NAN_METHOD(SetFont); 94 | #ifdef HAVE_FREETYPE 95 | static NAN_METHOD(SetFontFace); 96 | #endif 97 | static NAN_METHOD(SetFillColor); 98 | static NAN_METHOD(SetStrokeColor); 99 | static NAN_METHOD(SetFillPattern); 100 | static NAN_METHOD(SetStrokePattern); 101 | static NAN_METHOD(SetTextBaseline); 102 | static NAN_METHOD(SetTextAlignment); 103 | static NAN_METHOD(SetLineDash); 104 | static NAN_METHOD(GetLineDash); 105 | static NAN_METHOD(MeasureText); 106 | static NAN_METHOD(BezierCurveTo); 107 | static NAN_METHOD(QuadraticCurveTo); 108 | static NAN_METHOD(LineTo); 109 | static NAN_METHOD(MoveTo); 110 | static NAN_METHOD(FillRect); 111 | static NAN_METHOD(StrokeRect); 112 | static NAN_METHOD(ClearRect); 113 | static NAN_METHOD(Rect); 114 | static NAN_METHOD(Arc); 115 | static NAN_METHOD(ArcTo); 116 | static NAN_METHOD(GetImageData); 117 | static NAN_GETTER(GetPatternQuality); 118 | static NAN_GETTER(GetGlobalCompositeOperation); 119 | static NAN_GETTER(GetGlobalAlpha); 120 | static NAN_GETTER(GetShadowColor); 121 | static NAN_GETTER(GetFillColor); 122 | static NAN_GETTER(GetStrokeColor); 123 | static NAN_GETTER(GetMiterLimit); 124 | static NAN_GETTER(GetLineCap); 125 | static NAN_GETTER(GetLineJoin); 126 | static NAN_GETTER(GetLineWidth); 127 | static NAN_GETTER(GetLineDashOffset); 128 | static NAN_GETTER(GetShadowOffsetX); 129 | static NAN_GETTER(GetShadowOffsetY); 130 | static NAN_GETTER(GetShadowBlur); 131 | static NAN_GETTER(GetAntiAlias); 132 | static NAN_GETTER(GetTextDrawingMode); 133 | static NAN_GETTER(GetFilter); 134 | static NAN_SETTER(SetPatternQuality); 135 | static NAN_SETTER(SetGlobalCompositeOperation); 136 | static NAN_SETTER(SetGlobalAlpha); 137 | static NAN_SETTER(SetShadowColor); 138 | static NAN_SETTER(SetMiterLimit); 139 | static NAN_SETTER(SetLineCap); 140 | static NAN_SETTER(SetLineJoin); 141 | static NAN_SETTER(SetLineWidth); 142 | static NAN_SETTER(SetLineDashOffset); 143 | static NAN_SETTER(SetShadowOffsetX); 144 | static NAN_SETTER(SetShadowOffsetY); 145 | static NAN_SETTER(SetShadowBlur); 146 | static NAN_SETTER(SetAntiAlias); 147 | static NAN_SETTER(SetTextDrawingMode); 148 | static NAN_SETTER(SetFilter); 149 | inline void setContext(cairo_t *ctx) { _context = ctx; } 150 | inline cairo_t *context(){ return _context; } 151 | inline Canvas *canvas(){ return _canvas; } 152 | inline bool hasShadow(); 153 | void inline setSourceRGBA(rgba_t color); 154 | void inline setSourceRGBA(cairo_t *ctx, rgba_t color); 155 | void setTextPath(const char *str, double x, double y); 156 | void blur(cairo_surface_t *surface, int radius); 157 | void shadow(void (fn)(cairo_t *cr)); 158 | void shadowStart(); 159 | void shadowApply(); 160 | void savePath(); 161 | void restorePath(); 162 | void saveState(); 163 | void restoreState(); 164 | void inline setFillRule(v8::Local value); 165 | void fill(bool preserve = false); 166 | void stroke(bool preserve = false); 167 | void save(); 168 | void restore(); 169 | 170 | #if HAVE_PANGO 171 | void setFontFromState(); 172 | inline PangoLayout *layout(){ return _layout; } 173 | #endif 174 | 175 | private: 176 | ~Context2d(); 177 | Canvas *_canvas; 178 | cairo_t *_context; 179 | cairo_path_t *_path; 180 | #if HAVE_PANGO 181 | PangoLayout *_layout; 182 | #endif 183 | }; 184 | 185 | #endif 186 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/FontFace.cc: -------------------------------------------------------------------------------- 1 | // 2 | // FontFace.cc 3 | // 4 | // Copyright (c) 2012 Julian Viereck 5 | // 6 | 7 | #include "FontFace.h" 8 | 9 | #include 10 | 11 | Nan::Persistent FontFace::constructor; 12 | 13 | /* 14 | * Destroy ft_face. 15 | */ 16 | 17 | FontFace::~FontFace() { 18 | // Decrement extra reference count added in ::New(...). 19 | // Once there is no reference left to crFace, cairo will release the 20 | // free type font face as well. 21 | cairo_font_face_destroy(_crFace); 22 | } 23 | 24 | /* 25 | * Initialize FontFace. 26 | */ 27 | 28 | void 29 | FontFace::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { 30 | Nan::HandleScope scope; 31 | 32 | // Constructor 33 | Local ctor = Nan::New(FontFace::New); 34 | constructor.Reset(ctor); 35 | ctor->InstanceTemplate()->SetInternalFieldCount(1); 36 | ctor->SetClassName(Nan::New("FontFace").ToLocalChecked()); 37 | 38 | // Prototype 39 | Nan::Set(target, Nan::New("FontFace").ToLocalChecked(), ctor->GetFunction()); 40 | } 41 | 42 | /* 43 | * Initialize a new FontFace object. 44 | */ 45 | 46 | FT_Library library; /* handle to library */ 47 | 48 | bool FontFace::_initLibrary = true; 49 | static cairo_user_data_key_t key; 50 | 51 | /* 52 | * Initialize a new FontFace. 53 | */ 54 | 55 | NAN_METHOD(FontFace::New) { 56 | if (!info.IsConstructCall()) { 57 | return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); 58 | } 59 | 60 | if (!info[0]->IsString() 61 | || !info[1]->IsNumber()) { 62 | return Nan::ThrowError("Wrong argument types passed to FontFace constructor"); 63 | } 64 | 65 | String::Utf8Value filePath(info[0]); 66 | int faceIdx = int(info[1]->NumberValue()); 67 | 68 | FT_Face ftFace; 69 | FT_Error ftError; 70 | cairo_font_face_t *crFace; 71 | 72 | if (_initLibrary) { 73 | _initLibrary = false; 74 | ftError = FT_Init_FreeType(&library); 75 | if (ftError) { 76 | return Nan::ThrowError("Could not load library"); 77 | } 78 | } 79 | 80 | // Create new freetype font face. 81 | ftError = FT_New_Face(library, *filePath, faceIdx, &ftFace); 82 | if (ftError) { 83 | return Nan::ThrowError("Could not load font file"); 84 | } 85 | 86 | #if HAVE_PANGO 87 | // Load the font file in fontconfig 88 | FcBool ok = FcConfigAppFontAddFile(FcConfigGetCurrent(), (FcChar8 *)(*filePath)); 89 | if (!ok) { 90 | return Nan::ThrowError("Could not load font in FontConfig"); 91 | } 92 | #endif 93 | 94 | // Create new cairo font face. 95 | crFace = cairo_ft_font_face_create_for_ft_face(ftFace, 0); 96 | 97 | // If the cairo font face is released, release the FreeType font face as well. 98 | int status = cairo_font_face_set_user_data (crFace, &key, 99 | ftFace, (cairo_destroy_func_t) FT_Done_Face); 100 | if (status) { 101 | cairo_font_face_destroy (crFace); 102 | FT_Done_Face (ftFace); 103 | return Nan::ThrowError("Failed to setup cairo font face user data"); 104 | } 105 | 106 | // Explicit reference count the cairo font face. Otherwise the font face might 107 | // get released by cairo although the JS font face object is still alive. 108 | cairo_font_face_reference(crFace); 109 | 110 | FontFace *face = new FontFace(ftFace, crFace); 111 | face->Wrap(info.This()); 112 | info.GetReturnValue().Set(info.This()); 113 | } 114 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/FontFace.h: -------------------------------------------------------------------------------- 1 | // 2 | // FontFace.h 3 | // 4 | // Copyright (c) 2012 Julian Viereck 5 | // 6 | 7 | #ifndef __NODE_TRUE_TYPE_FONT_FACE_H__ 8 | #define __NODE_TRUE_TYPE_FONT_FACE_H__ 9 | 10 | #include "Canvas.h" 11 | 12 | #include 13 | #include 14 | #include FT_FREETYPE_H 15 | 16 | class FontFace: public Nan::ObjectWrap { 17 | public: 18 | static Nan::Persistent constructor; 19 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 20 | static NAN_METHOD(New); 21 | FontFace(FT_Face ftFace, cairo_font_face_t *crFace) 22 | :_ftFace(ftFace), _crFace(crFace) {} 23 | 24 | inline cairo_font_face_t *cairoFace(){ return _crFace; } 25 | private: 26 | ~FontFace(); 27 | FT_Face _ftFace; 28 | cairo_font_face_t *_crFace; 29 | static bool _initLibrary; 30 | }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/Image.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Image.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_IMAGE_H__ 9 | #define __NODE_IMAGE_H__ 10 | 11 | #include "Canvas.h" 12 | 13 | #ifdef HAVE_JPEG 14 | #include 15 | #include 16 | #endif 17 | 18 | #ifdef HAVE_GIF 19 | #include 20 | 21 | #if GIFLIB_MAJOR > 5 || GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1 22 | #define GIF_CLOSE_FILE(gif) DGifCloseFile(gif, NULL) 23 | #else 24 | #define GIF_CLOSE_FILE(gif) DGifCloseFile(gif) 25 | #endif 26 | #endif 27 | 28 | 29 | 30 | class Image: public Nan::ObjectWrap { 31 | public: 32 | char *filename; 33 | int width, height; 34 | Nan::Callback *onload; 35 | Nan::Callback *onerror; 36 | static Nan::Persistent constructor; 37 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 38 | static NAN_METHOD(New); 39 | static NAN_GETTER(GetSource); 40 | static NAN_GETTER(GetOnload); 41 | static NAN_GETTER(GetOnerror); 42 | static NAN_GETTER(GetComplete); 43 | static NAN_GETTER(GetWidth); 44 | static NAN_GETTER(GetHeight); 45 | static NAN_GETTER(GetDataMode); 46 | static NAN_SETTER(SetSource); 47 | static NAN_SETTER(SetOnload); 48 | static NAN_SETTER(SetOnerror); 49 | static NAN_SETTER(SetDataMode); 50 | inline cairo_surface_t *surface(){ return _surface; } 51 | inline uint8_t *data(){ return cairo_image_surface_get_data(_surface); } 52 | inline int stride(){ return cairo_image_surface_get_stride(_surface); } 53 | static int isPNG(uint8_t *data); 54 | static int isJPEG(uint8_t *data); 55 | static int isGIF(uint8_t *data); 56 | static cairo_status_t readPNG(void *closure, unsigned char *data, unsigned len); 57 | inline int isComplete(){ return COMPLETE == state; } 58 | cairo_status_t loadSurface(); 59 | cairo_status_t loadFromBuffer(uint8_t *buf, unsigned len); 60 | cairo_status_t loadPNGFromBuffer(uint8_t *buf); 61 | cairo_status_t loadPNG(); 62 | void clearData(); 63 | #ifdef HAVE_GIF 64 | cairo_status_t loadGIFFromBuffer(uint8_t *buf, unsigned len); 65 | cairo_status_t loadGIF(FILE *stream); 66 | #endif 67 | #ifdef HAVE_JPEG 68 | cairo_status_t loadJPEGFromBuffer(uint8_t *buf, unsigned len); 69 | cairo_status_t loadJPEG(FILE *stream); 70 | cairo_status_t decodeJPEGIntoSurface(jpeg_decompress_struct *info); 71 | #if CAIRO_VERSION_MINOR >= 10 72 | cairo_status_t decodeJPEGBufferIntoMimeSurface(uint8_t *buf, unsigned len); 73 | cairo_status_t assignDataAsMime(uint8_t *data, int len, const char *mime_type); 74 | #endif 75 | #endif 76 | void error(Local error); 77 | void loaded(); 78 | cairo_status_t load(); 79 | Image(); 80 | 81 | enum { 82 | DEFAULT 83 | , LOADING 84 | , COMPLETE 85 | } state; 86 | 87 | enum data_mode_t { 88 | DATA_IMAGE = 1 89 | , DATA_MIME = 2 90 | } data_mode; 91 | 92 | typedef enum { 93 | UNKNOWN 94 | , GIF 95 | , JPEG 96 | , PNG 97 | } type; 98 | 99 | static type extension(const char *filename); 100 | 101 | private: 102 | cairo_surface_t *_surface; 103 | uint8_t *_data; 104 | int _data_len; 105 | ~Image(); 106 | }; 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/ImageData.cc: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ImageData.cc 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #include "ImageData.h" 9 | 10 | Nan::Persistent ImageData::constructor; 11 | 12 | /* 13 | * Initialize ImageData. 14 | */ 15 | 16 | void 17 | ImageData::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { 18 | Nan::HandleScope scope; 19 | 20 | // Constructor 21 | Local ctor = Nan::New(ImageData::New); 22 | constructor.Reset(ctor); 23 | ctor->InstanceTemplate()->SetInternalFieldCount(1); 24 | ctor->SetClassName(Nan::New("ImageData").ToLocalChecked()); 25 | 26 | // Prototype 27 | Local proto = ctor->PrototypeTemplate(); 28 | Nan::SetAccessor(proto, Nan::New("width").ToLocalChecked(), GetWidth); 29 | Nan::SetAccessor(proto, Nan::New("height").ToLocalChecked(), GetHeight); 30 | Nan::Set(target, Nan::New("ImageData").ToLocalChecked(), ctor->GetFunction()); 31 | } 32 | 33 | /* 34 | * Initialize a new ImageData object. 35 | */ 36 | 37 | NAN_METHOD(ImageData::New) { 38 | if (!info.IsConstructCall()) { 39 | return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'"); 40 | } 41 | 42 | #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION <= 10 43 | Local clampedArray; 44 | Local global = Context::GetCurrent()->Global(); 45 | #else 46 | Local clampedArray; 47 | #endif 48 | 49 | uint32_t width; 50 | uint32_t height; 51 | int length; 52 | 53 | if (info[0]->IsUint32() && info[1]->IsUint32()) { 54 | width = info[0]->Uint32Value(); 55 | if (width == 0) { 56 | Nan::ThrowRangeError("The source width is zero."); 57 | return; 58 | } 59 | height = info[1]->Uint32Value(); 60 | if (height == 0) { 61 | Nan::ThrowRangeError("The source height is zero."); 62 | return; 63 | } 64 | length = width * height * 4; 65 | 66 | #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION <= 10 67 | Local sizeHandle = Nan::New(length); 68 | Local caargv[] = { sizeHandle }; 69 | clampedArray = global->Get(Nan::New("Uint8ClampedArray").ToLocalChecked()).As()->NewInstance(1, caargv); 70 | #else 71 | clampedArray = Uint8ClampedArray::New(ArrayBuffer::New(Isolate::GetCurrent(), length), 0, length); 72 | #endif 73 | 74 | #if NODE_MAJOR_VERSION == 0 && NODE_MINOR_VERSION <= 10 75 | } else if (info[0]->ToObject()->GetIndexedPropertiesExternalArrayDataType() == kExternalPixelArray && info[1]->IsUint32()) { 76 | clampedArray = info[0]->ToObject(); 77 | length = clampedArray->GetIndexedPropertiesExternalArrayDataLength(); 78 | #else 79 | } else if (info[0]->IsUint8ClampedArray() && info[1]->IsUint32()) { 80 | clampedArray = info[0].As(); 81 | length = clampedArray->Length(); 82 | #endif 83 | if (length == 0) { 84 | Nan::ThrowRangeError("The input data has a zero byte length."); 85 | return; 86 | } 87 | if (length % 4 != 0) { 88 | Nan::ThrowRangeError("The input data byte length is not a multiple of 4."); 89 | return; 90 | } 91 | width = info[1]->Uint32Value(); 92 | int size = length / 4; 93 | if (width == 0) { 94 | Nan::ThrowRangeError("The source width is zero."); 95 | return; 96 | } 97 | if (size % width != 0) { 98 | Nan::ThrowRangeError("The input data byte length is not a multiple of (4 * width)."); 99 | return; 100 | } 101 | height = size / width; 102 | if (info[2]->IsUint32() && info[2]->Uint32Value() != height) { 103 | Nan::ThrowRangeError("The input data byte length is not equal to (4 * width * height)."); 104 | return; 105 | } 106 | } else { 107 | Nan::ThrowTypeError("Expected (Uint8ClampedArray, width[, height]) or (width, height)"); 108 | return; 109 | } 110 | 111 | Nan::TypedArrayContents dataPtr(clampedArray); 112 | 113 | ImageData *imageData = new ImageData(reinterpret_cast(*dataPtr), width, height); 114 | imageData->Wrap(info.This()); 115 | info.This()->Set(Nan::New("data").ToLocalChecked(), clampedArray); 116 | info.GetReturnValue().Set(info.This()); 117 | } 118 | 119 | /* 120 | * Get width. 121 | */ 122 | 123 | NAN_GETTER(ImageData::GetWidth) { 124 | ImageData *imageData = Nan::ObjectWrap::Unwrap(info.This()); 125 | info.GetReturnValue().Set(Nan::New(imageData->width())); 126 | } 127 | 128 | /* 129 | * Get height. 130 | */ 131 | 132 | NAN_GETTER(ImageData::GetHeight) { 133 | ImageData *imageData = Nan::ObjectWrap::Unwrap(info.This()); 134 | info.GetReturnValue().Set(Nan::New(imageData->height())); 135 | } 136 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/ImageData.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ImageData.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_IMAGE_DATA_H__ 9 | #define __NODE_IMAGE_DATA_H__ 10 | 11 | #include "Canvas.h" 12 | #include 13 | #include "v8.h" 14 | 15 | class ImageData: public Nan::ObjectWrap { 16 | public: 17 | static Nan::Persistent constructor; 18 | static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); 19 | static NAN_METHOD(New); 20 | static NAN_GETTER(GetWidth); 21 | static NAN_GETTER(GetHeight); 22 | 23 | inline int width() { return _width; } 24 | inline int height() { return _height; } 25 | inline uint8_t *data() { return _data; } 26 | inline int stride() { return _width * 4; } 27 | ImageData(uint8_t *data, int width, int height) : _width(width), _height(height), _data(data) {} 28 | 29 | private: 30 | int _width; 31 | int _height; 32 | uint8_t *_data; 33 | 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/JPEGStream.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // JPEGStream.h 4 | // 5 | 6 | #ifndef __NODE_JPEG_STREAM_H__ 7 | #define __NODE_JPEG_STREAM_H__ 8 | 9 | #include "Canvas.h" 10 | #include 11 | #include 12 | 13 | /* 14 | * Expanded data destination object for closure output, 15 | * inspired by IJG's jdatadst.c 16 | */ 17 | 18 | typedef struct { 19 | struct jpeg_destination_mgr pub; 20 | closure_t *closure; 21 | JOCTET *buffer; 22 | int bufsize; 23 | } closure_destination_mgr; 24 | 25 | void 26 | init_closure_destination(j_compress_ptr cinfo){ 27 | // we really don't have to do anything here 28 | } 29 | 30 | boolean 31 | empty_closure_output_buffer(j_compress_ptr cinfo){ 32 | Nan::HandleScope scope; 33 | closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest; 34 | 35 | Local buf = Nan::NewBuffer((char *)dest->buffer, dest->bufsize).ToLocalChecked(); 36 | 37 | // emit "data" 38 | Local argv[2] = { 39 | Nan::Null() 40 | , buf 41 | }; 42 | Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local)dest->closure->fn, 2, argv); 43 | 44 | dest->buffer = (JOCTET *)malloc(dest->bufsize); 45 | cinfo->dest->next_output_byte = dest->buffer; 46 | cinfo->dest->free_in_buffer = dest->bufsize; 47 | return true; 48 | } 49 | 50 | void 51 | term_closure_destination(j_compress_ptr cinfo){ 52 | Nan::HandleScope scope; 53 | closure_destination_mgr *dest = (closure_destination_mgr *) cinfo->dest; 54 | 55 | /* emit remaining data */ 56 | Local buf = Nan::NewBuffer((char *)dest->buffer, dest->bufsize - dest->pub.free_in_buffer).ToLocalChecked(); 57 | 58 | Local data_argv[2] = { 59 | Nan::Null() 60 | , buf 61 | }; 62 | 63 | Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local)dest->closure->fn, 2, data_argv); 64 | 65 | // emit "end" 66 | Local end_argv[2] = { 67 | Nan::Null() 68 | , Nan::Null() 69 | }; 70 | 71 | Nan::MakeCallback(Nan::GetCurrentContext()->Global(), (v8::Local)dest->closure->fn, 2, end_argv); 72 | } 73 | 74 | void 75 | jpeg_closure_dest(j_compress_ptr cinfo, closure_t * closure, int bufsize){ 76 | closure_destination_mgr * dest; 77 | 78 | /* The destination object is made permanent so that multiple JPEG images 79 | * can be written to the same buffer without re-executing jpeg_mem_dest. 80 | */ 81 | if (cinfo->dest == NULL) { /* first time for this JPEG object? */ 82 | cinfo->dest = (struct jpeg_destination_mgr *) 83 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 84 | sizeof(closure_destination_mgr)); 85 | } 86 | 87 | dest = (closure_destination_mgr *) cinfo->dest; 88 | 89 | cinfo->dest->init_destination = &init_closure_destination; 90 | cinfo->dest->empty_output_buffer = &empty_closure_output_buffer; 91 | cinfo->dest->term_destination = &term_closure_destination; 92 | 93 | dest->closure = closure; 94 | dest->bufsize = bufsize; 95 | dest->buffer = (JOCTET *)malloc(bufsize); 96 | 97 | cinfo->dest->next_output_byte = dest->buffer; 98 | cinfo->dest->free_in_buffer = dest->bufsize; 99 | } 100 | 101 | void 102 | write_to_jpeg_stream(cairo_surface_t *surface, int bufsize, int quality, bool progressive, closure_t *closure){ 103 | int w = cairo_image_surface_get_width(surface); 104 | int h = cairo_image_surface_get_height(surface); 105 | struct jpeg_compress_struct cinfo; 106 | struct jpeg_error_mgr jerr; 107 | 108 | JSAMPROW slr; 109 | cinfo.err = jpeg_std_error(&jerr); 110 | jpeg_create_compress(&cinfo); 111 | cinfo.in_color_space = JCS_RGB; 112 | cinfo.input_components = 3; 113 | cinfo.image_width = w; 114 | cinfo.image_height = h; 115 | jpeg_set_defaults(&cinfo); 116 | if (progressive) 117 | jpeg_simple_progression(&cinfo); 118 | jpeg_set_quality(&cinfo, quality, (quality<25)?0:1); 119 | jpeg_closure_dest(&cinfo, closure, bufsize); 120 | 121 | jpeg_start_compress(&cinfo, TRUE); 122 | unsigned char *dst; 123 | unsigned int *src = (unsigned int *) cairo_image_surface_get_data(surface); 124 | int sl = 0; 125 | dst = (unsigned char *) malloc(w * 3); 126 | while (sl < h) { 127 | unsigned char *dp = dst; 128 | int x = 0; 129 | while (x < w) { 130 | dp[0] = (*src >> 16) & 255; 131 | dp[1] = (*src >> 8) & 255; 132 | dp[2] = *src & 255; 133 | src++; 134 | dp += 3; 135 | x++; 136 | } 137 | slr = dst; 138 | jpeg_write_scanlines(&cinfo, &slr, 1); 139 | sl++; 140 | } 141 | free(dst); 142 | jpeg_finish_compress(&cinfo); 143 | jpeg_destroy_compress(&cinfo); 144 | } 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/Point.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | // 4 | // Point.h 5 | // 6 | // Copyright (c) 2010 LearnBoost 7 | // 8 | 9 | #ifndef __NODE_POINT_H__ 10 | #define __NODE_POINT_H__ 11 | 12 | template 13 | class Point { 14 | public: 15 | T x, y; 16 | Point(T x, T y): x(x), y(y) {} 17 | }; 18 | 19 | #endif /* __NODE_POINT_H__ */ 20 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/closure.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // closure.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __NODE_CLOSURE_H__ 9 | #define __NODE_CLOSURE_H__ 10 | 11 | #ifdef __unix__ 12 | #include 13 | #endif 14 | 15 | #ifndef PAGE_SIZE 16 | #define PAGE_SIZE 4096 17 | #endif 18 | 19 | #include 20 | 21 | /* 22 | * PNG stream closure. 23 | */ 24 | 25 | typedef struct { 26 | Nan::Callback *pfn; 27 | Local fn; 28 | unsigned len; 29 | unsigned max_len; 30 | uint8_t *data; 31 | Canvas *canvas; 32 | cairo_status_t status; 33 | uint32_t compression_level; 34 | uint32_t filter; 35 | } closure_t; 36 | 37 | /* 38 | * Initialize the given closure. 39 | */ 40 | 41 | cairo_status_t 42 | closure_init(closure_t *closure, Canvas *canvas, unsigned int compression_level, unsigned int filter) { 43 | closure->len = 0; 44 | closure->canvas = canvas; 45 | closure->data = (uint8_t *) malloc(closure->max_len = PAGE_SIZE); 46 | if (!closure->data) return CAIRO_STATUS_NO_MEMORY; 47 | closure->compression_level = compression_level; 48 | closure->filter = filter; 49 | return CAIRO_STATUS_SUCCESS; 50 | } 51 | 52 | /* 53 | * Free the given closure's data, 54 | * and hint V8 at the memory dealloc. 55 | */ 56 | 57 | void 58 | closure_destroy(closure_t *closure) { 59 | if (closure->len) { 60 | free(closure->data); 61 | Nan::AdjustExternalMemory(-((intptr_t) closure->max_len)); 62 | } 63 | } 64 | 65 | #endif /* __NODE_CLOSURE_H__ */ 66 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/color.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // color.h 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #ifndef __COLOR_PARSER_H__ 9 | #define __COLOR_PARSER_H__ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | /* 17 | * RGBA struct. 18 | */ 19 | 20 | typedef struct { 21 | double r, g, b, a; 22 | } rgba_t; 23 | 24 | /* 25 | * Prototypes. 26 | */ 27 | 28 | rgba_t 29 | rgba_create(uint32_t rgba); 30 | 31 | int32_t 32 | rgba_from_string(const char *str, short *ok); 33 | 34 | void 35 | rgba_to_string(rgba_t rgba, char *buf, size_t len); 36 | 37 | void 38 | rgba_inspect(int32_t rgba); 39 | 40 | #endif /* __COLOR_PARSER_H__ */ 41 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/src/init.cc: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // init.cc 4 | // 5 | // Copyright (c) 2010 LearnBoost 6 | // 7 | 8 | #include 9 | #include "Canvas.h" 10 | #include "Image.h" 11 | #include "ImageData.h" 12 | #include "CanvasGradient.h" 13 | #include "CanvasPattern.h" 14 | #include "CanvasRenderingContext2d.h" 15 | 16 | #ifdef HAVE_FREETYPE 17 | #include "FontFace.h" 18 | #include FT_FREETYPE_H 19 | #endif 20 | 21 | // Compatibility with Visual Studio versions prior to VS2015 22 | #if defined(_MSC_VER) && _MSC_VER < 1900 23 | #define snprintf _snprintf 24 | #endif 25 | 26 | NAN_MODULE_INIT(init) { 27 | Canvas::Initialize(target); 28 | Image::Initialize(target); 29 | ImageData::Initialize(target); 30 | Context2d::Initialize(target); 31 | Gradient::Initialize(target); 32 | Pattern::Initialize(target); 33 | #ifdef HAVE_FREETYPE 34 | FontFace::Initialize(target); 35 | #endif 36 | 37 | target->Set(Nan::New("cairoVersion").ToLocalChecked(), Nan::New(cairo_version_string()).ToLocalChecked()); 38 | #ifdef HAVE_JPEG 39 | 40 | #ifndef JPEG_LIB_VERSION_MAJOR 41 | #ifdef JPEG_LIB_VERSION 42 | #define JPEG_LIB_VERSION_MAJOR (JPEG_LIB_VERSION / 10) 43 | #else 44 | #define JPEG_LIB_VERSION_MAJOR 0 45 | #endif 46 | #endif 47 | 48 | #ifndef JPEG_LIB_VERSION_MINOR 49 | #ifdef JPEG_LIB_VERSION 50 | #define JPEG_LIB_VERSION_MINOR (JPEG_LIB_VERSION % 10) 51 | #else 52 | #define JPEG_LIB_VERSION_MINOR 0 53 | #endif 54 | #endif 55 | 56 | char jpeg_version[10]; 57 | if (JPEG_LIB_VERSION_MINOR > 0) { 58 | snprintf(jpeg_version, 10, "%d%c", JPEG_LIB_VERSION_MAJOR, JPEG_LIB_VERSION_MINOR + 'a' - 1); 59 | } else { 60 | snprintf(jpeg_version, 10, "%d", JPEG_LIB_VERSION_MAJOR); 61 | } 62 | target->Set(Nan::New("jpegVersion").ToLocalChecked(), Nan::New(jpeg_version).ToLocalChecked()); 63 | #endif 64 | 65 | #ifdef HAVE_GIF 66 | #ifndef GIF_LIB_VERSION 67 | char gif_version[10]; 68 | snprintf(gif_version, 10, "%d.%d.%d", GIFLIB_MAJOR, GIFLIB_MINOR, GIFLIB_RELEASE); 69 | target->Set(Nan::New("gifVersion").ToLocalChecked(), Nan::New(gif_version).ToLocalChecked()); 70 | #else 71 | target->Set(Nan::New("gifVersion").ToLocalChecked(), Nan::New(GIF_LIB_VERSION).ToLocalChecked()); 72 | #endif 73 | #endif 74 | 75 | #ifdef HAVE_FREETYPE 76 | char freetype_version[10]; 77 | snprintf(freetype_version, 10, "%d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); 78 | target->Set(Nan::New("freetypeVersion").ToLocalChecked(), Nan::New(freetype_version).ToLocalChecked()); 79 | #endif 80 | } 81 | 82 | NODE_MODULE(canvas,init); 83 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/node_modules/canvas/util/has_lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | has_ldconfig() { 4 | hash ldconfig 2>/dev/null 5 | } 6 | 7 | has_system_lib() { 8 | local regex="lib$1.+(so|dylib)" 9 | 10 | # Add /sbin to path as ldconfig is located there on some systems - e.g. Debian 11 | # (and it still can be used by unprivileged users): 12 | PATH="$PATH:/sbin" 13 | export PATH 14 | # Try using ldconfig on linux systems 15 | if $(has_ldconfig); then 16 | for _ in $(ldconfig -p 2>/dev/null | grep -E "$regex"); do 17 | return 0 18 | done 19 | fi 20 | 21 | # Try just checking common library locations 22 | for dir in /lib /usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu; do 23 | test -d $dir && ls $dir | grep -E "$regex" && return 0 24 | done 25 | 26 | return 1 27 | } 28 | 29 | has_freetype() { 30 | pkg-config cairo --cflags-only-I | grep freetype2 31 | } 32 | 33 | has_pkgconfig_lib() { 34 | pkg-config --exists "$1" 35 | } 36 | 37 | case "$1" in 38 | gif) 39 | has_system_lib "gif" > /dev/null 40 | result=$? 41 | ;; 42 | jpeg) 43 | has_system_lib "jpeg" > /dev/null 44 | result=$? 45 | ;; 46 | pango) 47 | has_pkgconfig_lib "pango" > /dev/null 48 | result=$? 49 | ;; 50 | freetype) 51 | has_freetype > /dev/null 52 | result=$? 53 | ;; 54 | *) 55 | >&2 echo "Unknown library: $1" 56 | exit 1 57 | esac 58 | 59 | if test $result -eq 0; then 60 | echo "true" 61 | else 62 | echo "false" 63 | fi 64 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo-ft.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo-ft 7 | Description: FreeType font backend for cairo graphics library 8 | Version: 1.12.14 9 | 10 | Requires: cairo freetype2 >= 9.7.3 11 | Libs: 12 | Cflags: -I${includedir}/cairo 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo-pdf.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo-pdf 7 | Description: PDF surface backend for cairo graphics library 8 | Version: 1.12.14 9 | 10 | Requires: cairo 11 | Libs: -lz 12 | Cflags: -I${includedir}/cairo 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo-png.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo-png 7 | Description: PNG functions for cairo graphics library 8 | Version: 1.12.14 9 | 10 | Requires: cairo libpng 11 | Libs: 12 | Cflags: -I${includedir}/cairo 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo-ps.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo-ps 7 | Description: PostScript surface backend for cairo graphics library 8 | Version: 1.12.14 9 | 10 | Requires: cairo 11 | Libs: -lz 12 | Cflags: -I${includedir}/cairo 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo-script.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo-script 7 | Description: script surface backend for cairo graphics library 8 | Version: 1.12.14 9 | 10 | Requires: cairo 11 | Libs: 12 | Cflags: -I${includedir}/cairo 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo-svg.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo-svg 7 | Description: SVG surface backend for cairo graphics library 8 | Version: 1.12.14 9 | 10 | Requires: cairo 11 | Libs: 12 | Cflags: -I${includedir}/cairo 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/cairo.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: cairo 7 | Description: Multi-platform 2D graphics library 8 | Version: 1.12.14 9 | 10 | Requires.private: pixman-1 >= 0.22.0 freetype2 >= 9.7.3 libpng 11 | Libs: -L${libdir} -lcairo 12 | Libs.private: -lz -lz 13 | Cflags: -I${includedir}/cairo 14 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/freetype2.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: FreeType 2 7 | Description: A free, high-quality, and portable font engine. 8 | Version: 16.0.10 9 | Requires: 10 | Libs: -L${libdir} -lfreetype 11 | Libs.private: -lz 12 | Cflags: -I${includedir}/freetype2 -I${includedir} 13 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/libpng.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include/libpng16 5 | 6 | Name: libpng 7 | Description: Loads and saves PNG files 8 | Version: 1.6.23 9 | Libs: -L${libdir} -lpng16 10 | Libs.private: -lm -lz -lm 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/libpng16.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include/libpng16 5 | 6 | Name: libpng 7 | Description: Loads and saves PNG files 8 | Version: 1.6.23 9 | Libs: -L${libdir} -lpng16 10 | Libs.private: -lm -lz -lm 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency-4.3/pkgconfig/pixman-1.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/ec2-user/canvas 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | 6 | Name: Pixman 7 | Description: The pixman library (version 1) 8 | Version: 0.28.2 9 | Cflags: -I${includedir}/pixman-1 10 | Libs: -L${libdir} -lpixman-1 11 | 12 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/index.js: -------------------------------------------------------------------------------- 1 | var Canvas = require('canvas'); 2 | 3 | exports.handler = function(event, context) { 4 | 5 | var canvas = new Canvas(); 6 | canvas.width = 100; 7 | canvas.height = 100; 8 | 9 | var g = canvas.getContext('2d'); 10 | g.fillStyle = 'red'; 11 | g.fillRect(0, 0, 50, 50); 12 | g.fillStyle = 'green'; 13 | g.fillRect(50, 0, 50, 50); 14 | g.fillStyle = 'blue'; 15 | g.fillRect(0, 50, 50, 50); 16 | g.fillStyle = 'yellow'; 17 | g.fillRect(50, 50, 50, 50); 18 | 19 | console.log(canvas.toDataURL()); 20 | 21 | context.succeed('Done!'); 22 | }; 23 | -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/libcairo.so.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency/libcairo.so.2 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/libfreetype.so.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency/libfreetype.so.6 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/libgif.so.7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency/libgif.so.7 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/libjpeg.so.8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency/libjpeg.so.8 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/libpixman-1.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency/libpixman-1.so.0 -------------------------------------------------------------------------------- /dependencies/lambda-node-canvas-dependency/libpng16.so.16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anandanand84/aws-lambda-node-canvas/e70da68b3f6afec0b85a346f46b4767b4e9a8245/dependencies/lambda-node-canvas-dependency/libpng16.so.16 -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | //This is a sample gulp file that can be used. 3 | //npm install --save gulp gulp-zip gulp-awslambda 4 | const gulp = require('gulp'); 5 | const zip = require('gulp-zip'); 6 | const path = require('path'); 7 | const lambda = require('gulp-awslambda'); 8 | const aws_lambda_node_canvas = require('./'); 9 | 10 | let runtime = 'nodejs4.3' // nodejs or nodejs4.3 11 | 12 | const lambda_params = { 13 | FunctionName: 'NodeCanvas', /* Lambda function name */ 14 | Description: 'Node canvas function in aws lambda', //Description for your lambda function 15 | Handler: 'main.lambda_handler', //Assuming you will provide main.py file with a function called handler. 16 | MemorySize: 128, 17 | Runtime: runtime, 18 | Role : 'arn:aws:iam::044011827821:role/lambda_basic_execution',//eg:'arn:aws:iam::[Account]:role/lambda_basic_execution' 19 | Timeout: 50 20 | }; 21 | 22 | var opts = { 23 | region : 'ap-southeast-2' 24 | } 25 | 26 | gulp.task('default', () => { 27 | return gulp.src(['main.js', '!node_modules/**/*','!dist/**/*','!node_modules/aws-lambda-node-canvas/**/*']) //Your src files to bundle into aws lambda 28 | .pipe(aws_lambda_node_canvas({runtime : runtime})) //Adds all the required files needed to run node-canvas in aws lambda 29 | .pipe(zip('archive.zip')) 30 | .pipe(lambda(lambda_params, opts)) 31 | .pipe(gulp.dest('dist')); //Also place the uploaded file 32 | }); -------------------------------------------------------------------------------- /how-dependencies-were-created: -------------------------------------------------------------------------------- 1 | export LDFLAGS=-Wl,-rpath=/var/task/ 2 | sudo yum groupinstall "Development Tools" 3 | sudo yum install fontconfig-devel.x86_64 4 | sudo yum erase cairo 5 | 6 | export PKG_CONFIG_PATH='/usr/local/lib/pkgconfig' 7 | export LD_LIBRARY_PATH='/usr/local/lib':$LD_LIBRARY_PATH 8 | 9 | 10 | curl -L http://sourceforge.net/projects/libpng/files/libpng15/1.5.27/libpng-1.5.27.tar.xz/download -o libpng.tar.xz 11 | tar -Jxf libpng.tar.xz && cd libpng-1.5.27/ 12 | sudo yum -y install zlib-devel 13 | ./configure --prefix=/home/ec2-user/canvas 14 | make 15 | sudo make install 16 | 17 | curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz -o jpegsrc.tar.gz 18 | tar -zxf jpegsrc.tar.gz && cd jpeg-8d/ 19 | ./configure --disable-dependency-tracking --prefix=/home/ec2-user/canvas 20 | make 21 | sudo make install 22 | 23 | curl https://www.cairographics.org/releases/pixman-0.28.2.tar.gz -o pixman.tar.gz 24 | tar -zxf pixman.tar.gz && cd pixman-0.28.2/ 25 | ./configure --prefix=/home/ec2-user/canvas 26 | make 27 | sudo make install 28 | 29 | curl http://download-mirror.savannah.gnu.org/releases//freetype/freetype-2.4.11.tar.gz -o freetype.tar.gz 30 | tar -zxf freetype.tar.gz && cd freetype-2.4.11/ 31 | ./configure --prefix=/home/ec2-user/canvas 32 | make 33 | sudo make install 34 | 35 | curl https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.0.tar.bz2 -o fontconfig.gz 36 | 37 | sudo yum install libpng-devel 38 | curl https://cairographics.org/releases/cairo-1.12.14.tar.xz -o cairo.tar.xz 39 | tar -xJf cairo.tar.xz && cd cairo-1.12.14/ 40 | PKG_CONFIG_PATH=/home/ec2-user/canvas/lib/pkgconfig 41 | PKG_CONFIG=/home/ec2-user/canvas/lib/pkgconfig 42 | ./configure --disable-dependency-tracking --without-x --prefix=/home/ec2-user/canvas 43 | make 44 | sudo make install 45 | 46 | sudo yum install giflib-devel 47 | 48 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash 49 | 50 | nvm install 4.3 51 | 52 | PKG_CONFIG_PATH=/home/ec2-user/canvas/lib/pkgconfig:/usr/local/lib/pkgconfig -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var through = require('through2'); 2 | var vinyl = require('vinyl-fs'); 3 | var gutil = require('gulp-util'); 4 | var PluginError = gutil.PluginError; 5 | var path = require('path'); 6 | var gulp = require('gulp'); 7 | const fs = require('fs'); 8 | const unzip = require('gulp-unzip'); 9 | var GITHUB_URL = 'https://cdn.rawgit.com/WebSeed/node-canvas-aws-lambda-example/master/dist/lamdba.zip'; 10 | const dependencyDirectory = path.resolve(__dirname, 'dependencies'); 11 | var DEPENDENCY_LOCATION = path.resolve(dependencyDirectory, 'lambda-node-canvas-dependency'); 12 | var https = require('https'); 13 | const DOWNLOAD_ZIP_LOCATION = dependencyDirectory+path.sep+'lambda-node-canvas-dependency.zip'; 14 | //ami-60b6c60a 15 | module.exports = function (opts) { 16 | opts = opts || {}; 17 | if(!opts.runtime) { 18 | console.error(new PluginError('aws-lambda-node-canvas', 'runtime is mandatory')); 19 | return; 20 | } 21 | 22 | if(opts.runtime !== 'nodejs' && opts.runtime!=='nodejs4.3'){ 23 | console.error(new PluginError('aws-lambda-node-canvas', 'runtime should either be nodejs or nodejs4.3')); 24 | return; 25 | } 26 | 27 | if(opts.runtime !== 'nodejs') { 28 | DEPENDENCY_LOCATION = path.resolve(dependencyDirectory, 'lambda-node-canvas-dependency-4.3'); 29 | } 30 | 31 | var addNodeCanvasDependencyPath = function(originalStream, endCallback) { 32 | console.log(DEPENDENCY_LOCATION); 33 | gulp.src(DEPENDENCY_LOCATION + path.sep+'**'+path.sep+'*', { dot : true}) 34 | .pipe(through.obj(function(file, encoding, cb){ 35 | originalStream.push(file); 36 | cb(); 37 | })) 38 | .on('finish', function() { 39 | console.log('finish') 40 | endCallback(); 41 | }); 42 | }; 43 | 44 | var pass = through.obj(function(file, encoding, callback) { 45 | callback(null, file); 46 | },function(callback) { 47 | var self = this; 48 | if((!fs.existsSync(DEPENDENCY_LOCATION))){ 49 | var fileStream = fs.createWriteStream(DOWNLOAD_ZIP_LOCATION); 50 | console.log('Dependency not available, Downloading dependency file '+GITHUB_URL); 51 | https.get(GITHUB_URL, function(response) { 52 | response.pipe(fileStream) 53 | fileStream.on('finish', function() { 54 | console.log('Download Complete'); 55 | gulp.src(DOWNLOAD_ZIP_LOCATION , { dot : true }) 56 | .pipe(unzip({ keepEmpty : true })) 57 | .pipe(gulp.dest(DEPENDENCY_LOCATION)) 58 | .on('finish', function() { 59 | addNodeCanvasDependencyPath(self, callback); 60 | }) 61 | }) 62 | }); 63 | }else { 64 | addNodeCanvasDependencyPath(self, callback); 65 | } 66 | }); 67 | 68 | return pass; 69 | }; -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by anand on 8/3/16. 3 | */ 4 | var Canvas = require('canvas'); 5 | 6 | exports.lambda_handler = function(event, context) { 7 | 8 | var canvas = new Canvas(); 9 | canvas.width = 100; 10 | canvas.height = 100; 11 | 12 | var g = canvas.getContext('2d'); 13 | g.fillStyle = 'red'; 14 | g.fillRect(0, 0, 50, 50); 15 | g.fillStyle = 'green'; 16 | g.fillRect(50, 0, 50, 50); 17 | g.fillStyle = 'blue'; 18 | g.fillRect(0, 50, 50, 50); 19 | g.fillStyle = 'yellow'; 20 | g.fillRect(50, 50, 50, 50); 21 | 22 | var image = canvas.toDataURL(); 23 | console.log(image); 24 | context.succeed('Done! '+image); 25 | return image; 26 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aws-lambda-node-canvas", 3 | "version": "1.0.2", 4 | "description": "Gulp plugin to deploy node-canvas with its dependencies", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/anandanand84/aws-lambda-node-canvas.git" 12 | }, 13 | "keywords": [ 14 | "gulp", 15 | "aws", 16 | "lambda", 17 | "node", 18 | "canvas", 19 | "gulp", 20 | "plugin" 21 | ], 22 | "author": "anandanand84", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/anandanand84/aws-lambda-node-canvas/issues" 26 | }, 27 | "homepage": "https://github.com/anandanand84/aws-lambda-node-canvas#readme", 28 | "dependencies": { 29 | "gulp": "^3.9.1", 30 | "gulp-awslambda": "^0.4.0", 31 | "gulp-unzip": "^0.1.4", 32 | "gulp-util": "^3.0.7", 33 | "gulp-zip": "^3.2.0", 34 | "through2": "^2.0.1", 35 | "vinyl-fs": "^2.4.3" 36 | } 37 | } 38 | --------------------------------------------------------------------------------