Commit Graph

77 Commits

Author SHA1 Message Date
Bernhard Liebl
773d84acaf Add option for cpp symbol export 2018-08-08 07:21:54 +02:00
Mikko Mononen
35a45f3396 Merge branch 'pr/63' 2018-07-22 23:08:43 +03:00
Caleb Jones
d6eabf29c9 Parse <svg> percentage width for automatic sizing
Instead of calculating percentage coordinates relative to 1px, we calculate them
relative to 0px width, that way an explicit <svg width="100%"> will be converted
to <svg width="0px"> and trigger the bounding-box sizing calculation.
2018-04-13 19:57:06 -04:00
Martin Lindhe
19bf258060 type fix: change nsvg__parseLineJoin() default value to NSVG_JOIN_MITER 2018-03-16 15:05:04 +01:00
Mikko Mononen
47697e1414 Fixed how sign is applied for fractions 2017-07-01 18:07:55 +03:00
Mikko Mononen
9b51689812 Fix for issue #90 - use custom strong to float conversion
Use custom strong to float conversion instead of the one from std
library to fix parsing floats with locales which use different number
format than specified by SVG.
2017-06-30 18:16:26 +03:00
X-Ryl669
17aa37f0c4 Fix for gradient transformation when scaling is used 2017-06-13 15:46:05 +02:00
X-Ryl669
7a9b4005c0 Fix for wrong computation in ArcTo function 2017-06-01 11:35:03 +02:00
djack1010
a53bdc7512 Revert wrong comment 2017-04-25 11:12:41 +02:00
djack1010
41dcaefdd0 Applied requested changes 2017-04-24 11:41:21 +02:00
djack1010
fe14c0386c Ignore malformed attributes in XML 2017-04-22 23:45:24 +02:00
djack1010
4310325aba Check buffer length in parseCoordinateRaw 2017-04-22 23:41:19 +02:00
Mikko Mononen
aeba90c947 Merge branch 'master' into master 2017-04-22 08:14:59 +03:00
daniel-starke
096f60a5c5 Changed reverse shape list to tail cached variant 2017-04-21 22:05:26 +02:00
lieff
c28363f9fb coding style 2017-04-21 21:42:46 +03:00
daniel-starke
3f40cbc53e Fixed reverse shape list implementation 2017-04-21 18:41:59 +02:00
lieff
64c8b0c00c fix shapes order 2017-04-21 19:28:06 +03:00
daniel-starke
c4a603c20e Fixed GCC warnings 2017-04-21 18:14:03 +02:00
tpechot
f76c596d8a add new shapes to the head due to performance, reverse list of shapes later 2017-04-20 14:32:02 +02:00
Mark Tyberg
2f132b7ad8 addded support for stroke-miterlimit 2017-03-10 23:14:10 -05:00
Erick Fuentes
7742da24b0 Fixed typo and added variable types 2016-03-22 20:00:44 -04:00
Alessandro Roncone
3d8f8485f2 Added nsvgDuplicatePath . Also, fixed some minor typos into the tutorial. Ref #62 2016-02-17 20:12:59 -05:00
Dean McNamee
a2cab64022 Fix minor typo in credit comment (Anti-Graim -> Anti-Grain). 2016-02-02 13:56:30 +01:00
Dean McNamee
b021682f5a Fix relative T/t path commands. Typo from S/s command. 2016-01-23 18:49:33 +01:00
Nigel Stewart
a5be2ffa50 Resolve release-mode gcc compilation warning: fread return value ignored 2015-12-21 21:41:25 +10:00
Mikko Mononen
dc75508682 Implemented dashed stroke rendering 2015-11-07 23:19:30 +02:00
Mikko Mononen
7efce85328 Better support for coordinates, fixes local space percentage gradients
- fixed zero check in form inverse (was producing NaNs
- improved coordinate parsing
- handle gradient percentage coords properly
2015-11-07 20:00:05 +02:00
Olivier Galibert
d023064305 Fix the visibility attribute parsing, keep the information in the
shape and take it into account in the rendering.
2015-11-05 17:07:14 +01:00
jry2
b3dc3e6543 Fixed VC2015 RC warnings.
-possible loss of data while conversions
-potentially uninitialized local variables
-declaration hides previous local declaration
2015-06-12 21:19:26 +02:00
Mikko Mononen
cd0841b54a Make div255 to compile on gcc 2015-06-12 12:36:23 +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
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
Olivier Galibert
76b014b8bb Cleanup minor warnings 2015-03-23 23:00:51 +01: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
Dan Waylonis
d92551bf31 Silence compiler warnings on OS X. 2014-12-18 15:11:15 -08: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
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
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
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