Code Monkey home page Code Monkey logo

ansi-canvas's Introduction

ansi-canvas

Render a <canvas> node to your terminal

This module provides a <canvas> object backed by node-canvas, with its width and height properties automatically set to the proper size of the terminal window.

The result is that you can use the HTML Canvas API to render directly to your terminal!

Installation

Install with npm:

$ npm install ansi-canvas

Example

var ac = require('ansi-canvas');

var canvas = ac();
var context = canvas.getContext('2d');

// draw a purple background
context.fillStyle = 'purple';
context.fillRect(0, 0, canvas.width, canvas.height);

// write some text
context.fillStyle    = '#00f';
context.font         = 'italic 15px sans-serif';
context.textBaseline = 'top';
context.fillText  ('Hello world!', 1, 1);
context.font         = 'bold 20px sans-serif';
context.strokeText('Hello world!', 1, 21);

// IMPORTANT!!!
// call `canvas.render()` when you're ready to flush the canvas to the terminal
canvas.render();

Outputs something like:

Set the Font Size Really Small!

And then you get really high resolution, and then you could do something crazy… like… render SNES directly in your Terminal!!!

(note: this is just an image. if you were to actually implement SNES in the Terminal at a reasonable framerate and resolution you'd be god-like, but please let me know if you do it!)

License

(The MIT License)

Copyright (c) 2013 Nathan Rajlich <[email protected]>

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.

ansi-canvas's People

Contributors

timoxley avatar tootallnate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansi-canvas's Issues

Building on Windows

I have the error

Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
E:\Dev\node_modules\ansi-canvas\node_modules\canvas\build\canvas.vcxproj(18,3):
error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not f
ound. Confirm that the path in the declaration is correct, and that th
e file exists on disk.

render/invalidate small rectangle

afaik at the moment there is no way to render small rectangle on screen, .render() redraws the whole terminal. For applications like vnc this makes big performance hit as often I need to update small portions of the screen (e.i cursor movements). Is something like render(x,y,w,h) in the roadmap?

Using createImageData from node-canvas

Any idea on how to get createImageData?

The normal pattern of installing both modules (ansi-canvas & node-canvas) does not work because the "canvas.node" file gets built twice. Then putImageData() does a type check that fails. I assume instanceof is being used, but I cannot seem to find the offending code.

The anti-pattern of requiring a transitive dependency does not work with webpack. Yes.. I really am using webpack for a node module because I am experimenting with WebAssembly and I don't really understand the toolchain yet.

Can't install in Node v0.11.14

Maybe it's due to version of canvas module (1.0.3) specified as dependency in ansi-canvas' package.json , because if I install standalone canvas module (current is 1.1.6) I haven't any problems.

Specifically, I get these errors:

[email protected] install /home/q2dg/node_modules/ansi-canvas/node_modules/canvas
node-gyp rebuild
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory `/home/q2dg/node_modules/ansi-canvas/node_modules/canvas/build'
  CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.h:22:0,
                 from ../src/Canvas.cc:7:
../src/nan.h: In function ‘void NanThrowError(const char*)’:
../src/nan.h:105:46: error: ‘ThrowException’ is not a member of ‘v8’
     THROW_ERROR(v8::Exception::Error, errmsg);
                                              ^
../src/nan.h:105:86: error: ‘New’ is not a member of ‘v8::String’
     THROW_ERROR(v8::Exception::Error, errmsg);
                                                                                      ^
../src/nan.h: In function ‘void NanThrowError(v8::Local<v8::Value>)’:
../src/nan.h:110:5: error: ‘ThrowException’ is not a member of ‘v8’
     v8::ThrowException(error);
     ^
../src/nan.h: In function ‘void NanThrowTypeError(const char*)’:
../src/nan.h:114:46: error: ‘ThrowException’ is not a member of ‘v8’
     THROW_ERROR(v8::Exception::TypeError, errmsg);
                                              ^
../src/nan.h:114:90: error: ‘New’ is not a member of ‘v8::String’
     THROW_ERROR(v8::Exception::TypeError, errmsg);
                                                                                          ^
In file included from ../src/Canvas.h:22:0,
                 from ../src/Canvas.cc:7:
../src/nan.h: In function ‘void NanThrowRangeError(const char*)’:
../src/nan.h:118:46: error: ‘ThrowException’ is not a member of ‘v8’
     THROW_ERROR(v8::Exception::RangeError, errmsg);
                                              ^
../src/nan.h:118:91: error: ‘New’ is not a member of ‘v8::String’
     THROW_ERROR(v8::Exception::RangeError, errmsg);
                                                                                           ^
../src/nan.h: In function ‘void NanDispose(v8::Persistent<v8::Object>&)’:
../src/nan.h:122:12: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Dispose’
     handle.Dispose(nan_isolate);
            ^
In file included from ../src/Canvas.h:22:0,
                 from ../src/Canvas.cc:7:
../src/nan.h: In constructor ‘NanCallback::NanCallback(const v8::Local<v8::Function>&)’:
../src/nan.h:229:48: error: no matching function for call to ‘v8::Object::New()’
    v8::Local<v8::Object> obj = v8::Object::New();
                                                ^
../src/nan.h:229:48: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:2372:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:2372:24: note:   candidate expects 1 argument, 0 provided
In file included from ../src/Canvas.h:22:0,
                 from ../src/Canvas.cc:7:
../src/nan.h:230:13: error: ‘NewSymbol’ is not a member of ‘v8::String’
    obj->Set(NanSymbol("callback"), fn);
             ^
../src/nan.h: In destructor ‘NanCallback::~NanCallback()’:
../src/nan.h:236:11: error: ‘class v8::Persistent<v8::Object>’ has no member named ‘Dispose’
    handle.Dispose();
           ^
../src/nan.h: In member function ‘void NanCallback::Call(int, v8::Local<v8::Value>*)’:
../src/nan.h:252:12: error: ‘NewSymbol’ is not a member of ‘v8::String’
        Get(NanSymbol("callback")).As<v8::Function>();
            ^
../src/nan.h:252:62: error: expected primary-expression before ‘>’ token
        Get(NanSymbol("callback")).As<v8::Function>();
                                                              ^
../src/nan.h:252:64: error: expected primary-expression before ‘)’ token
        Get(NanSymbol("callback")).As<v8::Function>();
                                                                ^
../src/nan.h:254:19: error: ‘GetCurrent’ is not a member of ‘v8::Context’
    callback->Call(v8::Context::GetCurrent()->Global(), argc, argv);
                   ^
../src/nan.h: At global scope:
../src/nan.h:291:3: error: ‘uv_work_t’ does not name a type
   uv_work_t request;
   ^
../src/nan.h: In constructor ‘NanAsyncWorker::NanAsyncWorker(NanCallback*)’:
../src/nan.h:267:5: error: ‘request’ was not declared in this scope
     request.data = this;
     ^
../src/nan.h: In member function ‘void NanAsyncWorker::SavePersistent(const char*, v8::Local<v8::Object>&)’:
../src/nan.h:300:17: error: ‘NewSymbol’ is not a member of ‘v8::String’
     handle->Set(NanSymbol(key), obj);
                 ^
../src/nan.h: In member function ‘v8::Local<v8::Object> NanAsyncWorker::GetFromPersistent(const char*)’:
../src/nan.h:305:24: error: ‘NewSymbol’ is not a member of ‘v8::String’
     return handle->Get(NanSymbol(key)).As<v8::Object>();
                        ^
../src/nan.h:305:65: error: expected primary-expression before ‘>’ token
     return handle->Get(NanSymbol(key)).As<v8::Object>();
                                                                 ^
../src/nan.h:305:67: error: expected primary-expression before ‘)’ token
     return handle->Get(NanSymbol(key)).As<v8::Object>();
                                                                   ^
../src/nan.h: In member function ‘virtual void NanAsyncWorker::HandleErrorCallback()’:
../src/nan.h:318:30: error: ‘New’ is not a member of ‘v8::String’
         v8::Exception::Error(v8::String::New(errmsg))
                              ^
../src/nan.h: At global scope:
../src/nan.h:324:30: error: variable or field ‘NanAsyncExecute’ declared void
 inline void NanAsyncExecute (uv_work_t* req) {
                              ^
../src/nan.h:324:30: error: ‘uv_work_t’ was not declared in this scope
../src/nan.h:324:41: error: ‘req’ was not declared in this scope
 inline void NanAsyncExecute (uv_work_t* req) {
                                         ^
../src/nan.h:329:38: error: variable or field ‘NanAsyncExecuteComplete’ declared void
 inline void NanAsyncExecuteComplete (uv_work_t* req) {
                                      ^
../src/nan.h:329:38: error: ‘uv_work_t’ was not declared in this scope
../src/nan.h:329:49: error: ‘req’ was not declared in this scope
 inline void NanAsyncExecuteComplete (uv_work_t* req) {
                                                 ^
../src/nan.h: In function ‘void NanAsyncQueueWorker(NanAsyncWorker*)’:
../src/nan.h:337:23: error: ‘uv_default_loop’ was not declared in this scope
       uv_default_loop()
                       ^
../src/nan.h:338:16: error: ‘class NanAsyncWorker’ has no member named ‘request’
     , &worker->request
                ^
../src/nan.h:339:7: error: ‘NanAsyncExecute’ was not declared in this scope
     , NanAsyncExecute
       ^
../src/nan.h:340:8: error: ‘uv_after_work_cb’ was not declared in this scope
     , (uv_after_work_cb)NanAsyncExecuteComplete
        ^
../src/nan.h:341:3: error: ‘uv_queue_work’ was not declared in this scope
   );
   ^
In file included from ../src/Canvas.cc:7:0:
../src/Canvas.h: At global scope:
../src/Canvas.h:67:31: error: ‘uv_work_t’ has not been declared
     static void ToBufferAsync(uv_work_t *req);
                               ^
../src/Canvas.h:68:36: error: ‘uv_work_t’ has not been declared
     static void ToBufferAsyncAfter(uv_work_t *req);
                                    ^
In file included from ../src/Canvas.cc:15:0:
../src/closure.h: In function ‘void closure_destroy(closure_t*)’:
../src/closure.h:49:5: error: ‘AdjustAmountOfExternalAllocatedMemory’ is not a member of ‘v8::V8’
     V8::AdjustAmountOfExternalAllocatedMemory(- (intptr_t) closure->max_len);
     ^
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h: In function ‘boolean empty_closure_output_buffer(j_compress_ptr)’:
../src/JPEGStream.h:36:30: error: too few arguments to function ‘v8::Handle<v8::Primitive> v8::Null(v8::Isolate*)’
       Local<Value>::New(Null())
                              ^
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:306:28: note: declared here
   friend Handle<Primitive> Null(Isolate* isolate);
                            ^
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:37:28: error: no matching function for call to ‘v8::Local<v8::Value>::New(v8::Local<v8::Object>&)’
     , Local<Value>::New(buf)
                            ^
../src/JPEGStream.h:37:28: note: candidates are:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:368:57: note: static v8::Local<T> v8::Local<T>::New(v8::Isolate*, v8::Handle<T>) [with T = v8::Value]
   V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that);
                                                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:368:57: note:   candidate expects 2 arguments, 1 provided
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:369:57: note: static v8::Local<T> v8::Local<T>::New(v8::Isolate*, const v8::PersistentBase<T>&) [with T = v8::Value]
   V8_INLINE static Local<T> New(Isolate* isolate,
                                                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:369:57: note:   candidate expects 2 arguments, 1 provided
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:391:57: note: static v8::Local<T> v8::Local<T>::New(v8::Isolate*, T*) [with T = v8::Value]
   V8_INLINE static Local<T> New(Isolate* isolate, T* that);
                                                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:391:57: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:38:33: error: no matching function for call to ‘v8::Integer::New(int&)’
     , Integer::New(dest->bufsize)
                                 ^
../src/JPEGStream.h:38:33: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1989:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1989:25: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:40:27: error: ‘GetCurrent’ is not a member of ‘v8::Context’
   dest->closure->fn->Call(Context::GetCurrent()->Global(), 3, argv);
                           ^
../src/JPEGStream.h: In function ‘void term_closure_destination(j_compress_ptr)’:
../src/JPEGStream.h:54:30: error: too few arguments to function ‘v8::Handle<v8::Primitive> v8::Null(v8::Isolate*)’
       Local<Value>::New(Null())
                              ^
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:306:28: note: declared here
   friend Handle<Primitive> Null(Isolate* isolate);
                            ^
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:55:28: error: no matching function for call to ‘v8::Local<v8::Value>::New(v8::Local<v8::Object>&)’
     , Local<Value>::New(buf)
                            ^
../src/JPEGStream.h:55:28: note: candidates are:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:368:57: note: static v8::Local<T> v8::Local<T>::New(v8::Isolate*, v8::Handle<T>) [with T = v8::Value]
   V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that);
                                                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:368:57: note:   candidate expects 2 arguments, 1 provided
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:369:57: note: static v8::Local<T> v8::Local<T>::New(v8::Isolate*, const v8::PersistentBase<T>&) [with T = v8::Value]
   V8_INLINE static Local<T> New(Isolate* isolate,
                                                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:369:57: note:   candidate expects 2 arguments, 1 provided
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:391:57: note: static v8::Local<T> v8::Local<T>::New(v8::Isolate*, T*) [with T = v8::Value]
   V8_INLINE static Local<T> New(Isolate* isolate, T* that);
                                                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:391:57: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:56:29: error: no matching function for call to ‘v8::Integer::New(size_t&)’
     , Integer::New(remaining)
                             ^
../src/JPEGStream.h:56:29: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1989:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1989:25: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:59:27: error: ‘GetCurrent’ is not a member of ‘v8::Context’
   dest->closure->fn->Call(Context::GetCurrent()->Global(), 3, data_argv);
                           ^
../src/JPEGStream.h:63:30: error: too few arguments to function ‘v8::Handle<v8::Primitive> v8::Null(v8::Isolate*)’
       Local<Value>::New(Null())
                              ^
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:306:28: note: declared here
   friend Handle<Primitive> Null(Isolate* isolate);
                            ^
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:64:30: error: too few arguments to function ‘v8::Handle<v8::Primitive> v8::Null(v8::Isolate*)’
     , Local<Value>::New(Null())
                              ^
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:306:28: note: declared here
   friend Handle<Primitive> Null(Isolate* isolate);
                            ^
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:65:21: error: no matching function for call to ‘v8::Integer::New(int)’
     , Integer::New(0)
                     ^
../src/JPEGStream.h:65:21: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1989:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1989:25: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/Canvas.cc:18:0:
../src/JPEGStream.h:68:27: error: ‘GetCurrent’ is not a member of ‘v8::Context’
   dest->closure->fn->Call(Context::GetCurrent()->Global(), 3, end_argv);
                           ^
../src/Canvas.cc: In static member function ‘static void Canvas::Initialize(v8::Handle<v8::Object>)’:
../src/Canvas.cc:32:67: error: no matching function for call to ‘v8::FunctionTemplate::New(void (&)(const v8::FunctionCallbackInfo<v8::Value>&))’
   Local<FunctionTemplate> ctor = FunctionTemplate::New(Canvas::New);
                                                                   ^
../src/Canvas.cc:32:67: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:3434:34: note: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)
   static Local<FunctionTemplate> New(
                                  ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:3434:34: note:   no known conversion for argument 1 from ‘void(const v8::FunctionCallbackInfo<v8::Value>&)’ to ‘v8::Isolate*’
../src/Canvas.cc:35:22: error: ‘NewSymbol’ is not a member of ‘v8::String’
   ctor->SetClassName(NanSymbol("Canvas"));
                      ^
../src/Canvas.cc:44:22: error: ‘NewSymbol’ is not a member of ‘v8::String’
   proto->SetAccessor(NanSymbol("type"), GetType);
                      ^
../src/Canvas.cc:45:22: error: ‘NewSymbol’ is not a member of ‘v8::String’
   proto->SetAccessor(NanSymbol("width"), GetWidth, SetWidth);
                      ^
../src/Canvas.cc:46:22: error: ‘NewSymbol’ is not a member of ‘v8::String’
   proto->SetAccessor(NanSymbol("height"), GetHeight, SetHeight);
                      ^
../src/Canvas.cc:47:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
   target->Set(NanSymbol("Canvas"), ctor->GetFunction());
               ^
../src/Canvas.cc: In static member function ‘static void Canvas::New(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/Canvas.cc:60:51: error: ‘AsciiValue’ is not a member of ‘v8::String’
   if (args[2]->IsString()) type = !strcmp("pdf", *String::AsciiValue(args[2]))
                                                   ^
../src/Canvas.cc: In static member function ‘static void Canvas::GetType(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)’:
../src/Canvas.cc:75:36: error: ‘New’ is not a member of ‘v8::String’
   NanReturnValue(String::New(canvas->isPDF() ? "pdf" : "image"));
                                    ^
../src/Canvas.cc:75:82: error: return-statement with a value, in function returning 'void' [-fpermissive]
   NanReturnValue(String::New(canvas->isPDF() ? "pdf" : "image"));
                                                                                  ^
../src/Canvas.cc: In static member function ‘static void Canvas::GetWidth(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)’:
../src/Canvas.cc:85:61: error: no matching function for call to ‘v8::Number::New(int&)’
   NanReturnValue(Number::New(canvas->width));
                                                             ^
../src/Canvas.cc:85:61: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1976:24: note: static v8::Local<v8::Number> v8::Number::New(v8::Isolate*, double)
   static Local<Number> New(Isolate* isolate, double value);
                        ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1976:24: note:   candidate expects 2 arguments, 1 provided
../src/Canvas.cc:85:62: error: return-statement with a value, in function returning 'void' [-fpermissive]
   NanReturnValue(Number::New(canvas->width));
                                                              ^
../src/Canvas.cc: In static member function ‘static void Canvas::GetHeight(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&)’:
../src/Canvas.cc:108:62: error: no matching function for call to ‘v8::Number::New(int&)’
   NanReturnValue(Number::New(canvas->height));
                                                              ^
../src/Canvas.cc:108:62: note: candidate is:
In file included from ../src/Canvas.h:11:0,
                 from ../src/Canvas.cc:7:
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1976:24: note: static v8::Local<v8::Number> v8::Number::New(v8::Isolate*, double)
   static Local<Number> New(Isolate* isolate, double value);
                        ^
/home/q2dg/.node-gyp/0.11.14/deps/v8/include/v8.h:1976:24: note:   candidate expects 2 arguments, 1 provided
../src/Canvas.cc:108:63: error: return-statement with a value, in function returning 'void' [-fpermissive]
   NanReturnValue(Number::New(canvas->height));
                                                               ^
../src/Canvas.cc: At global scope:
../src/Canvas.cc:158:23: error: variable or field ‘ToBufferAsync’ declared void
 Canvas::ToBufferAsync(uv_work_t *req) {
                       ^
../src/Canvas.cc:158:23: error: ‘uv_work_t’ was not declared in this scope
../src/Canvas.cc:158:34: error: ‘req’ was not declared in this scope
 Canvas::ToBufferAsync(uv_work_t *req) {
                                  ^
../src/Canvas.cc:184:28: error: variable or field ‘ToBufferAsyncAfter’ declared void
 Canvas::ToBufferAsyncAfter(uv_work_t *req) {
                            ^
../src/Canvas.cc:184:28: error: ‘uv_work_t’ was not declared in this scope
../src/Canvas.cc:184:39: error: ‘req’ was not declared in this scope
 Canvas::ToBufferAsyncAfter(uv_work_t *req) {
                                       ^
../src/Canvas.cc:129:1: warning: ‘cairo_status_t toBuffer(void*, const uint8_t*, unsigned int)’ defined but not used [-Wunused-function]
 toBuffer(void *c, const uint8_t *data, unsigned len) {
 ^
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
make: Leaving directory `/home/q2dg/node_modules/ansi-canvas/node_modules/canvas/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/q2dg/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1059:12)
gyp ERR! System Linux 3.16.7-200.fc20.x86_64
gyp ERR! command "node" "/home/q2dg/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/q2dg/node_modules/ansi-canvas/node_modules/canvas
gyp ERR! node -v v0.11.14
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

Error: Cannot find module '../build/Release/canvas.node'

module.js:557
    throw err;
    ^

Error: Cannot find module '../build/Release/canvas.node'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/adm/Documents/Projects/ihack2712/theteamcoders.api.v2/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.