Commit Graph

62 Commits

Author SHA1 Message Date
Mikko Mononen
cd0841b54a Make div255 to compile on gcc 2015-06-12 12:36:23 +03:00
Mikko Mononen
1dd78511c4 Merge pull request #40 from chrismile/master
Fix for "nsvg__scanlineSolid"
2015-06-12 12:30:08 +03:00
Christoph Neuhauser
8d51b88261 Fix for "nsvg__scanlineSolid"
Updated fix for https://github.com/memononen/nanosvg/issues/37 (code now
using nsvg__div255).

Fix for "nsvg__scanlineSolid" #2

Updated fix for https://github.com/memononen/nanosvg/issues/37 (code now
using nsvg__div255).
2015-06-12 11:11:26 +02:00
Mikko Mononen
5966d6e77a Handle fill rule properly
- added parser for fill rule
- added even-odd fill rule support for rasteriser
2015-06-12 07:45:34 +03:00
Mikko Mononen
46e8b7864c Merge pull request #35 from chrismile/master
Improved gradient support
2015-05-27 16:20:18 +03:00
Christoph Neuhauser
0cda96c5ba Style change
!stops -> stops == NULL
2015-05-27 14:52:36 +02:00
Christoph Neuhauser
7f38f873bc Improved gradient support
Fixed/added the following things:
- The right initial values for linear (x2=1.0f) and radial gradients
(cx=cy=r=0.5f). See:
http://www.w3.org/TR/SVG/pservers.html#LinearGradients
- Fixed matrix multiplication order in "nsvg__createGradient" to
properly support gradientUnits="userSpaceOnUse"
- Added support for gradientUnits="objectBoundingBox" with percentage
and floating point values (tested with
http://www.w3.org/TR/SVG/images/pservers/lingrad01.svg)
- Added patch from https://github.com/memononen/nanosvg/issues/29
- Fixed removing the hash in front of "link:href" references. Currently
this only means that the first char is skipped. Not quite optimal (can
there be leading whitespace chars?), but it at least works.
2015-05-27 14:27:31 +02:00
Mikko Mononen
0874d4917d Merge pull request #32 from galibert/master
Cleanup minor warnings
2015-03-24 10:14:23 +02:00
Olivier Galibert
76b014b8bb Cleanup minor warnings 2015-03-23 23:00:51 +01:00
Mikko Mononen
3919b40ad2 Merge pull request #28 from scanlime/upstream
Keep the 'id' attribute for shapes
2015-01-25 20:54:02 +02:00
Micah Elizabeth Scott
4b17261f97 Keep the 'id' attribute for shapes
This remembers the 'id' string for shapes (or their parent groups).

I find this useful for storing pertinent names or metadata in the shape's layer name in Illustrator. When saving the document as SVG, that string ends up in the 'id' attribute.

The library was already saving 'id' attributes for gradients. I didn't see an elegant way to combine that mechanism with this patch, but the small change in attr parsing order should allow the two to coexist.
2015-01-24 20:39:50 -08:00
Mikko Mononen
767072b07a Fix for issue #23
- fix conversion of ndiv to int so that right number of iterations are
done.
2015-01-09 21:33:21 +02:00
Mikko Mononen
fbc6c549c6 Merge pull request #22 from waylonis/master
Silence compiler warnings on OS X.
2014-12-19 11:42:02 +02:00
Dan Waylonis
d92551bf31 Silence compiler warnings on OS X. 2014-12-18 15:11:15 -08:00
Mikko Mononen
c4f15e8f2f Restore example filename 2014-11-05 18:57:34 +02:00
Mikko Mononen
4101587c9a Issue #20: fixed stroke scaling handling
- better handling of getting stroke scaling from matrix
2014-11-05 11:12:59 +02:00
Mikko Mononen
205d5197d2 Issue #20: better handling of miter joins
- better handling if stroke miter joins (inner bevel)
- correct default miter 4
2014-11-05 10:47:35 +02:00
Mikko Mononen
ae51200111 Another fix for issue #20: more robust matrix parsing
- separated number parsing into a function
- more robust parse logic for matrix
2014-11-04 15:23:41 +02:00
Mikko Mononen
ac375ba28d Fix for issue #20
- yet another fix for path parsing, allow number to start with .
2014-11-03 19:00:22 +02:00
Mikko Mononen
cd0a2029fa First stab at line rendering
- added tessellation and rendering of lines
- added parsing for line joins and caps
2014-10-31 15:56:36 +02:00
Mikko Mononen
268503755e Merge pull request #19 from SmilyOrg/minor-fixes
A couple of minor fixes
2014-09-25 21:29:06 +03:00
Miha Lunar
295fc16eff added a null check, otherwise it can crash when loading an empty file 2014-09-25 20:17:23 +02:00
Miha Lunar
e54d5b4451 changed from float to double to avoid losing precision (and avoid a warning) 2014-09-25 20:16:37 +02:00
Mikko Mononen
e1c9a791f2 Merge pull request #16 from bryanmcconkey/master
Fix for C89 compilers
2014-08-25 12:07:41 +03:00
Bryan McConkey
022f52ee94 Fix for C89 compilers. In compilers that only support C89 the variables must be declared first. 2014-08-18 16:00:39 -04:00
Mikko Mononen
671a4be4f3 Merge pull request #15 from jpjodoin/master
Bug fix for rotation handling.
2014-07-24 23:29:10 +03:00
Jean-Philippe Jodoin
771146226b Bug fix for rotation handling. We were doing [T][R0][T-1] instead of [T-1][R0][T] because of the premultiply in nsvg__parseRotate. 2014-07-24 16:23:22 -04:00
Mikko Mononen
35b5b59729 Fixed bug when using close 'z' followed by relative move to 'm'
- close path was not moving the current point to the end of the close
line segment
2014-06-14 01:09:04 +03:00
Mikko Mononen
ed582145f6 Fixed borked notused macro 2014-06-13 21:21:26 +03:00
Mikko Mononen
c53c48759d Added typedefs to structs
- typedef’d structs
- added named parameters
2014-06-12 20:53:00 +03:00
Mikko Mononen
1acb9f0c9b Fixed issue #11
- fixed compiler warnings
- supper single and double quotes
2014-06-12 20:01:32 +03:00
Mikko Mononen
0e41b5d029 Merge pull request #13 from tn0502/master
Fixed a couple of compiler warnings.
2014-05-31 11:28:38 +03:00
Tommy Nguyen
6cab36303d Fixed a couple of compiler warnings.
- anonymous types declared in an anonymous union are an extension
- unused parameters
2014-05-31 10:12:00 +02:00
Mikko Mononen
4d78e65c86 Fix for issue #12
- fixed previous control point for shorthand beliers
2014-05-25 12:55:25 +03:00
Mikko Mononen
95caf10c0b Fix for issue #4 and issue #5 added per shape opacity parameter
- added parsing for per shape opacity
- added support for per shape opacity in rasteriser
2014-04-04 21:58:50 +03:00
Mikko Mononen
1b894120be Fixed issue #6
- fixed endless loop in nsvg__findGradientData
2014-03-29 10:03:53 +02:00
Mikko Mononen
507bdf4653 Merge pull request #10 from bryanmcconkey/master
Fix for nsvg__parseTransform not parsing multiple transformations
2014-03-29 09:58:42 +02:00
Bryan McConkey
6cc0d0163e Fix for nsvg__parseTransform not parsing multiple transformations 2014-03-28 23:06:15 -04:00
Mikko Mononen
e937a513c6 Fix for unpremultiply, osx compiling
- fixed compiling on osx mavericks
- fixed unpremultiply
2014-02-25 23:03:38 +02:00
Mikko Mononen
5f217448d9 Merge pull request #8 from bryanmcconkey/master
Fix for transforms on path elements
2014-02-23 19:14:13 +02:00
Bryan McConkey
1666f36021 Storing pointer to path data instead of index. As per memononen's feedback. 2014-02-23 12:08:23 -05:00
Bryan McConkey
5a48c96aac Fix for transforms on path elements with 'transform' attributes which appear after the path data 'd' attributes but should still apply to the path 2014-02-23 08:45:22 -05:00
Mikko Mononen
0189176ec4 Fixed null pointer access in unit conversion 2014-02-02 18:25:53 +02:00
Mikko Mononen
47864e21bc Added gradients
- renamed NSVGParser to NSVGparser
- first stab at parsing gradients
- first stab at rendering gradients
- fixed overflow in rasterizer
2014-01-30 23:33:41 +02:00
Mikko Mononen
135a658741 Added viewBox and unit coversion support
- added exact bounds calculation for bezier curves, paths, shapes
- added unit coversion for svg length values (use px internally)
- added viewBox and preserveAspectRatio handling
- removed some test SVGs
2014-01-29 19:50:41 +02:00
Mikko Mononen
a866ad3d7a Further nextPathItem fixes for numbers 2014-01-26 22:07:28 +02:00
Mikko Mononen
87aed6d1fc Fixed bug in path number parsing in exponent form (i.e. 6e-5) 2014-01-23 19:02:23 +02:00
Mikko Mononen
95daad571d Fix for potential buffer override in nsvg__parseElement() 2014-01-11 21:01:49 +02:00
Mikko Mononen
b3f906a393 Updated documentation 2014-01-09 23:22:38 +02:00
Mikko Mononen
8e47686015 Added pool alloc for active edges, improved tesselation algo, better guessing of image size
- added pool alloc for active edges
- improved tesselation algo
- better guessing of image size
- reverted tiger to default state
2014-01-09 23:05:52 +02:00