Jan Stola
6b38d3b808
Removing redundant duplicate calls.
9 years ago
Linus Unnebäck
a94a427da0
require new in constructor
9 years ago
Raul Ochoa
c651227202
Allow to unbind onload/onerror callback handlers
Assigning `null` to handlers removes them, this mimic the behaviour from Google Chrome.
From Chrome's Developer Tools:
```js
> function handler(evt) { console.log('img handler: %s', evt.type); }
< undefined
> var img = document.createElement('img')
< undefined
> img.onload = handler
< handler(evt)
> img.onerror = handler
< handler(evt)
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png '; true
< true
< img handler: load
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png '; true
< true
< img handler: load
> img.src = 'https://example.com/404.png '; true
< true
< img handler: error
> img.src = 'https://example.com/404.png '; true
< true
< img handler: error
> img.onload = null
< null
> img.onerror = null
< null
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png '; true
< true
> img.src = 'https://example.com/404.png '; true
< true
```
10 years ago
Zach Bjornson
d4d3b9c724
Update to NAN 2 and node 3+ APIs
10 years ago
Raul Ochoa
d37f9c31c1
Don't unbind onload/onerror callbacks after invoking them
From "[WHATWG HTML Living Standard]
(https://html.spec.whatwg.org/multipage/indices.html#event-load )", the definition of 'onload':
> Fired at the Window when the document has finished loading; fired at an
element containing a resource (e.g. img, embed) when its resource has finished
loading
To adhere to that specification both handlers should be called as many times as Image loads.
From Google Chrome's Developer Tools:
```js
> function handler(evt) { console.log('img handler: %s', evt.type); }
< undefined
> var img = document.createElement('img')
< undefined
> img.onload = handler
< handler(evt)
> img.onerror = handler
< handler(evt)
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png '; true
< true
< img handler: load
> img.src = 'https://www.google.com/images/errors/logo_sm_2.png '; true
< true
< img handler: load
> img.src = 'https://example.com/404.png '; true
< true
< img handler: error
> img.src = 'https://example.com/404.png '; true
< true
< img handler: error
```
10 years ago
kibao
6edec3b6e4
Fix segmentation fault in Image::loadFromBuffer when buffer is empty
10 years ago
Matthieu Dehaussy
372fb699f0
Update Image.cc
fix fopen mode for non-POSIX platform
10 years ago
svandecappelle
c383d11412
Giflib 5.1
11 years ago
svandecappelle
9fa62ba875
Update Image.cc
11 years ago
svandecappelle
0eefc23ee5
Giflib 5.1
update to compile with giflib >= 5.1
11 years ago
King Koopa
c18d777f57
Updated NAN to 1.2.0
11 years ago
Rod Vagg
9b62e5f64e
beginning nan@1.0.0 conversion
11 years ago
King Koopa
8dbdd009b5
Runs on new v8.
11 years ago
William Riancho
1256ce44d7
fix segfault when onload and onerror are not function
11 years ago
King Koopa
0bc1aaf38b
Added scopes.
12 years ago
King Koopa
1219a151bc
Testing...
12 years ago
Jason Rose
50b904edd7
Deallocating both onload and onerror handlers.
12 years ago
Akita Noek
a0632275c5
Fixed build error with giflib 5.0
Newer giflib versions have a new ErrorCode parameter in several
functions, DGifOpen being one of them.
12 years ago
mscdex
fd56f06e87
Fix resource leaks on read errors
12 years ago
Rod Vagg
2354d9bb8c
0.11.4+ compatibility using NAN
See https://github.com/rvagg/nan
12 years ago
TJ Holowaychuk
4686fa3b97
Revert "Fixed Error that prevented NPM install on mac."
This reverts commit 92d8e84a6d
.
incorrect
12 years ago
Infinite Whiteboard
13b8f41141
Added backwards compatibility through conditional compilation.
12 years ago
Infinite Whiteboard
14a19421d2
Patch for Node 0.11.3
12 years ago
Victor Goya
93bb98d440
loadJPEG: fix fread() return value testing
According to the fread() manpage, successful fread() call will return 1 and not len in this case.
12 years ago
Matthew Borden
92d8e84a6d
Fixed Error that prevented NPM install on mac.
NPM spat out a error that there was only 2 params in DGIFOPEN. I added
the third, an error interger.
12 years ago
Mark Cochran
4a3caeb25f
Adding support for grayscale JPEG.
13 years ago
c-spencer
35d491a284
Add pango drawing support, and silence some warnings.
13 years ago
Nathan Rajlich
7cf35c8396
export the "gifVersion" when compiled with gif support
13 years ago
TJ Holowaychuk
f5be948340
fix jpeg malloc Image issue. Closes #160 [c-spencer]
13 years ago
TJ Holowaychuk
f47422fd06
fixed Image bit flags
13 years ago
TJ Holowaychuk
69d4eb3987
slight refactor
13 years ago
c-spencer
03584c3307
Improve Image mode API
13 years ago
c-spencer
4c5962b90e
Add clearData method to handle reassignment of src, and clean up mime data memory handling.
13 years ago
c-spencer
cc994d2d8d
Improve how _data_len is managed and use to adjust memory, hide more of mime API behind cairo version conditional.
13 years ago
c-spencer
8b8ee7f017
Add optional mime-data tracking to Image.
13 years ago
c-spencer
d5838bc4aa
Refactor JPEG decoding into decodeJPEGIntoSurface
13 years ago
TJ Holowaychuk
56d49559de
clean up free()s
13 years ago
TJ Holowaychuk
ba94a33d74
live_data -> _data
13 years ago
David Björklund
c9f991b8de
Fixes the Image memory leak ( #150 ). It is basically the fix from @AllYearbooks fork without the mime-stuff.
13 years ago
Tj Holowaychuk
f8ffa3fdb5
replaced seek with fstat()
13 years ago
Tj Holowaychuk
323e24ba42
clean up styling
13 years ago
obarthel
4cfb7a61b2
Added error cleanup code to the JPEG loader functions
13 years ago
Tj Holowaychuk
762f8865de
misc cleanup
13 years ago
Tj Holowaychuk
f72f8072ab
Added data uri support. Closes #49
easy as pie now that we have .src=Buffer support
13 years ago
Walt Lin
bb1fbcf426
Make node-canvas compile with libjpeg62-dev or libjpeg8-dev.
- detect if libjpeg is < 8 and if so, define our own jpeg_mem_src.
13 years ago
Tj Holowaychuk
8192e7e817
Added better image format detection
removed lame extension checks
14 years ago
Tj Holowaychuk
7f8c2998a3
unnecessary parens
14 years ago
Tj Holowaychuk
451154ce4c
unnecessary parens
14 years ago
Tj Holowaychuk
5f74448ba2
unnecessary parens
14 years ago
Tj Holowaychuk
ae4eb50bf1
imageIdx -> i
14 years ago