Hussein Jafferjee
85aff9e5e4
improve comment on why the offset is there
9 years ago
Hussein Jafferjee
f8368996b8
Change to 1.4 to match chrome
9 years ago
Hussein Jafferjee
4f722ffa53
forgot to destroy context and surface
9 years ago
Hussein Jafferjee
4e9269cc34
implement blur on images (drawImage)
9 years ago
Zach Bjornson
d4d3b9c724
Update to NAN 2 and node 3+ APIs
10 years ago
Linus Unnebäck
858d79bb4c
test: fix up some small issues
10 years ago
Zach Bjornson
7d9286638f
Support node <0.12 using kExternalPixelArray.
10 years ago
Zach Bjornson
43c94e43bf
Pixels with a=0 should have 0 for RGB; pixels with a=255 should have rgb for RGB.
10 years ago
Zach Bjornson
11f0709ec6
Fix tests "putImageData() 8" and "putImageData() 9".
Negative arguments were causing source image data to be painted wrapped-around the other side of the canvas.
10 years ago
Zach Bjornson
76580a8199
Optimize Context2d::PutImageData. Benchmarked 53% faster.
Benchmark:
var canvas = new Canvas(300, 600);
var ctx = canvas.getContext("2d");
// any manipulation of canvas/ctx here.
var data = ctx.getImageData(0,0,300,600);
// time 1000x:
ctx.putImageData(data, 0, 0);
10 years ago
Zach Bjornson
b4a05d7892
Replace CanvasPixelArray with Uint8ClampedArray to meet spec.
Added some argument testing/manipulation to match WebKit/Moz behaviors.
Additionally benchmarked:
* branching on `if (a == 0 || a == 255)`, as it is
* not branching (always doing the alpha calculation)
* Mozilla's implementation found here: https://dxr.mozilla.org/mozilla-central/source/dom/canvas/CanvasRenderingContext2D.cpp#5083
Mozilla's is insignificantly faster (p=0.17) :) so left it as-is.
10 years ago
Josip Janžić
2ed7587379
define correct isnan, isinf functions
10 years ago
Joe Freeman
66a7a895d8
Fix 'drawImage' scaling (the dimensions of the region that gets clipped also needs to be scaled).
10 years ago
Andy Wood
dfc661f28f
Just use cairo_image_surface_create rather than cairo_surface_create_similar_image which was introduced in cairo 1.12.
Unfortunately the cairo distributed with GTK+, used in the Windows build, is only 1.10.
Using the similar_image version offers backends the chance to be more efficient, but the alternative used here is used as a fallback in the cairo code anyway.
10 years ago
Andy Wood
8c6984a099
Fix issue with line width not being correct in stroked shadows.
10 years ago
Andy Wood
822d822066
Refactor setSourceRGBA to allow the context to be supplied.
10 years ago
Andy Wood
39766d1fd6
Simple image shadow (no blurring or handling current transforms) based on image's alpha channel.
10 years ago
Andy Wood
2b366c684e
The +1 on the offset seems to match the browser's output better, but I can't work out why it would be needed (unless it's pixel alignment related).
10 years ago
Andy Wood
617aabc6ae
Make the shadow radius more accurately match the browser's, making use of sigma scale as used in SKIA: https://github.com/google/skia/blob/master/src/effects/SkBlurMask.cpp#L26 .
10 years ago
Andy Wood
0dcc70b2b3
Create a new image surface to render blurred shadows to, this means that vector formats like PDF will now render blurs.
10 years ago
Andy Wood
5d9582b81e
Add recommended calls to flush and dirty buffer, as per http://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-image-surface-get-data .
10 years ago
Andy Wood
95e342d259
Fix to ensure shadowOffset is unaffected by the current transform.
10 years ago
Jake Gordon
36bd6498b5
float rather than int for drawImage arguments
10 years ago
King Koopa
9ffde8ebb3
Add algorithm include to CanvasRenderingContext2d.cc for std::min
11 years ago
King Koopa
c18d777f57
Updated NAN to 1.2.0
11 years ago
Vincent Weevers
f42a018a8d
Add shims so Windows Visual C++ can use C99's isnan() and isinf().
11 years ago
David Caldwell
87abe5a85e
Use std::vector instead of C99 variable length arrays because of Visual C++.
Addresses Issue #420
11 years ago
David Caldwell
31dd7d6d21
Add support for the lineDash API.
Described here:
http://www.w3.org/TR/2dcontext/#dom-context-2d-setlinedash
The test images match on Chrome, but not on Firefox. It looks like
Firefox resets the lineDash to [] when given invalid parameters. My
reading of the spec agrees with Chrome.
11 years ago
Rod Vagg
9b62e5f64e
beginning nan@1.0.0 conversion
11 years ago
nulltask
844294efd1
change operator lighter to lighten
11 years ago
King Koopa
8dbdd009b5
Runs on new v8.
11 years ago
Mitar
76bbe247fa
Correctly limit bounds in PutImageData to prevent segment fault.
11 years ago
Seth Fitzsimmons
fb9e576bfb
Distinguish between 'add' and 'lighter'
When CAIRO_OPERATOR_ADD and CAIRO_OPERATOR_LIGHTEN are both available,
make CAIRO_OPERATOR_ADD available as 'add'.
11 years ago
Rod Vagg
2354d9bb8c
0.11.4+ compatibility using NAN
See https://github.com/rvagg/nan
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
Seth Fitzsimmons
8dc36f09fa
CanvasRenderingContext2d#filter
Like patternQuality, but applies to transformations effecting more than just
patternsi (i.e. the implicitly created pattern).
See
http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-pattern-set-filter
for more information.
12 years ago
Seth Fitzsimmons
a1fa149551
Add 'nearest' and 'bilinear' to patternQuality
12 years ago
TJ Holowaychuk
ef897a2a2c
ocd
12 years ago
Julian Viereck
1d3a99d85a
Add support to load fonts from file.
12 years ago
c-spencer
474635d526
Fix Context2d::SetFont for pango when setting normal weight/style
13 years ago
c-spencer
3388ab5b33
Properly dispose of pango related allocations in ~Context2d()
13 years ago
c-spencer
efadaead73
Add measureText implementation for pango
13 years ago
c-spencer
8e9defcb79
Tidy up build files and util script.
13 years ago
c-spencer
50ab677036
Use strndup for duplicating fontFamily strings.
13 years ago
c-spencer
35d491a284
Add pango drawing support, and silence some warnings.
13 years ago
c-spencer
8b8ee7f017
Add optional mime-data tracking to Image.
13 years ago
c-spencer
307fa29396
Switch draw mode state to an enum.
13 years ago
c-spencer
d5d9c59e56
Improve bottom and middle baseline calculation.
13 years ago
c-spencer
e06ed99dec
Partial TextMetrics support.
13 years ago