Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffb55b0f31 | |||
| a4c032afa2 | |||
| abe8f4cba5 | |||
| a16842271b | |||
| 58126e06e4 | |||
| 5af5e054ab | |||
| edd3aa1f33 | |||
| 3366bc4fa5 | |||
| 104002183b | |||
| 7010b7ea50 | |||
| 5266a8c07a | |||
| caf55e8bdf | |||
| 8160d05eba | |||
| a6d6a06521 | |||
| 103a4d71f6 | |||
| 98874b1d2c | |||
| e742db31e0 | |||
| 198fd09f07 | |||
| 3493194b1b | |||
| 0016775eaf | |||
| 304a04cc22 | |||
| e4fd0af582 | |||
| 69a2a0c97e | |||
| 5299bb0479 | |||
| 4f1943cad1 | |||
| f02d186293 | |||
| 3291718cfb | |||
| 6fbaaf5884 | |||
| abc65797ea | |||
| af5a1c2718 | |||
| fb9a5282b9 | |||
| d83933a103 | |||
| bd7a0d5021 | |||
| a9a038568c | |||
| 77fbb38b6f | |||
| 12c3191569 | |||
| e3e9626ef7 | |||
| 1160d89f16 | |||
| 1575cbfde8 | |||
| 5c4c2eee91 | |||
| 087b13e58f | |||
| 1183e167aa | |||
| 4dbfc59437 | |||
| 409bd509fa | |||
| 8ae1d1b4e0 | |||
| 7243fbe5ff | |||
| 51b9a5e85f | |||
| 40098589de | |||
| 7cb96b21f2 | |||
| 1bff7c6970 |
@@ -1 +0,0 @@
|
||||
.DS_Store
|
||||
@@ -1,979 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
590EB7A427F637EF0047CECF /* IJSVGTransformLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 590EB7A227F637EF0047CECF /* IJSVGTransformLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
590EB7A527F637EF0047CECF /* IJSVGTransformLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 590EB7A327F637EF0047CECF /* IJSVGTransformLayer.m */; };
|
||||
5919E65723F47FF60051873A /* IJSVGUnitRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 5919E65523F47FF60051873A /* IJSVGUnitRect.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
5919E65823F47FF60051873A /* IJSVGUnitRect.m in Sources */ = {isa = PBXBuildFile; fileRef = 5919E65623F47FF60051873A /* IJSVGUnitRect.m */; };
|
||||
5919E65B23F480330051873A /* IJSVGUnitPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 5919E65923F480330051873A /* IJSVGUnitPoint.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
5919E65C23F480330051873A /* IJSVGUnitPoint.m in Sources */ = {isa = PBXBuildFile; fileRef = 5919E65A23F480330051873A /* IJSVGUnitPoint.m */; };
|
||||
591A3E4D25CC91F800AD45B7 /* IJSVGParsing.h in Headers */ = {isa = PBXBuildFile; fileRef = 591A3E4B25CC91F800AD45B7 /* IJSVGParsing.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
591A3E4E25CC91F800AD45B7 /* IJSVGParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 591A3E4C25CC91F800AD45B7 /* IJSVGParsing.m */; };
|
||||
594A10DA248D7C90001A3181 /* NSImage+IJSVGAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 594A10D8248D7C90001A3181 /* NSImage+IJSVGAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
594A10DB248D7C90001A3181 /* NSImage+IJSVGAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 594A10D9248D7C90001A3181 /* NSImage+IJSVGAdditions.m */; };
|
||||
594CF55F238FF462009B251B /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594CF55E238FF462009B251B /* AppKit.framework */; };
|
||||
594CF561238FF46C009B251B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594CF560238FF46C009B251B /* Foundation.framework */; };
|
||||
594CF563238FF473009B251B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 594CF562238FF473009B251B /* QuartzCore.framework */; };
|
||||
5978C46A280A241200D25296 /* IJSVGRootLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5978C468280A241200D25296 /* IJSVGRootLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
5978C46B280A241200D25296 /* IJSVGRootLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5978C469280A241200D25296 /* IJSVGRootLayer.m */; };
|
||||
599EB4D3238FF570004CB6BC /* libobjc.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 599EB4D2238FF535004CB6BC /* libobjc.tbd */; };
|
||||
59A24EBC23F480EA0090C374 /* IJSVGUnitSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A24EBA23F480EA0090C374 /* IJSVGUnitSize.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59A24EBD23F480EA0090C374 /* IJSVGUnitSize.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A24EBB23F480EA0090C374 /* IJSVGUnitSize.m */; };
|
||||
59E7CFAF23B148600077D599 /* IJSVGCommandParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E7CFAD23B148600077D599 /* IJSVGCommandParser.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59E7CFB023B148600077D599 /* IJSVGCommandParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E7CFAE23B148600077D599 /* IJSVGCommandParser.m */; };
|
||||
59EB75D623905F7300F5AE63 /* IJSVGLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756523905F6B00F5AE63 /* IJSVGLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75D723905F7300F5AE63 /* IJSVGGradientLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756623905F6B00F5AE63 /* IJSVGGradientLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75D823905F7300F5AE63 /* IJSVGStyleSheetRule.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB756723905F6B00F5AE63 /* IJSVGStyleSheetRule.m */; };
|
||||
59EB75D923905F7300F5AE63 /* IJSVGCommandLineTo.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756823905F6B00F5AE63 /* IJSVGCommandLineTo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75DA23905F7300F5AE63 /* IJSVGDef.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB756923905F6B00F5AE63 /* IJSVGDef.m */; };
|
||||
59EB75DB23905F7300F5AE63 /* IJSVG.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756A23905F6B00F5AE63 /* IJSVG.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75DC23905F7300F5AE63 /* IJSVGText.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756B23905F6B00F5AE63 /* IJSVGText.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75DD23905F7300F5AE63 /* IJSVGCommandQuadraticCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB756C23905F6B00F5AE63 /* IJSVGCommandQuadraticCurve.m */; };
|
||||
59EB75DE23905F7300F5AE63 /* IJSVGCommandVerticalLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756D23905F6C00F5AE63 /* IJSVGCommandVerticalLine.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75E023905F7300F5AE63 /* IJSVGStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB756F23905F6C00F5AE63 /* IJSVGStyleSheet.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75E123905F7300F5AE63 /* IJSVGCommandSmoothCurve.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757023905F6C00F5AE63 /* IJSVGCommandSmoothCurve.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75E223905F7300F5AE63 /* IJSVGColorList.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757123905F6C00F5AE63 /* IJSVGColorList.m */; };
|
||||
59EB75E323905F7300F5AE63 /* IJSVGRadialGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757223905F6C00F5AE63 /* IJSVGRadialGradient.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75E423905F7300F5AE63 /* IJSVGGradientUnitLength.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757323905F6C00F5AE63 /* IJSVGGradientUnitLength.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75E523905F7300F5AE63 /* IJSVGStrokeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757423905F6C00F5AE63 /* IJSVGStrokeLayer.m */; };
|
||||
59EB75E623905F7300F5AE63 /* IJSVGStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757523905F6C00F5AE63 /* IJSVGStyle.m */; };
|
||||
59EB75E723905F7300F5AE63 /* IJSVGImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757623905F6C00F5AE63 /* IJSVGImage.m */; };
|
||||
59EB75E823905F7300F5AE63 /* IJSVGUnitLength.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757723905F6C00F5AE63 /* IJSVGUnitLength.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75E923905F7300F5AE63 /* IJSVGStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757823905F6C00F5AE63 /* IJSVGStringAdditions.m */; };
|
||||
59EB75EA23905F7300F5AE63 /* IJSVGTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757923905F6C00F5AE63 /* IJSVGTransaction.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75EB23905F7300F5AE63 /* IJSVGShapeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757A23905F6C00F5AE63 /* IJSVGShapeLayer.m */; };
|
||||
59EB75EC23905F7300F5AE63 /* IJSVGLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757B23905F6C00F5AE63 /* IJSVGLayer.m */; };
|
||||
59EB75ED23905F7300F5AE63 /* IJSVGFontConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757C23905F6C00F5AE63 /* IJSVGFontConverter.m */; };
|
||||
59EB75EE23905F7300F5AE63 /* IJSVGImageRep.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB757D23905F6C00F5AE63 /* IJSVGImageRep.m */; };
|
||||
59EB75EF23905F7300F5AE63 /* IJSVGCommandQuadraticCurve.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757E23905F6C00F5AE63 /* IJSVGCommandQuadraticCurve.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75F023905F7300F5AE63 /* IJSVGStyleSheetSelectorRaw.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB757F23905F6C00F5AE63 /* IJSVGStyleSheetSelectorRaw.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75F123905F7300F5AE63 /* IJSVGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758023905F6C00F5AE63 /* IJSVGUtils.m */; };
|
||||
59EB75F223905F7300F5AE63 /* IJSVGStyleSheetSelectorRaw.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758123905F6C00F5AE63 /* IJSVGStyleSheetSelectorRaw.m */; };
|
||||
59EB75F323905F7300F5AE63 /* IJSVGGroupLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758223905F6C00F5AE63 /* IJSVGGroupLayer.m */; };
|
||||
59EB75F423905F7300F5AE63 /* IJSVGColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB758323905F6C00F5AE63 /* IJSVGColor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75F523905F7300F5AE63 /* IJSVGError.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB758423905F6C00F5AE63 /* IJSVGError.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75F623905F7300F5AE63 /* IJSVGColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758523905F6C00F5AE63 /* IJSVGColor.m */; };
|
||||
59EB75F723905F7300F5AE63 /* IJSVGDef.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB758623905F6C00F5AE63 /* IJSVGDef.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75F823905F7300F5AE63 /* IJSVGCommandHorizontalLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758723905F6C00F5AE63 /* IJSVGCommandHorizontalLine.m */; };
|
||||
59EB75F923905F7300F5AE63 /* IJSVGFontConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB758823905F6D00F5AE63 /* IJSVGFontConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75FB23905F7300F5AE63 /* IJSVGPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758A23905F6D00F5AE63 /* IJSVGPath.m */; };
|
||||
59EB75FC23905F7300F5AE63 /* IJSVGGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB758B23905F6D00F5AE63 /* IJSVGGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB75FD23905F7300F5AE63 /* IJSVGPatternLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758C23905F6D00F5AE63 /* IJSVGPatternLayer.m */; };
|
||||
59EB75FE23905F7300F5AE63 /* IJSVGRenderingStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758D23905F6D00F5AE63 /* IJSVGRenderingStyle.m */; };
|
||||
59EB760023905F7300F5AE63 /* IJSVGGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB758F23905F6D00F5AE63 /* IJSVGGradientLayer.m */; };
|
||||
59EB760123905F7300F5AE63 /* IJSVGLayerTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB759023905F6D00F5AE63 /* IJSVGLayerTree.m */; };
|
||||
59EB760223905F7300F5AE63 /* IJSVGCommandVerticalLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB759123905F6D00F5AE63 /* IJSVGCommandVerticalLine.m */; };
|
||||
59EB760323905F7300F5AE63 /* IJSVGNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759223905F6D00F5AE63 /* IJSVGNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760523905F7300F5AE63 /* IJSVGUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759423905F6D00F5AE63 /* IJSVGUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760623905F7300F5AE63 /* IJSVGCommandHorizontalLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759523905F6D00F5AE63 /* IJSVGCommandHorizontalLine.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760723905F7300F5AE63 /* IJSVGNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB759623905F6D00F5AE63 /* IJSVGNode.m */; };
|
||||
59EB760823905F7300F5AE63 /* IJSVGShapeLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759723905F6D00F5AE63 /* IJSVGShapeLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760923905F7300F5AE63 /* IJSVGCommandCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB759823905F6E00F5AE63 /* IJSVGCommandCurve.m */; };
|
||||
59EB760A23905F7300F5AE63 /* IJSVGCommandMove.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB759923905F6E00F5AE63 /* IJSVGCommandMove.m */; };
|
||||
59EB760B23905F7300F5AE63 /* IJSVGStyleSheetSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759A23905F6E00F5AE63 /* IJSVGStyleSheetSelector.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760C23905F7300F5AE63 /* IJSVGStyleSheetRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759B23905F6E00F5AE63 /* IJSVGStyleSheetRule.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760D23905F7300F5AE63 /* IJSVGCommandCurve.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759C23905F6E00F5AE63 /* IJSVGCommandCurve.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760E23905F7300F5AE63 /* IJSVGPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759D23905F6E00F5AE63 /* IJSVGPath.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB760F23905F7300F5AE63 /* IJSVGCommandEllipticalArc.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759E23905F6E00F5AE63 /* IJSVGCommandEllipticalArc.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761023905F7300F5AE63 /* IJSVGLinearGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB759F23905F6E00F5AE63 /* IJSVGLinearGradient.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761123905F7300F5AE63 /* IJSVGCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75A023905F6E00F5AE63 /* IJSVGCommand.m */; };
|
||||
59EB761223905F7300F5AE63 /* IJSVGRenderingStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75A123905F6E00F5AE63 /* IJSVGRenderingStyle.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761323905F7300F5AE63 /* IJSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75A223905F6E00F5AE63 /* IJSVG.m */; };
|
||||
59EB761423905F7300F5AE63 /* IJSVGImageRep.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75A323905F6E00F5AE63 /* IJSVGImageRep.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761523905F7300F5AE63 /* IJSVGStrokeLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75A423905F6E00F5AE63 /* IJSVGStrokeLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761623905F7300F5AE63 /* IJSVGParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75A523905F6E00F5AE63 /* IJSVGParser.m */; };
|
||||
59EB761723905F7300F5AE63 /* IJSVGRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75A623905F6F00F5AE63 /* IJSVGRadialGradient.m */; };
|
||||
59EB761823905F7300F5AE63 /* IJSVGParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75A723905F6F00F5AE63 /* IJSVGParser.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761923905F7300F5AE63 /* IJSVGCommandSmoothCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75A823905F6F00F5AE63 /* IJSVGCommandSmoothCurve.m */; };
|
||||
59EB761A23905F7300F5AE63 /* IJSVGColorList.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75A923905F6F00F5AE63 /* IJSVGColorList.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761B23905F7300F5AE63 /* IJSVGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75AA23905F6F00F5AE63 /* IJSVGPattern.m */; };
|
||||
59EB761C23905F7300F5AE63 /* IJSVGGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75AB23905F6F00F5AE63 /* IJSVGGradient.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761D23905F7300F5AE63 /* IJSVGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75AC23905F6F00F5AE63 /* IJSVGStyle.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761E23905F7300F5AE63 /* IJSVGGroupLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75AD23905F6F00F5AE63 /* IJSVGGroupLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB761F23905F7300F5AE63 /* IJSVGCommandLineTo.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75AE23905F6F00F5AE63 /* IJSVGCommandLineTo.m */; };
|
||||
59EB762023905F7300F5AE63 /* IJSVGCommandMove.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75AF23905F6F00F5AE63 /* IJSVGCommandMove.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762123905F7300F5AE63 /* IJSVGTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75B023905F6F00F5AE63 /* IJSVGTransform.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762223905F7300F5AE63 /* IJSVGMath.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75B123905F6F00F5AE63 /* IJSVGMath.m */; };
|
||||
59EB762323905F7300F5AE63 /* IJSVGExporterPathInstruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75B223905F6F00F5AE63 /* IJSVGExporterPathInstruction.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762423905F7300F5AE63 /* IJSVGTransaction.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75B323905F6F00F5AE63 /* IJSVGTransaction.m */; };
|
||||
59EB762523905F7300F5AE63 /* IJSVGTransform.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75B423905F6F00F5AE63 /* IJSVGTransform.m */; };
|
||||
59EB762623905F7300F5AE63 /* IJSVGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75B523905F7000F5AE63 /* IJSVGImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762723905F7300F5AE63 /* IJSVGMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75B623905F7000F5AE63 /* IJSVGMath.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762823905F7300F5AE63 /* IJSVGCommandClose.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75B723905F7000F5AE63 /* IJSVGCommandClose.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762923905F7300F5AE63 /* IJSVGStringAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75B823905F7000F5AE63 /* IJSVGStringAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762A23905F7300F5AE63 /* IJSVGGradientUnitLength.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75B923905F7000F5AE63 /* IJSVGGradientUnitLength.m */; };
|
||||
59EB762B23905F7300F5AE63 /* IJSVGUnitLength.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75BA23905F7000F5AE63 /* IJSVGUnitLength.m */; };
|
||||
59EB762C23905F7300F5AE63 /* IJSVGPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75BB23905F7000F5AE63 /* IJSVGPattern.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762D23905F7300F5AE63 /* IJSVGLayerTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75BC23905F7000F5AE63 /* IJSVGLayerTree.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB762E23905F7300F5AE63 /* IJSVGExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75BD23905F7000F5AE63 /* IJSVGExporter.m */; };
|
||||
59EB763023905F7300F5AE63 /* IJSVGPatternLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75BF23905F7000F5AE63 /* IJSVGPatternLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB763123905F7300F5AE63 /* IJSVGText.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C023905F7100F5AE63 /* IJSVGText.m */; };
|
||||
59EB763223905F7300F5AE63 /* IJSVGView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C123905F7100F5AE63 /* IJSVGView.m */; };
|
||||
59EB763323905F7300F5AE63 /* IJSVGLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C223905F7100F5AE63 /* IJSVGLinearGradient.m */; };
|
||||
59EB763523905F7300F5AE63 /* IJSVGStyleSheetSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C423905F7100F5AE63 /* IJSVGStyleSheetSelector.m */; };
|
||||
59EB763623905F7300F5AE63 /* IJSVGImageLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C523905F7100F5AE63 /* IJSVGImageLayer.m */; };
|
||||
59EB763723905F7300F5AE63 /* IJSVGCommandClose.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C623905F7100F5AE63 /* IJSVGCommandClose.m */; };
|
||||
59EB763823905F7300F5AE63 /* IJSVGCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75C723905F7100F5AE63 /* IJSVGCommand.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB763923905F7300F5AE63 /* IJSVGCommandSmoothQuadraticCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C823905F7200F5AE63 /* IJSVGCommandSmoothQuadraticCurve.m */; };
|
||||
59EB763A23905F7300F5AE63 /* IJSVGForeignObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75C923905F7200F5AE63 /* IJSVGForeignObject.m */; };
|
||||
59EB763B23905F7300F5AE63 /* IJSVGCommandSmoothQuadraticCurve.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75CA23905F7200F5AE63 /* IJSVGCommandSmoothQuadraticCurve.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB763C23905F7300F5AE63 /* IJSVGCommandEllipticalArc.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75CB23905F7200F5AE63 /* IJSVGCommandEllipticalArc.m */; };
|
||||
59EB763D23905F7300F5AE63 /* IJSVGGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75CC23905F7200F5AE63 /* IJSVGGroup.m */; };
|
||||
59EB763E23905F7300F5AE63 /* IJSVGView.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75CD23905F7200F5AE63 /* IJSVGView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB763F23905F7300F5AE63 /* IJSVGForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75CE23905F7200F5AE63 /* IJSVGForeignObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB764023905F7300F5AE63 /* IJSVGExporterPathInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75CF23905F7200F5AE63 /* IJSVGExporterPathInstruction.m */; };
|
||||
59EB764123905F7300F5AE63 /* IJSVGImageLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75D023905F7200F5AE63 /* IJSVGImageLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB764223905F7300F5AE63 /* IJSVGStyleSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75D123905F7300F5AE63 /* IJSVGStyleSheet.m */; };
|
||||
59EB764323905F7300F5AE63 /* IJSVGGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75D223905F7300F5AE63 /* IJSVGGradient.m */; };
|
||||
59EB764423905F7300F5AE63 /* IJSVGRendering.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75D323905F7300F5AE63 /* IJSVGRendering.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB764523905F7300F5AE63 /* IJSVGExporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EB75D423905F7300F5AE63 /* IJSVGExporter.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59EB764623905F7300F5AE63 /* IJSVGRendering.m in Sources */ = {isa = PBXBuildFile; fileRef = 59EB75D523905F7300F5AE63 /* IJSVGRendering.m */; };
|
||||
59F36508262F1ABB00BCE3FD /* IJSVGColorType.h in Headers */ = {isa = PBXBuildFile; fileRef = 59F36506262F1ABB00BCE3FD /* IJSVGColorType.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59F36509262F1ABB00BCE3FD /* IJSVGColorType.m in Sources */ = {isa = PBXBuildFile; fileRef = 59F36507262F1ABB00BCE3FD /* IJSVGColorType.m */; };
|
||||
59F9EAF82808BB5F00188ACB /* IJSVGViewBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 59F9EAF62808BB5F00188ACB /* IJSVGViewBox.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59F9EAF92808BB5F00188ACB /* IJSVGViewBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 59F9EAF72808BB5F00188ACB /* IJSVGViewBox.m */; };
|
||||
59FCC09427F2394D00BB924E /* IJSVGRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 59FCC09227F2394D00BB924E /* IJSVGRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59FCC09527F2394D00BB924E /* IJSVGRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 59FCC09327F2394D00BB924E /* IJSVGRootNode.m */; };
|
||||
59FDBF0027F3454800AF7038 /* IJSVGColorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 59FDBEFE27F3454800AF7038 /* IJSVGColorNode.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
59FDBF0127F3454800AF7038 /* IJSVGColorNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 59FDBEFF27F3454800AF7038 /* IJSVGColorNode.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
590EB7A227F637EF0047CECF /* IJSVGTransformLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGTransformLayer.h; sourceTree = "<group>"; };
|
||||
590EB7A327F637EF0047CECF /* IJSVGTransformLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGTransformLayer.m; sourceTree = "<group>"; };
|
||||
5919E65523F47FF60051873A /* IJSVGUnitRect.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGUnitRect.h; sourceTree = "<group>"; };
|
||||
5919E65623F47FF60051873A /* IJSVGUnitRect.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGUnitRect.m; sourceTree = "<group>"; };
|
||||
5919E65923F480330051873A /* IJSVGUnitPoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGUnitPoint.h; sourceTree = "<group>"; };
|
||||
5919E65A23F480330051873A /* IJSVGUnitPoint.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGUnitPoint.m; sourceTree = "<group>"; };
|
||||
591A3E4B25CC91F800AD45B7 /* IJSVGParsing.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGParsing.h; sourceTree = "<group>"; };
|
||||
591A3E4C25CC91F800AD45B7 /* IJSVGParsing.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGParsing.m; sourceTree = "<group>"; };
|
||||
594A10D8248D7C90001A3181 /* NSImage+IJSVGAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSImage+IJSVGAdditions.h"; sourceTree = "<group>"; };
|
||||
594A10D9248D7C90001A3181 /* NSImage+IJSVGAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSImage+IJSVGAdditions.m"; sourceTree = "<group>"; };
|
||||
594CF46F238FF38E009B251B /* IJSVG.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = IJSVG.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
594CF473238FF38E009B251B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
594CF55E238FF462009B251B /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
|
||||
594CF560238FF46C009B251B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
594CF562238FF473009B251B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
5978C468280A241200D25296 /* IJSVGRootLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGRootLayer.h; sourceTree = "<group>"; };
|
||||
5978C469280A241200D25296 /* IJSVGRootLayer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGRootLayer.m; sourceTree = "<group>"; };
|
||||
599EB4D2238FF535004CB6BC /* libobjc.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libobjc.tbd; path = usr/lib/libobjc.tbd; sourceTree = SDKROOT; };
|
||||
59A24EBA23F480EA0090C374 /* IJSVGUnitSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGUnitSize.h; sourceTree = "<group>"; };
|
||||
59A24EBB23F480EA0090C374 /* IJSVGUnitSize.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGUnitSize.m; sourceTree = "<group>"; };
|
||||
59E7CFAD23B148600077D599 /* IJSVGCommandParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IJSVGCommandParser.h; path = IJSVG/Source/Parsing/IJSVGCommandParser.h; sourceTree = SOURCE_ROOT; };
|
||||
59E7CFAE23B148600077D599 /* IJSVGCommandParser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = IJSVGCommandParser.m; path = IJSVG/Source/Parsing/IJSVGCommandParser.m; sourceTree = SOURCE_ROOT; };
|
||||
59EB756523905F6B00F5AE63 /* IJSVGLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGLayer.h; sourceTree = "<group>"; };
|
||||
59EB756623905F6B00F5AE63 /* IJSVGGradientLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGradientLayer.h; sourceTree = "<group>"; };
|
||||
59EB756723905F6B00F5AE63 /* IJSVGStyleSheetRule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheetRule.m; sourceTree = "<group>"; };
|
||||
59EB756823905F6B00F5AE63 /* IJSVGCommandLineTo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandLineTo.h; sourceTree = "<group>"; };
|
||||
59EB756923905F6B00F5AE63 /* IJSVGDef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGDef.m; sourceTree = "<group>"; };
|
||||
59EB756A23905F6B00F5AE63 /* IJSVG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVG.h; sourceTree = "<group>"; };
|
||||
59EB756B23905F6B00F5AE63 /* IJSVGText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGText.h; sourceTree = "<group>"; };
|
||||
59EB756C23905F6B00F5AE63 /* IJSVGCommandQuadraticCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandQuadraticCurve.m; sourceTree = "<group>"; };
|
||||
59EB756D23905F6C00F5AE63 /* IJSVGCommandVerticalLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandVerticalLine.h; sourceTree = "<group>"; };
|
||||
59EB756F23905F6C00F5AE63 /* IJSVGStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheet.h; sourceTree = "<group>"; };
|
||||
59EB757023905F6C00F5AE63 /* IJSVGCommandSmoothCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandSmoothCurve.h; sourceTree = "<group>"; };
|
||||
59EB757123905F6C00F5AE63 /* IJSVGColorList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGColorList.m; sourceTree = "<group>"; };
|
||||
59EB757223905F6C00F5AE63 /* IJSVGRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGRadialGradient.h; sourceTree = "<group>"; };
|
||||
59EB757323905F6C00F5AE63 /* IJSVGGradientUnitLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGradientUnitLength.h; sourceTree = "<group>"; };
|
||||
59EB757423905F6C00F5AE63 /* IJSVGStrokeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStrokeLayer.m; sourceTree = "<group>"; };
|
||||
59EB757523905F6C00F5AE63 /* IJSVGStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyle.m; sourceTree = "<group>"; };
|
||||
59EB757623905F6C00F5AE63 /* IJSVGImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGImage.m; sourceTree = "<group>"; };
|
||||
59EB757723905F6C00F5AE63 /* IJSVGUnitLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGUnitLength.h; sourceTree = "<group>"; };
|
||||
59EB757823905F6C00F5AE63 /* IJSVGStringAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStringAdditions.m; sourceTree = "<group>"; };
|
||||
59EB757923905F6C00F5AE63 /* IJSVGTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGTransaction.h; sourceTree = "<group>"; };
|
||||
59EB757A23905F6C00F5AE63 /* IJSVGShapeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGShapeLayer.m; sourceTree = "<group>"; };
|
||||
59EB757B23905F6C00F5AE63 /* IJSVGLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGLayer.m; sourceTree = "<group>"; };
|
||||
59EB757C23905F6C00F5AE63 /* IJSVGFontConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGFontConverter.m; sourceTree = "<group>"; };
|
||||
59EB757D23905F6C00F5AE63 /* IJSVGImageRep.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGImageRep.m; sourceTree = "<group>"; };
|
||||
59EB757E23905F6C00F5AE63 /* IJSVGCommandQuadraticCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandQuadraticCurve.h; sourceTree = "<group>"; };
|
||||
59EB757F23905F6C00F5AE63 /* IJSVGStyleSheetSelectorRaw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheetSelectorRaw.h; sourceTree = "<group>"; };
|
||||
59EB758023905F6C00F5AE63 /* IJSVGUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGUtils.m; sourceTree = "<group>"; };
|
||||
59EB758123905F6C00F5AE63 /* IJSVGStyleSheetSelectorRaw.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheetSelectorRaw.m; sourceTree = "<group>"; };
|
||||
59EB758223905F6C00F5AE63 /* IJSVGGroupLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGroupLayer.m; sourceTree = "<group>"; };
|
||||
59EB758323905F6C00F5AE63 /* IJSVGColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGColor.h; sourceTree = "<group>"; };
|
||||
59EB758423905F6C00F5AE63 /* IJSVGError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGError.h; sourceTree = "<group>"; };
|
||||
59EB758523905F6C00F5AE63 /* IJSVGColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGColor.m; sourceTree = "<group>"; };
|
||||
59EB758623905F6C00F5AE63 /* IJSVGDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGDef.h; sourceTree = "<group>"; };
|
||||
59EB758723905F6C00F5AE63 /* IJSVGCommandHorizontalLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandHorizontalLine.m; sourceTree = "<group>"; };
|
||||
59EB758823905F6D00F5AE63 /* IJSVGFontConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGFontConverter.h; sourceTree = "<group>"; };
|
||||
59EB758A23905F6D00F5AE63 /* IJSVGPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGPath.m; sourceTree = "<group>"; };
|
||||
59EB758B23905F6D00F5AE63 /* IJSVGGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGroup.h; sourceTree = "<group>"; };
|
||||
59EB758C23905F6D00F5AE63 /* IJSVGPatternLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGPatternLayer.m; sourceTree = "<group>"; };
|
||||
59EB758D23905F6D00F5AE63 /* IJSVGRenderingStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGRenderingStyle.m; sourceTree = "<group>"; };
|
||||
59EB758F23905F6D00F5AE63 /* IJSVGGradientLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGradientLayer.m; sourceTree = "<group>"; };
|
||||
59EB759023905F6D00F5AE63 /* IJSVGLayerTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGLayerTree.m; sourceTree = "<group>"; };
|
||||
59EB759123905F6D00F5AE63 /* IJSVGCommandVerticalLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandVerticalLine.m; sourceTree = "<group>"; };
|
||||
59EB759223905F6D00F5AE63 /* IJSVGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGNode.h; sourceTree = "<group>"; };
|
||||
59EB759423905F6D00F5AE63 /* IJSVGUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGUtils.h; sourceTree = "<group>"; };
|
||||
59EB759523905F6D00F5AE63 /* IJSVGCommandHorizontalLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandHorizontalLine.h; sourceTree = "<group>"; };
|
||||
59EB759623905F6D00F5AE63 /* IJSVGNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGNode.m; sourceTree = "<group>"; };
|
||||
59EB759723905F6D00F5AE63 /* IJSVGShapeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGShapeLayer.h; sourceTree = "<group>"; };
|
||||
59EB759823905F6E00F5AE63 /* IJSVGCommandCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandCurve.m; sourceTree = "<group>"; };
|
||||
59EB759923905F6E00F5AE63 /* IJSVGCommandMove.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandMove.m; sourceTree = "<group>"; };
|
||||
59EB759A23905F6E00F5AE63 /* IJSVGStyleSheetSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheetSelector.h; sourceTree = "<group>"; };
|
||||
59EB759B23905F6E00F5AE63 /* IJSVGStyleSheetRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheetRule.h; sourceTree = "<group>"; };
|
||||
59EB759C23905F6E00F5AE63 /* IJSVGCommandCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandCurve.h; sourceTree = "<group>"; };
|
||||
59EB759D23905F6E00F5AE63 /* IJSVGPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGPath.h; sourceTree = "<group>"; };
|
||||
59EB759E23905F6E00F5AE63 /* IJSVGCommandEllipticalArc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandEllipticalArc.h; sourceTree = "<group>"; };
|
||||
59EB759F23905F6E00F5AE63 /* IJSVGLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGLinearGradient.h; sourceTree = "<group>"; };
|
||||
59EB75A023905F6E00F5AE63 /* IJSVGCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommand.m; sourceTree = "<group>"; };
|
||||
59EB75A123905F6E00F5AE63 /* IJSVGRenderingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGRenderingStyle.h; sourceTree = "<group>"; };
|
||||
59EB75A223905F6E00F5AE63 /* IJSVG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVG.m; sourceTree = "<group>"; };
|
||||
59EB75A323905F6E00F5AE63 /* IJSVGImageRep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGImageRep.h; sourceTree = "<group>"; };
|
||||
59EB75A423905F6E00F5AE63 /* IJSVGStrokeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStrokeLayer.h; sourceTree = "<group>"; };
|
||||
59EB75A523905F6E00F5AE63 /* IJSVGParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGParser.m; sourceTree = "<group>"; };
|
||||
59EB75A623905F6F00F5AE63 /* IJSVGRadialGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGRadialGradient.m; sourceTree = "<group>"; };
|
||||
59EB75A723905F6F00F5AE63 /* IJSVGParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGParser.h; sourceTree = "<group>"; };
|
||||
59EB75A823905F6F00F5AE63 /* IJSVGCommandSmoothCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandSmoothCurve.m; sourceTree = "<group>"; };
|
||||
59EB75A923905F6F00F5AE63 /* IJSVGColorList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGColorList.h; sourceTree = "<group>"; };
|
||||
59EB75AA23905F6F00F5AE63 /* IJSVGPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGPattern.m; sourceTree = "<group>"; };
|
||||
59EB75AB23905F6F00F5AE63 /* IJSVGGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGradient.h; sourceTree = "<group>"; };
|
||||
59EB75AC23905F6F00F5AE63 /* IJSVGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyle.h; sourceTree = "<group>"; };
|
||||
59EB75AD23905F6F00F5AE63 /* IJSVGGroupLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGroupLayer.h; sourceTree = "<group>"; };
|
||||
59EB75AE23905F6F00F5AE63 /* IJSVGCommandLineTo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandLineTo.m; sourceTree = "<group>"; };
|
||||
59EB75AF23905F6F00F5AE63 /* IJSVGCommandMove.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandMove.h; sourceTree = "<group>"; };
|
||||
59EB75B023905F6F00F5AE63 /* IJSVGTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGTransform.h; sourceTree = "<group>"; };
|
||||
59EB75B123905F6F00F5AE63 /* IJSVGMath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGMath.m; sourceTree = "<group>"; };
|
||||
59EB75B223905F6F00F5AE63 /* IJSVGExporterPathInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGExporterPathInstruction.h; sourceTree = "<group>"; };
|
||||
59EB75B323905F6F00F5AE63 /* IJSVGTransaction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGTransaction.m; sourceTree = "<group>"; };
|
||||
59EB75B423905F6F00F5AE63 /* IJSVGTransform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGTransform.m; sourceTree = "<group>"; };
|
||||
59EB75B523905F7000F5AE63 /* IJSVGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGImage.h; sourceTree = "<group>"; };
|
||||
59EB75B623905F7000F5AE63 /* IJSVGMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGMath.h; sourceTree = "<group>"; };
|
||||
59EB75B723905F7000F5AE63 /* IJSVGCommandClose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandClose.h; sourceTree = "<group>"; };
|
||||
59EB75B823905F7000F5AE63 /* IJSVGStringAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStringAdditions.h; sourceTree = "<group>"; };
|
||||
59EB75B923905F7000F5AE63 /* IJSVGGradientUnitLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGradientUnitLength.m; sourceTree = "<group>"; };
|
||||
59EB75BA23905F7000F5AE63 /* IJSVGUnitLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGUnitLength.m; sourceTree = "<group>"; };
|
||||
59EB75BB23905F7000F5AE63 /* IJSVGPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGPattern.h; sourceTree = "<group>"; };
|
||||
59EB75BC23905F7000F5AE63 /* IJSVGLayerTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGLayerTree.h; sourceTree = "<group>"; };
|
||||
59EB75BD23905F7000F5AE63 /* IJSVGExporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGExporter.m; sourceTree = "<group>"; };
|
||||
59EB75BF23905F7000F5AE63 /* IJSVGPatternLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGPatternLayer.h; sourceTree = "<group>"; };
|
||||
59EB75C023905F7100F5AE63 /* IJSVGText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGText.m; sourceTree = "<group>"; };
|
||||
59EB75C123905F7100F5AE63 /* IJSVGView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGView.m; sourceTree = "<group>"; };
|
||||
59EB75C223905F7100F5AE63 /* IJSVGLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGLinearGradient.m; sourceTree = "<group>"; };
|
||||
59EB75C423905F7100F5AE63 /* IJSVGStyleSheetSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheetSelector.m; sourceTree = "<group>"; };
|
||||
59EB75C523905F7100F5AE63 /* IJSVGImageLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGImageLayer.m; sourceTree = "<group>"; };
|
||||
59EB75C623905F7100F5AE63 /* IJSVGCommandClose.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandClose.m; sourceTree = "<group>"; };
|
||||
59EB75C723905F7100F5AE63 /* IJSVGCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommand.h; sourceTree = "<group>"; };
|
||||
59EB75C823905F7200F5AE63 /* IJSVGCommandSmoothQuadraticCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandSmoothQuadraticCurve.m; sourceTree = "<group>"; };
|
||||
59EB75C923905F7200F5AE63 /* IJSVGForeignObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGForeignObject.m; sourceTree = "<group>"; };
|
||||
59EB75CA23905F7200F5AE63 /* IJSVGCommandSmoothQuadraticCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandSmoothQuadraticCurve.h; sourceTree = "<group>"; };
|
||||
59EB75CB23905F7200F5AE63 /* IJSVGCommandEllipticalArc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandEllipticalArc.m; sourceTree = "<group>"; };
|
||||
59EB75CC23905F7200F5AE63 /* IJSVGGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGroup.m; sourceTree = "<group>"; };
|
||||
59EB75CD23905F7200F5AE63 /* IJSVGView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGView.h; sourceTree = "<group>"; };
|
||||
59EB75CE23905F7200F5AE63 /* IJSVGForeignObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGForeignObject.h; sourceTree = "<group>"; };
|
||||
59EB75CF23905F7200F5AE63 /* IJSVGExporterPathInstruction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGExporterPathInstruction.m; sourceTree = "<group>"; };
|
||||
59EB75D023905F7200F5AE63 /* IJSVGImageLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGImageLayer.h; sourceTree = "<group>"; };
|
||||
59EB75D123905F7300F5AE63 /* IJSVGStyleSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheet.m; sourceTree = "<group>"; };
|
||||
59EB75D223905F7300F5AE63 /* IJSVGGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGradient.m; sourceTree = "<group>"; };
|
||||
59EB75D323905F7300F5AE63 /* IJSVGRendering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGRendering.h; sourceTree = "<group>"; };
|
||||
59EB75D423905F7300F5AE63 /* IJSVGExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGExporter.h; sourceTree = "<group>"; };
|
||||
59EB75D523905F7300F5AE63 /* IJSVGRendering.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGRendering.m; sourceTree = "<group>"; };
|
||||
59F36506262F1ABB00BCE3FD /* IJSVGColorType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGColorType.h; sourceTree = "<group>"; };
|
||||
59F36507262F1ABB00BCE3FD /* IJSVGColorType.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGColorType.m; sourceTree = "<group>"; };
|
||||
59F9EAF62808BB5F00188ACB /* IJSVGViewBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGViewBox.h; sourceTree = "<group>"; };
|
||||
59F9EAF72808BB5F00188ACB /* IJSVGViewBox.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGViewBox.m; sourceTree = "<group>"; };
|
||||
59FCC09227F2394D00BB924E /* IJSVGRootNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGRootNode.h; sourceTree = "<group>"; };
|
||||
59FCC09327F2394D00BB924E /* IJSVGRootNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGRootNode.m; sourceTree = "<group>"; };
|
||||
59FDBEFE27F3454800AF7038 /* IJSVGColorNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGColorNode.h; sourceTree = "<group>"; };
|
||||
59FDBEFF27F3454800AF7038 /* IJSVGColorNode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGColorNode.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
594CF46C238FF38E009B251B /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
599EB4D3238FF570004CB6BC /* libobjc.tbd in Frameworks */,
|
||||
594CF55F238FF462009B251B /* AppKit.framework in Frameworks */,
|
||||
594CF561238FF46C009B251B /* Foundation.framework in Frameworks */,
|
||||
594CF563238FF473009B251B /* QuartzCore.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
592ABBE223979F9B00F44380 /* Commands */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB75C723905F7100F5AE63 /* IJSVGCommand.h */,
|
||||
59EB75A023905F6E00F5AE63 /* IJSVGCommand.m */,
|
||||
59EB75B723905F7000F5AE63 /* IJSVGCommandClose.h */,
|
||||
59EB75C623905F7100F5AE63 /* IJSVGCommandClose.m */,
|
||||
59EB759C23905F6E00F5AE63 /* IJSVGCommandCurve.h */,
|
||||
59EB759823905F6E00F5AE63 /* IJSVGCommandCurve.m */,
|
||||
59EB759E23905F6E00F5AE63 /* IJSVGCommandEllipticalArc.h */,
|
||||
59EB75CB23905F7200F5AE63 /* IJSVGCommandEllipticalArc.m */,
|
||||
59EB759523905F6D00F5AE63 /* IJSVGCommandHorizontalLine.h */,
|
||||
59EB758723905F6C00F5AE63 /* IJSVGCommandHorizontalLine.m */,
|
||||
59EB756823905F6B00F5AE63 /* IJSVGCommandLineTo.h */,
|
||||
59EB75AE23905F6F00F5AE63 /* IJSVGCommandLineTo.m */,
|
||||
59EB75AF23905F6F00F5AE63 /* IJSVGCommandMove.h */,
|
||||
59EB759923905F6E00F5AE63 /* IJSVGCommandMove.m */,
|
||||
59EB757E23905F6C00F5AE63 /* IJSVGCommandQuadraticCurve.h */,
|
||||
59EB756C23905F6B00F5AE63 /* IJSVGCommandQuadraticCurve.m */,
|
||||
59EB757023905F6C00F5AE63 /* IJSVGCommandSmoothCurve.h */,
|
||||
59EB75A823905F6F00F5AE63 /* IJSVGCommandSmoothCurve.m */,
|
||||
59EB75CA23905F7200F5AE63 /* IJSVGCommandSmoothQuadraticCurve.h */,
|
||||
59EB75C823905F7200F5AE63 /* IJSVGCommandSmoothQuadraticCurve.m */,
|
||||
59EB756D23905F6C00F5AE63 /* IJSVGCommandVerticalLine.h */,
|
||||
59EB759123905F6D00F5AE63 /* IJSVGCommandVerticalLine.m */,
|
||||
);
|
||||
path = Commands;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE323979FBB00F44380 /* Stylesheets */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB75AC23905F6F00F5AE63 /* IJSVGStyle.h */,
|
||||
59EB757523905F6C00F5AE63 /* IJSVGStyle.m */,
|
||||
59EB756F23905F6C00F5AE63 /* IJSVGStyleSheet.h */,
|
||||
59EB75D123905F7300F5AE63 /* IJSVGStyleSheet.m */,
|
||||
59EB759B23905F6E00F5AE63 /* IJSVGStyleSheetRule.h */,
|
||||
59EB756723905F6B00F5AE63 /* IJSVGStyleSheetRule.m */,
|
||||
59EB759A23905F6E00F5AE63 /* IJSVGStyleSheetSelector.h */,
|
||||
59EB75C423905F7100F5AE63 /* IJSVGStyleSheetSelector.m */,
|
||||
59EB757F23905F6C00F5AE63 /* IJSVGStyleSheetSelectorRaw.h */,
|
||||
59EB758123905F6C00F5AE63 /* IJSVGStyleSheetSelectorRaw.m */,
|
||||
);
|
||||
path = Stylesheets;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE423979FD200F44380 /* Colors */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB758323905F6C00F5AE63 /* IJSVGColor.h */,
|
||||
59EB758523905F6C00F5AE63 /* IJSVGColor.m */,
|
||||
59EB75A923905F6F00F5AE63 /* IJSVGColorList.h */,
|
||||
59EB757123905F6C00F5AE63 /* IJSVGColorList.m */,
|
||||
59F36506262F1ABB00BCE3FD /* IJSVGColorType.h */,
|
||||
59F36507262F1ABB00BCE3FD /* IJSVGColorType.m */,
|
||||
);
|
||||
path = Colors;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE523979FE100F44380 /* Layers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB756623905F6B00F5AE63 /* IJSVGGradientLayer.h */,
|
||||
59EB758F23905F6D00F5AE63 /* IJSVGGradientLayer.m */,
|
||||
59EB75AD23905F6F00F5AE63 /* IJSVGGroupLayer.h */,
|
||||
59EB758223905F6C00F5AE63 /* IJSVGGroupLayer.m */,
|
||||
59EB75D023905F7200F5AE63 /* IJSVGImageLayer.h */,
|
||||
59EB75C523905F7100F5AE63 /* IJSVGImageLayer.m */,
|
||||
59EB756523905F6B00F5AE63 /* IJSVGLayer.h */,
|
||||
59EB757B23905F6C00F5AE63 /* IJSVGLayer.m */,
|
||||
59EB75BF23905F7000F5AE63 /* IJSVGPatternLayer.h */,
|
||||
59EB758C23905F6D00F5AE63 /* IJSVGPatternLayer.m */,
|
||||
59EB759723905F6D00F5AE63 /* IJSVGShapeLayer.h */,
|
||||
59EB757A23905F6C00F5AE63 /* IJSVGShapeLayer.m */,
|
||||
59EB75A423905F6E00F5AE63 /* IJSVGStrokeLayer.h */,
|
||||
59EB757423905F6C00F5AE63 /* IJSVGStrokeLayer.m */,
|
||||
590EB7A227F637EF0047CECF /* IJSVGTransformLayer.h */,
|
||||
590EB7A327F637EF0047CECF /* IJSVGTransformLayer.m */,
|
||||
5978C468280A241200D25296 /* IJSVGRootLayer.h */,
|
||||
5978C469280A241200D25296 /* IJSVGRootLayer.m */,
|
||||
);
|
||||
path = Layers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE62397A00C00F44380 /* Parsing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59E7CFAD23B148600077D599 /* IJSVGCommandParser.h */,
|
||||
59E7CFAE23B148600077D599 /* IJSVGCommandParser.m */,
|
||||
59EB75A723905F6F00F5AE63 /* IJSVGParser.h */,
|
||||
59EB75A523905F6E00F5AE63 /* IJSVGParser.m */,
|
||||
);
|
||||
path = Parsing;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE72397A02900F44380 /* Nodes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB75CE23905F7200F5AE63 /* IJSVGForeignObject.h */,
|
||||
59EB75C923905F7200F5AE63 /* IJSVGForeignObject.m */,
|
||||
59EB758623905F6C00F5AE63 /* IJSVGDef.h */,
|
||||
59EB756923905F6B00F5AE63 /* IJSVGDef.m */,
|
||||
59EB759F23905F6E00F5AE63 /* IJSVGLinearGradient.h */,
|
||||
59EB75C223905F7100F5AE63 /* IJSVGLinearGradient.m */,
|
||||
59EB757223905F6C00F5AE63 /* IJSVGRadialGradient.h */,
|
||||
59EB75A623905F6F00F5AE63 /* IJSVGRadialGradient.m */,
|
||||
59EB75AB23905F6F00F5AE63 /* IJSVGGradient.h */,
|
||||
59EB75D223905F7300F5AE63 /* IJSVGGradient.m */,
|
||||
59EB758B23905F6D00F5AE63 /* IJSVGGroup.h */,
|
||||
59EB75CC23905F7200F5AE63 /* IJSVGGroup.m */,
|
||||
59EB75B523905F7000F5AE63 /* IJSVGImage.h */,
|
||||
59EB757623905F6C00F5AE63 /* IJSVGImage.m */,
|
||||
59EB759223905F6D00F5AE63 /* IJSVGNode.h */,
|
||||
59EB759623905F6D00F5AE63 /* IJSVGNode.m */,
|
||||
59EB759D23905F6E00F5AE63 /* IJSVGPath.h */,
|
||||
59EB758A23905F6D00F5AE63 /* IJSVGPath.m */,
|
||||
59EB75BB23905F7000F5AE63 /* IJSVGPattern.h */,
|
||||
59EB75AA23905F6F00F5AE63 /* IJSVGPattern.m */,
|
||||
59EB756B23905F6B00F5AE63 /* IJSVGText.h */,
|
||||
59EB75C023905F7100F5AE63 /* IJSVGText.m */,
|
||||
59FCC09227F2394D00BB924E /* IJSVGRootNode.h */,
|
||||
59FCC09327F2394D00BB924E /* IJSVGRootNode.m */,
|
||||
59FDBEFE27F3454800AF7038 /* IJSVGColorNode.h */,
|
||||
59FDBEFF27F3454800AF7038 /* IJSVGColorNode.m */,
|
||||
);
|
||||
path = Nodes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE82397A06800F44380 /* Utils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB757323905F6C00F5AE63 /* IJSVGGradientUnitLength.h */,
|
||||
59EB75B923905F7000F5AE63 /* IJSVGGradientUnitLength.m */,
|
||||
59EB75B623905F7000F5AE63 /* IJSVGMath.h */,
|
||||
59EB75B123905F6F00F5AE63 /* IJSVGMath.m */,
|
||||
59EB757923905F6C00F5AE63 /* IJSVGTransaction.h */,
|
||||
59EB75B323905F6F00F5AE63 /* IJSVGTransaction.m */,
|
||||
59EB75B023905F6F00F5AE63 /* IJSVGTransform.h */,
|
||||
59EB75B423905F6F00F5AE63 /* IJSVGTransform.m */,
|
||||
59EB757723905F6C00F5AE63 /* IJSVGUnitLength.h */,
|
||||
59EB75BA23905F7000F5AE63 /* IJSVGUnitLength.m */,
|
||||
59EB759423905F6D00F5AE63 /* IJSVGUtils.h */,
|
||||
59EB758023905F6C00F5AE63 /* IJSVGUtils.m */,
|
||||
5919E65523F47FF60051873A /* IJSVGUnitRect.h */,
|
||||
5919E65623F47FF60051873A /* IJSVGUnitRect.m */,
|
||||
5919E65923F480330051873A /* IJSVGUnitPoint.h */,
|
||||
5919E65A23F480330051873A /* IJSVGUnitPoint.m */,
|
||||
59A24EBA23F480EA0090C374 /* IJSVGUnitSize.h */,
|
||||
59A24EBB23F480EA0090C374 /* IJSVGUnitSize.m */,
|
||||
591A3E4B25CC91F800AD45B7 /* IJSVGParsing.h */,
|
||||
591A3E4C25CC91F800AD45B7 /* IJSVGParsing.m */,
|
||||
59F9EAF62808BB5F00188ACB /* IJSVGViewBox.h */,
|
||||
59F9EAF72808BB5F00188ACB /* IJSVGViewBox.m */,
|
||||
);
|
||||
path = Utils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBE92397A08500F44380 /* Exporter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB75D423905F7300F5AE63 /* IJSVGExporter.h */,
|
||||
59EB75BD23905F7000F5AE63 /* IJSVGExporter.m */,
|
||||
59EB75B223905F6F00F5AE63 /* IJSVGExporterPathInstruction.h */,
|
||||
59EB75CF23905F7200F5AE63 /* IJSVGExporterPathInstruction.m */,
|
||||
);
|
||||
path = Exporter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBEA2397A10000F44380 /* Rendering */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB75BC23905F7000F5AE63 /* IJSVGLayerTree.h */,
|
||||
59EB759023905F6D00F5AE63 /* IJSVGLayerTree.m */,
|
||||
59EB75D323905F7300F5AE63 /* IJSVGRendering.h */,
|
||||
59EB75D523905F7300F5AE63 /* IJSVGRendering.m */,
|
||||
59EB75A123905F6E00F5AE63 /* IJSVGRenderingStyle.h */,
|
||||
59EB758D23905F6D00F5AE63 /* IJSVGRenderingStyle.m */,
|
||||
);
|
||||
path = Rendering;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
592ABBEB2397A11800F44380 /* Additions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB75B823905F7000F5AE63 /* IJSVGStringAdditions.h */,
|
||||
59EB757823905F6C00F5AE63 /* IJSVGStringAdditions.m */,
|
||||
594A10D8248D7C90001A3181 /* NSImage+IJSVGAdditions.h */,
|
||||
594A10D9248D7C90001A3181 /* NSImage+IJSVGAdditions.m */,
|
||||
);
|
||||
path = Additions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
594CF465238FF38E009B251B = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
594CF471238FF38E009B251B /* IJSVG */,
|
||||
594CF470238FF38E009B251B /* Products */,
|
||||
594CF55D238FF461009B251B /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
594CF470238FF38E009B251B /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
594CF46F238FF38E009B251B /* IJSVG.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
594CF471238FF38E009B251B /* IJSVG */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB756423905F3100F5AE63 /* Source */,
|
||||
594CF473238FF38E009B251B /* Info.plist */,
|
||||
);
|
||||
path = IJSVG;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
594CF55D238FF461009B251B /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
599EB4D2238FF535004CB6BC /* libobjc.tbd */,
|
||||
594CF562238FF473009B251B /* QuartzCore.framework */,
|
||||
594CF560238FF46C009B251B /* Foundation.framework */,
|
||||
594CF55E238FF462009B251B /* AppKit.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
59DD1FD123A22CFD00E28C56 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59EB756A23905F6B00F5AE63 /* IJSVG.h */,
|
||||
59EB75A223905F6E00F5AE63 /* IJSVG.m */,
|
||||
59EB758423905F6C00F5AE63 /* IJSVGError.h */,
|
||||
59EB758823905F6D00F5AE63 /* IJSVGFontConverter.h */,
|
||||
59EB757C23905F6C00F5AE63 /* IJSVGFontConverter.m */,
|
||||
59EB75A323905F6E00F5AE63 /* IJSVGImageRep.h */,
|
||||
59EB757D23905F6C00F5AE63 /* IJSVGImageRep.m */,
|
||||
59EB75CD23905F7200F5AE63 /* IJSVGView.h */,
|
||||
59EB75C123905F7100F5AE63 /* IJSVGView.m */,
|
||||
);
|
||||
path = Core;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
59EB756423905F3100F5AE63 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59DD1FD123A22CFD00E28C56 /* Core */,
|
||||
592ABBEB2397A11800F44380 /* Additions */,
|
||||
592ABBEA2397A10000F44380 /* Rendering */,
|
||||
592ABBE92397A08500F44380 /* Exporter */,
|
||||
592ABBE82397A06800F44380 /* Utils */,
|
||||
592ABBE72397A02900F44380 /* Nodes */,
|
||||
592ABBE62397A00C00F44380 /* Parsing */,
|
||||
592ABBE523979FE100F44380 /* Layers */,
|
||||
592ABBE423979FD200F44380 /* Colors */,
|
||||
592ABBE323979FBB00F44380 /* Stylesheets */,
|
||||
592ABBE223979F9B00F44380 /* Commands */,
|
||||
);
|
||||
path = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
594CF46A238FF38E009B251B /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
59EB762623905F7300F5AE63 /* IJSVGImage.h in Headers */,
|
||||
59EB760823905F7300F5AE63 /* IJSVGShapeLayer.h in Headers */,
|
||||
59EB760F23905F7300F5AE63 /* IJSVGCommandEllipticalArc.h in Headers */,
|
||||
59EB75F523905F7300F5AE63 /* IJSVGError.h in Headers */,
|
||||
59EB763E23905F7300F5AE63 /* IJSVGView.h in Headers */,
|
||||
59EB75DB23905F7300F5AE63 /* IJSVG.h in Headers */,
|
||||
59EB764423905F7300F5AE63 /* IJSVGRendering.h in Headers */,
|
||||
59EB75DC23905F7300F5AE63 /* IJSVGText.h in Headers */,
|
||||
59EB761C23905F7300F5AE63 /* IJSVGGradient.h in Headers */,
|
||||
59EB75F923905F7300F5AE63 /* IJSVGFontConverter.h in Headers */,
|
||||
59EB75EF23905F7300F5AE63 /* IJSVGCommandQuadraticCurve.h in Headers */,
|
||||
59EB75FC23905F7300F5AE63 /* IJSVGGroup.h in Headers */,
|
||||
59EB760323905F7300F5AE63 /* IJSVGNode.h in Headers */,
|
||||
59EB762023905F7300F5AE63 /* IJSVGCommandMove.h in Headers */,
|
||||
59EB762C23905F7300F5AE63 /* IJSVGPattern.h in Headers */,
|
||||
59EB762923905F7300F5AE63 /* IJSVGStringAdditions.h in Headers */,
|
||||
59EB761A23905F7300F5AE63 /* IJSVGColorList.h in Headers */,
|
||||
59EB762123905F7300F5AE63 /* IJSVGTransform.h in Headers */,
|
||||
59EB763F23905F7300F5AE63 /* IJSVGForeignObject.h in Headers */,
|
||||
59EB75F423905F7300F5AE63 /* IJSVGColor.h in Headers */,
|
||||
59EB760D23905F7300F5AE63 /* IJSVGCommandCurve.h in Headers */,
|
||||
59EB763823905F7300F5AE63 /* IJSVGCommand.h in Headers */,
|
||||
59EB760C23905F7300F5AE63 /* IJSVGStyleSheetRule.h in Headers */,
|
||||
59EB75E323905F7300F5AE63 /* IJSVGRadialGradient.h in Headers */,
|
||||
59EB760523905F7300F5AE63 /* IJSVGUtils.h in Headers */,
|
||||
59EB763B23905F7300F5AE63 /* IJSVGCommandSmoothQuadraticCurve.h in Headers */,
|
||||
59EB75E823905F7300F5AE63 /* IJSVGUnitLength.h in Headers */,
|
||||
59EB762723905F7300F5AE63 /* IJSVGMath.h in Headers */,
|
||||
59EB761523905F7300F5AE63 /* IJSVGStrokeLayer.h in Headers */,
|
||||
59EB75DE23905F7300F5AE63 /* IJSVGCommandVerticalLine.h in Headers */,
|
||||
59EB764123905F7300F5AE63 /* IJSVGImageLayer.h in Headers */,
|
||||
59EB75E023905F7300F5AE63 /* IJSVGStyleSheet.h in Headers */,
|
||||
59EB761423905F7300F5AE63 /* IJSVGImageRep.h in Headers */,
|
||||
59EB761223905F7300F5AE63 /* IJSVGRenderingStyle.h in Headers */,
|
||||
59EB760E23905F7300F5AE63 /* IJSVGPath.h in Headers */,
|
||||
59EB75EA23905F7300F5AE63 /* IJSVGTransaction.h in Headers */,
|
||||
59EB75D723905F7300F5AE63 /* IJSVGGradientLayer.h in Headers */,
|
||||
59EB75F723905F7300F5AE63 /* IJSVGDef.h in Headers */,
|
||||
59EB760623905F7300F5AE63 /* IJSVGCommandHorizontalLine.h in Headers */,
|
||||
59EB762323905F7300F5AE63 /* IJSVGExporterPathInstruction.h in Headers */,
|
||||
59EB761023905F7300F5AE63 /* IJSVGLinearGradient.h in Headers */,
|
||||
59EB75E123905F7300F5AE63 /* IJSVGCommandSmoothCurve.h in Headers */,
|
||||
59EB75D923905F7300F5AE63 /* IJSVGCommandLineTo.h in Headers */,
|
||||
59EB75D623905F7300F5AE63 /* IJSVGLayer.h in Headers */,
|
||||
59EB763023905F7300F5AE63 /* IJSVGPatternLayer.h in Headers */,
|
||||
59EB75F023905F7300F5AE63 /* IJSVGStyleSheetSelectorRaw.h in Headers */,
|
||||
59EB761823905F7300F5AE63 /* IJSVGParser.h in Headers */,
|
||||
59EB761E23905F7300F5AE63 /* IJSVGGroupLayer.h in Headers */,
|
||||
59EB761D23905F7300F5AE63 /* IJSVGStyle.h in Headers */,
|
||||
5919E65723F47FF60051873A /* IJSVGUnitRect.h in Headers */,
|
||||
5919E65B23F480330051873A /* IJSVGUnitPoint.h in Headers */,
|
||||
591A3E4D25CC91F800AD45B7 /* IJSVGParsing.h in Headers */,
|
||||
59A24EBC23F480EA0090C374 /* IJSVGUnitSize.h in Headers */,
|
||||
59EB764523905F7300F5AE63 /* IJSVGExporter.h in Headers */,
|
||||
59F36508262F1ABB00BCE3FD /* IJSVGColorType.h in Headers */,
|
||||
59E7CFAF23B148600077D599 /* IJSVGCommandParser.h in Headers */,
|
||||
59EB762823905F7300F5AE63 /* IJSVGCommandClose.h in Headers */,
|
||||
59EB75E423905F7300F5AE63 /* IJSVGGradientUnitLength.h in Headers */,
|
||||
59FCC09427F2394D00BB924E /* IJSVGRootNode.h in Headers */,
|
||||
594A10DA248D7C90001A3181 /* NSImage+IJSVGAdditions.h in Headers */,
|
||||
59EB762D23905F7300F5AE63 /* IJSVGLayerTree.h in Headers */,
|
||||
59FDBF0027F3454800AF7038 /* IJSVGColorNode.h in Headers */,
|
||||
590EB7A427F637EF0047CECF /* IJSVGTransformLayer.h in Headers */,
|
||||
5978C46A280A241200D25296 /* IJSVGRootLayer.h in Headers */,
|
||||
59F9EAF82808BB5F00188ACB /* IJSVGViewBox.h in Headers */,
|
||||
59EB760B23905F7300F5AE63 /* IJSVGStyleSheetSelector.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
594CF46E238FF38E009B251B /* IJSVG */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 594CF477238FF38E009B251B /* Build configuration list for PBXNativeTarget "IJSVG" */;
|
||||
buildPhases = (
|
||||
594CF46A238FF38E009B251B /* Headers */,
|
||||
594CF46B238FF38E009B251B /* Sources */,
|
||||
594CF46C238FF38E009B251B /* Frameworks */,
|
||||
594CF46D238FF38E009B251B /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = IJSVG;
|
||||
productName = IJSVG;
|
||||
productReference = 594CF46F238FF38E009B251B /* IJSVG.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
594CF466238FF38E009B251B /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1220;
|
||||
ORGANIZATIONNAME = "Curtis Hard";
|
||||
TargetAttributes = {
|
||||
594CF46E238FF38E009B251B = {
|
||||
CreatedOnToolsVersion = 11.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 594CF469238FF38E009B251B /* Build configuration list for PBXProject "IJSVG" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 594CF465238FF38E009B251B;
|
||||
productRefGroup = 594CF470238FF38E009B251B /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
594CF46E238FF38E009B251B /* IJSVG */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
594CF46D238FF38E009B251B /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
594CF46B238FF38E009B251B /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
59EB763123905F7300F5AE63 /* IJSVGText.m in Sources */,
|
||||
59A24EBD23F480EA0090C374 /* IJSVGUnitSize.m in Sources */,
|
||||
59EB760223905F7300F5AE63 /* IJSVGCommandVerticalLine.m in Sources */,
|
||||
59EB75FD23905F7300F5AE63 /* IJSVGPatternLayer.m in Sources */,
|
||||
59EB763923905F7300F5AE63 /* IJSVGCommandSmoothQuadraticCurve.m in Sources */,
|
||||
59EB75D823905F7300F5AE63 /* IJSVGStyleSheetRule.m in Sources */,
|
||||
59EB75FB23905F7300F5AE63 /* IJSVGPath.m in Sources */,
|
||||
59F36509262F1ABB00BCE3FD /* IJSVGColorType.m in Sources */,
|
||||
59EB760123905F7300F5AE63 /* IJSVGLayerTree.m in Sources */,
|
||||
59EB763A23905F7300F5AE63 /* IJSVGForeignObject.m in Sources */,
|
||||
59EB761123905F7300F5AE63 /* IJSVGCommand.m in Sources */,
|
||||
59EB760923905F7300F5AE63 /* IJSVGCommandCurve.m in Sources */,
|
||||
59EB763323905F7300F5AE63 /* IJSVGLinearGradient.m in Sources */,
|
||||
594A10DB248D7C90001A3181 /* NSImage+IJSVGAdditions.m in Sources */,
|
||||
59EB761923905F7300F5AE63 /* IJSVGCommandSmoothCurve.m in Sources */,
|
||||
59EB761323905F7300F5AE63 /* IJSVG.m in Sources */,
|
||||
59EB763623905F7300F5AE63 /* IJSVGImageLayer.m in Sources */,
|
||||
59EB75EC23905F7300F5AE63 /* IJSVGLayer.m in Sources */,
|
||||
59EB75E523905F7300F5AE63 /* IJSVGStrokeLayer.m in Sources */,
|
||||
59EB763223905F7300F5AE63 /* IJSVGView.m in Sources */,
|
||||
59EB763523905F7300F5AE63 /* IJSVGStyleSheetSelector.m in Sources */,
|
||||
59E7CFB023B148600077D599 /* IJSVGCommandParser.m in Sources */,
|
||||
59EB760723905F7300F5AE63 /* IJSVGNode.m in Sources */,
|
||||
5919E65C23F480330051873A /* IJSVGUnitPoint.m in Sources */,
|
||||
59EB75E923905F7300F5AE63 /* IJSVGStringAdditions.m in Sources */,
|
||||
59FDBF0127F3454800AF7038 /* IJSVGColorNode.m in Sources */,
|
||||
59EB761723905F7300F5AE63 /* IJSVGRadialGradient.m in Sources */,
|
||||
59EB75E223905F7300F5AE63 /* IJSVGColorList.m in Sources */,
|
||||
59EB75ED23905F7300F5AE63 /* IJSVGFontConverter.m in Sources */,
|
||||
59EB763C23905F7300F5AE63 /* IJSVGCommandEllipticalArc.m in Sources */,
|
||||
59EB75E723905F7300F5AE63 /* IJSVGImage.m in Sources */,
|
||||
59EB75E623905F7300F5AE63 /* IJSVGStyle.m in Sources */,
|
||||
59EB75EB23905F7300F5AE63 /* IJSVGShapeLayer.m in Sources */,
|
||||
59EB75F623905F7300F5AE63 /* IJSVGColor.m in Sources */,
|
||||
59EB75F323905F7300F5AE63 /* IJSVGGroupLayer.m in Sources */,
|
||||
591A3E4E25CC91F800AD45B7 /* IJSVGParsing.m in Sources */,
|
||||
5919E65823F47FF60051873A /* IJSVGUnitRect.m in Sources */,
|
||||
5978C46B280A241200D25296 /* IJSVGRootLayer.m in Sources */,
|
||||
59EB762523905F7300F5AE63 /* IJSVGTransform.m in Sources */,
|
||||
59EB760023905F7300F5AE63 /* IJSVGGradientLayer.m in Sources */,
|
||||
59EB762B23905F7300F5AE63 /* IJSVGUnitLength.m in Sources */,
|
||||
59EB75F823905F7300F5AE63 /* IJSVGCommandHorizontalLine.m in Sources */,
|
||||
59EB764623905F7300F5AE63 /* IJSVGRendering.m in Sources */,
|
||||
59EB762E23905F7300F5AE63 /* IJSVGExporter.m in Sources */,
|
||||
59EB761623905F7300F5AE63 /* IJSVGParser.m in Sources */,
|
||||
59EB75DD23905F7300F5AE63 /* IJSVGCommandQuadraticCurve.m in Sources */,
|
||||
59EB762423905F7300F5AE63 /* IJSVGTransaction.m in Sources */,
|
||||
59EB75DA23905F7300F5AE63 /* IJSVGDef.m in Sources */,
|
||||
59EB763723905F7300F5AE63 /* IJSVGCommandClose.m in Sources */,
|
||||
59F9EAF92808BB5F00188ACB /* IJSVGViewBox.m in Sources */,
|
||||
59EB764323905F7300F5AE63 /* IJSVGGradient.m in Sources */,
|
||||
59EB762A23905F7300F5AE63 /* IJSVGGradientUnitLength.m in Sources */,
|
||||
59EB764223905F7300F5AE63 /* IJSVGStyleSheet.m in Sources */,
|
||||
59EB764023905F7300F5AE63 /* IJSVGExporterPathInstruction.m in Sources */,
|
||||
59EB75FE23905F7300F5AE63 /* IJSVGRenderingStyle.m in Sources */,
|
||||
59EB75F223905F7300F5AE63 /* IJSVGStyleSheetSelectorRaw.m in Sources */,
|
||||
590EB7A527F637EF0047CECF /* IJSVGTransformLayer.m in Sources */,
|
||||
59EB75EE23905F7300F5AE63 /* IJSVGImageRep.m in Sources */,
|
||||
59EB762223905F7300F5AE63 /* IJSVGMath.m in Sources */,
|
||||
59FCC09527F2394D00BB924E /* IJSVGRootNode.m in Sources */,
|
||||
59EB763D23905F7300F5AE63 /* IJSVGGroup.m in Sources */,
|
||||
59EB761F23905F7300F5AE63 /* IJSVGCommandLineTo.m in Sources */,
|
||||
59EB75F123905F7300F5AE63 /* IJSVGUtils.m in Sources */,
|
||||
59EB760A23905F7300F5AE63 /* IJSVGCommandMove.m in Sources */,
|
||||
59EB761B23905F7300F5AE63 /* IJSVGPattern.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
594CF475238FF38E009B251B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
594CF476238FF38E009B251B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
594CF478238FF38E009B251B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEFINES_MODULE = NO;
|
||||
DEVELOPMENT_TEAM = 9KTR4W9XX6;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = IJSVG/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.iconjar.ijsvg;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
594CF479238FF38E009B251B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEFINES_MODULE = NO;
|
||||
DEVELOPMENT_TEAM = 9KTR4W9XX6;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = IJSVG/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.iconjar.ijsvg;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
594CF469238FF38E009B251B /* Build configuration list for PBXProject "IJSVG" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
594CF475238FF38E009B251B /* Debug */,
|
||||
594CF476238FF38E009B251B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
594CF477238FF38E009B251B /* Build configuration list for PBXNativeTarget "IJSVG" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
594CF478238FF38E009B251B /* Debug */,
|
||||
594CF479238FF38E009B251B /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 594CF466238FF38E009B251B /* Project object */;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:IJSVG.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Binary file not shown.
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1250"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "594CF46E238FF38E009B251B"
|
||||
BuildableName = "IJSVG.framework"
|
||||
BlueprintName = "IJSVG"
|
||||
ReferencedContainer = "container:IJSVG.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "594CF46E238FF38E009B251B"
|
||||
BuildableName = "IJSVG.framework"
|
||||
BlueprintName = "IJSVG"
|
||||
ReferencedContainer = "container:IJSVG.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>IJSVG.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>594CF46E238FF38E009B251B</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true />
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2020 Curtis Hard. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// IJSVGStringAdditions.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 07/06/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSString (IJSVGAdditions)
|
||||
|
||||
- (NSArray<NSString*>*)ijsvg_componentsSeparatedByChars:(const char*)aChar;
|
||||
- (BOOL)ijsvg_isNumeric;
|
||||
- (BOOL)ijsvg_containsAlpha;
|
||||
- (NSArray*)ijsvg_componentsSplitByWhiteSpace;
|
||||
- (BOOL)ijsvg_isHexString;
|
||||
|
||||
@end
|
||||
@@ -1,71 +0,0 @@
|
||||
//
|
||||
// IJSVGStringAdditions.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 07/06/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGStringAdditions.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
@implementation NSString (IJSVGAdditions)
|
||||
|
||||
- (NSArray<NSString*>*)ijsvg_componentsSeparatedByChars:(const char*)aChar
|
||||
{
|
||||
char* chars = (char*)self.UTF8String;
|
||||
if(chars == NULL || strlen(chars) == 0) {
|
||||
return @[];
|
||||
}
|
||||
NSMutableArray<NSString*>* strings = nil;
|
||||
strings = [[[NSMutableArray alloc] init] autorelease];
|
||||
char* copy = strdup(chars);
|
||||
char* spt = NULL;
|
||||
char* ptr = strtok_r(copy, aChar, &spt);
|
||||
while(ptr != NULL) {
|
||||
NSString* possibleString = nil;
|
||||
if((possibleString = [NSString stringWithUTF8String:ptr]) != nil) {
|
||||
[strings addObject:possibleString];
|
||||
}
|
||||
ptr = strtok_r(NULL, aChar, &spt);
|
||||
}
|
||||
(void)free(copy), copy = NULL;
|
||||
return strings;
|
||||
}
|
||||
|
||||
- (BOOL)ijsvg_containsAlpha
|
||||
{
|
||||
const char* buffer = self.UTF8String;
|
||||
char currentChar;
|
||||
while((currentChar = *buffer++) ) {
|
||||
if (isalpha(currentChar)) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)ijsvg_isNumeric
|
||||
{
|
||||
const char* buffer = self.UTF8String;
|
||||
char currentChar;
|
||||
while((currentChar = *buffer++) ) {
|
||||
if (!isnumber(currentChar)) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSArray*)ijsvg_componentsSplitByWhiteSpace
|
||||
{
|
||||
return [self ijsvg_componentsSeparatedByChars:"\t\n\r "];
|
||||
}
|
||||
|
||||
- (BOOL)ijsvg_isHexString
|
||||
{
|
||||
const char* chars = self.UTF8String;
|
||||
return IJSVGCharBufferIsHEX((char*)chars);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// NSImage+IJSVGAdditions.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 07/06/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
IJSVG* IJSVGGetFromNSImage(NSImage* image);
|
||||
|
||||
@interface NSImage (IJSVGAdditions)
|
||||
|
||||
+ (NSImage*)SVGImageNamed:(NSString*)imageName;
|
||||
|
||||
@end
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// NSImage+IJSVGAdditions.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 07/06/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGImageRep.h"
|
||||
#import "NSImage+IJSVGAdditions.h"
|
||||
|
||||
IJSVG* IJSVGGetFromNSImage(NSImage* image)
|
||||
{
|
||||
for (NSImageRep* rep in image.representations) {
|
||||
if ([rep isKindOfClass:IJSVGImageRep.class]) {
|
||||
return ((IJSVGImageRep*)rep).SVG;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@implementation NSImage (IJSVGAdditions)
|
||||
|
||||
+ (NSImage*)SVGImageNamed:(NSString*)imageName
|
||||
{
|
||||
// find the image
|
||||
NSBundle* bundle = NSBundle.mainBundle;
|
||||
NSString* str = nil;
|
||||
NSString* ext = imageName.pathExtension;
|
||||
if (ext == nil || ext.length == 0) {
|
||||
ext = @"svg";
|
||||
}
|
||||
|
||||
if ((str = [bundle pathForResource:imageName.stringByDeletingPathExtension
|
||||
ofType:ext])
|
||||
!= nil) {
|
||||
|
||||
// work out if we can get the data
|
||||
NSData* data = [[[NSData alloc] initWithContentsOfFile:str] autorelease];
|
||||
if (data == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
// grab the image rep
|
||||
IJSVGImageRep* rep = [[[IJSVGImageRep alloc] initWithData:data] autorelease];
|
||||
NSImage* image = [[[NSImage alloc] init] autorelease];
|
||||
[image addRepresentation:rep];
|
||||
return image;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,828 +0,0 @@
|
||||
//
|
||||
// IJSVGColor.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 31/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGColor.h"
|
||||
#import "IJSVGUtils.h"
|
||||
#import "IJSVGStringAdditions.h"
|
||||
#import "IJSVGParsing.h"
|
||||
|
||||
NSString* const IJSVGColorCurrentColorName = @"currentColor";
|
||||
|
||||
@implementation IJSVGColor
|
||||
|
||||
static NSDictionary* _colorTree = nil;
|
||||
|
||||
|
||||
CGFloat* IJSVGColorCSSHSLToHSB(CGFloat hue, CGFloat saturation, CGFloat lightness)
|
||||
{
|
||||
hue *= (1.f / 360.f);
|
||||
hue = (hue - floorf(hue));
|
||||
saturation *= 0.01;
|
||||
lightness *= 0.01;
|
||||
lightness *= 2.f;
|
||||
|
||||
CGFloat s = saturation * ((lightness < 1.f) ? lightness : (2.f - lightness));
|
||||
CGFloat brightness = (lightness + s) * .5f;
|
||||
if (s != 0.f) {
|
||||
s = (2.f * s) / (lightness + s);
|
||||
}
|
||||
CGFloat* floats = (CGFloat*)malloc(3 * sizeof(CGFloat));
|
||||
floats[0] = hue;
|
||||
floats[1] = s;
|
||||
floats[2] = brightness;
|
||||
return floats;
|
||||
};
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[self.class _generateTree];
|
||||
}
|
||||
|
||||
+ (NSColorSpace*)defaultColorSpace
|
||||
{
|
||||
return NSColorSpace.deviceRGBColorSpace;
|
||||
}
|
||||
|
||||
+ (NSColor*)computeColorSpace:(NSColor*)color
|
||||
{
|
||||
NSColorSpace* space = [self defaultColorSpace];
|
||||
if (color.colorSpace != space) {
|
||||
color = [color colorUsingColorSpace:space];
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
+ (void)_generateTree
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
_colorTree = [@{
|
||||
@"aliceblue" : @(0xf0f8ff),
|
||||
@"antiquewhite" : @(0xfaebd7),
|
||||
@"aqua" : @(0x00ffff),
|
||||
@"aquamarine" : @(0x7fffd4),
|
||||
@"azure" : @(0xf0ffff),
|
||||
@"beige" : @(0xf5f5dc),
|
||||
@"bisque" : @(0xffe4c4),
|
||||
@"black" : @(0x000000),
|
||||
@"blanchedalmond" : @(0xffebcd),
|
||||
@"blue" : @(0x0000ff),
|
||||
@"blueviolet" : @(0x8a2be2),
|
||||
@"brown" : @(0xa52a2a),
|
||||
@"burlywood" : @(0xdeb887),
|
||||
@"cadetblue" : @(0x5f9ea0),
|
||||
@"chartreuse" : @(0x7fff00),
|
||||
@"chocolate" : @(0xd2691e),
|
||||
@"coral" : @(0xff7f50),
|
||||
@"cornflowerblue" : @(0x6495ed),
|
||||
@"cornsilk" : @(0xfff8dc),
|
||||
@"crimson" : @(0xdc143c),
|
||||
@"currentcolor" : @(0x000000),
|
||||
@"cyan" : @(0x00ffff),
|
||||
@"darkblue" : @(0x00008b),
|
||||
@"darkcyan" : @(0x008b8b),
|
||||
@"darkgoldenrod" : @(0xb8860b),
|
||||
@"darkgray" : @(0xa9a9a9),
|
||||
@"darkgreen" : @(0x006400),
|
||||
@"darkgrey" : @(0xa9a9a9),
|
||||
@"darkkhaki" : @(0xbdb76b),
|
||||
@"darkmagenta" : @(0x8b008b),
|
||||
@"darkolivegreen" : @(0x556b2f),
|
||||
@"darkorange" : @(0xff8c00),
|
||||
@"darkorchid" : @(0x9932cc),
|
||||
@"darkred" : @(0x8b0000),
|
||||
@"darksalmon" : @(0xe9967a),
|
||||
@"darkseagreen" : @(0x8fbc8f),
|
||||
@"darkslateblue" : @(0x483d8b),
|
||||
@"darkslategray" : @(0x2f4f4f),
|
||||
@"darkturquoise" : @(0x00ced1),
|
||||
@"darkviolet" : @(0x9400d3),
|
||||
@"deeppink" : @(0xff1493),
|
||||
@"deepskyblue" : @(0x00bfff),
|
||||
@"dimgray" : @(0x696969),
|
||||
@"dimgrey" : @(0x696969),
|
||||
@"dodgerblue" : @(0x1e90ff),
|
||||
@"firebrick" : @(0xb22222),
|
||||
@"floralwhite" : @(0xfffaf0),
|
||||
@"forestgreen" : @(0x228b22),
|
||||
@"fuchsia" : @(0xff00ff),
|
||||
@"gainsboro" : @(0xdcdcdc),
|
||||
@"ghostwhite" : @(0xf8f8ff),
|
||||
@"gold" : @(0xffd700),
|
||||
@"goldenrod" : @(0xdaa520),
|
||||
@"gray" : @(0x808080),
|
||||
@"green" : @(0x008000),
|
||||
@"greenyellow" : @(0xadff2f),
|
||||
@"grey" : @(0x808080),
|
||||
@"honeydew" : @(0xf0fff0),
|
||||
@"hotpink" : @(0xff69b4),
|
||||
@"indianred" : @(0xcd5c5c),
|
||||
@"indigo" : @(0x4b0082),
|
||||
@"ivory" : @(0xfffff0),
|
||||
@"khaki" : @(0xf0e68c),
|
||||
@"lavender" : @(0xe6e6fa),
|
||||
@"lavenderblush" : @(0xfff0f5),
|
||||
@"lawngreen" : @(0x7cfc00),
|
||||
@"lemonchiffon" : @(0xfffacd),
|
||||
@"lightblue" : @(0xadd8e6),
|
||||
@"lightcoral" : @(0xf08080),
|
||||
@"lightcyan" : @(0xe0ffff),
|
||||
@"lightgoldenrodyellow" : @(0xfafad2),
|
||||
@"lightgray" : @(0xd3d3d3),
|
||||
@"lightgreen" : @(0x90ee90),
|
||||
@"lightgrey" : @(0xd3d3d3),
|
||||
@"lightpink" : @(0xffb6c1),
|
||||
@"lightsalmon" : @(0xffa07a),
|
||||
@"lightseagreen" : @(0x20b2aa),
|
||||
@"lightskyblue" : @(0x87cefa),
|
||||
@"lightslategray" : @(0x778899),
|
||||
@"lightsteelblue" : @(0xb0c4de),
|
||||
@"lightyellow" : @(0xffffe0),
|
||||
@"lime" : @(0x00ff00),
|
||||
@"limegreen" : @(0x32cd32),
|
||||
@"linen" : @(0xfaf0e6),
|
||||
@"magenta" : @(0xff00ff),
|
||||
@"maroon" : @(0x800000),
|
||||
@"mediumaquamarine" : @(0x66cdaa),
|
||||
@"mediumblue" : @(0x0000cd),
|
||||
@"mediumorchid" : @(0xba55d3),
|
||||
@"mediumpurple" : @(0x9370db),
|
||||
@"mediumseagreen" : @(0x3cb371),
|
||||
@"mediumslateblue" : @(0x7b68ee),
|
||||
@"mediumspringgreen" : @(0x00fa9a),
|
||||
@"mediumturquoise" : @(0x48d1cc),
|
||||
@"mediumvioletred" : @(0xc71585),
|
||||
@"midnightblue" : @(0x191970),
|
||||
@"mintcream" : @(0xf5fffa),
|
||||
@"mistyrose" : @(0xffe4e1),
|
||||
@"moccasin" : @(0xffe4b5),
|
||||
@"navajowhite" : @(0xffdead),
|
||||
@"navy" : @(0x000080),
|
||||
@"oldlace" : @(0xfdf5e6),
|
||||
@"olive" : @(0x808000),
|
||||
@"olivedrab" : @(0x6b8e23),
|
||||
@"orange" : @(0xffa500),
|
||||
@"orangered" : @(0xff4500),
|
||||
@"orchid" : @(0xda70d6),
|
||||
@"palegoldenrod" : @(0xeee8aa),
|
||||
@"palegreen" : @(0x98fb98),
|
||||
@"paleturquoise" : @(0xafeeee),
|
||||
@"palevioletred" : @(0xdb7093),
|
||||
@"papayawhip" : @(0xffefd5),
|
||||
@"peachpuff" : @(0xffdab9),
|
||||
@"peru" : @(0xcd853f),
|
||||
@"pink" : @(0xffc0cb),
|
||||
@"plum" : @(0xdda0dd),
|
||||
@"powderblue" : @(0xb0e0e6),
|
||||
@"purple" : @(0x800080),
|
||||
@"red" : @(0xff0000),
|
||||
@"rosybrown" : @(0xbc8f8f),
|
||||
@"royalblue" : @(0x4169e1),
|
||||
@"saddlebrown" : @(0x8b4513),
|
||||
@"salmon" : @(0xfa8072),
|
||||
@"sandybrown" : @(0xf4a460),
|
||||
@"seagreen" : @(0x2e8b57),
|
||||
@"seashell" : @(0xfff5ee),
|
||||
@"sienna" : @(0xa0522d),
|
||||
@"silver" : @(0xc0c0c0),
|
||||
@"skyblue" : @(0x87ceeb),
|
||||
@"slateblue" : @(0x6a5acd),
|
||||
@"slategrey" : @(0x708090),
|
||||
@"snow" : @(0xfffafa),
|
||||
@"springgreen" : @(0x00ff7f),
|
||||
@"steelblue" : @(0x4682b4),
|
||||
@"tan" : @(0xd2b48c),
|
||||
@"teal" : @(0x008080),
|
||||
@"thistle" : @(0xd8bfd8),
|
||||
@"tomato" : @(0xff6347),
|
||||
@"turquoise" : @(0x40e0d0),
|
||||
@"violet" : @(0xee82ee),
|
||||
@"wheat" : @(0xf5deb3),
|
||||
@"white" : @(0xffffff),
|
||||
@"whitesmoke" : @(0xf5f5f5),
|
||||
@"yellow" : @(0xffff00),
|
||||
@"yellowgreen" : @(0x9acd32)
|
||||
} retain];
|
||||
});
|
||||
}
|
||||
|
||||
+ (NSColor*)computeColor:(id)colour
|
||||
{
|
||||
if ([colour isKindOfClass:[NSColor class]])
|
||||
return colour;
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromRString:(NSString*)rString
|
||||
gString:(NSString*)gString
|
||||
bString:(NSString*)bString
|
||||
aString:(NSString*)aString
|
||||
{
|
||||
return [self colorFromRUnit:[IJSVGUnitLength unitWithString:rString]
|
||||
gUnit:[IJSVGUnitLength unitWithString:gString]
|
||||
bUnit:[IJSVGUnitLength unitWithString:bString]
|
||||
aUnit:[IJSVGUnitLength unitWithString:aString]];
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromRUnit:(IJSVGUnitLength*)rUnit
|
||||
gUnit:(IJSVGUnitLength*)gUnit
|
||||
bUnit:(IJSVGUnitLength*)bUnit
|
||||
aUnit:(IJSVGUnitLength*)aUnit
|
||||
{
|
||||
CGFloat r = rUnit.type == IJSVGUnitLengthTypePercentage ? [rUnit computeValue:255.f] : [rUnit computeValue:1.f];
|
||||
CGFloat g = gUnit.type == IJSVGUnitLengthTypePercentage ? [gUnit computeValue:255.f] : [gUnit computeValue:1.f];
|
||||
CGFloat b = bUnit.type == IJSVGUnitLengthTypePercentage ? [bUnit computeValue:255.f] : [bUnit computeValue:1.f];
|
||||
CGFloat a = [aUnit computeValue:100.f];
|
||||
return [self computeColorSpace:[NSColor colorWithDeviceRed:(r / 255.f)
|
||||
green:(g / 255.f)
|
||||
blue:(b / 255.f)
|
||||
alpha:a]];
|
||||
}
|
||||
|
||||
+ (BOOL)isNoneOrTransparent:(NSString*)string
|
||||
{
|
||||
const char* str = string.lowercaseString.UTF8String;
|
||||
return strcmp(str, "none") == 0 || strcmp(str, "transparent") == 0;
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromString:(NSString*)string
|
||||
{
|
||||
// swap over to C for performance
|
||||
if(string == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
const char* oString = string.UTF8String;
|
||||
if(strlen(oString) == 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
char* str = IJSVGTimmedCharBufferCreate(oString);
|
||||
if (IJSVGCharBufferIsHEX(str) == YES) {
|
||||
(void)free(str), str = NULL;
|
||||
return [self.class colorFromHEXString:string];
|
||||
}
|
||||
|
||||
// is it RGB?
|
||||
if (IJSVGCharBufferHasPrefix(str, "rgb") == YES) {
|
||||
NSUInteger count = 0;
|
||||
IJSVGParsingStringMethod** methods = NULL;
|
||||
methods = IJSVGParsingMethodParseString(str, &count);
|
||||
IJSVGParsingStringMethod* method = methods[0];
|
||||
|
||||
// memory clean for the string
|
||||
(void)free(str), str = NULL;
|
||||
|
||||
// nothing to return, just mem clean and get out of here
|
||||
if(count == 0 || methods == NULL) {
|
||||
if(methods != NULL) {
|
||||
IJSVGParsingStringMethodsRelease(methods, count);
|
||||
methods = NULL;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
// parse the parameters
|
||||
NSString* parameters = [NSString stringWithUTF8String:method->parameters];
|
||||
NSArray* parts = [parameters ijsvg_componentsSeparatedByChars:","];
|
||||
NSString* alpha = @"100%";
|
||||
if (parts.count == 4) {
|
||||
alpha = parts[3];
|
||||
}
|
||||
|
||||
IJSVGParsingStringMethodsRelease(methods, count);
|
||||
methods = NULL;
|
||||
return [self colorFromRString:parts[0]
|
||||
gString:parts[1]
|
||||
bString:parts[2]
|
||||
aString:alpha];
|
||||
}
|
||||
|
||||
// is it HSL?
|
||||
if (IJSVGCharBufferHasPrefix(str, "hsl")) {
|
||||
NSInteger count = 0;
|
||||
CGFloat* params = [IJSVGUtils scanFloatsFromCString:str
|
||||
size:&count];
|
||||
CGFloat alpha = 1;
|
||||
if (count == 4) {
|
||||
alpha = params[3];
|
||||
}
|
||||
|
||||
// convert HSL to HSB
|
||||
CGFloat* hsb = IJSVGColorCSSHSLToHSB(params[0], params[1], params[2]);
|
||||
NSColor* color = [NSColor colorWithDeviceHue:hsb[0]
|
||||
saturation:hsb[1]
|
||||
brightness:hsb[2]
|
||||
alpha:alpha];
|
||||
|
||||
color = [self computeColorSpace:color];
|
||||
|
||||
// memory clean!
|
||||
(void)free(str), str = NULL;
|
||||
(void)free(hsb), hsb = NULL;
|
||||
(void)free(params), params = NULL;
|
||||
return color;
|
||||
}
|
||||
|
||||
// is simply a clear color, dont fill
|
||||
if (strcmp(str, "none") == 0 ||
|
||||
strcmp(str, "transparent") == 0) {
|
||||
(void)free(str), str = NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// could return nil
|
||||
(void)free(str), str = NULL;
|
||||
return [self.class colorFromPredefinedColorName:string];
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromPredefinedColorName:(NSString*)name
|
||||
{
|
||||
NSNumber* hex = nil;
|
||||
name = [name.lowercaseString stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
||||
if ((hex = _colorTree[name]) == nil) {
|
||||
return nil;
|
||||
}
|
||||
return [self.class colorFromHEXInteger:hex.integerValue];
|
||||
}
|
||||
|
||||
+ (NSString*)colorStringFromColor:(NSColor*)color
|
||||
{
|
||||
IJSVGColorStringOptions options = IJSVGColorStringOptionDefault;
|
||||
return [self colorStringFromColor:color
|
||||
options:options];
|
||||
}
|
||||
|
||||
+ (NSString*)colorStringFromColor:(NSColor*)color
|
||||
options:(IJSVGColorStringOptions)options
|
||||
{
|
||||
// convert to RGB
|
||||
color = [self computeColorSpace:color];
|
||||
|
||||
int red = color.redComponent * 0xFF;
|
||||
int green = color.greenComponent * 0xFF;
|
||||
int blue = color.blueComponent * 0xFF;
|
||||
int alpha = (int)(color.alphaComponent * 100);
|
||||
|
||||
BOOL forceHex = (options & IJSVGColorStringOptionForceHEX) != 0;
|
||||
BOOL allowShortHand = (options & IJSVGColorStringOptionAllowShortHand) != 0;
|
||||
BOOL allowRRGGBBAA = (options & IJSVGColorStringOptionAllowRRGGBBAA) != 0;
|
||||
|
||||
// jsut return none
|
||||
if (alpha == 0 && forceHex == NO) {
|
||||
return @"none";
|
||||
}
|
||||
|
||||
// always return hex unless criteria is met
|
||||
if (forceHex == YES || allowRRGGBBAA == YES || alpha == 100 || (red == 0 && green == 0 && blue == 0 && alpha == 0) || (red == 255 && green == 255 && blue == 255 && alpha == 100)) {
|
||||
|
||||
// we need to make sure the last 2 chars
|
||||
// are the same or we cant enable shorthand
|
||||
if (allowRRGGBBAA == YES) {
|
||||
NSString* alphaHexString = [NSString stringWithFormat:@"%02X",
|
||||
(int)(color.alphaComponent * 0xFF)];
|
||||
if ([alphaHexString characterAtIndex:0] !=
|
||||
[alphaHexString characterAtIndex:1]) {
|
||||
allowShortHand = NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (allowShortHand == YES) {
|
||||
NSString* r = [NSString stringWithFormat:@"%02X", red];
|
||||
NSString* g = [NSString stringWithFormat:@"%02X", green];
|
||||
NSString* b = [NSString stringWithFormat:@"%02X", blue];
|
||||
if ([r characterAtIndex:0] == [r characterAtIndex:1] &&
|
||||
[g characterAtIndex:0] == [g characterAtIndex:1] &&
|
||||
[b characterAtIndex:0] == [b characterAtIndex:1]) {
|
||||
// allow shorthand alpha
|
||||
if (allowRRGGBBAA == YES && alpha != 100) {
|
||||
NSString* a = [NSString stringWithFormat:@"%02X",
|
||||
(int)(color.alphaComponent * 0xFF)];
|
||||
return [NSString stringWithFormat:@"#%c%c%c%c",
|
||||
[r characterAtIndex:0], [g characterAtIndex:0],
|
||||
[b characterAtIndex:0], [a characterAtIndex:0]];
|
||||
}
|
||||
return [NSString stringWithFormat:@"#%c%c%c", [r characterAtIndex:0],
|
||||
[g characterAtIndex:0], [b characterAtIndex:0]];
|
||||
}
|
||||
}
|
||||
if (allowRRGGBBAA == YES && alpha != 100) {
|
||||
return [NSString stringWithFormat:@"#%02X%02X%02X%02X", red, green,
|
||||
blue, (int)(color.alphaComponent * 0xFF)];
|
||||
}
|
||||
return [NSString stringWithFormat:@"#%02X%02X%02X", red, green, blue];
|
||||
}
|
||||
|
||||
// note the %g, CSS alpha is 0 to 1, not 0 - 100, my bad!
|
||||
return [NSString stringWithFormat:@"rgba(%d,%d,%d,%@)", red, green, blue,
|
||||
IJSVGShortFloatString((float)alpha / 100.f)];
|
||||
}
|
||||
|
||||
+ (NSString*)colorNameFromPredefinedColor:(IJSVGPredefinedColor)color
|
||||
{
|
||||
switch (color) {
|
||||
case IJSVGColorAliceblue:
|
||||
return @"aliceblue";
|
||||
case IJSVGColorAntiquewhite:
|
||||
return @"antiquewhite";
|
||||
case IJSVGColorAqua:
|
||||
return @"aqua";
|
||||
case IJSVGColorAquamarine:
|
||||
return @"aquamarine";
|
||||
case IJSVGColorAzure:
|
||||
return @"azure";
|
||||
case IJSVGColorBeige:
|
||||
return @"beige";
|
||||
case IJSVGColorBisque:
|
||||
return @"bisque";
|
||||
case IJSVGColorBlack:
|
||||
return @"black";
|
||||
case IJSVGColorBlanchedalmond:
|
||||
return @"blanchedalmond";
|
||||
case IJSVGColorBlue:
|
||||
return @"blue";
|
||||
case IJSVGColorBlueviolet:
|
||||
return @"blueviolet";
|
||||
case IJSVGColorBrown:
|
||||
return @"brown";
|
||||
case IJSVGColorBurlywood:
|
||||
return @"burlywood";
|
||||
case IJSVGColorCadetblue:
|
||||
return @"cadetblue";
|
||||
case IJSVGColorChartreuse:
|
||||
return @"chartreuse";
|
||||
case IJSVGColorChocolate:
|
||||
return @"chocolate";
|
||||
case IJSVGColorCoral:
|
||||
return @"coral";
|
||||
case IJSVGColorCornflowerblue:
|
||||
return @"cornflowerblue";
|
||||
case IJSVGColorCornsilk:
|
||||
return @"cornsilk";
|
||||
case IJSVGColorCrimson:
|
||||
return @"crimson";
|
||||
case IJSVGColorCyan:
|
||||
return @"cyan";
|
||||
case IJSVGColorDarkblue:
|
||||
return @"darkblue";
|
||||
case IJSVGColorDarkcyan:
|
||||
return @"darkcyan";
|
||||
case IJSVGColorDarkgoldenrod:
|
||||
return @"darkgoldenrod";
|
||||
case IJSVGColorDarkgray:
|
||||
return @"darkgray";
|
||||
case IJSVGColorDarkgreen:
|
||||
return @"darkgreen";
|
||||
case IJSVGColorDarkgrey:
|
||||
return @"darkgrey";
|
||||
case IJSVGColorDarkkhaki:
|
||||
return @"darkkhaki";
|
||||
case IJSVGColorDarkmagenta:
|
||||
return @"darkmagenta";
|
||||
case IJSVGColorDarkolivegreen:
|
||||
return @"darkolivegreen";
|
||||
case IJSVGColorDarkorange:
|
||||
return @"darkorange";
|
||||
case IJSVGColorDarkorchid:
|
||||
return @"darkorchid";
|
||||
case IJSVGColorDarkred:
|
||||
return @"darkred";
|
||||
case IJSVGColorDarksalmon:
|
||||
return @"darksalmon";
|
||||
case IJSVGColorDarkseagreen:
|
||||
return @"darkseagreen";
|
||||
case IJSVGColorDarkslateblue:
|
||||
return @"darkslateblue";
|
||||
case IJSVGColorDarkslategray:
|
||||
return @"darkslategray";
|
||||
case IJSVGColorDarkslategrey:
|
||||
return @"darkslategrey";
|
||||
case IJSVGColorDarkturquoise:
|
||||
return @"darkturquoise";
|
||||
case IJSVGColorDarkviolet:
|
||||
return @"darkviolet";
|
||||
case IJSVGColorDeeppink:
|
||||
return @"deeppink";
|
||||
case IJSVGColorDeepskyblue:
|
||||
return @"deepskyblue";
|
||||
case IJSVGColorDimgray:
|
||||
return @"dimgray";
|
||||
case IJSVGColorDimgrey:
|
||||
return @"dimgrey";
|
||||
case IJSVGColorDodgerblue:
|
||||
return @"dodgerblue";
|
||||
case IJSVGColorFirebrick:
|
||||
return @"firebrick";
|
||||
case IJSVGColorFloralwhite:
|
||||
return @"floralwhite";
|
||||
case IJSVGColorForestgreen:
|
||||
return @"forestgreen";
|
||||
case IJSVGColorFuchsia:
|
||||
return @"fuchsia";
|
||||
case IJSVGColorGainsboro:
|
||||
return @"gainsboro";
|
||||
case IJSVGColorGhostwhite:
|
||||
return @"ghostwhite";
|
||||
case IJSVGColorGold:
|
||||
return @"gold";
|
||||
case IJSVGColorGoldenrod:
|
||||
return @"goldenrod";
|
||||
case IJSVGColorGray:
|
||||
return @"gray";
|
||||
case IJSVGColorGreen:
|
||||
return @"green";
|
||||
case IJSVGColorGreenyellow:
|
||||
return @"greenyellow";
|
||||
case IJSVGColorGrey:
|
||||
return @"grey";
|
||||
case IJSVGColorHoneydew:
|
||||
return @"honeydew";
|
||||
case IJSVGColorHotpink:
|
||||
return @"hotpink";
|
||||
case IJSVGColorIndianred:
|
||||
return @"indianred";
|
||||
case IJSVGColorIndigo:
|
||||
return @"indigo";
|
||||
case IJSVGColorIvory:
|
||||
return @"ivory";
|
||||
case IJSVGColorKhaki:
|
||||
return @"khaki";
|
||||
case IJSVGColorLavender:
|
||||
return @"lavender";
|
||||
case IJSVGColorLavenderblush:
|
||||
return @"lavenderblush";
|
||||
case IJSVGColorLawngreen:
|
||||
return @"lawngreen";
|
||||
case IJSVGColorLemonchiffon:
|
||||
return @"lemonchiffon";
|
||||
case IJSVGColorLightblue:
|
||||
return @"lightblue";
|
||||
case IJSVGColorLightcoral:
|
||||
return @"lightcoral";
|
||||
case IJSVGColorLightcyan:
|
||||
return @"lightcyan";
|
||||
case IJSVGColorLightgoldenrodyellow:
|
||||
return @"lightgoldenrodyellow";
|
||||
case IJSVGColorLightgray:
|
||||
return @"lightgray";
|
||||
case IJSVGColorLightgreen:
|
||||
return @"lightgreen";
|
||||
case IJSVGColorLightgrey:
|
||||
return @"lightgrey";
|
||||
case IJSVGColorLightpink:
|
||||
return @"lightpink";
|
||||
case IJSVGColorLightsalmon:
|
||||
return @"lightsalmon";
|
||||
case IJSVGColorLightseagreen:
|
||||
return @"lightseagreen";
|
||||
case IJSVGColorLightskyblue:
|
||||
return @"lightskyblue";
|
||||
case IJSVGColorLightslategray:
|
||||
return @"lightslategray";
|
||||
case IJSVGColorLightslategrey:
|
||||
return @"lightslategrey";
|
||||
case IJSVGColorLightsteelblue:
|
||||
return @"lightsteelblue";
|
||||
case IJSVGColorLightyellow:
|
||||
return @"lightyellow";
|
||||
case IJSVGColorLime:
|
||||
return @"lime";
|
||||
case IJSVGColorLimegreen:
|
||||
return @"limegreen";
|
||||
case IJSVGColorLinen:
|
||||
return @"linen";
|
||||
case IJSVGColorMagenta:
|
||||
return @"magenta";
|
||||
case IJSVGColorMaroon:
|
||||
return @"maroon";
|
||||
case IJSVGColorMediumaquamarine:
|
||||
return @"mediumaquamarine";
|
||||
case IJSVGColorMediumblue:
|
||||
return @"mediumblue";
|
||||
case IJSVGColorMediumorchid:
|
||||
return @"mediumorchid";
|
||||
case IJSVGColorMediumpurple:
|
||||
return @"mediumpurple";
|
||||
case IJSVGColorMediumseagreen:
|
||||
return @"mediumseagreen";
|
||||
case IJSVGColorMediumslateblue:
|
||||
return @"mediumslateblue";
|
||||
case IJSVGColorMediumspringgreen:
|
||||
return @"mediumspringgreen";
|
||||
case IJSVGColorMediumturquoise:
|
||||
return @"mediumturquoise";
|
||||
case IJSVGColorMediumvioletred:
|
||||
return @"mediumvioletred";
|
||||
case IJSVGColorMidnightblue:
|
||||
return @"midnightblue";
|
||||
case IJSVGColorMintcream:
|
||||
return @"mintcream";
|
||||
case IJSVGColorMistyrose:
|
||||
return @"mistyrose";
|
||||
case IJSVGColorMoccasin:
|
||||
return @"moccasin";
|
||||
case IJSVGColorNavajowhite:
|
||||
return @"navajowhite";
|
||||
case IJSVGColorNavy:
|
||||
return @"navy";
|
||||
case IJSVGColorOldlace:
|
||||
return @"oldlace";
|
||||
case IJSVGColorOlive:
|
||||
return @"olive";
|
||||
case IJSVGColorOlivedrab:
|
||||
return @"olivedrab";
|
||||
case IJSVGColorOrange:
|
||||
return @"orange";
|
||||
case IJSVGColorOrangered:
|
||||
return @"orangered";
|
||||
case IJSVGColorOrchid:
|
||||
return @"orchid";
|
||||
case IJSVGColorPalegoldenrod:
|
||||
return @"palegoldenrod";
|
||||
case IJSVGColorPalegreen:
|
||||
return @"palegreen";
|
||||
case IJSVGColorPaleturquoise:
|
||||
return @"paleturquoise";
|
||||
case IJSVGColorPalevioletred:
|
||||
return @"palevioletred";
|
||||
case IJSVGColorPapayawhip:
|
||||
return @"papayawhip";
|
||||
case IJSVGColorPeachpuff:
|
||||
return @"peachpuff";
|
||||
case IJSVGColorPeru:
|
||||
return @"peru";
|
||||
case IJSVGColorPink:
|
||||
return @"pink";
|
||||
case IJSVGColorPlum:
|
||||
return @"plum";
|
||||
case IJSVGColorPowderblue:
|
||||
return @"powderblue";
|
||||
case IJSVGColorPurple:
|
||||
return @"purple";
|
||||
case IJSVGColorRed:
|
||||
return @"red";
|
||||
case IJSVGColorRosybrown:
|
||||
return @"rosybrown";
|
||||
case IJSVGColorRoyalblue:
|
||||
return @"royalblue";
|
||||
case IJSVGColorSaddlebrown:
|
||||
return @"saddlebrown";
|
||||
case IJSVGColorSalmon:
|
||||
return @"salmon";
|
||||
case IJSVGColorSandybrown:
|
||||
return @"sandybrown";
|
||||
case IJSVGColorSeagreen:
|
||||
return @"seagreen";
|
||||
case IJSVGColorSeashell:
|
||||
return @"seashell";
|
||||
case IJSVGColorSienna:
|
||||
return @"sienna";
|
||||
case IJSVGColorSilver:
|
||||
return @"silver";
|
||||
case IJSVGColorSkyblue:
|
||||
return @"skyblue";
|
||||
case IJSVGColorSlateblue:
|
||||
return @"slateblue";
|
||||
case IJSVGColorSlategray:
|
||||
return @"slategray";
|
||||
case IJSVGColorSlategrey:
|
||||
return @"slategrey";
|
||||
case IJSVGColorSnow:
|
||||
return @"snow";
|
||||
case IJSVGColorSpringgreen:
|
||||
return @"springgreen";
|
||||
case IJSVGColorSteelblue:
|
||||
return @"steelblue";
|
||||
case IJSVGColorTan:
|
||||
return @"tan";
|
||||
case IJSVGColorTeal:
|
||||
return @"teal";
|
||||
case IJSVGColorThistle:
|
||||
return @"thistle";
|
||||
case IJSVGColorTomato:
|
||||
return @"tomato";
|
||||
case IJSVGColorTurquoise:
|
||||
return @"turquoise";
|
||||
case IJSVGColorViolet:
|
||||
return @"violet";
|
||||
case IJSVGColorWheat:
|
||||
return @"wheat";
|
||||
case IJSVGColorWhite:
|
||||
return @"white";
|
||||
case IJSVGColorWhitesmoke:
|
||||
return @"whitesmoke";
|
||||
case IJSVGColorYellow:
|
||||
return @"yellow";
|
||||
case IJSVGColorYellowgreen:
|
||||
return @"yellowgreen";
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSColor*)changeAlphaOnColor:(NSColor*)color
|
||||
to:(CGFloat)alphaValue
|
||||
{
|
||||
color = [self computeColorSpace:color];
|
||||
return [self computeColorSpace:[NSColor colorWithDeviceRed:color.redComponent
|
||||
green:color.greenComponent
|
||||
blue:color.blueComponent
|
||||
alpha:alphaValue]];
|
||||
}
|
||||
|
||||
+ (BOOL)isColor:(NSString*)string
|
||||
{
|
||||
return [string hasPrefix:@"#"] || [string hasPrefix:@"rgb"];
|
||||
}
|
||||
|
||||
+ (BOOL)isHex:(NSString*)string
|
||||
{
|
||||
return string.ijsvg_isHexString;
|
||||
}
|
||||
|
||||
+ (unsigned long)lengthOfHEXInteger:(NSUInteger)hex
|
||||
{
|
||||
char* buffer;
|
||||
asprintf(&buffer, "%lX", (long)hex);
|
||||
unsigned long length = strlen(buffer);
|
||||
free(buffer);
|
||||
return length;
|
||||
}
|
||||
|
||||
+ (BOOL)HEXContainsAlphaComponent:(NSUInteger)hex
|
||||
{
|
||||
return [self lengthOfHEXInteger:hex] == 8;
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromHEXInteger:(NSInteger)hex
|
||||
{
|
||||
CGFloat alpha = 1.f;
|
||||
if ([self HEXContainsAlphaComponent:hex] == YES) {
|
||||
alpha = (hex & 0xFF) / 255.f;
|
||||
hex = hex >> 8;
|
||||
}
|
||||
return [self computeColorSpace:[NSColor colorWithDeviceRed:((hex >> 16) & 0xFF) / 255.f
|
||||
green:((hex >> 8) & 0xFF) / 255.f
|
||||
blue:(hex & 0xFF) / 255.f
|
||||
alpha:alpha]];
|
||||
}
|
||||
|
||||
+ (unsigned long)HEXFromArbitraryHexString:(NSString*)aString
|
||||
{
|
||||
const char* hexString = [aString cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
return strtoul(hexString, NULL, 16);
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromHEXString:(NSString*)string
|
||||
{
|
||||
return [self colorFromHEXString:string
|
||||
containsAlphaComponent:nil];
|
||||
}
|
||||
|
||||
+ (NSColor*)colorFromHEXString:(NSString*)string
|
||||
containsAlphaComponent:(BOOL*)containsAlphaComponent
|
||||
{
|
||||
// absolutely no string
|
||||
if(string == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
char* str = (char*)string.UTF8String;
|
||||
size_t length = strlen(str);
|
||||
if (length == 0 || IJSVGCharBufferIsHEX(str) == NO) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
// remove the hash from the front of the string
|
||||
if(str[0] == '#') {
|
||||
length--;
|
||||
str++;
|
||||
}
|
||||
|
||||
unsigned long hex;
|
||||
// we need to work out if its shorthand
|
||||
// if it is, the length needs to be length*2
|
||||
if (length == 3 || length == 4) {
|
||||
char* chars = NULL;
|
||||
chars = (char*)calloc(sizeof(char),length*2+1);
|
||||
for(int i = 0; i < length; i++) {
|
||||
chars[i*2] = chars[i*2+1] = str[i];
|
||||
}
|
||||
hex = strtoul(chars, NULL, 16);
|
||||
(void)free(chars), chars = NULL;
|
||||
} else {
|
||||
hex = strtoul(str, NULL, 16);
|
||||
}
|
||||
|
||||
// now convert rest to hex
|
||||
if (containsAlphaComponent != nil) {
|
||||
*containsAlphaComponent = [self HEXContainsAlphaComponent:hex];
|
||||
}
|
||||
return [self colorFromHEXInteger:hex];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// IJSVGColorList.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 07/07/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGColor.h>
|
||||
#import <IJSVG/IJSVGColorType.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface IJSVGColorList : NSObject <NSCopying> {
|
||||
|
||||
@private
|
||||
NSMutableDictionary<NSColor*, NSColor*>* _replacementColorTree;
|
||||
NSMutableSet<IJSVGColorType*>* _colors;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign, readonly) NSUInteger count;
|
||||
|
||||
- (NSColor*)proposedColorForColor:(NSColor*)color;
|
||||
- (void)removeAllReplacementColors;
|
||||
- (void)removeReplacementColor:(NSColor*)color;
|
||||
- (void)setReplacementColor:(NSColor*)newColor
|
||||
forColor:(NSColor*)color;
|
||||
- (void)setReplacementColors:(NSDictionary<NSColor*, NSColor*>*)colors
|
||||
clearExistingColors:(BOOL)clearExistingColors;
|
||||
|
||||
- (void)addColorsFromList:(IJSVGColorList*)sheet;
|
||||
- (NSSet<IJSVGColorType*>*)colors;
|
||||
- (void)addColor:(IJSVGColorType*)color;
|
||||
- (NSDictionary<NSColor*, NSColor*>*)replacementColors;
|
||||
|
||||
@end
|
||||
@@ -1,136 +0,0 @@
|
||||
//
|
||||
// IJSVGColorList.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 07/07/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGColorList.h"
|
||||
|
||||
@implementation IJSVGColorList
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_replacementColorTree release]), _replacementColorTree = nil;
|
||||
(void)([_colors release]), _colors = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
_replacementColorTree = [[NSMutableDictionary alloc] init];
|
||||
_colors = [[NSMutableSet alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGColorList* sheet = [[self.class alloc] init];
|
||||
[sheet setReplacementColors:[_replacementColorTree.copy autorelease]
|
||||
clearExistingColors:YES];
|
||||
return sheet;
|
||||
}
|
||||
|
||||
- (NSColor*)proposedColorForColor:(NSColor*)color
|
||||
{
|
||||
// nothing found, just return color
|
||||
if (_replacementColorTree == nil || _replacementColorTree.count == 0) {
|
||||
return color;
|
||||
}
|
||||
|
||||
// check the mappings
|
||||
NSColor* found = nil;
|
||||
color = [IJSVGColor computeColorSpace:color];
|
||||
if ((found = _replacementColorTree[color]) != nil) {
|
||||
return found;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
- (void)_invalidateColorTree
|
||||
{
|
||||
(void)([_replacementColorTree release]), _replacementColorTree = nil;
|
||||
_replacementColorTree = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
- (void)removeAllReplacementColors
|
||||
{
|
||||
[self _invalidateColorTree];
|
||||
}
|
||||
|
||||
- (void)removeReplacementColor:(NSColor*)color
|
||||
{
|
||||
if (_replacementColorTree == nil) {
|
||||
return;
|
||||
}
|
||||
[_replacementColorTree removeObjectForKey:[IJSVGColor computeColorSpace:color]];
|
||||
}
|
||||
|
||||
- (void)setReplacementColor:(NSColor*)newColor
|
||||
forColor:(NSColor*)color
|
||||
{
|
||||
color = [IJSVGColor computeColorSpace:color];
|
||||
newColor = [IJSVGColor computeColorSpace:newColor];
|
||||
_replacementColorTree[color] = newColor;
|
||||
}
|
||||
|
||||
- (void)setReplacementColors:(NSDictionary<NSColor*, NSColor*>*)colors
|
||||
clearExistingColors:(BOOL)clearExistingColors
|
||||
{
|
||||
if (clearExistingColors == YES) {
|
||||
[self _invalidateColorTree];
|
||||
}
|
||||
for (NSColor* oldColor in colors) {
|
||||
[self setReplacementColor:colors[oldColor]
|
||||
forColor:oldColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSSet<IJSVGColorType*>*)colors
|
||||
{
|
||||
return [NSSet setWithSet:_colors];
|
||||
}
|
||||
|
||||
- (void)addColorsFromList:(IJSVGColorList*)sheet
|
||||
{
|
||||
for(IJSVGColorType* color in sheet.colors) {
|
||||
[self addColor:color];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addColor:(IJSVGColorType*)color
|
||||
{
|
||||
// we just need to update its bit mask
|
||||
if([_colors containsObject:color] == YES) {
|
||||
void (^handler)(IJSVGColorType * _Nonnull obj, BOOL * _Nonnull stop) =
|
||||
^(IJSVGColorType * _Nonnull obj, BOOL * _Nonnull stop) {
|
||||
if([obj isEqual:color] == YES) {
|
||||
obj.flags |= color.flags;
|
||||
*stop = YES;
|
||||
}
|
||||
};
|
||||
[_colors enumerateObjectsUsingBlock:handler];
|
||||
return;
|
||||
}
|
||||
[_colors addObject:color];
|
||||
}
|
||||
|
||||
- (NSDictionary<NSColor*,NSColor*>*)replacementColors
|
||||
{
|
||||
return _replacementColorTree;
|
||||
}
|
||||
|
||||
- (void)removeColor:(IJSVGColorType*)color
|
||||
{
|
||||
[_colors removeObject:color];
|
||||
}
|
||||
|
||||
- (NSUInteger)count
|
||||
{
|
||||
return _colors.count;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// IJSVGColorType.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 20/04/2021.
|
||||
// Copyright © 2021 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, IJSVGColorTypeFlags) {
|
||||
IJSVGColorTypeNone = 0,
|
||||
IJSVGColorTypeFlagUnknown = 1 << 0,
|
||||
IJSVGColorTypeFlagFill = 1 << 1,
|
||||
IJSVGColorTypeFlagStroke = 1 << 2,
|
||||
IJSVGColorTypeFlagStop = 1 << 3
|
||||
};
|
||||
|
||||
@interface IJSVGColorType : NSObject {
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSColor* color;
|
||||
@property (nonatomic, assign) IJSVGColorTypeFlags flags;
|
||||
|
||||
+ (IJSVGColorType*)typeWithColor:(NSColor*)color
|
||||
flags:(IJSVGColorTypeFlags)mask;
|
||||
|
||||
@end
|
||||
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// IJSVGColorType.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 20/04/2021.
|
||||
// Copyright © 2021 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGColorType.h"
|
||||
|
||||
@implementation IJSVGColorType
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_color release], _color = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (IJSVGColorType*)typeWithColor:(NSColor*)color
|
||||
flags:(IJSVGColorTypeFlags)mask
|
||||
{
|
||||
IJSVGColorType* type = [[[self alloc] init] autorelease];
|
||||
type.color = color;
|
||||
type.flags = mask;
|
||||
return type;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if([object isKindOfClass:IJSVGColorType.class] == NO) {
|
||||
return NO;
|
||||
}
|
||||
return [self.color isEqual:((IJSVGColorType*)object).color];
|
||||
}
|
||||
|
||||
- (NSUInteger)hash
|
||||
{
|
||||
return self.color.hash;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,73 +0,0 @@
|
||||
//
|
||||
// IJSVGCommand.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGCommandParser.h>
|
||||
#import <IJSVG/IJSVGPath.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static const NSInteger IJSVGCustomVariableParameterCount = NSNotFound;
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGCommandType) {
|
||||
kIJSVGCommandTypeAbsolute,
|
||||
kIJSVGCommandTypeRelative
|
||||
};
|
||||
|
||||
@interface IJSVGCommand : NSObject <NSCopying> {
|
||||
@private
|
||||
NSInteger _currentIndex;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) char command;
|
||||
@property (nonatomic, assign) CGFloat* parameters;
|
||||
@property (nonatomic, assign) NSInteger parameterCount;
|
||||
@property (nonatomic, assign) IJSVGCommandType type;
|
||||
@property (nonatomic, retain) NSArray<IJSVGCommand*>* subCommands;
|
||||
@property (nonatomic, assign) IJSVGCommand* previousCommand;
|
||||
@property (nonatomic, assign) BOOL isSubCommand;
|
||||
|
||||
+ (Class)commandClassForCommandChar:(char)aChar;
|
||||
+ (NSInteger)requiredParameterCount;
|
||||
+ (NSPoint)readCoordinatePair:(CGFloat*)pairs
|
||||
index:(NSInteger)index;
|
||||
+ (IJSVGPathDataSequence*)pathDataSequence;
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path;
|
||||
+ (void)parseParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)paramCount
|
||||
intoArray:(NSMutableArray<IJSVGCommand*>*)commands
|
||||
parentCommand:(IJSVGCommand*)parentCommand;
|
||||
|
||||
+ (NSArray<IJSVGCommand*>*)commandsForDataCharacters:(const char*)buffer;
|
||||
+ (NSArray<IJSVGCommand*>*)commandsForDataCharacters:(const char*)buffer
|
||||
dataStream:(IJSVGPathDataStream*)dataStream;
|
||||
+ (CGMutablePathRef)newPathForCommandsArray:(NSArray<IJSVGCommand*>*)commands;
|
||||
|
||||
+ (NSArray<IJSVGCommand*>*)convertCommands:(NSArray<IJSVGCommand*>*)commands
|
||||
toUnits:(IJSVGUnitType)unitType
|
||||
bounds:(CGRect)bounds;
|
||||
|
||||
- (id)initWithCommandStringBuffer:(const char*)str
|
||||
dataStream:(IJSVGPathDataStream*)dataStream;
|
||||
- (IJSVGCommand*)subcommandWithParameters:(CGFloat*)subParams
|
||||
paramCount:(NSInteger)paramCount
|
||||
previousCommand:(IJSVGCommand*)command;
|
||||
- (void)convertToUnits:(IJSVGUnitType)units
|
||||
boundingBox:(CGRect)boundingBox;
|
||||
- (IJSVGCommand*)commandByConvertingToUnits:(IJSVGUnitType)unitType
|
||||
boundingBox:(CGRect)boundingBox;
|
||||
|
||||
- (CGFloat)readFloat;
|
||||
- (NSPoint)readPoint;
|
||||
- (BOOL)readBOOL;
|
||||
- (void)resetRead;
|
||||
|
||||
@end
|
||||
@@ -1,352 +0,0 @@
|
||||
//
|
||||
// IJSVGCommand.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommand.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
#import "IJSVGCommandClose.h"
|
||||
#import "IJSVGCommandCurve.h"
|
||||
#import "IJSVGCommandEllipticalArc.h"
|
||||
#import "IJSVGCommandHorizontalLine.h"
|
||||
#import "IJSVGCommandLineTo.h"
|
||||
#import "IJSVGCommandMove.h"
|
||||
#import "IJSVGCommandQuadraticCurve.h"
|
||||
#import "IJSVGCommandSmoothCurve.h"
|
||||
#import "IJSVGCommandSmoothQuadraticCurve.h"
|
||||
#import "IJSVGCommandVerticalLine.h"
|
||||
|
||||
@implementation IJSVGCommand
|
||||
|
||||
+ (BOOL)requiresCustomParameterParsing
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ (IJSVGPathDataSequence*)pathDataSequence
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)parseParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)paramCount
|
||||
intoArray:(NSMutableArray<IJSVGCommand*>*)commands
|
||||
parentCommand:(IJSVGCommand*)parentCommand
|
||||
{
|
||||
}
|
||||
|
||||
+ (NSPoint)readCoordinatePair:(CGFloat*)pairs
|
||||
index:(NSInteger)index
|
||||
{
|
||||
return NSMakePoint(pairs[index * 2], pairs[index * 2 + 1]);
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
// register here...
|
||||
}
|
||||
|
||||
+ (Class)commandClassForCommandChar:(char)aChar
|
||||
{
|
||||
aChar = tolower(aChar);
|
||||
switch (aChar) {
|
||||
case 'a':
|
||||
return IJSVGCommandEllipticalArc.class;
|
||||
case 'c':
|
||||
return IJSVGCommandCurve.class;
|
||||
case 'h':
|
||||
return IJSVGCommandHorizontalLine.class;
|
||||
case 'l':
|
||||
return IJSVGCommandLineTo.class;
|
||||
case 'm':
|
||||
return IJSVGCommandMove.class;
|
||||
case 'q':
|
||||
return IJSVGCommandQuadraticCurve.class;
|
||||
case 's':
|
||||
return IJSVGCommandSmoothCurve.class;
|
||||
case 't':
|
||||
return IJSVGCommandSmoothQuadraticCurve.class;
|
||||
case 'v':
|
||||
return IJSVGCommandVerticalLine.class;
|
||||
case 'z':
|
||||
return IJSVGCommandClose.class;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (CGMutablePathRef)newPathForCommandsArray:(NSArray<IJSVGCommand*>*)commands
|
||||
{
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
IJSVGCommand* preCommand = nil;
|
||||
for(IJSVGCommand* command in commands) {
|
||||
for (IJSVGCommand* subCommand in command.subCommands) {
|
||||
[command.class runWithParams:subCommand.parameters
|
||||
paramCount:subCommand.parameterCount
|
||||
command:subCommand
|
||||
previousCommand:preCommand
|
||||
type:subCommand.type
|
||||
path:path];
|
||||
preCommand = subCommand;
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGCommand*>*)commandsForDataCharacters:(const char*)buffer
|
||||
{
|
||||
IJSVGPathDataStream* stream = IJSVGPathDataStreamCreateDefault();
|
||||
NSArray<IJSVGCommand*>* commands = [self commandsForDataCharacters:buffer
|
||||
dataStream:stream];
|
||||
IJSVGPathDataStreamRelease(stream);
|
||||
return commands;
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGCommand*>*)commandsForDataCharacters:(const char*)buffer
|
||||
dataStream:(IJSVGPathDataStream*)dataStream
|
||||
{
|
||||
NSMutableArray<IJSVGCommand*>* commands = [[[NSMutableArray alloc] init] autorelease];
|
||||
NSUInteger len = strlen(buffer);
|
||||
NSUInteger lastIndex = len - 1;
|
||||
|
||||
// make sure we plus 1 for the null byte
|
||||
char* charBuffer = (char*)malloc(sizeof(char)*(len + 1));
|
||||
NSInteger start = 0;
|
||||
for (NSInteger i = 0; i < len; i++) {
|
||||
char nextChar = buffer[i + 1];
|
||||
BOOL atEnd = i == lastIndex;
|
||||
BOOL isStartCommand = IJSVGIsLegalCommandCharacter(nextChar);
|
||||
if (isStartCommand == YES || atEnd == YES) {
|
||||
|
||||
// copy memory from current buffer
|
||||
NSInteger index = ((i + 1) - start);
|
||||
memcpy(&charBuffer[0], &buffer[start], sizeof(char)*index);
|
||||
charBuffer[index] = '\0';
|
||||
|
||||
// create the command from the substring
|
||||
unsigned long length = index + 1;
|
||||
size_t mlength = sizeof(char)*length;
|
||||
char* commandString = (char*)malloc(mlength);
|
||||
memcpy(commandString, &charBuffer[0], mlength);
|
||||
|
||||
// reset start position
|
||||
start = (i + 1);
|
||||
|
||||
// previous command is actual subcommand
|
||||
Class commandClass = [IJSVGCommand commandClassForCommandChar:commandString[0]];
|
||||
IJSVGCommand* command = nil;
|
||||
command = (IJSVGCommand*)[[[commandClass alloc] initWithCommandStringBuffer:commandString
|
||||
dataStream:dataStream] autorelease];
|
||||
|
||||
[commands addObject:command];
|
||||
|
||||
// free the memory as at this point, we are done with it
|
||||
(void)free(commandString), commandString = NULL;
|
||||
}
|
||||
}
|
||||
(void)free(charBuffer), charBuffer = NULL;
|
||||
return commands;
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGCommand*>*)convertCommands:(NSArray<IJSVGCommand*>*)commands
|
||||
toUnits:(IJSVGUnitType)unitType
|
||||
bounds:(CGRect)bounds
|
||||
{
|
||||
NSMutableArray<IJSVGCommand*>* newCommands = nil;
|
||||
newCommands = [[[NSMutableArray alloc] initWithCapacity:commands.count] autorelease];
|
||||
for(IJSVGCommand* command in commands) {
|
||||
IJSVGCommand* nCommand = [command commandByConvertingToUnits:unitType
|
||||
boundingBox:bounds];
|
||||
[newCommands addObject:nCommand];
|
||||
}
|
||||
return newCommands;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_subCommands release]), _subCommands = nil;
|
||||
if (_parameters) {
|
||||
(void)(free(_parameters)), _parameters = nil;
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)initWithCommandStringBuffer:(const char*)str
|
||||
dataStream:(IJSVGPathDataStream*)dataStream
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
// work out the basics
|
||||
_currentIndex = 0;
|
||||
_command = str[0];
|
||||
_type = [IJSVGUtils typeForCommandChar:_command];
|
||||
NSInteger sets = 0;
|
||||
NSInteger paramCount = [self.class requiredParameterCount];
|
||||
IJSVGPathDataSequence* sequence = [self.class pathDataSequence];
|
||||
_parameters = IJSVGParsePathDataStreamSequence(str, strlen(str),
|
||||
dataStream, sequence, paramCount, &sets);
|
||||
|
||||
if (sets <= 1) {
|
||||
CGFloat* subParams = [self parametersFromIndexOffset:0];
|
||||
IJSVGCommand* command = [self subcommandWithParameters:subParams
|
||||
paramCount:paramCount
|
||||
previousCommand:nil];
|
||||
_subCommands = @[ command ].retain;
|
||||
} else {
|
||||
NSMutableArray<IJSVGCommand*>* subCommandArray = nil;
|
||||
subCommandArray = [[NSMutableArray alloc] initWithCapacity:sets].autorelease;
|
||||
|
||||
// interate over the sets
|
||||
IJSVGCommand* lastCommand = nil;
|
||||
for (NSInteger i = 0; i < sets; i++) {
|
||||
// memory for this will be handled by the created subcommand
|
||||
CGFloat* subParams = [self parametersFromIndexOffset:i];
|
||||
|
||||
// generate the subcommand
|
||||
IJSVGCommand* command = [self subcommandWithParameters:subParams
|
||||
paramCount:paramCount
|
||||
previousCommand:lastCommand];
|
||||
|
||||
// make sure we assign the last command or hell breaks
|
||||
// lose and the firey demons will run wild, namely, commands will break
|
||||
// if they are multiples of a set
|
||||
lastCommand = command;
|
||||
[subCommandArray addObject:command];
|
||||
}
|
||||
|
||||
// store the retained value
|
||||
_subCommands = subCommandArray.copy;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setSubCommands:(NSArray<IJSVGCommand*>*)subCommands
|
||||
{
|
||||
(void)[_subCommands release], _subCommands = nil;
|
||||
_subCommands = subCommands.retain;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
IJSVGCommand* command = [[self.class alloc] init];
|
||||
command.type = self.type;
|
||||
command.command = self.command;
|
||||
command.isSubCommand = self.isSubCommand;
|
||||
command.parameterCount = self.parameterCount;
|
||||
size_t memsize = sizeof(CGFloat)*self.parameterCount;
|
||||
command.parameters = (CGFloat*)malloc(memsize);
|
||||
memcpy(command.parameters, self.parameters, memsize);
|
||||
|
||||
|
||||
IJSVGCommand* lastCommand = nil;
|
||||
NSMutableArray<IJSVGCommand*>* subcommands = nil;
|
||||
subcommands = [[[NSMutableArray alloc] initWithCapacity:self.subCommands.count] autorelease];
|
||||
for(IJSVGCommand* subcommand in self.subCommands) {
|
||||
IJSVGCommand* subCopy = [[subcommand copy] autorelease];
|
||||
subCopy.previousCommand = lastCommand;
|
||||
subCopy.isSubCommand = lastCommand != nil;
|
||||
[subcommands addObject:subCopy];
|
||||
}
|
||||
command.subCommands = subcommands;
|
||||
return command;
|
||||
}
|
||||
|
||||
- (CGFloat*)parametersFromIndexOffset:(NSInteger)index
|
||||
{
|
||||
CGFloat* subParams = 0;
|
||||
NSInteger req = [self.class requiredParameterCount];
|
||||
if (req != 0) {
|
||||
subParams = (CGFloat*)malloc(req * sizeof(CGFloat));
|
||||
memcpy(subParams, &self.parameters[index * req], sizeof(CGFloat) * req);
|
||||
}
|
||||
return subParams;
|
||||
}
|
||||
|
||||
- (IJSVGCommand*)subcommandWithParameters:(CGFloat*)subParams
|
||||
paramCount:(NSInteger)paramCount
|
||||
previousCommand:(IJSVGCommand*)aPreviousCommand
|
||||
{
|
||||
// create a subcommand per set
|
||||
IJSVGCommand* c = [[[self.class alloc] init] autorelease];
|
||||
c.parameterCount = paramCount;
|
||||
c.parameters = subParams;
|
||||
c.type = self.type;
|
||||
c.command = self.command;
|
||||
c.previousCommand = aPreviousCommand;
|
||||
c.isSubCommand = aPreviousCommand != nil;
|
||||
return c;
|
||||
}
|
||||
|
||||
- (CGFloat)readFloat
|
||||
{
|
||||
CGFloat f = _parameters[_currentIndex];
|
||||
_currentIndex++;
|
||||
return f;
|
||||
}
|
||||
|
||||
- (NSPoint)readPoint
|
||||
{
|
||||
CGFloat x = _parameters[_currentIndex];
|
||||
CGFloat y = _parameters[_currentIndex + 1];
|
||||
_currentIndex += 2;
|
||||
return NSMakePoint(x, y);
|
||||
}
|
||||
|
||||
- (BOOL)readBOOL
|
||||
{
|
||||
return [self readFloat] == 1;
|
||||
}
|
||||
|
||||
- (void)resetRead
|
||||
{
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
- (void)convertToUnits:(IJSVGUnitType)units
|
||||
boundingBox:(CGRect)boundingBox
|
||||
{
|
||||
for(IJSVGCommand* command in _subCommands) {
|
||||
[command convertToUnits:units
|
||||
boundingBox:boundingBox];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
NSMutableString* str = [[[NSMutableString alloc] init] autorelease];
|
||||
[str appendFormat:@"%c ",_command];
|
||||
NSMutableArray* args = [[[NSMutableArray alloc] initWithCapacity:_parameterCount] autorelease];
|
||||
for(int i = 0; i < _parameterCount; i++) {
|
||||
[args addObject:[NSString stringWithFormat:@"%f",_parameters[i]]];
|
||||
}
|
||||
[str appendString:[args componentsJoinedByString:@", "]];
|
||||
return str;
|
||||
}
|
||||
|
||||
- (IJSVGCommand*)commandByConvertingToUnits:(IJSVGUnitType)unitType
|
||||
boundingBox:(CGRect)boundingBox
|
||||
{
|
||||
IJSVGCommand* copy = self.copy;
|
||||
[copy convertToUnits:unitType
|
||||
boundingBox:boundingBox];
|
||||
return [copy autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,38 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandCurve.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandCurve.h"
|
||||
|
||||
@implementation IJSVGCommandCurve
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddCurveToPoint(path, NULL, params[0], params[1],
|
||||
params[2], params[3],
|
||||
params[4], params[5]);
|
||||
return;
|
||||
}
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPathAddCurveToPoint(path, NULL,
|
||||
currentPoint.x + params[0], currentPoint.y + params[1],
|
||||
currentPoint.x + params[2], currentPoint.y + params[3],
|
||||
currentPoint.x + params[4], currentPoint.y + params[5]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,139 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandArc.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 03/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandEllipticalArc.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
@implementation IJSVGCommandEllipticalArc
|
||||
|
||||
static IJSVGPathDataSequence* _sequence;
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
+ (IJSVGPathDataSequence*)pathDataSequence
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
_sequence = (IJSVGPathDataSequence*)malloc(sizeof(IJSVGPathDataSequence) * 7);
|
||||
_sequence[0] = kIJSVGPathDataSequenceTypeFloat;
|
||||
_sequence[1] = kIJSVGPathDataSequenceTypeFloat;
|
||||
_sequence[2] = kIJSVGPathDataSequenceTypeFloat;
|
||||
_sequence[3] = kIJSVGPathDataSequenceTypeFlag;
|
||||
_sequence[4] = kIJSVGPathDataSequenceTypeFlag;
|
||||
_sequence[5] = kIJSVGPathDataSequenceTypeFloat;
|
||||
_sequence[6] = kIJSVGPathDataSequenceTypeFloat;
|
||||
});
|
||||
return _sequence;
|
||||
}
|
||||
|
||||
// modified from https://github.com/SVGKit/SVGKit/blob/880c94a5b77b6f22beb491a7a7e02ace220c32af/Source/Parsers/SVGKPointsAndPathsParser.m
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
CGPoint radii = CGPointZero;
|
||||
CGPoint arcEndPoint = CGPointZero;
|
||||
CGPoint pathCurrentPoint = CGPathGetCurrentPoint(path);
|
||||
CGFloat xAxisRotation = 0.f;
|
||||
BOOL largeArcFlag = NO;
|
||||
BOOL sweepFlag = NO;
|
||||
|
||||
radii = [currentCommand readPoint];
|
||||
xAxisRotation = [currentCommand readFloat];
|
||||
largeArcFlag = [currentCommand readBOOL];
|
||||
sweepFlag = [currentCommand readBOOL];
|
||||
arcEndPoint = [currentCommand readPoint];
|
||||
|
||||
CGFloat rx = fabs(radii.x);
|
||||
CGFloat ry = fabs(radii.y);
|
||||
|
||||
xAxisRotation *= M_PI / 180.f;
|
||||
xAxisRotation = fmod(xAxisRotation, 2.f * M_PI);
|
||||
|
||||
if (type == kIJSVGCommandTypeRelative) {
|
||||
arcEndPoint.x += pathCurrentPoint.x;
|
||||
arcEndPoint.y += pathCurrentPoint.y;
|
||||
}
|
||||
|
||||
CGFloat x1 = pathCurrentPoint.x;
|
||||
CGFloat y1 = pathCurrentPoint.y;
|
||||
|
||||
CGFloat x2 = arcEndPoint.x;
|
||||
CGFloat y2 = arcEndPoint.y;
|
||||
|
||||
if (rx == 0.f || ry == 0.f) {
|
||||
CGPathAddLineToPoint(path, NULL, x2, y2);
|
||||
return;
|
||||
}
|
||||
|
||||
CGFloat cosPhi = cos(xAxisRotation);
|
||||
CGFloat sinPhi = sin(xAxisRotation);
|
||||
|
||||
CGFloat x1p = cosPhi * (x1 - x2) / 2.f + sinPhi * (y1 - y2) / 2.f;
|
||||
CGFloat y1p = -sinPhi * (x1 - x2) / 2.f + cosPhi * (y1 - y2) / 2.f;
|
||||
|
||||
CGFloat rx_2 = rx * rx;
|
||||
CGFloat ry_2 = ry * ry;
|
||||
CGFloat xp_2 = x1p * x1p;
|
||||
CGFloat yp_2 = y1p * y1p;
|
||||
|
||||
CGFloat delta = xp_2 / rx_2 + yp_2 / ry_2;
|
||||
|
||||
if (delta > 1.f) {
|
||||
rx *= sqrt(delta);
|
||||
ry *= sqrt(delta);
|
||||
rx_2 = rx * rx;
|
||||
ry_2 = ry * ry;
|
||||
}
|
||||
|
||||
CGFloat sign = (largeArcFlag == sweepFlag) ? -1.f : 1.f;
|
||||
CGFloat numerator = MAX(0.f, rx_2 * ry_2 - rx_2 * yp_2 - ry_2 * xp_2);
|
||||
CGFloat denom = rx_2 * yp_2 + ry_2 * xp_2;
|
||||
CGFloat lhs = denom == 0.f ? 0.f : sign * sqrt(numerator / denom);
|
||||
|
||||
CGFloat cxp = lhs * (rx * y1p) / ry;
|
||||
CGFloat cyp = lhs * -((ry * x1p) / rx);
|
||||
|
||||
CGFloat cx = cosPhi * cxp + -sinPhi * cyp + (x1 + x2) / 2.f;
|
||||
CGFloat cy = cxp * sinPhi + cyp * cosPhi + (y1 + y2) / 2.f;
|
||||
|
||||
CGAffineTransform transform = CGAffineTransformMakeScale(1.f / rx, 1.f / ry);
|
||||
transform = CGAffineTransformRotate(transform, -xAxisRotation);
|
||||
transform = CGAffineTransformTranslate(transform, -cx, -cy);
|
||||
|
||||
CGPoint arcPt1 = CGPointApplyAffineTransform(CGPointMake(x1, y1), transform);
|
||||
CGPoint arcPt2 = CGPointApplyAffineTransform(CGPointMake(x2, y2), transform);
|
||||
|
||||
CGFloat startAngle = atan2(arcPt1.y, arcPt1.x);
|
||||
CGFloat endAngle = atan2(arcPt2.y, arcPt2.x);
|
||||
|
||||
CGFloat angleDelta = endAngle - startAngle;;
|
||||
|
||||
if (sweepFlag == YES) {
|
||||
if (angleDelta < 0.f) {
|
||||
angleDelta += 2.f * M_PI;
|
||||
}
|
||||
} else if (angleDelta > 0.f) {
|
||||
angleDelta = angleDelta - 2.f * M_PI;
|
||||
}
|
||||
|
||||
transform = CGAffineTransformMakeTranslation(cx, cy);
|
||||
transform = CGAffineTransformRotate(transform, xAxisRotation);
|
||||
transform = CGAffineTransformScale(transform, rx, ry);
|
||||
|
||||
CGPathAddRelativeArc(path, &transform, 0.f, 0.f, 1.f,
|
||||
startAngle, angleDelta);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandHorizontalLine.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandHorizontalLine.h"
|
||||
|
||||
@implementation IJSVGCommandHorizontalLine
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddLineToPoint(path, NULL, params[0], CGPathGetCurrentPoint(path).y);
|
||||
return;
|
||||
}
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPathAddLineToPoint(path, NULL, currentPoint.x + params[0],
|
||||
currentPoint.y);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandLineTo.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandLineTo.h"
|
||||
|
||||
@implementation IJSVGCommandLineTo
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddLineToPoint(path, NULL, params[0], params[1]);
|
||||
return;
|
||||
}
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPathAddLineToPoint(path, NULL, currentPoint.x + params[0],
|
||||
currentPoint.y + params[1]);
|
||||
}
|
||||
|
||||
- (void)convertToUnits:(IJSVGUnitType)units
|
||||
boundingBox:(CGRect)boundingBox
|
||||
{
|
||||
if(units == IJSVGUnitObjectBoundingBox) {
|
||||
self.parameters[0] = [[IJSVGUnitLength unitWithPercentageFloat:self.parameters[0]] computeValue:boundingBox.size.width];
|
||||
self.parameters[1] = [[IJSVGUnitLength unitWithPercentageFloat:self.parameters[1]] computeValue:boundingBox.size.height];
|
||||
}
|
||||
[super convertToUnits:units
|
||||
boundingBox:boundingBox];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,65 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandMove.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandLineTo.h"
|
||||
#import "IJSVGCommandMove.h"
|
||||
|
||||
@implementation IJSVGCommandMove
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
// move to's allow more then one move to, but if there are more then one,
|
||||
// we need to run the line to instead...who knew!
|
||||
if (command.class == self.class && currentCommand.isSubCommand == YES) {
|
||||
[IJSVGCommandLineTo runWithParams:params
|
||||
paramCount:count
|
||||
command:currentCommand
|
||||
previousCommand:command
|
||||
type:type
|
||||
path:path];
|
||||
return;
|
||||
}
|
||||
|
||||
// actual move to command - do a moveToPoint only
|
||||
// if the type is absolute, or its possible the type is
|
||||
// relative but there is no previous command which means
|
||||
// there is no current point. Asking for current point on an empty
|
||||
// path will result in an exception being thrown
|
||||
if (type == kIJSVGCommandTypeAbsolute || command == nil) {
|
||||
CGPathMoveToPoint(path, NULL,
|
||||
params[0], params[1]);
|
||||
return;
|
||||
}
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPathMoveToPoint(path, NULL,
|
||||
currentPoint.x + params[0],
|
||||
currentPoint.y + params[1]);
|
||||
}
|
||||
|
||||
- (void)convertToUnits:(IJSVGUnitType)units
|
||||
boundingBox:(CGRect)boundingBox
|
||||
{
|
||||
if(units == IJSVGUnitObjectBoundingBox) {
|
||||
self.parameters[0] = [[IJSVGUnitLength unitWithPercentageFloat:self.parameters[0]] computeValue:boundingBox.size.width];
|
||||
self.parameters[1] = [[IJSVGUnitLength unitWithPercentageFloat:self.parameters[1]] computeValue:boundingBox.size.height];
|
||||
}
|
||||
[super convertToUnits:units
|
||||
boundingBox:boundingBox];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandQuadraticCurve.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandQuadraticCurve.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
@implementation IJSVGCommandQuadraticCurve
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddQuadCurveToPoint(path, NULL, params[0], params[1],
|
||||
params[2], params[3]);
|
||||
return;
|
||||
}
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPathAddQuadCurveToPoint(path, NULL,
|
||||
currentPoint.x + params[0], currentPoint.y + params[1],
|
||||
currentPoint.x + params[2], currentPoint.y + params[3]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,64 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandSmoothCurve.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandCurve.h"
|
||||
#import "IJSVGCommandSmoothCurve.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
@implementation IJSVGCommandSmoothCurve
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPoint firstControl = CGPointMake(currentPoint.x, currentPoint.y);
|
||||
if (command != nil) {
|
||||
if (command.class == [IJSVGCommandCurve class] || command.class == self.class) {
|
||||
if (command.class == [IJSVGCommandCurve class]) {
|
||||
if (command.type == kIJSVGCommandTypeAbsolute) {
|
||||
firstControl = CGPointMake(-1 * command.parameters[2] + 2 * currentPoint.x,
|
||||
-1 * command.parameters[3] + 2 * currentPoint.y);
|
||||
} else {
|
||||
NSPoint oldPoint = CGPointMake(currentPoint.x - command.parameters[4],
|
||||
currentPoint.y - command.parameters[5]);
|
||||
firstControl = CGPointMake(-1 * (command.parameters[2] + oldPoint.x) + 2 * currentPoint.x,
|
||||
-1 * (command.parameters[3] + oldPoint.y) + 2 * currentPoint.y);
|
||||
}
|
||||
} else {
|
||||
if (command.type == kIJSVGCommandTypeAbsolute) {
|
||||
firstControl = CGPointMake(-1 * command.parameters[0] + 2 * currentPoint.x,
|
||||
-1 * command.parameters[1] + 2 * currentPoint.y);
|
||||
} else {
|
||||
NSPoint oldPoint = CGPointMake(currentPoint.x - command.parameters[2],
|
||||
currentPoint.y - command.parameters[3]);
|
||||
firstControl = CGPointMake(-1 * (command.parameters[0] + oldPoint.x) + 2 * currentPoint.x,
|
||||
-1 * (command.parameters[1] + oldPoint.y) + 2 * currentPoint.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddCurveToPoint(path, NULL, firstControl.x, firstControl.y,
|
||||
params[0], params[1], params[2], params[3]);
|
||||
return;
|
||||
}
|
||||
CGPathAddCurveToPoint(path, NULL, firstControl.x, firstControl.y,
|
||||
currentPoint.x + params[0], currentPoint.y + params[1],
|
||||
currentPoint.x + params[2], currentPoint.y + params[3]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,58 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandCommandQuadraticCurve.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandQuadraticCurve.h"
|
||||
#import "IJSVGCommandSmoothQuadraticCurve.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
@implementation IJSVGCommandSmoothQuadraticCurve
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
CGPoint lastControlPoint = IJSVGPathGetLastQuadraticCommandPoint(path);
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPoint commandPoint = CGPointMake(currentPoint.x, currentPoint.y);
|
||||
if (command != nil) {
|
||||
if (command.class == IJSVGCommandQuadraticCurve.class) {
|
||||
// quadratic curve
|
||||
if (command.type == kIJSVGCommandTypeAbsolute) {
|
||||
commandPoint = NSMakePoint(-1 * command.parameters[0] + 2 * currentPoint.x,
|
||||
-1 * command.parameters[1] + 2 * currentPoint.y);
|
||||
} else {
|
||||
CGPoint oldPoint = CGPointMake(currentPoint.x - command.parameters[2],
|
||||
currentPoint.y - command.parameters[3]);
|
||||
commandPoint = CGPointMake(-1 * (command.parameters[0] + oldPoint.x) + 2 * (currentPoint.x),
|
||||
-1 * (command.parameters[1] + oldPoint.y) + 2 * currentPoint.y);
|
||||
}
|
||||
} else if (command.class == self.class) {
|
||||
// smooth quadratic curve
|
||||
commandPoint = CGPointMake(-1 * (lastControlPoint.x) + 2 * (currentPoint.x),
|
||||
-1 * (lastControlPoint.y) + 2 * currentPoint.y);
|
||||
}
|
||||
}
|
||||
// path.lastControlPoint = commandPoint;
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddQuadCurveToPoint(path, NULL, commandPoint.x, commandPoint.y,
|
||||
params[0], params[1]);
|
||||
return;
|
||||
}
|
||||
CGPathAddQuadCurveToPoint(path, NULL, commandPoint.x, commandPoint.y,
|
||||
currentPoint.x + params[0], currentPoint.y + params[1]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandVerticalLine.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandVerticalLine.h"
|
||||
|
||||
@implementation IJSVGCommandVerticalLine
|
||||
|
||||
+ (NSInteger)requiredParameterCount
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ (void)runWithParams:(CGFloat*)params
|
||||
paramCount:(NSInteger)count
|
||||
command:(IJSVGCommand*)currentCommand
|
||||
previousCommand:(IJSVGCommand*)command
|
||||
type:(IJSVGCommandType)type
|
||||
path:(CGMutablePathRef)path
|
||||
{
|
||||
if (type == kIJSVGCommandTypeAbsolute) {
|
||||
CGPathAddLineToPoint(path, NULL, CGPathGetCurrentPoint(path).x, params[0]);
|
||||
return;
|
||||
}
|
||||
CGPoint currentPoint = CGPathGetCurrentPoint(path);
|
||||
CGPathAddLineToPoint(path, NULL, currentPoint.x, currentPoint.y + params[0]);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,170 +0,0 @@
|
||||
//
|
||||
// IJSVGImage.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGColorList.h>
|
||||
#import <IJSVG/IJSVGRootNode.h>
|
||||
#import <IJSVG/IJSVGExporter.h>
|
||||
#import <IJSVG/IJSVGGradientLayer.h>
|
||||
#import <IJSVG/IJSVGGroupLayer.h>
|
||||
#import <IJSVG/IJSVGRootLayer.h>
|
||||
#import <IJSVG/IJSVGImageLayer.h>
|
||||
#import <IJSVG/IJSVGLayerTree.h>
|
||||
#import <IJSVG/IJSVGParser.h>
|
||||
#import <IJSVG/IJSVGRendering.h>
|
||||
#import <IJSVG/IJSVGRenderingStyle.h>
|
||||
#import <IJSVG/IJSVGTransaction.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class IJSVG;
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, IJSVGMatchPropertiesMask) {
|
||||
IJSVGMatchPropertyNone = 0,
|
||||
IJSVGMatchPropertyContainsMaskedElement = 1 << 0,
|
||||
IJSVGMatchPropertyContainsStrokedElement = 1 << 1
|
||||
};
|
||||
|
||||
@protocol IJSVGDelegate <NSObject, IJSVGParserDelegate>
|
||||
|
||||
@optional
|
||||
- (void)svg:(IJSVG*)svg
|
||||
foundSubSVG:(IJSVG*)subSVG
|
||||
withSVGString:(NSString*)subSVGString;
|
||||
|
||||
@end
|
||||
|
||||
@interface IJSVG : NSObject <NSPasteboardWriting, IJSVGParserDelegate> {
|
||||
|
||||
@private
|
||||
IJSVGRootNode* _rootNode;
|
||||
CGFloat _scale;
|
||||
CGFloat _clipScale;
|
||||
id<IJSVGDelegate> _delegate;
|
||||
IJSVGLayerTree* _layerTree;
|
||||
CGRect _viewBox;
|
||||
CGFloat _backingScale;
|
||||
NSMutableDictionary* _replacementColors;
|
||||
|
||||
struct {
|
||||
unsigned int shouldHandleSubSVG : 1;
|
||||
} _respondsTo;
|
||||
}
|
||||
|
||||
// set this to be called when the layer is about to draw, it will call this
|
||||
// and ask for the scale of the backing store where its going to be drawn
|
||||
// and apply the scale to each layer that has custom drawing against it, mainly
|
||||
// pattern and gradient layers
|
||||
@property (nonatomic, copy) IJSVGRenderingBackingScaleFactorHelper renderingBackingScaleHelper;
|
||||
|
||||
// global overwriting rules for when rendering an SVG, this will overide any
|
||||
// fillColor, strokeColor, pattern and gradient fill
|
||||
@property (nonatomic, assign) IJSVGRenderQuality renderQuality;
|
||||
@property (nonatomic, assign) BOOL clipToViewport;
|
||||
@property (nonatomic, retain) IJSVGRenderingStyle* renderingStyle;
|
||||
@property (nonatomic, readonly) IJSVGUnitSize * intrinsicSize;
|
||||
@property (nonatomic, copy) NSString* title;
|
||||
@property (nonatomic, copy) NSString* desc;
|
||||
@property (nonatomic, retain) IJSVGLayerTree* layerTree;
|
||||
@property (nonatomic, retain) IJSVGRootLayer* rootLayer;
|
||||
|
||||
- (void)prepForDrawingInView:(NSView*)view;
|
||||
- (BOOL)isFont;
|
||||
- (IJSVGGroup*)rootNode;
|
||||
- (NSRect)viewBox;
|
||||
- (NSArray<IJSVGPath*>*)glyphs;
|
||||
- (NSString*)identifier;
|
||||
- (NSArray<IJSVG*>*)subSVGs:(BOOL)recursive;
|
||||
- (NSString*)SVGStringWithOptions:(IJSVGExporterOptions)options;
|
||||
- (NSString*)SVGStringWithOptions:(IJSVGExporterOptions)options
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
|
||||
+ (id)svgNamed:(NSString*)string;
|
||||
+ (id)svgNamed:(NSString*)string
|
||||
delegate:(id<IJSVGDelegate>)delegate;
|
||||
|
||||
- (id)initWithImage:(NSImage*)image;
|
||||
|
||||
- (id)initWithSVGLayer:(IJSVGGroupLayer*)group
|
||||
viewBox:(NSRect)viewBox;
|
||||
|
||||
- (id)initWithSVGString:(NSString*)string
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate;
|
||||
|
||||
- (id)initWithSVGString:(NSString*)string;
|
||||
- (id)initWithSVGString:(NSString*)string
|
||||
error:(NSError**)error;
|
||||
|
||||
- (id)initWithSVGData:(NSData*)data;
|
||||
- (id)initWithSVGData:(NSData*)data
|
||||
error:(NSError**)error;
|
||||
|
||||
- (id)initWithFile:(NSString*)file;
|
||||
- (id)initWithFile:(NSString*)file
|
||||
error:(NSError**)error;
|
||||
- (id)initWithFile:(NSString*)file
|
||||
delegate:(id<IJSVGDelegate>)delegate;
|
||||
- (id)initWithFile:(NSString*)file
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate;
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL;
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
error:(NSError**)error;
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
delegate:(id<IJSVGDelegate>)delegate;
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate;
|
||||
|
||||
- (id)initWithDataAssetNamed:(NSDataAssetName)name
|
||||
error:(NSError**)error;
|
||||
- (id)initWithDataAssetNamed:(NSDataAssetName)name
|
||||
bundle:(NSBundle*)bundle
|
||||
error:(NSError**)error;
|
||||
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize;
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
error:(NSError**)error;
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
flipped:(BOOL)flipped;
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
flipped:(BOOL)flipped
|
||||
error:(NSError**)error;
|
||||
- (NSImage*)imageByMaintainingAspectRatioWithSize:(NSSize)aSize
|
||||
flipped:(BOOL)flipped
|
||||
error:(NSError**)error;
|
||||
- (CGImageRef)newCGImageRefWithSize:(CGSize)size
|
||||
flipped:(BOOL)flipped
|
||||
error:(NSError**)error;
|
||||
|
||||
- (BOOL)drawAtPoint:(NSPoint)point
|
||||
size:(NSSize)size;
|
||||
- (BOOL)drawAtPoint:(NSPoint)point
|
||||
size:(NSSize)aSize
|
||||
error:(NSError**)error;
|
||||
- (BOOL)drawInRect:(NSRect)rect;
|
||||
- (BOOL)drawInRect:(NSRect)rect
|
||||
error:(NSError**)error;
|
||||
- (void)drawInRect:(NSRect)rect
|
||||
context:(CGContextRef)context;
|
||||
|
||||
- (NSData*)PDFData;
|
||||
- (NSData*)PDFData:(NSError**)error;
|
||||
- (NSData*)PDFDataWithRect:(NSRect)rect;
|
||||
- (NSData*)PDFDataWithRect:(NSRect)rect
|
||||
error:(NSError**)error;
|
||||
|
||||
- (NSRect)computeOriginalDrawingFrameWithSize:(NSSize)aSize;
|
||||
- (void)setNeedsDisplay;
|
||||
|
||||
// colors
|
||||
- (IJSVGColorList*)colorList;
|
||||
- (void)performBlock:(dispatch_block_t)block;
|
||||
|
||||
// matching
|
||||
- (BOOL)matchesPropertiesWithMask:(IJSVGMatchPropertiesMask)mask;
|
||||
@end
|
||||
@@ -1,970 +0,0 @@
|
||||
//
|
||||
// IJSVGImage.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVG.h"
|
||||
#import "IJSVGExporter.h"
|
||||
#import "IJSVGTransaction.h"
|
||||
|
||||
@implementation IJSVG
|
||||
|
||||
// these are explicitly implemented
|
||||
@synthesize title = _title;
|
||||
@synthesize desc = _desc;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
// this can all be called on the background thread to be released
|
||||
BOOL hasTransaction = IJSVGBeginTransaction();
|
||||
(void)([_renderingBackingScaleHelper release]), _renderingBackingScaleHelper = nil;
|
||||
(void)([_replacementColors release]), _replacementColors = nil;
|
||||
(void)([_renderingStyle release]), _renderingStyle = nil;
|
||||
(void)([_rootNode release]), _rootNode = nil;
|
||||
(void)([_intrinsicSize release]), _intrinsicSize = nil;
|
||||
(void)([_title release]), _title = nil;
|
||||
(void)([_desc release]), _desc = nil;
|
||||
(void)([_rootLayer release]), _rootLayer = nil;
|
||||
|
||||
// kill any memory that has been around
|
||||
(void)([_layerTree release]), _layerTree = nil;
|
||||
[super dealloc];
|
||||
if (hasTransaction == YES) {
|
||||
IJSVGEndTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
+ (id)svgNamed:(NSString*)string
|
||||
error:(NSError**)error
|
||||
{
|
||||
return [self.class svgNamed:string
|
||||
error:error
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
+ (id)svgNamed:(NSString*)string
|
||||
{
|
||||
return [self.class svgNamed:string
|
||||
error:nil];
|
||||
}
|
||||
|
||||
+ (id)svgNamed:(NSString*)string
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
return [self.class svgNamed:string
|
||||
error:nil
|
||||
delegate:delegate];
|
||||
}
|
||||
|
||||
+ (id)svgNamed:(NSString*)string
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
NSBundle* bundle = NSBundle.mainBundle;
|
||||
NSString* str = nil;
|
||||
NSString* ext = [string pathExtension];
|
||||
if (ext == nil || ext.length == 0) {
|
||||
ext = @"svg";
|
||||
}
|
||||
if ((str = [bundle pathForResource:[string stringByDeletingPathExtension]
|
||||
ofType:ext]) != nil) {
|
||||
return [[[self alloc] initWithFile:str
|
||||
error:error
|
||||
delegate:delegate] autorelease];
|
||||
}
|
||||
|
||||
// check the asset catalogues
|
||||
return [[[self alloc] initWithDataAssetNamed:string
|
||||
error:error] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithDataAssetNamed:(NSDataAssetName)name
|
||||
error:(NSError**)error
|
||||
{
|
||||
return [self initWithDataAssetNamed:name
|
||||
bundle:NSBundle.mainBundle
|
||||
error:error];
|
||||
}
|
||||
|
||||
- (id)initWithDataAssetNamed:(NSDataAssetName)name
|
||||
bundle:(NSBundle*)bundle
|
||||
error:(NSError**)error
|
||||
{
|
||||
NSDataAsset* dataAsset = [[[NSDataAsset alloc] initWithName:name
|
||||
bundle:bundle] autorelease];
|
||||
if(dataAsset != nil) {
|
||||
return [[self initWithSVGData:dataAsset.data
|
||||
error:error] autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)initWithImage:(NSImage*)image
|
||||
{
|
||||
__block IJSVGGroupLayer* layer = nil;
|
||||
__block IJSVGImageLayer* imageLayer = nil;
|
||||
|
||||
// create the layers we require
|
||||
IJSVGImage* imageNode = [[[IJSVGImage alloc] init] autorelease];
|
||||
imageNode.image = image;
|
||||
|
||||
BOOL hasTransaction = IJSVGBeginTransaction();
|
||||
layer = [[[IJSVGGroupLayer alloc] init] autorelease];
|
||||
imageLayer =
|
||||
[[[IJSVGImageLayer alloc] initWithImage:imageNode] autorelease];
|
||||
[layer addSublayer:imageLayer];
|
||||
if (hasTransaction == YES) {
|
||||
IJSVGEndTransaction();
|
||||
}
|
||||
|
||||
// return the initialized SVG
|
||||
return [self initWithSVGLayer:layer
|
||||
viewBox:imageLayer.frame];
|
||||
}
|
||||
|
||||
- (id)initWithSVGLayer:(IJSVGGroupLayer*)group
|
||||
viewBox:(NSRect)viewBox
|
||||
{
|
||||
// this completely bypasses passing of files
|
||||
if ((self = [super init]) != nil) {
|
||||
// keep the layer tree
|
||||
_viewBox = viewBox;
|
||||
|
||||
// any setups
|
||||
[self _setupBasicsFromAnyInitializer];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithFile:(NSString*)file
|
||||
{
|
||||
return [self initWithFile:file
|
||||
error:nil
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
- (id)initWithFile:(NSString*)file
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
return [self initWithFilePathURL:[NSURL fileURLWithPath:file isDirectory:NO]
|
||||
error:error
|
||||
delegate:delegate];
|
||||
}
|
||||
|
||||
- (id)initWithFile:(NSString*)file
|
||||
error:(NSError**)error
|
||||
{
|
||||
return [self initWithFile:file
|
||||
error:error
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
- (id)initWithFile:(NSString*)file
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
return [self initWithFile:file
|
||||
error:nil
|
||||
delegate:delegate];
|
||||
}
|
||||
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
{
|
||||
return [self initWithFilePathURL:aURL
|
||||
error:nil
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
error:(NSError**)error
|
||||
{
|
||||
return [self initWithFilePathURL:aURL
|
||||
error:error
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
return [self initWithFilePathURL:aURL
|
||||
error:nil
|
||||
delegate:delegate];
|
||||
}
|
||||
|
||||
- (id)initWithFilePathURL:(NSURL*)aURL
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
// create the object
|
||||
if ((self = [super init]) != nil) {
|
||||
NSError* anError = nil;
|
||||
_delegate = delegate;
|
||||
|
||||
// this is a really quick check against the delegate
|
||||
// for methods that exist
|
||||
[self _checkDelegate];
|
||||
|
||||
// create the group
|
||||
IJSVGParser* parser = [IJSVGParser groupForFileURL:aURL
|
||||
error:&anError
|
||||
delegate:self];
|
||||
_rootNode = parser.rootNode.retain;
|
||||
[self _setupBasicInfoFromGroup];
|
||||
[self _setupBasicsFromAnyInitializer];
|
||||
|
||||
// something went wrong...
|
||||
if (_rootNode == nil) {
|
||||
if (error != NULL) {
|
||||
*error = anError;
|
||||
}
|
||||
(void)([self release]), self = nil;
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithSVGData:(NSData*)data
|
||||
{
|
||||
return [self initWithSVGData:data
|
||||
error:nil];
|
||||
}
|
||||
|
||||
- (id)initWithSVGData:(NSData*)data
|
||||
error:(NSError**)error
|
||||
{
|
||||
NSString* svgString = [[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding];
|
||||
return [self initWithSVGString:svgString.autorelease
|
||||
error:error];
|
||||
}
|
||||
|
||||
- (id)initWithSVGString:(NSString*)string
|
||||
{
|
||||
return [self initWithSVGString:string
|
||||
error:nil
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
- (id)initWithSVGString:(NSString*)string
|
||||
error:(NSError**)error
|
||||
{
|
||||
return [self initWithSVGString:string
|
||||
error:error
|
||||
delegate:nil];
|
||||
}
|
||||
|
||||
- (id)initWithSVGString:(NSString*)string
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGDelegate>)delegate
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
// this is basically the same as init with URL just
|
||||
// bypasses the loading of a file
|
||||
NSError* anError = nil;
|
||||
_delegate = delegate;
|
||||
[self _checkDelegate];
|
||||
|
||||
// setup the parser
|
||||
IJSVGParser* parser = [[[IJSVGParser alloc] initWithSVGString:string
|
||||
error:&anError
|
||||
delegate:self] autorelease];
|
||||
_rootNode = parser.rootNode.retain;
|
||||
|
||||
[self _setupBasicInfoFromGroup];
|
||||
[self _setupBasicsFromAnyInitializer];
|
||||
|
||||
// something went wrong :(
|
||||
if (_rootNode == nil) {
|
||||
if (error != NULL) {
|
||||
*error = anError;
|
||||
}
|
||||
(void)([self release]), self = nil;
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)performBlock:(dispatch_block_t)block
|
||||
{
|
||||
BOOL hasTransaction = IJSVGBeginTransaction();
|
||||
block();
|
||||
if (hasTransaction == YES) {
|
||||
IJSVGEndTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_setupBasicInfoFromGroup
|
||||
{
|
||||
_viewBox = [_rootNode.viewBox computeValue:CGSizeZero];
|
||||
_intrinsicSize = _rootNode.intrinsicSize.retain;
|
||||
}
|
||||
|
||||
- (void)_setupBasicsFromAnyInitializer
|
||||
{
|
||||
self.renderingStyle = [[[IJSVGRenderingStyle alloc] init] autorelease];
|
||||
self.clipToViewport = YES;
|
||||
self.renderQuality = kIJSVGRenderQualityFullResolution;
|
||||
|
||||
// setup low level backing scale
|
||||
self.renderingBackingScaleHelper = ^CGFloat {
|
||||
return NSScreen.mainScreen.backingScaleFactor;
|
||||
};
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString*)title
|
||||
{
|
||||
_rootNode.title = title;
|
||||
}
|
||||
|
||||
- (NSString*)title
|
||||
{
|
||||
return _rootNode.title;
|
||||
}
|
||||
|
||||
- (void)setDesc:(NSString*)description
|
||||
{
|
||||
_rootNode.desc = description;
|
||||
}
|
||||
|
||||
- (NSString*)desc
|
||||
{
|
||||
return _rootNode.desc;
|
||||
}
|
||||
|
||||
- (NSString*)identifier
|
||||
{
|
||||
return _rootNode.identifier;
|
||||
}
|
||||
|
||||
- (void)_checkDelegate
|
||||
{
|
||||
_respondsTo.shouldHandleSubSVG = [_delegate respondsToSelector:@selector(svg:foundSubSVG:withSVGString:)];
|
||||
}
|
||||
|
||||
- (NSRect)viewBox
|
||||
{
|
||||
return _viewBox;
|
||||
}
|
||||
|
||||
- (IJSVGGroup*)rootNode
|
||||
{
|
||||
return _rootNode;
|
||||
}
|
||||
|
||||
- (BOOL)isFont
|
||||
{
|
||||
return [_rootNode isFont];
|
||||
}
|
||||
|
||||
- (NSArray<IJSVGPath*>*)glyphs
|
||||
{
|
||||
return [_rootNode glyphs];
|
||||
}
|
||||
|
||||
- (NSArray<IJSVG*>*)subSVGs:(BOOL)recursive
|
||||
{
|
||||
return [_rootNode subSVGs:recursive];
|
||||
}
|
||||
|
||||
- (NSString*)SVGStringWithOptions:(IJSVGExporterOptions)options
|
||||
{
|
||||
IJSVGExporter* exporter = [[[IJSVGExporter alloc] initWithSVG:self
|
||||
size:self.viewBox.size
|
||||
options:options] autorelease];
|
||||
return [exporter SVGString];
|
||||
}
|
||||
|
||||
- (NSString*)SVGStringWithOptions:(IJSVGExporterOptions)options
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
IJSVGExporter* exporter = [[[IJSVGExporter alloc] initWithSVG:self
|
||||
size:self.viewBox.size
|
||||
options:options
|
||||
floatingPointOptions:floatingPointOptions] autorelease];
|
||||
return [exporter SVGString];
|
||||
}
|
||||
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
{
|
||||
return [self imageWithSize:aSize
|
||||
flipped:NO
|
||||
error:nil];
|
||||
}
|
||||
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
error:(NSError**)error;
|
||||
{
|
||||
return [self imageWithSize:aSize
|
||||
flipped:NO
|
||||
error:error];
|
||||
}
|
||||
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
flipped:(BOOL)flipped
|
||||
{
|
||||
return [self imageWithSize:aSize
|
||||
flipped:flipped
|
||||
error:nil];
|
||||
}
|
||||
|
||||
- (NSSize)computeSVGSizeWithRenderSize:(NSSize)size
|
||||
{
|
||||
IJSVGUnitSize* svgSize = _intrinsicSize;
|
||||
return NSMakeSize([svgSize.width computeValue:size.width],
|
||||
[svgSize.height computeValue:size.height]);
|
||||
}
|
||||
|
||||
- (NSRect)computeOriginalDrawingFrameWithSize:(NSSize)aSize
|
||||
{
|
||||
NSSize propSize = [self computeSVGSizeWithRenderSize:aSize];
|
||||
[self _beginDraw:(NSRect) { .origin = CGPointZero, .size = aSize }];
|
||||
return NSMakeRect(0.f, 0.f, propSize.width * _clipScale,
|
||||
propSize.height * _clipScale);
|
||||
}
|
||||
|
||||
- (CGImageRef)newCGImageRefWithSize:(CGSize)size
|
||||
flipped:(BOOL)flipped
|
||||
error:(NSError**)error
|
||||
{
|
||||
// setup the drawing rect, this is used for both the intial drawing
|
||||
// and the backing scale helper block
|
||||
NSRect rect = (CGRect) {
|
||||
.origin = CGPointZero,
|
||||
.size = (CGSize)size
|
||||
};
|
||||
|
||||
// this is highly important this is setup
|
||||
[self _beginDraw:rect];
|
||||
|
||||
// make sure we setup the scale based on the backing scale factor
|
||||
CGFloat scale = [self backingScaleFactor];
|
||||
|
||||
// create the context and colorspace
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGContextRef ref = CGBitmapContextCreate(NULL, (int)size.width * scale,
|
||||
(int)size.height * scale, 8, 0, colorSpace,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little);
|
||||
|
||||
// scale the context
|
||||
CGContextScaleCTM(ref, scale, scale);
|
||||
|
||||
if (flipped == YES) {
|
||||
CGContextTranslateCTM(ref, 0.f, size.height);
|
||||
CGContextScaleCTM(ref, 1.f, -1.f);
|
||||
}
|
||||
|
||||
// draw the SVG into the context
|
||||
[self _drawInRect:rect
|
||||
context:ref
|
||||
error:error];
|
||||
|
||||
// create the image from the context
|
||||
CGImageRef imageRef = CGBitmapContextCreateImage(ref);
|
||||
|
||||
// release all things!
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
CGContextRelease(ref);
|
||||
return imageRef;
|
||||
}
|
||||
|
||||
- (NSImage*)imageWithSize:(NSSize)aSize
|
||||
flipped:(BOOL)flipped
|
||||
error:(NSError**)error
|
||||
{
|
||||
CGImageRef ref = [self newCGImageRefWithSize:aSize
|
||||
flipped:flipped
|
||||
error:error];
|
||||
|
||||
NSImage* image = [[NSImage alloc] initWithCGImage:ref
|
||||
size:aSize];
|
||||
CGImageRelease(ref);
|
||||
return image.autorelease;
|
||||
}
|
||||
|
||||
- (NSImage*)imageByMaintainingAspectRatioWithSize:(NSSize)aSize
|
||||
flipped:(BOOL)flipped
|
||||
error:(NSError**)error
|
||||
{
|
||||
NSRect rect = [self computeOriginalDrawingFrameWithSize:aSize];
|
||||
return [self imageWithSize:rect.size flipped:flipped error:error];
|
||||
}
|
||||
|
||||
- (NSData*)PDFData
|
||||
{
|
||||
return [self PDFData:nil];
|
||||
}
|
||||
|
||||
- (NSData*)PDFData:(NSError**)error
|
||||
{
|
||||
return [self
|
||||
PDFDataWithRect:(NSRect) { .origin = NSZeroPoint, .size = _viewBox.size }
|
||||
error:error];
|
||||
}
|
||||
|
||||
- (NSData*)PDFDataWithRect:(NSRect)rect
|
||||
{
|
||||
return [self PDFDataWithRect:rect error:nil];
|
||||
}
|
||||
|
||||
- (NSData*)PDFDataWithRect:(NSRect)rect
|
||||
error:(NSError**)error
|
||||
{
|
||||
// create the data for the PDF
|
||||
NSMutableData* data = [[[NSMutableData alloc] init] autorelease];
|
||||
|
||||
// assign the data to the consumer
|
||||
CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData((CFMutableDataRef)data);
|
||||
const CGRect box = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width,
|
||||
rect.size.height);
|
||||
|
||||
// create the context
|
||||
CGContextRef context = CGPDFContextCreate(dataConsumer, &box, NULL);
|
||||
|
||||
CGContextBeginPage(context, &box);
|
||||
|
||||
// the context is currently upside down, doh! flip it...
|
||||
CGContextScaleCTM(context, 1, -1);
|
||||
CGContextTranslateCTM(context, 0, -box.size.height);
|
||||
|
||||
// make sure we set the masks to path bits n bobs
|
||||
// [self _beginVectorDraw];
|
||||
// draw the icon
|
||||
[self _drawInRect:(NSRect)box context:context error:error];
|
||||
// [self _endVectorDraw];
|
||||
|
||||
CGContextEndPage(context);
|
||||
|
||||
// clean up
|
||||
CGPDFContextClose(context);
|
||||
CGContextRelease(context);
|
||||
CGDataConsumerRelease(dataConsumer);
|
||||
return data;
|
||||
}
|
||||
|
||||
//- (void)endVectorDraw
|
||||
//{
|
||||
// [self _endVectorDraw];
|
||||
//}
|
||||
//
|
||||
//- (void)beginVectorDraw
|
||||
//{
|
||||
// [self _beginVectorDraw];
|
||||
//}
|
||||
|
||||
//- (void)_beginVectorDraw
|
||||
//{
|
||||
// // turn on converts masks to PDF's
|
||||
// // as PDF context and layer masks dont work
|
||||
// void (^block)(CALayer* layer, BOOL isMask, BOOL* stop) =
|
||||
// ^void(CALayer* layer, BOOL isMask, BOOL* stop) {
|
||||
// ((IJSVGLayer*)layer).convertMasksToPaths = YES;
|
||||
// };
|
||||
// [IJSVGLayer recursivelyWalkLayer:self.layer
|
||||
// withBlock:block];
|
||||
//}
|
||||
//
|
||||
//- (void)_endVectorDraw
|
||||
//{
|
||||
// // turn of convert masks to paths as not
|
||||
// // needed for generic rendering
|
||||
// void (^block)(CALayer* layer, BOOL isMask, BOOL* stop) =
|
||||
// ^void(CALayer* layer, BOOL isMask, BOOL* stop) {
|
||||
// ((IJSVGLayer*)layer).convertMasksToPaths = NO;
|
||||
// };
|
||||
// [IJSVGLayer recursivelyWalkLayer:self.layer
|
||||
// withBlock:block];
|
||||
//}
|
||||
|
||||
- (void)prepForDrawingInView:(NSView*)view
|
||||
{
|
||||
// kill the render
|
||||
if (view == nil) {
|
||||
self.renderingBackingScaleHelper = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
// construct the layer before drawing
|
||||
[self rootLayer];
|
||||
|
||||
// set the scale
|
||||
__block NSView* weakView = view;
|
||||
self.renderingBackingScaleHelper = ^CGFloat {
|
||||
return weakView.window.screen.backingScaleFactor;
|
||||
};
|
||||
}
|
||||
|
||||
- (BOOL)drawAtPoint:(NSPoint)point
|
||||
size:(NSSize)aSize
|
||||
{
|
||||
return [self drawAtPoint:point
|
||||
size:aSize
|
||||
error:nil];
|
||||
}
|
||||
|
||||
- (BOOL)drawAtPoint:(NSPoint)point
|
||||
size:(NSSize)aSize
|
||||
error:(NSError**)error
|
||||
{
|
||||
return
|
||||
[self drawInRect:NSMakeRect(point.x, point.y,
|
||||
aSize.width, aSize.height)
|
||||
error:error];
|
||||
}
|
||||
|
||||
- (BOOL)drawInRect:(NSRect)rect
|
||||
{
|
||||
return [self drawInRect:rect error:nil];
|
||||
}
|
||||
|
||||
- (BOOL)drawInRect:(NSRect)rect
|
||||
error:(NSError**)error
|
||||
{
|
||||
CGContextRef currentCGContext;
|
||||
if (@available(macOS 10.10, *)) {
|
||||
currentCGContext = NSGraphicsContext.currentContext.CGContext;
|
||||
} else {
|
||||
currentCGContext = NSGraphicsContext.currentContext.graphicsPort;
|
||||
}
|
||||
return [self _drawInRect:rect
|
||||
context:currentCGContext
|
||||
error:error];
|
||||
}
|
||||
|
||||
- (NSRect)computeRectDrawingInRect:(NSRect)rect
|
||||
isValid:(BOOL*)valid
|
||||
{
|
||||
// we also need to calculate the viewport so we can clip
|
||||
// the drawing if needed
|
||||
NSRect viewPort = NSZeroRect;
|
||||
NSSize propSize = [self computeSVGSizeWithRenderSize:rect.size];
|
||||
viewPort.origin.x = round((rect.size.width / 2 - (propSize.width / 2) * _clipScale) + rect.origin.x);
|
||||
viewPort.origin.y = round(
|
||||
(rect.size.height / 2 - (propSize.height / 2) * _clipScale) + rect.origin.y);
|
||||
viewPort.size.width = propSize.width * _clipScale;
|
||||
viewPort.size.height = propSize.height * _clipScale;
|
||||
|
||||
// check the viewport
|
||||
if (NSEqualRects(_viewBox, NSZeroRect) ||
|
||||
_viewBox.size.width <= 0 ||
|
||||
_viewBox.size.height <= 0 ||
|
||||
NSEqualRects(NSZeroRect, viewPort) ||
|
||||
CGRectIsEmpty(viewPort) ||
|
||||
CGRectIsNull(viewPort) ||
|
||||
viewPort.size.width <= 0 ||
|
||||
viewPort.size.height <= 0) {
|
||||
*valid = NO;
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
*valid = YES;
|
||||
return viewPort;
|
||||
}
|
||||
|
||||
- (void)drawInRect:(NSRect)rect
|
||||
context:(CGContextRef)context
|
||||
{
|
||||
[self _drawInRect:rect context:context error:nil];
|
||||
}
|
||||
|
||||
//- (BOOL)_drawInRect:(NSRect)rect
|
||||
// context:(CGContextRef)ref
|
||||
// error:(NSError**)error
|
||||
//{
|
||||
// // prep for draw...
|
||||
// CGContextSaveGState(ref);
|
||||
// @try {
|
||||
// [self _beginDraw:rect];
|
||||
//
|
||||
// // we also need to calculate the viewport so we can clip
|
||||
// // the drawing if needed
|
||||
// BOOL canDraw = NO;
|
||||
// NSRect viewPort = [self computeRectDrawingInRect:rect isValid:&canDraw];
|
||||
// // check the viewport
|
||||
// if (canDraw == NO) {
|
||||
// if (error != NULL) {
|
||||
// *error = [[[NSError alloc] initWithDomain:IJSVGErrorDomain
|
||||
// code:IJSVGErrorDrawing
|
||||
// userInfo:nil] autorelease];
|
||||
// }
|
||||
// } else {
|
||||
// // clip to mask
|
||||
// if (self.clipToViewport == YES) {
|
||||
// CGContextClipToRect(ref, viewPort);
|
||||
// }
|
||||
//
|
||||
// // add the origin back onto the viewport
|
||||
// viewPort.origin.x -= (_viewBox.origin.x) * _scale;
|
||||
// viewPort.origin.y -= (_viewBox.origin.y) * _scale;
|
||||
//
|
||||
// // transforms
|
||||
// CGContextTranslateCTM(ref, viewPort.origin.x, viewPort.origin.y);
|
||||
// CGContextScaleCTM(ref, _scale, _scale);
|
||||
//
|
||||
// // do we need to update the backing scales on the
|
||||
// // layers?
|
||||
// [self backingScaleFactor:nil];
|
||||
//
|
||||
// CGInterpolationQuality quality;
|
||||
// switch (self.renderQuality) {
|
||||
// case kIJSVGRenderQualityLow: {
|
||||
// quality = kCGInterpolationLow;
|
||||
// break;
|
||||
// }
|
||||
// case kIJSVGRenderQualityOptimized: {
|
||||
// quality = kCGInterpolationMedium;
|
||||
// break;
|
||||
// }
|
||||
// default: {
|
||||
// quality = kCGInterpolationHigh;
|
||||
// }
|
||||
// }
|
||||
// CGContextSetInterpolationQuality(ref, quality);
|
||||
// BOOL hasTransaction = IJSVGBeginTransaction();
|
||||
// [self.layer renderInContext:ref];
|
||||
// if (hasTransaction == YES) {
|
||||
// IJSVGEndTransaction();
|
||||
// }
|
||||
// }
|
||||
// } @catch (NSException* exception) {
|
||||
// // just catch and give back a drawing error to the caller
|
||||
// if (error != NULL) {
|
||||
// *error = [[[NSError alloc] initWithDomain:IJSVGErrorDomain
|
||||
// code:IJSVGErrorDrawing
|
||||
// userInfo:nil] autorelease];
|
||||
// }
|
||||
// }
|
||||
// CGContextRestoreGState(ref);
|
||||
// return (error == nil);
|
||||
//}
|
||||
|
||||
- (BOOL)_drawInRect:(NSRect)rect
|
||||
context:(CGContextRef)ref
|
||||
error:(NSError**)error
|
||||
{
|
||||
BOOL transaction = IJSVGBeginTransaction();
|
||||
CGContextSaveGState(ref);
|
||||
// make sure we setup a transaction
|
||||
CGFloat backingScale = [self backingScaleFactor];
|
||||
[self.rootLayer renderInContext:ref
|
||||
viewPort:rect
|
||||
backingScale:backingScale
|
||||
quality:_renderQuality];
|
||||
CGContextRestoreGState(ref);
|
||||
if(transaction) {
|
||||
IJSVGEndTransaction();
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (IJSVGLayerTree*)layerTree
|
||||
{
|
||||
if(_layerTree == nil) {
|
||||
_layerTree = [[IJSVGLayerTree alloc] init];
|
||||
}
|
||||
return _layerTree;
|
||||
}
|
||||
|
||||
- (IJSVGRootLayer*)rootLayer
|
||||
{
|
||||
if(_rootLayer == nil) {
|
||||
_rootLayer = [self.layerTree rootLayerForRootNode:_rootNode].retain;
|
||||
}
|
||||
return _rootLayer;
|
||||
}
|
||||
|
||||
- (CGFloat)backingScaleFactor
|
||||
{
|
||||
__block CGFloat scale = 1.f;
|
||||
scale = (self.renderingBackingScaleHelper)();
|
||||
if (scale < 1.f) {
|
||||
scale = 1.f;
|
||||
}
|
||||
return _backingScale = scale;
|
||||
}
|
||||
|
||||
- (void)setRenderingStyle:(IJSVGRenderingStyle*)style
|
||||
{
|
||||
(void)([_renderingStyle release]), _renderingStyle = nil;
|
||||
_renderingStyle = style.retain;
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString*)keyPath
|
||||
ofObject:(id)object
|
||||
change:(NSDictionary<NSKeyValueChangeKey, id>*)change
|
||||
context:(void*)context
|
||||
{
|
||||
// invalidate the tree if a style is set
|
||||
if (object == _renderingStyle) {
|
||||
[self invalidateLayerTree];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setNeedsDisplay
|
||||
{
|
||||
[self invalidateLayerTree];
|
||||
}
|
||||
|
||||
- (void)invalidateLayerTree
|
||||
{
|
||||
(void)([_layerTree release]), _layerTree = nil;
|
||||
}
|
||||
|
||||
- (IJSVGColorList*)colorList
|
||||
{
|
||||
IJSVGColorList* sheet = [[[IJSVGColorList alloc] init] autorelease];
|
||||
void (^block)(CALayer* layer, BOOL* stop) =
|
||||
^void(CALayer* layer, BOOL* stop) {
|
||||
|
||||
// dont do anything
|
||||
if(([layer isKindOfClass:IJSVGShapeLayer.class] &&
|
||||
layer.isHidden == NO) == NO) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// compute
|
||||
IJSVGShapeLayer* sLayer = (IJSVGShapeLayer*)layer;
|
||||
NSColor* color = nil;
|
||||
|
||||
// fill color
|
||||
if (sLayer.fillColor != nil) {
|
||||
color = [NSColor colorWithCGColor:sLayer.fillColor];
|
||||
color = [IJSVGColor computeColorSpace:color];
|
||||
if (color.alphaComponent != 0.f) {
|
||||
IJSVGColorType* type = nil;
|
||||
type = [IJSVGColorType typeWithColor:color
|
||||
flags:IJSVGColorTypeFlagFill];
|
||||
[sheet addColor:type];
|
||||
}
|
||||
}
|
||||
|
||||
// stroke color
|
||||
if (sLayer.strokeColor != nil) {
|
||||
color = [NSColor colorWithCGColor:sLayer.strokeColor];
|
||||
color = [IJSVGColor computeColorSpace:color];
|
||||
if (color.alphaComponent != 0.f) {
|
||||
IJSVGColorType* type = nil;
|
||||
type = [IJSVGColorType typeWithColor:color
|
||||
flags:IJSVGColorTypeFlagStroke];
|
||||
[sheet addColor:type];
|
||||
}
|
||||
}
|
||||
|
||||
// check for any patterns or strokes
|
||||
if (sLayer.patternFillLayer != nil || sLayer.gradientFillLayer != nil ||
|
||||
sLayer.gradientStrokeLayer != nil || sLayer.patternStrokeLayer != nil) {
|
||||
|
||||
// add any colors from gradients
|
||||
IJSVGGradientLayer* gradLayer = nil;
|
||||
IJSVGGradientLayer* gradStrokeLayer = nil;
|
||||
|
||||
// gradient fill
|
||||
if ((gradLayer = sLayer.gradientFillLayer) != nil) {
|
||||
IJSVGColorList* gradSheet = gradLayer.gradient.colorList;
|
||||
[sheet addColorsFromList:gradSheet];
|
||||
}
|
||||
|
||||
// gradient stroke layers
|
||||
if ((gradStrokeLayer = sLayer.gradientStrokeLayer) != nil) {
|
||||
IJSVGColorList* gradSheet = gradStrokeLayer.gradient.colorList;
|
||||
[sheet addColorsFromList:gradSheet];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// gogogo!
|
||||
[IJSVGLayer recursivelyWalkLayer:self.rootLayer
|
||||
withBlock:block];
|
||||
return sheet;
|
||||
}
|
||||
|
||||
- (void)_beginDraw:(NSRect)rect
|
||||
{
|
||||
// in order to correctly fit the the SVG into the
|
||||
// rect, we need to work out the ratio scale in order
|
||||
// to transform the paths into our viewbox
|
||||
NSSize dest = rect.size;
|
||||
NSSize source = _viewBox.size;
|
||||
NSSize propSize = [self computeSVGSizeWithRenderSize:rect.size];
|
||||
_clipScale = MIN(dest.width / propSize.width,
|
||||
dest.height / propSize.height);
|
||||
|
||||
// work out the actual scale based on the clip scale
|
||||
CGFloat w = propSize.width * _clipScale;
|
||||
CGFloat h = propSize.height * _clipScale;
|
||||
_scale = MIN(w / source.width, h / source.height);
|
||||
}
|
||||
|
||||
#pragma mark NSPasteboard
|
||||
|
||||
- (NSArray*)writableTypesForPasteboard:(NSPasteboard*)pasteboard
|
||||
{
|
||||
return @[ NSPasteboardTypePDF ];
|
||||
}
|
||||
|
||||
- (id)pasteboardPropertyListForType:(NSString*)type
|
||||
{
|
||||
if ([type isEqualToString:NSPasteboardTypePDF]) {
|
||||
return [self PDFData];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark IJSVGParserDelegate
|
||||
|
||||
- (void)svgParser:(IJSVGParser*)svg
|
||||
foundSubSVG:(IJSVG*)subSVG
|
||||
withSVGString:(NSString*)string
|
||||
{
|
||||
if (_delegate != nil && _respondsTo.shouldHandleSubSVG == 1) {
|
||||
[_delegate svg:self
|
||||
foundSubSVG:subSVG
|
||||
withSVGString:string];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark matching
|
||||
|
||||
- (BOOL)matchesPropertiesWithMask:(IJSVGMatchPropertiesMask)mask
|
||||
{
|
||||
__block IJSVGMatchPropertiesMask matchedMask = IJSVGMatchPropertyNone;
|
||||
IJSVGNodeWalkHandler handler = ^(IJSVGNode* node, BOOL* allowChildNodes,
|
||||
BOOL* stop) {
|
||||
// dont compute nodes that are not designed
|
||||
// to be rendered
|
||||
if(node.shouldRender == NO) {
|
||||
*allowChildNodes = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
// check for stroke
|
||||
IJSVGPath* path = (IJSVGPath*)node;
|
||||
if((mask & IJSVGMatchPropertyContainsStrokedElement) != 0 &&
|
||||
[node isKindOfClass:IJSVGPath.class] == YES &&
|
||||
[path matchesTraits:IJSVGNodeTraitStroked] == YES) {
|
||||
matchedMask |= IJSVGMatchPropertyContainsStrokedElement;
|
||||
}
|
||||
|
||||
// check for mask
|
||||
if((mask & IJSVGMatchPropertyContainsMaskedElement) != 0 &&
|
||||
node.mask != nil) {
|
||||
matchedMask |= IJSVGMatchPropertyContainsMaskedElement;
|
||||
}
|
||||
|
||||
// simply check if masks equal, if they are, stop this loop
|
||||
// and return the evaluation
|
||||
if(matchedMask == mask) {
|
||||
*stop = YES;
|
||||
}
|
||||
};
|
||||
[IJSVGNode walkNodeTree:_rootNode
|
||||
handler:handler];
|
||||
return matchedMask == mask;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,29 +0,0 @@
|
||||
//
|
||||
// IJSVGFontConverter.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 21/05/2015.
|
||||
// Copyright (c) 2015 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVG.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef void (^IJSVGFontConverterEnumerateBlock)(NSString* unicode, IJSVG* svg);
|
||||
|
||||
@interface IJSVGFontConverter : NSObject {
|
||||
|
||||
@private
|
||||
NSURL* _url;
|
||||
NSFont* _font;
|
||||
NSMutableDictionary<NSString*, id>* _transformedPaths;
|
||||
}
|
||||
|
||||
- (id)initWithFontAtFileURL:(NSURL*)url;
|
||||
- (NSFont*)font;
|
||||
- (void)enumerateUsingBlock:(IJSVGFontConverterEnumerateBlock)block;
|
||||
|
||||
+ (IJSVG*)convertIJSVGPathToSVG:(IJSVGPath*)path;
|
||||
+ (IJSVG*)convertPathToSVG:(CGPathRef)path;
|
||||
|
||||
@end
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// IJSVGImageRep.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 15/03/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGParser.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class IJSVG;
|
||||
|
||||
@interface IJSVGImageRep : NSImageRep {
|
||||
|
||||
@private
|
||||
IJSVG* _svg;
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(NSData*)data;
|
||||
|
||||
@property (nonatomic, readonly) CGRect viewBox;
|
||||
@property (nonatomic, readonly) IJSVG* SVG;
|
||||
|
||||
@end
|
||||
@@ -1,115 +0,0 @@
|
||||
//
|
||||
// IJSVGImageRep.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 15/03/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVG.h"
|
||||
#import "IJSVGImageRep.h"
|
||||
|
||||
@implementation IJSVGImageRep
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
[NSBitmapImageRep registerImageRepClass:self];
|
||||
}
|
||||
|
||||
+ (BOOL)canInitWithData:(NSData*)data
|
||||
{
|
||||
return [IJSVGParser isDataSVG:data];
|
||||
}
|
||||
|
||||
+ (NSArray<NSString*>*)imageTypes
|
||||
{
|
||||
if (@available(macOS 10.10, *)) {
|
||||
return @[ (NSString*)kUTTypeScalableVectorGraphics, @"svg" ];
|
||||
} else {
|
||||
return @[ @"public.svg-image", @"svg" ];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray<NSString*>*)imageUnfilteredTypes
|
||||
{
|
||||
if (@available(macOS 10.10, *)) {
|
||||
return @[ (NSString*)kUTTypeScalableVectorGraphics, @"svg" ];
|
||||
} else {
|
||||
return @[ @"public.svg-image", @"svg" ];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray<NSImageRep*>*)imageRepsWithData:(NSData*)data
|
||||
{
|
||||
IJSVGImageRep* instance = [self imageRepWithData:data];
|
||||
if (instance == nil) {
|
||||
return @[];
|
||||
}
|
||||
return @[ instance ];
|
||||
}
|
||||
|
||||
+ (instancetype)imageRepWithData:(NSData*)data
|
||||
{
|
||||
return [[[self alloc] initWithData:data] autorelease];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_svg release]), _svg = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(NSData*)data
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
// grab the string from the data
|
||||
// its more then likely UTF-8...
|
||||
NSString* string = [[[NSString alloc] initWithData:data
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
|
||||
_svg = [[IJSVG alloc] initWithSVGString:string];
|
||||
|
||||
// no valid SVG, just return nil;
|
||||
if (_svg == nil) {
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// set default properties
|
||||
self.pixelsWide = _svg.viewBox.size.width;
|
||||
self.pixelsHigh = _svg.viewBox.size.height;
|
||||
self.size = _svg.viewBox.size;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)draw
|
||||
{
|
||||
[_svg drawInRect:self.viewBox];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)drawAtPoint:(NSPoint)point
|
||||
{
|
||||
[_svg drawAtPoint:point
|
||||
size:_svg.viewBox.size];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)drawInRect:(NSRect)rect
|
||||
{
|
||||
[_svg drawInRect:rect];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (CGRect)viewBox
|
||||
{
|
||||
return _svg.viewBox;
|
||||
}
|
||||
|
||||
- (IJSVG*)SVG
|
||||
{
|
||||
return _svg;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// IJSVGView.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 04/04/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVG.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
IB_DESIGNABLE
|
||||
@interface IJSVGView : NSView {
|
||||
IBInspectable NSString* imageName;
|
||||
IBInspectable NSColor* tintColor;
|
||||
|
||||
IJSVG* SVG;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IJSVG* SVG;
|
||||
|
||||
+ (IJSVGView*)viewWithSVGNamed:(NSString*)name;
|
||||
- (id)initWithSVG:(IJSVG*)anSvg;
|
||||
|
||||
@end
|
||||
@@ -1,118 +0,0 @@
|
||||
//
|
||||
// IJSVGExporter.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 06/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <IJSVG/IJSVGUtils.h>
|
||||
#import <IJSVG/IJSVGColorType.h>
|
||||
|
||||
@class IJSVG;
|
||||
@class IJSVGExporter;
|
||||
@class IJSVGLayer;
|
||||
@class IJSVGNode;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef void (^IJSVGCGPathHandler)(const CGPathElement* pathElement);
|
||||
typedef void (^IJSVGPathElementEnumerationBlock)(const CGPathElement* pathElement, CGPoint currentPoint);
|
||||
|
||||
void IJSVGExporterPathCaller(void* info, const CGPathElement* pathElement);
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, IJSVGExporterOptions) {
|
||||
IJSVGExporterOptionNone = 1 << 0,
|
||||
IJSVGExporterOptionRemoveUselessGroups = 1 << 1,
|
||||
IJSVGExporterOptionRemoveUselessDef = 1 << 2,
|
||||
IJSVGExporterOptionMoveAttributesToGroup = 1 << 3,
|
||||
IJSVGExporterOptionCreateUseForPaths = 1 << 4,
|
||||
IJSVGExporterOptionSortAttributes = 1 << 5,
|
||||
IJSVGExporterOptionCollapseGroups = 1 << 6,
|
||||
IJSVGExporterOptionCleanupPaths = 1 << 7,
|
||||
IJSVGExporterOptionRemoveHiddenElements = 1 << 8,
|
||||
IJSVGExporterOptionScaleToSizeIfNecessary = 1 << 9,
|
||||
IJSVGExporterOptionCompressOutput = 1 << 10,
|
||||
IJSVGExporterOptionCollapseGradients = 1 << 11,
|
||||
IJSVGExporterOptionCreateClasses = 1 << 12,
|
||||
IJSVGExporterOptionRemoveWidthHeightAttributes = 1 << 13,
|
||||
IJSVGExporterOptionColorAllowRRGGBBAA = 1 << 14,
|
||||
IJSVGExporterOptionRemoveComments = 1 << 15,
|
||||
IJSVGExporterOptionCenterWithinViewBox = 1 << 16,
|
||||
IJSVGExporterOptionRemoveXMLDeclaration = 1 << 17,
|
||||
IJSVGExporterOptionConvertArcs = 1 << 18,
|
||||
IJSVGExporterOptionConvertShapesToPaths = 1 << 19,
|
||||
IJSVGExporterOptionRoundTransforms = 1 << 20,
|
||||
IJSVGExporterOptionRemoveDefaultValues = 1 << 21,
|
||||
IJSVGExporterOptionAll = IJSVGExporterOptionRemoveUselessDef | IJSVGExporterOptionRemoveUselessGroups |
|
||||
IJSVGExporterOptionCreateUseForPaths | IJSVGExporterOptionMoveAttributesToGroup |
|
||||
IJSVGExporterOptionSortAttributes | IJSVGExporterOptionCollapseGroups |
|
||||
IJSVGExporterOptionCleanupPaths | IJSVGExporterOptionRemoveHiddenElements |
|
||||
IJSVGExporterOptionScaleToSizeIfNecessary | IJSVGExporterOptionCompressOutput |
|
||||
IJSVGExporterOptionCollapseGradients | IJSVGExporterOptionRemoveWidthHeightAttributes |
|
||||
IJSVGExporterOptionColorAllowRRGGBBAA | IJSVGExporterOptionRemoveComments |
|
||||
IJSVGExporterOptionCenterWithinViewBox | IJSVGExporterOptionRemoveXMLDeclaration |
|
||||
IJSVGExporterOptionConvertArcs | IJSVGExporterOptionConvertShapesToPaths |
|
||||
IJSVGExporterOptionRoundTransforms | IJSVGExporterOptionRemoveDefaultValues
|
||||
};
|
||||
|
||||
BOOL IJSVGExporterHasOption(IJSVGExporterOptions options, NSInteger option);
|
||||
void IJSVGEnumerateCGPathElements(CGPathRef path, IJSVGPathElementEnumerationBlock enumBlock);
|
||||
const NSArray<NSString*>* IJSVGShortCharacterArray(void);
|
||||
const NSDictionary<NSString*, NSString*>* IJSVGDefaultAttributes(void);
|
||||
|
||||
|
||||
@protocol IJSVGExporterDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
- (NSString* _Nullable)svgExporter:(IJSVGExporter*)exporter
|
||||
identifierForElement:(NSXMLElement* _Nullable)element
|
||||
type:(IJSVGNodeType)type
|
||||
defaultID:(NSString* (^)(void))defaultID;
|
||||
- (NSString* _Nullable)svgExporter:(IJSVGExporter*)exporter
|
||||
stringForColor:(NSColor*)color
|
||||
flags:(IJSVGColorTypeFlags)flag
|
||||
options:(IJSVGColorStringOptions)options;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@interface IJSVGExporter : NSObject {
|
||||
|
||||
@private
|
||||
IJSVG* _svg;
|
||||
CGSize _size;
|
||||
IJSVGExporterOptions _options;
|
||||
NSXMLDocument* _dom;
|
||||
NSXMLElement* _defElement;
|
||||
NSInteger _idCount;
|
||||
NSInteger _shortIdCount;
|
||||
BOOL _appliedXLink;
|
||||
|
||||
struct {
|
||||
unsigned int identifierForElement: 1;
|
||||
unsigned int stringForColor: 1;
|
||||
} _respondsTo;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) id<IJSVGExporterDelegate> delegate;
|
||||
@property (nonatomic, assign) IJSVGFloatingPointOptions floatingPointOptions;
|
||||
@property (nonatomic, copy, nullable) NSString* title;
|
||||
@property (nonatomic, copy, nullable) NSString* desc;
|
||||
|
||||
- (id)initWithSVG:(IJSVG*)svg
|
||||
size:(CGSize)size
|
||||
options:(IJSVGExporterOptions)options;
|
||||
- (id)initWithSVG:(IJSVG*)svg
|
||||
size:(CGSize)size
|
||||
options:(IJSVGExporterOptions)options
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
|
||||
- (NSString*)SVGString;
|
||||
- (NSData*)SVGData;
|
||||
- (IJSVG*)SVG:(NSError**)error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,67 +0,0 @@
|
||||
//
|
||||
// IJSVGExporterPathInstruction.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 08/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef struct {
|
||||
char instruction;
|
||||
NSArray<NSString*>* params;
|
||||
} IJSVGExporterPathInstructionCommand;
|
||||
|
||||
typedef struct {
|
||||
CGPoint center;
|
||||
CGFloat radius;
|
||||
} IJSVGExporterPathInstructionCircle;
|
||||
|
||||
@interface IJSVGExporterPathInstruction : NSObject {
|
||||
|
||||
@private
|
||||
NSInteger _dataCount;
|
||||
CGFloat* _data;
|
||||
CGFloat* _base;
|
||||
CGFloat* _coords;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) char instruction;
|
||||
|
||||
void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, IJSVGFloatingPointOptions options);
|
||||
CGFloat IJSVGExporterPathFloatToFixed(CGFloat number, int precision);
|
||||
IJSVGExporterPathInstructionCommand* IJSVGExporterPathInstructionCommandCopy(IJSVGExporterPathInstructionCommand command);
|
||||
void IJSVGExporterPathInstructionCommandFree(IJSVGExporterPathInstructionCommand* _Nullable command);
|
||||
|
||||
+ (NSArray<IJSVGExporterPathInstruction*>*)instructionsFromPath:(CGPathRef)path
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
|
||||
- (id)initWithInstruction:(char)instruction
|
||||
dataCount:(NSInteger)floatCount;
|
||||
|
||||
- (CGFloat*)data;
|
||||
- (NSInteger)dataLength;
|
||||
|
||||
+ (NSArray<IJSVGExporterPathInstruction*>*)convertInstructionsCurves:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
+ (void)convertInstructionsToMixedAbsoluteRelative:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
+ (void)convertInstructionsDataToRounded:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
+ (void)convertInstructionsToRelativeCoordinates:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
+ (NSString*)pathStringFromInstructions:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
+ (NSString*)pathStringWithInstructionSet:(NSArray<NSValue*>*)instructionSets
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
static NSInteger const kIJSVGExporterPathInstructionFloatPrecision = 3;
|
||||
static CGFloat const kIJSVGExporterPathInstructionErrorThreshold = 1e-2;
|
||||
|
||||
#define IJ_SVG_EXPORT_ROUND(value) IJSVGExporterPathFloatToFixed(value, kIJSVGExporterPathInstructionFloatPrecision)
|
||||
@@ -1,629 +0,0 @@
|
||||
//
|
||||
// IJSVGExporterPathInstruction.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 08/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGExporter.h"
|
||||
#import "IJSVGExporterPathInstruction.h"
|
||||
#import "IJSVGUtils.h"
|
||||
#import <math.h>
|
||||
|
||||
@implementation IJSVGExporterPathInstruction
|
||||
|
||||
@synthesize instruction = _instruction;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (_data != NULL) {
|
||||
(void)free(_data), _data = NULL;
|
||||
}
|
||||
if (_base != NULL) {
|
||||
(void)free(_base), _base = NULL;
|
||||
}
|
||||
if (_coords != NULL) {
|
||||
(void)free(_coords), _coords = NULL;
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)initWithInstruction:(char)instruction
|
||||
dataCount:(NSInteger)floatCount
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
_instruction = instruction;
|
||||
|
||||
// only allocate if not zero
|
||||
if (floatCount != 0) {
|
||||
_dataCount = floatCount;
|
||||
_data = (CGFloat*)calloc(sizeof(CGFloat), floatCount);
|
||||
}
|
||||
|
||||
// setup base and coords
|
||||
_base = (CGFloat*)malloc(sizeof(CGFloat) * 2);
|
||||
_coords = (CGFloat*)malloc(sizeof(CGFloat) * 2);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInteger)dataLength
|
||||
{
|
||||
return _dataCount;
|
||||
}
|
||||
|
||||
- (CGFloat*)data
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
- (CGFloat*)base
|
||||
{
|
||||
return _base;
|
||||
}
|
||||
|
||||
- (CGFloat*)coords
|
||||
{
|
||||
return _coords;
|
||||
}
|
||||
|
||||
IJSVGExporterPathInstructionCommand* IJSVGExporterPathInstructionCommandCopy(IJSVGExporterPathInstructionCommand command)
|
||||
{
|
||||
IJSVGExporterPathInstructionCommand* copy = NULL;
|
||||
copy = (IJSVGExporterPathInstructionCommand*)malloc(sizeof(IJSVGExporterPathInstructionCommand));
|
||||
copy->instruction = command.instruction;
|
||||
copy->params = command.params;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void IJSVGExporterPathInstructionCommandFree(IJSVGExporterPathInstructionCommand* _Nullable command)
|
||||
{
|
||||
if (command != NULL) {
|
||||
free(command);
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSString*)pathStringWithInstructionSet:(NSArray<NSValue*>*)instructionSets
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
IJSVGExporterPathInstructionCommand* lastCommand = NULL;
|
||||
NSMutableString* string = [[[NSMutableString alloc] init] autorelease];
|
||||
for (NSValue* value in instructionSets) {
|
||||
// read back the bytes
|
||||
IJSVGExporterPathInstructionCommand command;
|
||||
[value getValue:&command];
|
||||
|
||||
// add on the instruction character only if there is no current command
|
||||
// or the last command is not the same as the current command
|
||||
// if they both are the same, we still need to seperate them via a space
|
||||
if (lastCommand == nil || (lastCommand != nil && lastCommand->instruction != command.instruction)) {
|
||||
[string appendFormat:@"%c", command.instruction];
|
||||
} else {
|
||||
[string appendString:@" "];
|
||||
}
|
||||
|
||||
// compresses the floats
|
||||
NSString* compressedFloats = IJSVGCompressFloatParameterArray(command.params);
|
||||
[string appendString:compressedFloats];
|
||||
|
||||
// store last command
|
||||
IJSVGExporterPathInstructionCommandFree(lastCommand);
|
||||
lastCommand = IJSVGExporterPathInstructionCommandCopy(command);
|
||||
}
|
||||
|
||||
IJSVGExporterPathInstructionCommandFree(lastCommand);
|
||||
return string;
|
||||
}
|
||||
|
||||
+ (NSString*)pathStringFromInstructions:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
NSMutableArray* pathInstructions = [[[NSMutableArray alloc] init] autorelease];
|
||||
for (IJSVGExporterPathInstruction* instruction in instructions) {
|
||||
CGFloat* data = instruction.data;
|
||||
const char lowerInstruction = tolower(instruction.instruction);
|
||||
NSArray<NSString*>* set = nil;
|
||||
switch (lowerInstruction) {
|
||||
case 't':
|
||||
case 'm':
|
||||
case 'l': {
|
||||
set = @[
|
||||
IJSVGShortFloatStringWithOptions(data[0], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[1], floatingPointOptions)
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
case 'v':
|
||||
case 'h': {
|
||||
set = @[
|
||||
IJSVGShortFloatStringWithOptions(data[0], floatingPointOptions)
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c': {
|
||||
set = @[
|
||||
IJSVGShortFloatStringWithOptions(data[0], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[1], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[2], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[3], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[4], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[5], floatingPointOptions)
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
case 's':
|
||||
case 'q': {
|
||||
set = @[
|
||||
IJSVGShortFloatStringWithOptions(data[0], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[1], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[2], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[3], floatingPointOptions)
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
case 'a': {
|
||||
set = @[
|
||||
IJSVGShortFloatStringWithOptions(data[0], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[1], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[2], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[3], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[4], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[5], floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(data[6], floatingPointOptions),
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
// close path
|
||||
case 'z': {
|
||||
set = @[];
|
||||
}
|
||||
}
|
||||
|
||||
// wrap into the command and give to the array
|
||||
IJSVGExporterPathInstructionCommand wrapper;
|
||||
wrapper.instruction = instruction.instruction;
|
||||
wrapper.params = set ?: @[];
|
||||
|
||||
// encode and store
|
||||
NSValue* value = [NSValue valueWithBytes:&wrapper
|
||||
objCType:@encode(IJSVGExporterPathInstructionCommand)];
|
||||
[pathInstructions addObject:value];
|
||||
}
|
||||
return [self pathStringWithInstructionSet:pathInstructions
|
||||
floatingPointOptions:floatingPointOptions];
|
||||
}
|
||||
|
||||
CGFloat IJSVGExporterPathFloatToFixed(CGFloat number, int precision)
|
||||
{
|
||||
return floorf(pow(10, precision) * number) / pow(10, precision);
|
||||
}
|
||||
|
||||
void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length,
|
||||
IJSVGFloatingPointOptions options)
|
||||
{
|
||||
for (NSInteger i = length; i-- > 0;) {
|
||||
CGFloat d = data[i];
|
||||
CGFloat proposed = IJSVGExporterPathFloatToFixed(d, options.precision);
|
||||
if (proposed != d) {
|
||||
CGFloat rounded = +IJSVGExporterPathFloatToFixed(d, options.precision - 1);
|
||||
data[i] = IJSVGExporterPathFloatToFixed(+fabs(rounded - d), options.precision + 1)
|
||||
>= kIJSVGExporterPathInstructionErrorThreshold
|
||||
? +IJSVGExporterPathFloatToFixed(d, options.precision)
|
||||
: rounded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)convertInstructionsToRoundRelativeCoordinates:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
CGFloat relSubPoint[2] = { 0.f, 0.f };
|
||||
for (IJSVGExporterPathInstruction* instruction in instructions) {
|
||||
char instructionChar = instruction.instruction;
|
||||
NSInteger length = instruction.dataLength;
|
||||
CGFloat* data = instruction.data;
|
||||
if (strchr("mltqsc", instructionChar) != NULL) {
|
||||
for (NSInteger i = length; i--;) {
|
||||
data[i] += instruction.base[i % 2] - relSubPoint[i % 2];
|
||||
}
|
||||
} else if (instructionChar == 'h') {
|
||||
data[0] += instruction.base[0] - relSubPoint[0];
|
||||
} else if (instructionChar == 'v') {
|
||||
data[0] += instruction.base[1] - relSubPoint[1];
|
||||
} else if (instructionChar == 'a') {
|
||||
data[5] += instruction.base[0] - relSubPoint[0];
|
||||
data[5] += instruction.base[1] - relSubPoint[1];
|
||||
}
|
||||
IJSVGExporterPathInstructionRoundData(data, length, floatingPointOptions);
|
||||
if (instructionChar == 'h') {
|
||||
relSubPoint[0] += data[0];
|
||||
} else if (instructionChar == 'v') {
|
||||
relSubPoint[1] += data[0];
|
||||
} else {
|
||||
relSubPoint[0] += data[length - 2];
|
||||
relSubPoint[1] += data[length - 1];
|
||||
}
|
||||
IJSVGExporterPathInstructionRoundData(relSubPoint, 2, floatingPointOptions);
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)convertInstructionsToMixedAbsoluteRelative:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
IJSVGExporterPathInstruction* prevInstruction = nil;
|
||||
for (IJSVGExporterPathInstruction* instruction in instructions) {
|
||||
if (prevInstruction == nil || instruction.dataLength == 0) {
|
||||
prevInstruction = instruction;
|
||||
continue;
|
||||
}
|
||||
|
||||
char instructionChar = instruction.instruction;
|
||||
CGFloat* data = instruction.data;
|
||||
NSInteger length = instruction.dataLength;
|
||||
CGFloat* adata = (CGFloat*)malloc(sizeof(CGFloat) * length);
|
||||
memcpy(adata, data, sizeof(CGFloat) * length);
|
||||
|
||||
if (strchr("mltqsc", instructionChar) != NULL) {
|
||||
for (NSInteger i = length; i--;) {
|
||||
adata[i] += instruction.base[i % 2];
|
||||
}
|
||||
} else if (instructionChar == 'h') {
|
||||
adata[0] += instruction.base[0];
|
||||
} else if (instructionChar == 'v') {
|
||||
adata[0] += instruction.base[1];
|
||||
} else if (instructionChar == 'a') {
|
||||
adata[5] += instruction.base[0];
|
||||
adata[6] += instruction.base[1];
|
||||
}
|
||||
|
||||
IJSVGExporterPathInstructionRoundData(adata, length, floatingPointOptions);
|
||||
|
||||
IJSVGExporterPathInstruction* ainstruction = nil;
|
||||
ainstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:instructionChar
|
||||
dataCount:length] autorelease];
|
||||
memcpy(ainstruction.data, adata, sizeof(CGFloat) * length);
|
||||
|
||||
// run these through our default string runner
|
||||
// to compare the outputs
|
||||
NSString* orig = [self pathStringFromInstructions:@[ instruction ]
|
||||
floatingPointOptions:floatingPointOptions];
|
||||
NSString* comp = [self pathStringFromInstructions:@[ ainstruction ]
|
||||
floatingPointOptions:floatingPointOptions];
|
||||
|
||||
if (comp.length < orig.length && !(instructionChar == prevInstruction.instruction && prevInstruction.instruction > 96 && comp.length == orig.length - 1 && data[0] < 0.f && fmod(prevInstruction.data[prevInstruction.dataLength - 1], 1) != 0.f)) {
|
||||
instruction.instruction = toupper(instructionChar);
|
||||
memcpy(data, adata, sizeof(CGFloat) * length);
|
||||
}
|
||||
(void)free(adata), adata = NULL;
|
||||
prevInstruction = instruction;
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)convertInstructionsDataToRounded:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
for (IJSVGExporterPathInstruction* instruction in instructions) {
|
||||
CGFloat* data = instruction.data;
|
||||
IJSVGExporterPathInstructionRoundData(data, instruction.dataLength,
|
||||
floatingPointOptions);
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGExporterPathInstruction*>*)convertInstructionsCurves:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
NSMutableArray<IJSVGExporterPathInstruction*>* nInstructions = nil;
|
||||
nInstructions = [[[NSMutableArray alloc] initWithCapacity:instructions.count] autorelease];
|
||||
IJSVGExporterPathInstruction* lastInstruction = nil;
|
||||
for (IJSVGExporterPathInstruction* instruction in instructions) {
|
||||
lastInstruction = nInstructions.lastObject;
|
||||
if (lastInstruction == nil) {
|
||||
[nInstructions addObject:instruction];
|
||||
continue;
|
||||
}
|
||||
if (instruction.instruction == 'c') {
|
||||
if (lastInstruction.instruction == 'c' && instruction.data[0] == -(lastInstruction.data[2] - lastInstruction.data[4]) && instruction.data[1] == -(lastInstruction.data[3] - lastInstruction.data[5])) {
|
||||
IJSVGExporterPathInstruction* nInstruction = nil;
|
||||
nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'s'
|
||||
dataCount:4] autorelease];
|
||||
nInstruction.data[0] = instruction.data[2];
|
||||
nInstruction.data[1] = instruction.data[3];
|
||||
nInstruction.data[2] = instruction.data[4];
|
||||
nInstruction.data[3] = instruction.data[5];
|
||||
[nInstructions addObject:nInstruction];
|
||||
continue;
|
||||
} else if (lastInstruction.instruction == 's' && instruction.data[0] == -(lastInstruction.data[0] - lastInstruction.data[2]) && instruction.data[1] == -(lastInstruction.data[1] - lastInstruction.data[3])) {
|
||||
IJSVGExporterPathInstruction* nInstruction = nil;
|
||||
nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'s'
|
||||
dataCount:4] autorelease];
|
||||
nInstruction.data[0] = instruction.data[2];
|
||||
nInstruction.data[1] = instruction.data[3];
|
||||
nInstruction.data[2] = instruction.data[4];
|
||||
nInstruction.data[3] = instruction.data[5];
|
||||
[nInstructions addObject:nInstruction];
|
||||
continue;
|
||||
} else if (lastInstruction.instruction != 'c' && lastInstruction.instruction != 's' && instruction.data[0] == 0.f && instruction.data[1] == 0.f) {
|
||||
IJSVGExporterPathInstruction* nInstruction = nil;
|
||||
nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'s'
|
||||
dataCount:4] autorelease];
|
||||
nInstruction.data[0] = instruction.data[2];
|
||||
nInstruction.data[1] = instruction.data[3];
|
||||
nInstruction.data[2] = instruction.data[4];
|
||||
nInstruction.data[3] = instruction.data[5];
|
||||
[nInstructions addObject:nInstruction];
|
||||
continue;
|
||||
}
|
||||
} else if (instruction.instruction == 'q') {
|
||||
if (lastInstruction.instruction == 'q' && instruction.data[0] == (lastInstruction.data[2] - lastInstruction.data[0]) && instruction.data[1] == (lastInstruction.data[3] - lastInstruction.data[1])) {
|
||||
IJSVGExporterPathInstruction* nInstruction = nil;
|
||||
nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'t'
|
||||
dataCount:2] autorelease];
|
||||
nInstruction.data[0] = instruction.data[2];
|
||||
nInstruction.data[1] = instruction.data[3];
|
||||
[nInstructions addObject:nInstruction];
|
||||
continue;
|
||||
} else if (lastInstruction.instruction == 't' && instruction.data[2] == lastInstruction.data[0] && instruction.data[3] == lastInstruction.data[1]) {
|
||||
IJSVGExporterPathInstruction* nInstruction = nil;
|
||||
nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'t'
|
||||
dataCount:2] autorelease];
|
||||
nInstruction.data[0] = instruction.data[2];
|
||||
nInstruction.data[1] = instruction.data[3];
|
||||
[nInstructions addObject:nInstruction];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
[nInstructions addObject:instruction];
|
||||
}
|
||||
return nInstructions;
|
||||
}
|
||||
|
||||
+ (void)convertInstructionsToRelativeCoordinates:(NSArray<IJSVGExporterPathInstruction*>*)instructions
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
CGFloat point[2] = { 0, 0 };
|
||||
CGFloat subpathPoint[2] = { 0, 0 };
|
||||
IJSVGExporterPathInstruction* baseInstruction = nil;
|
||||
IJSVGExporterPathInstruction* prevInstruction = nil;
|
||||
|
||||
NSInteger index = 0;
|
||||
for (IJSVGExporterPathInstruction* anInstruction in instructions) {
|
||||
char instruction = anInstruction.instruction;
|
||||
CGFloat* data = anInstruction.data;
|
||||
NSInteger length = anInstruction.dataLength;
|
||||
|
||||
if (data != NULL) {
|
||||
|
||||
// already relative
|
||||
if (instruction == 'm' || instruction == 'c' || instruction == 's' || instruction == 'l' || instruction == 'q' || instruction == 't' || instruction == 'a') {
|
||||
|
||||
point[0] += data[length - 2];
|
||||
point[1] += data[length - 1];
|
||||
|
||||
if (instruction == 'm') {
|
||||
subpathPoint[0] = point[0];
|
||||
subpathPoint[1] = point[1];
|
||||
|
||||
baseInstruction = anInstruction;
|
||||
}
|
||||
|
||||
} else if (instruction == 'h') {
|
||||
point[0] += data[0];
|
||||
} else if (instruction == 'v') {
|
||||
point[1] += data[0];
|
||||
}
|
||||
|
||||
// convert absolute to relative
|
||||
if (instruction == 'M') {
|
||||
if (index > 0) {
|
||||
instruction = 'm';
|
||||
}
|
||||
|
||||
data[0] -= point[0];
|
||||
data[1] -= point[1];
|
||||
|
||||
subpathPoint[0] = point[0] += data[0];
|
||||
subpathPoint[1] = point[1] += data[1];
|
||||
|
||||
baseInstruction = anInstruction;
|
||||
} else if (instruction == 'L' || instruction == 'T') {
|
||||
instruction = tolower(instruction);
|
||||
|
||||
data[0] -= point[0];
|
||||
data[1] -= point[1];
|
||||
|
||||
point[0] += data[0];
|
||||
point[1] += data[1];
|
||||
} else if (instruction == 'C') {
|
||||
instruction = 'c';
|
||||
|
||||
data[0] -= point[0];
|
||||
data[1] -= point[1];
|
||||
data[2] -= point[0];
|
||||
data[3] -= point[1];
|
||||
data[4] -= point[0];
|
||||
data[5] -= point[1];
|
||||
|
||||
point[0] += data[4];
|
||||
point[1] += data[5];
|
||||
} else if (instruction == 'S' || instruction == 'Q') {
|
||||
instruction = tolower(instruction);
|
||||
|
||||
data[0] -= point[0];
|
||||
data[1] -= point[1];
|
||||
data[2] -= point[0];
|
||||
data[3] -= point[1];
|
||||
|
||||
point[0] += data[2];
|
||||
point[1] += data[3];
|
||||
} else if (instruction == 'A') {
|
||||
instruction = 'a';
|
||||
|
||||
data[5] -= point[0];
|
||||
data[6] -= point[1];
|
||||
|
||||
point[0] += data[5];
|
||||
point[1] += data[6];
|
||||
} else if (instruction == 'H') {
|
||||
instruction = 'h';
|
||||
|
||||
data[0] -= point[0];
|
||||
point[0] += data[0];
|
||||
} else if (instruction == 'V') {
|
||||
instruction = 'v';
|
||||
|
||||
data[0] -= point[1];
|
||||
point[1] += data[0];
|
||||
}
|
||||
|
||||
// reset the instruction
|
||||
anInstruction.instruction = instruction;
|
||||
CGFloat* coords = anInstruction.coords;
|
||||
coords[0] = point[0];
|
||||
coords[1] = point[1];
|
||||
|
||||
} else if (instruction == 'Z' || instruction == 'z') {
|
||||
if (baseInstruction != nil) {
|
||||
CGFloat* coords = anInstruction.coords;
|
||||
coords[0] = baseInstruction.coords[0];
|
||||
coords[1] = baseInstruction.coords[1];
|
||||
}
|
||||
point[0] = subpathPoint[0];
|
||||
point[1] = subpathPoint[1];
|
||||
}
|
||||
|
||||
CGFloat* base = anInstruction.base;
|
||||
if (prevInstruction != nil) {
|
||||
base[0] = prevInstruction.coords[0];
|
||||
base[1] = prevInstruction.coords[1];
|
||||
} else {
|
||||
base[0] = 0.f;
|
||||
base[1] = 0.f;
|
||||
}
|
||||
|
||||
// increment index
|
||||
prevInstruction = anInstruction;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGExporterPathInstruction*>*)instructionsFromPath:(CGPathRef)path
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
|
||||
// keep track of the current point
|
||||
__block CGPoint currentPoint = CGPointZero;
|
||||
NSMutableArray* instructions = [[[NSMutableArray alloc] init] autorelease];
|
||||
|
||||
// create the path callback
|
||||
IJSVGCGPathHandler callback = ^(const CGPathElement* pathElement) {
|
||||
IJSVGExporterPathInstruction* instruction = nil;
|
||||
// work out what to do
|
||||
switch (pathElement->type) {
|
||||
|
||||
case kCGPathElementMoveToPoint: {
|
||||
// move to command
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M'
|
||||
dataCount:2] autorelease];
|
||||
CGPoint point = pathElement->points[0];
|
||||
instruction.data[0] = point.x;
|
||||
instruction.data[1] = point.y;
|
||||
currentPoint = point;
|
||||
|
||||
[instructions addObject:instruction];
|
||||
break;
|
||||
}
|
||||
|
||||
case kCGPathElementAddLineToPoint: {
|
||||
// line to command
|
||||
CGPoint point = pathElement->points[0];
|
||||
if (point.x == currentPoint.x) {
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'V'
|
||||
dataCount:1] autorelease];
|
||||
instruction.data[0] = point.y;
|
||||
} else if (point.y == currentPoint.y) {
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'H'
|
||||
dataCount:1] autorelease];
|
||||
instruction.data[0] = point.x;
|
||||
} else {
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'L'
|
||||
dataCount:2] autorelease];
|
||||
instruction.data[0] = point.x;
|
||||
instruction.data[1] = point.y;
|
||||
}
|
||||
currentPoint = point;
|
||||
|
||||
[instructions addObject:instruction];
|
||||
break;
|
||||
}
|
||||
|
||||
case kCGPathElementAddQuadCurveToPoint: {
|
||||
// quad curve to command
|
||||
CGPoint controlPoint = pathElement->points[0];
|
||||
CGPoint point = pathElement->points[1];
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Q'
|
||||
dataCount:4] autorelease];
|
||||
instruction.data[0] = controlPoint.x;
|
||||
instruction.data[1] = controlPoint.y;
|
||||
instruction.data[2] = point.x;
|
||||
instruction.data[3] = point.y;
|
||||
currentPoint = point;
|
||||
|
||||
[instructions addObject:instruction];
|
||||
break;
|
||||
}
|
||||
|
||||
case kCGPathElementAddCurveToPoint: {
|
||||
// curve to command
|
||||
CGPoint controlPoint1 = pathElement->points[0];
|
||||
CGPoint controlPoint2 = pathElement->points[1];
|
||||
CGPoint point = pathElement->points[2];
|
||||
|
||||
currentPoint = point;
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'C'
|
||||
dataCount:6] autorelease];
|
||||
instruction.data[0] = controlPoint1.x;
|
||||
instruction.data[1] = controlPoint1.y;
|
||||
instruction.data[2] = controlPoint2.x;
|
||||
instruction.data[3] = controlPoint2.y;
|
||||
instruction.data[4] = point.x;
|
||||
instruction.data[5] = point.y;
|
||||
|
||||
[instructions addObject:instruction];
|
||||
break;
|
||||
}
|
||||
|
||||
case kCGPathElementCloseSubpath: {
|
||||
// close command
|
||||
instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z'
|
||||
dataCount:0] autorelease];
|
||||
[instructions addObject:instruction];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// apply the
|
||||
CGPathApply(path, (__bridge void*)callback, IJSVGExporterPathCaller);
|
||||
|
||||
// remove last instruction if it was Z -> M
|
||||
IJSVGExporterPathInstruction* lastInstruction = instructions.lastObject;
|
||||
if (lastInstruction.instruction == 'M' || lastInstruction.instruction == 'm') {
|
||||
if (instructions.count >= 2) {
|
||||
NSInteger index = [instructions indexOfObject:lastInstruction] - 1;
|
||||
IJSVGExporterPathInstruction* prevInstruction = instructions[index];
|
||||
if (prevInstruction.instruction == 'z' || prevInstruction.instruction == 'Z') {
|
||||
[instructions removeLastObject];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instructions;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,108 +0,0 @@
|
||||
//
|
||||
// IJSVGGradientLayer.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 29/12/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGGradientLayer.h"
|
||||
#import <IJSVG/IJSVGRootLayer.h>
|
||||
|
||||
@implementation IJSVGGradientLayer
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_gradient release]), _gradient = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)requiresBackingScaleHelp
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)setGradient:(IJSVGGradient*)newGradient
|
||||
{
|
||||
if (_gradient != nil) {
|
||||
(void)([_gradient release]), _gradient = nil;
|
||||
}
|
||||
_gradient = [newGradient retain];
|
||||
|
||||
// lets check its alpha properties on the colors
|
||||
BOOL hasAlphaChannel = NO;
|
||||
NSInteger stops = _gradient.gradient.numberOfColorStops;
|
||||
for (NSInteger i = 0; i < stops; i++) {
|
||||
NSColor* color = nil;
|
||||
[_gradient.gradient getColor:&color
|
||||
location:NULL
|
||||
atIndex:i];
|
||||
if (color.alphaComponent != 1.f) {
|
||||
hasAlphaChannel = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.opaque = hasAlphaChannel == NO;
|
||||
}
|
||||
|
||||
- (void)setOpacity:(float)opacity
|
||||
{
|
||||
if (opacity != 1.f) {
|
||||
self.opaque = NO;
|
||||
}
|
||||
[super setOpacity:opacity];
|
||||
}
|
||||
|
||||
- (void)setBackingScaleFactor:(CGFloat)backingScaleFactor
|
||||
{
|
||||
switch (self.renderQuality) {
|
||||
case kIJSVGRenderQualityOptimized: {
|
||||
backingScaleFactor = (backingScaleFactor * .35f);
|
||||
break;
|
||||
}
|
||||
case kIJSVGRenderQualityLow: {
|
||||
backingScaleFactor = (backingScaleFactor * .05f);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
[super setBackingScaleFactor:backingScaleFactor];
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer> *)referencingLayer
|
||||
{
|
||||
return [super referencingLayer] ?: self.superlayer;
|
||||
}
|
||||
|
||||
- (void)drawInContext:(CGContextRef)ctx
|
||||
{
|
||||
[super drawInContext:ctx];
|
||||
|
||||
// nothing to do :(
|
||||
if (self.gradient == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
// draw the gradient
|
||||
CALayer<IJSVGDrawableLayer>* layer = (CALayer<IJSVGDrawableLayer>*)self.referencingLayer;
|
||||
CGRect objectRect = layer.boundingBox;
|
||||
CGRect objectFrame = layer.frame;
|
||||
CGAffineTransform affine = [IJSVGLayer absoluteTransformForLayer:layer];
|
||||
affine = CGAffineTransformTranslate(affine,
|
||||
-CGRectGetMinX(objectFrame),
|
||||
-CGRectGetMinY(objectFrame));
|
||||
CGContextSaveGState(ctx);
|
||||
|
||||
IJSVGRootLayer* rootNode = (IJSVGRootLayer*)[IJSVGLayer rootLayerForLayer:self];
|
||||
CGRect bounds = [rootNode.viewBox computeValue:CGSizeZero];
|
||||
|
||||
[self.gradient drawInContextRef:ctx
|
||||
objectRect:objectRect
|
||||
absoluteTransform:affine
|
||||
viewPort:bounds];
|
||||
CGContextRestoreGState(ctx);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// IJSVGGroupLayer.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGLayer.h>
|
||||
#import <IJSVG/IJSVGShapeLayer.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface IJSVGGroupLayer : IJSVGLayer {
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IJSVGUnitRect* viewBox;
|
||||
@property (nonatomic, assign) IJSVGViewBoxAlignment viewBoxAlignment;
|
||||
@property (nonatomic, assign) IJSVGViewBoxMeetOrSlice viewBoxMeetOrSlice;
|
||||
|
||||
@end
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// IJSVGImageLayer.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGLayer.h>
|
||||
#import <IJSVG/IJSVGImage.h>
|
||||
#import <IJSVG/IJSVGTransformLayer.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface IJSVGImageLayer : IJSVGLayer {
|
||||
|
||||
@private
|
||||
IJSVGLayer* _imageLayer;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IJSVGImage* image;
|
||||
|
||||
- (id)initWithImage:(IJSVGImage*)image;
|
||||
|
||||
@end
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// IJSVGImageLayer.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGImageLayer.h"
|
||||
|
||||
@implementation IJSVGImageLayer
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_image release], _image = nil;
|
||||
(void)[_imageLayer release], _imageLayer = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)initWithImage:(IJSVGImage*)image
|
||||
{
|
||||
if((self = [super init]) != nil) {
|
||||
_image = image.retain;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)requiresBackingScaleHelp
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)layoutSublayers
|
||||
{
|
||||
[super layoutSublayers];
|
||||
[self reloadContent];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)reloadContent
|
||||
{
|
||||
if(_imageLayer == nil) {
|
||||
_imageLayer = [IJSVGLayer layer].retain;
|
||||
_imageLayer.contentsGravity = kCAGravityResize;
|
||||
_imageLayer.affineTransform = CGAffineTransformMakeScale(1.f, -1.f);
|
||||
_imageLayer.contents = (id)_image.CGImage;
|
||||
[self addSublayer:_imageLayer];
|
||||
}
|
||||
|
||||
_imageLayer.frame = self.bounds;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,135 +0,0 @@
|
||||
//
|
||||
// IJSVGLayer.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGRendering.h>
|
||||
#import <IJSVG/IJSVGTransaction.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@class IJSVGShapeLayer;
|
||||
@class IJSVGGradientLayer;
|
||||
@class IJSVGPatternLayer;
|
||||
@class IJSVGStrokeLayer;
|
||||
@class IJSVGGroupLayer;
|
||||
@class IJSVGLayer;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, IJSVGLayerFillType) {
|
||||
IJSVGLayerFillTypeColor,
|
||||
IJSVGLayerFillTypePattern,
|
||||
IJSVGLayerFillTypeGradient,
|
||||
IJSVGLayerFillTypeUnknown
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, IJSVGLayerTraits) {
|
||||
IJSVGLayerTraitGroup
|
||||
};
|
||||
|
||||
@protocol IJSVGPathableLayer <NSObject>
|
||||
|
||||
@required
|
||||
@property (nonatomic, assign) CGPathRef path;
|
||||
|
||||
@end
|
||||
|
||||
@protocol IJSVGDrawableLayer <NSObject>
|
||||
|
||||
@required
|
||||
@property (nonatomic, assign) CGBlendMode blendingMode;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* clipLayer;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* maskLayer;
|
||||
@property (nonatomic, copy) CAShapeLayerFillRule clipRule;
|
||||
@property (nonatomic, copy) CAShapeLayerFillRule fillRule;
|
||||
@property (nonatomic, readonly) CGPoint absoluteOrigin;
|
||||
@property (nonatomic, assign) IJSVGRenderQuality renderQuality;
|
||||
@property (nonatomic, assign) CGFloat backingScaleFactor;
|
||||
@property (nonatomic, readonly) BOOL requiresBackingScaleHelp;
|
||||
@property (nonatomic, readonly) CALayer<IJSVGDrawableLayer>* rootLayer;
|
||||
@property (nonatomic, readonly) CGRect absoluteFrame;
|
||||
@property (nonatomic, assign) CGRect boundingBox;
|
||||
@property (nonatomic, readonly) CGRect strokeBoundingBox;
|
||||
@property (nonatomic, readonly) CGRect boundingBoxBounds;
|
||||
@property (nonatomic, assign) CGRect outerBoundingBox;
|
||||
@property (nonatomic, assign) CALayer<IJSVGDrawableLayer>* referencingLayer;
|
||||
@property (nonatomic, readonly) NSArray<CALayer<IJSVGDrawableLayer>*>* debugLayers;
|
||||
|
||||
- (void)performRenderInContext:(CGContextRef)ctx;
|
||||
|
||||
@end
|
||||
|
||||
@interface IJSVGLayer : CALayer <IJSVGDrawableLayer> {
|
||||
|
||||
@private
|
||||
IJSVGLayer* _maskingLayer;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) IJSVGGradientLayer* gradientFillLayer;
|
||||
@property (nonatomic, assign) IJSVGPatternLayer* patternFillLayer;
|
||||
@property (nonatomic, assign) IJSVGStrokeLayer* strokeLayer;
|
||||
@property (nonatomic, assign) IJSVGGradientLayer* gradientStrokeLayer;
|
||||
@property (nonatomic, assign) IJSVGPatternLayer* patternStrokeLayer;
|
||||
@property (nonatomic, readonly) BOOL requiresBackingScaleHelp;
|
||||
@property (nonatomic, assign) CGFloat backingScaleFactor;
|
||||
@property (nonatomic, assign) IJSVGRenderQuality renderQuality;
|
||||
@property (nonatomic, assign) CGBlendMode blendingMode;
|
||||
@property (nonatomic, assign) CGPoint absoluteOrigin;
|
||||
@property (nonatomic, assign) BOOL convertMasksToPaths;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* clipLayer;
|
||||
@property (nonatomic, copy) CAShapeLayerFillRule clipRule;
|
||||
@property (nonatomic, copy) CAShapeLayerFillRule fillRule;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* maskLayer;
|
||||
@property (nonatomic, readonly) CALayer<IJSVGDrawableLayer>* rootLayer;
|
||||
@property (nonatomic, readonly) CGRect absoluteFrame;
|
||||
@property (nonatomic, assign) CGRect boundingBox;
|
||||
@property (nonatomic, readonly) CGRect boundingBoxBounds;
|
||||
@property (nonatomic, readonly) CGRect strokeBoundingBox;
|
||||
@property (nonatomic, assign) CGRect outerBoundingBox;
|
||||
@property (nonatomic, readonly) CGRect outerBoundingBoxBounds;
|
||||
@property (nonatomic, assign) CALayer<IJSVGDrawableLayer>* referencingLayer;
|
||||
|
||||
+ (IJSVGLayerFillType)fillTypeForFill:(id)fill;
|
||||
|
||||
+ (NSArray*)deepestSublayersOfLayer:(CALayer*)layer;
|
||||
+ (void)recursivelyWalkLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
withBlock:(void (^)(CALayer<IJSVGDrawableLayer>* layer, BOOL* stop))block;
|
||||
|
||||
- (void)applySublayerMaskToContext:(CGContextRef)context
|
||||
forSublayer:(IJSVGLayer*)sublayer
|
||||
withOffset:(CGPoint)offset;
|
||||
|
||||
+ (CGImageRef)newMaskImageForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
scale:(CGFloat)scale;
|
||||
|
||||
+ (CGImageRef)newImageForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
colorSpace:(CGColorSpaceRef)colorSpace
|
||||
bitmapInfo:(uint32_t)bitmapInfo
|
||||
scale:(CGFloat)scale;
|
||||
|
||||
+ (void)renderLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
inContext:(CGContextRef)ctx;
|
||||
|
||||
+ (void)applyBlendingMode:(CGBlendMode)blendMode
|
||||
toContext:(CGContextRef)ctx
|
||||
drawingBlock:(dispatch_block_t)drawingBlock;
|
||||
|
||||
+ (void)clipContextWithClip:(CALayer<IJSVGDrawableLayer>*)clipLayer
|
||||
toLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
inContext:(CGContextRef)ctx
|
||||
drawingBlock:(dispatch_block_t)drawingBlock;
|
||||
|
||||
+ (void)clipContextWithMask:(CALayer<IJSVGDrawableLayer>*)maskLayer
|
||||
toLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
inContext:(CGContextRef)context
|
||||
drawingBlock:(dispatch_block_t)drawingBlock;
|
||||
|
||||
+ (CALayer<IJSVGDrawableLayer>*)rootLayerForLayer:(CALayer<IJSVGDrawableLayer>*)layer;
|
||||
+ (CGAffineTransform)absoluteTransformForLayer:(CALayer*)layer;
|
||||
+ (CGRect)absoluteFrameForLayer:(CALayer<IJSVGDrawableLayer>*)layer;
|
||||
+ (CGRect)calculateFrameForSublayers:(NSArray<CALayer<IJSVGDrawableLayer>*>*)layers;
|
||||
|
||||
+ (void)logLayer:(CALayer<IJSVGDrawableLayer>*)layer;
|
||||
|
||||
@end
|
||||
@@ -1,500 +0,0 @@
|
||||
//
|
||||
// IJSVGLayer.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVG.h"
|
||||
#import "IJSVGGroupLayer.h"
|
||||
#import "IJSVGLayer.h"
|
||||
#import "IJSVGShapeLayer.h"
|
||||
#import "IJSVGTransformLayer.h"
|
||||
#import "IJSVGRootLayer.h"
|
||||
|
||||
@implementation IJSVGLayer
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_clipLayer release]), _clipLayer = nil;
|
||||
(void)([_maskLayer release]), _maskLayer = nil;
|
||||
(void)([_clipRule release]), _clipRule = nil;
|
||||
(void)([_fillRule release]), _fillRule = nil;
|
||||
(void)([_maskingLayer release]), _maskingLayer = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if((self = [super init]) != nil) {
|
||||
_boundingBox = CGRectNull;
|
||||
_outerBoundingBox = CGRectNull;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CAShapeLayerFillRule)fillRule
|
||||
{
|
||||
return kCAFillRuleNonZero;
|
||||
}
|
||||
|
||||
- (CAShapeLayerFillRule)clipRule
|
||||
{
|
||||
if(_clipRule == nil) {
|
||||
return self.fillRule;
|
||||
}
|
||||
return _clipRule;
|
||||
}
|
||||
|
||||
+ (IJSVGLayerFillType)fillTypeForFill:(id)fill
|
||||
{
|
||||
if([fill isKindOfClass:IJSVGColorNode.class]) {
|
||||
return IJSVGLayerFillTypeColor;
|
||||
}
|
||||
if([fill isKindOfClass:IJSVGGradient.class]) {
|
||||
return IJSVGLayerFillTypeGradient;
|
||||
}
|
||||
if([fill isKindOfClass:IJSVGPattern.class]) {
|
||||
return IJSVGLayerFillTypePattern;
|
||||
}
|
||||
return IJSVGLayerFillTypeUnknown;
|
||||
}
|
||||
|
||||
+ (CGAffineTransform)absoluteTransformForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
CGAffineTransform identity = CGAffineTransformIdentity;
|
||||
CALayer<IJSVGDrawableLayer>* parentLayer = layer;
|
||||
while((parentLayer = parentLayer.referencingLayer) != nil) {
|
||||
identity = [self absoluteTransformForLayer:parentLayer];
|
||||
|
||||
// only go up until we find a root layer, at that point, we know
|
||||
// we can stop looking
|
||||
if([parentLayer isKindOfClass:IJSVGRootLayer.class] == YES) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return CGAffineTransformConcat(identity, layer.affineTransform);
|
||||
}
|
||||
|
||||
+ (CALayer<IJSVGDrawableLayer>*)rootLayerForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
CALayer<IJSVGDrawableLayer>* parentLayer = (CALayer<IJSVGDrawableLayer>*)layer.referencingLayer;
|
||||
while([parentLayer isKindOfClass:IJSVGRootLayer.class] == NO &&
|
||||
parentLayer.referencingLayer != nil) {
|
||||
parentLayer = (CALayer<IJSVGDrawableLayer>*)parentLayer.referencingLayer;
|
||||
}
|
||||
return parentLayer;
|
||||
}
|
||||
|
||||
+ (void)renderLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
inContext:(CGContextRef)ctx
|
||||
{
|
||||
dispatch_block_t drawingBlock = ^{
|
||||
[layer performRenderInContext:ctx];
|
||||
};
|
||||
[self applyBlendingMode:layer.blendingMode
|
||||
toContext:ctx
|
||||
drawingBlock:^{
|
||||
// we need to clip first
|
||||
if(layer.clipLayer == nil) {
|
||||
drawingBlock();
|
||||
return;
|
||||
}
|
||||
[self clipContextWithClip:layer.clipLayer
|
||||
toLayer:layer
|
||||
inContext:ctx
|
||||
drawingBlock:drawingBlock];
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void)applyBlendingMode:(CGBlendMode)blendMode
|
||||
toContext:(CGContextRef)ctx
|
||||
drawingBlock:(dispatch_block_t)drawingBlock
|
||||
{
|
||||
if (blendMode != kCGBlendModeNormal) {
|
||||
CGContextSaveGState(ctx);
|
||||
CGContextSetBlendMode(ctx, blendMode);
|
||||
drawingBlock();
|
||||
CGContextRestoreGState(ctx);
|
||||
return;
|
||||
}
|
||||
drawingBlock();
|
||||
}
|
||||
|
||||
/// Shape layers are the only thing we can clip, as they contain a path, however
|
||||
/// the layer passed to us from a clip could have groups contained with in it that
|
||||
/// have transforms on them, so simply recursively iterate over them and concat
|
||||
/// their transforms down to the path and clip at the end with the path.
|
||||
+ (void)recursivelyClip:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
transform:(CGAffineTransform)transform
|
||||
inContext:(CGContextRef)ctx
|
||||
{
|
||||
if([layer isKindOfClass:IJSVGShapeLayer.class]) {
|
||||
[self clipContextWithShapeLayer:(IJSVGShapeLayer*)layer
|
||||
transform:transform
|
||||
inContext:ctx];
|
||||
return;
|
||||
}
|
||||
|
||||
for(CALayer<IJSVGDrawableLayer>* drawableLayer in layer.sublayers) {
|
||||
CGAffineTransform drawTransform = CGAffineTransformConcat(transform,
|
||||
drawableLayer.affineTransform);
|
||||
|
||||
// If its not a shape layer, just go down the tree until we find one
|
||||
if([drawableLayer isKindOfClass:IJSVGShapeLayer.class] == NO) {
|
||||
[self recursivelyClip:drawableLayer
|
||||
transform:drawTransform
|
||||
inContext:ctx];
|
||||
continue;
|
||||
}
|
||||
IJSVGShapeLayer* shapeLayer = (IJSVGShapeLayer*)drawableLayer;
|
||||
[self clipContextWithShapeLayer:shapeLayer
|
||||
transform:transform
|
||||
inContext:ctx];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)clipContextWithShapeLayer:(IJSVGShapeLayer*)shapeLayer
|
||||
transform:(CGAffineTransform)transform
|
||||
inContext:(CGContextRef)ctx
|
||||
{
|
||||
CGAffineTransform drawTransform = CGAffineTransformConcat(transform,
|
||||
shapeLayer.affineTransform);
|
||||
// Shape layers paths are reset back to 0,0 origin, so in order to be
|
||||
// correct path, we need to shift it back to where it belongs.
|
||||
drawTransform = CGAffineTransformTranslate(transform,
|
||||
shapeLayer.frame.origin.x,
|
||||
shapeLayer.frame.origin.y);
|
||||
CGPathRef path = CGPathCreateCopyByTransformingPath(shapeLayer.path,
|
||||
&drawTransform);
|
||||
CGContextAddPath(ctx, path);
|
||||
CGPathRelease(path);
|
||||
}
|
||||
|
||||
+ (void)clipContextWithClip:(CALayer<IJSVGDrawableLayer>*)clipLayer
|
||||
toLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
inContext:(CGContextRef)ctx
|
||||
drawingBlock:(dispatch_block_t)drawingBlock
|
||||
{
|
||||
CGContextSaveGState(ctx);
|
||||
[self recursivelyClip:clipLayer
|
||||
transform:CGAffineTransformIdentity
|
||||
inContext:ctx];
|
||||
if([layer.clipRule isEqualToString:kCAFillRuleEvenOdd]) {
|
||||
CGContextEOClip(ctx);
|
||||
} else {
|
||||
CGContextClip(ctx);
|
||||
}
|
||||
drawingBlock();
|
||||
CGContextRestoreGState(ctx);
|
||||
}
|
||||
|
||||
+ (void)clipContextWithMask:(CALayer<IJSVGDrawableLayer>*)maskLayer
|
||||
toLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
inContext:(CGContextRef)ctx
|
||||
drawingBlock:(dispatch_block_t)drawingBlock
|
||||
{
|
||||
CGContextSaveGState(ctx);
|
||||
CGRect bounds = layer.outerBoundingBox;
|
||||
CGFloat scale = layer.backingScaleFactor;
|
||||
CGImageRef maskImage = [self newMaskImageForLayer:maskLayer
|
||||
scale:scale];
|
||||
CGContextClipToMask(ctx, bounds, maskImage);
|
||||
drawingBlock();
|
||||
CGImageRelease(maskImage);
|
||||
CGContextRestoreGState(ctx);
|
||||
}
|
||||
|
||||
+ (CGImageRef)newMaskImageForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
scale:(CGFloat)scale
|
||||
{
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
|
||||
CGImageRef ref = [self newImageForLayer:layer
|
||||
colorSpace:colorSpace
|
||||
bitmapInfo:kCGImageAlphaNone
|
||||
scale:scale];
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
return ref;
|
||||
}
|
||||
|
||||
+ (CGImageRef)newImageForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
colorSpace:(CGColorSpaceRef)colorSpace
|
||||
bitmapInfo:(uint32_t)bitmapInfo
|
||||
scale:(CGFloat)scale
|
||||
{
|
||||
CGRect frame = layer.outerBoundingBox;
|
||||
CGContextRef offscreenContext = CGBitmapContextCreate(NULL,
|
||||
ceilf(frame.size.width * scale),
|
||||
ceilf(frame.size.height * scale),
|
||||
8, 0, colorSpace, bitmapInfo);
|
||||
|
||||
CGContextSaveGState(offscreenContext);
|
||||
CGContextScaleCTM(offscreenContext, scale, scale);
|
||||
CGContextTranslateCTM(offscreenContext, -frame.origin.x, -frame.origin.y);
|
||||
[layer renderInContext:offscreenContext];
|
||||
CGImageRef image = CGBitmapContextCreateImage(offscreenContext);
|
||||
CGContextRelease(offscreenContext);
|
||||
return image;
|
||||
}
|
||||
|
||||
+ (CGRect)absoluteFrameForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
return (CGRect) {
|
||||
.origin = [self absoluteOriginForLayer:layer],
|
||||
.size = layer.frame.size
|
||||
};
|
||||
}
|
||||
|
||||
+ (CGPoint)absoluteOriginForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
CGPoint point = CGPointZero;
|
||||
CALayer<IJSVGDrawableLayer>* pLayer = layer;
|
||||
while (pLayer != nil) {
|
||||
point.x += pLayer.frame.origin.x;
|
||||
point.y += pLayer.frame.origin.y;
|
||||
pLayer = pLayer.referencingLayer;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
+ (NSArray*)deepestSublayersOfLayer:(CALayer*)layer
|
||||
{
|
||||
NSMutableArray* arr = [[[NSMutableArray alloc] init] autorelease];
|
||||
for (CALayer* subLayer in layer.sublayers) {
|
||||
if (subLayer.sublayers.count != 0) {
|
||||
NSArray* moreLayers = [self deepestSublayersOfLayer:(IJSVGLayer*)subLayer];
|
||||
[arr addObjectsFromArray:moreLayers];
|
||||
} else {
|
||||
[arr addObject:subLayer];
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
+ (void)recursivelyWalkLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
withBlock:(void (^)(CALayer<IJSVGDrawableLayer>* layer, BOOL* stop))block
|
||||
{
|
||||
// call for layer and mask if there is one
|
||||
BOOL stop = NO;
|
||||
block(layer, &stop);
|
||||
if(stop == YES) {
|
||||
return;
|
||||
}
|
||||
|
||||
// sublayers!!
|
||||
for (CALayer<IJSVGDrawableLayer>* aLayer in layer.sublayers) {
|
||||
[self recursivelyWalkLayer:aLayer
|
||||
withBlock:block];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)logLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
[self logLayer:layer
|
||||
depth:0];
|
||||
}
|
||||
|
||||
+ (void)logLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
depth:(NSUInteger)depth
|
||||
{
|
||||
NSLog(@"%@ %@ frame: %@ transform: %@",[@"" stringByPaddingToLength:depth
|
||||
withString:@"- - "
|
||||
startingAtIndex:0], layer,
|
||||
NSStringFromRect(layer.frame),
|
||||
[IJSVGTransform affineTransformToSVGTransformComponentString:layer.affineTransform]);
|
||||
for(CALayer<IJSVGDrawableLayer>* sublayer in layer.debugLayers) {
|
||||
[self logLayer:sublayer
|
||||
depth:depth+1];
|
||||
}
|
||||
}
|
||||
|
||||
+ (CGRect)calculateFrameForSublayers:(NSArray<CALayer<IJSVGDrawableLayer>*>*)layers
|
||||
{
|
||||
CGRect rect = CGRectNull;
|
||||
for(CALayer<IJSVGDrawableLayer>* layer in layers) {
|
||||
CGRect layerFrame = layer.outerBoundingBox;
|
||||
// if we are a transform layer, we can just apply its transform
|
||||
// to its sublayers and keep going down the tree
|
||||
if([layer isKindOfClass:IJSVGTransformLayer.class] == YES) {
|
||||
CGRect frame = [self calculateFrameForSublayers:layer.sublayers];
|
||||
frame = CGRectApplyAffineTransform(frame, layer.affineTransform);
|
||||
layerFrame = frame;
|
||||
}
|
||||
if(CGRectIsNull(rect)) {
|
||||
rect = layerFrame;
|
||||
continue;
|
||||
}
|
||||
rect = CGRectUnion(rect, layerFrame);
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (void)setBackingScaleFactor:(CGFloat)newFactor
|
||||
{
|
||||
if (_backingScaleFactor == newFactor) {
|
||||
return;
|
||||
}
|
||||
|
||||
_backingScaleFactor = newFactor;
|
||||
self.contentsScale = newFactor;
|
||||
self.rasterizationScale = newFactor;
|
||||
|
||||
// make sure its applied to any mask or clipPath
|
||||
_maskLayer.backingScaleFactor = newFactor;
|
||||
_clipLayer.backingScaleFactor = newFactor;
|
||||
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)performRenderInContext:(CGContextRef)ctx
|
||||
{
|
||||
if(_maskLayer != nil) {
|
||||
[self.class clipContextWithMask:_maskLayer
|
||||
toLayer:self
|
||||
inContext:ctx
|
||||
drawingBlock:^{
|
||||
[super renderInContext:ctx];
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[super renderInContext:ctx];
|
||||
}
|
||||
|
||||
- (void)setConvertMasksToPaths:(BOOL)flag
|
||||
{
|
||||
if (_convertMasksToPaths == flag) {
|
||||
return;
|
||||
}
|
||||
_convertMasksToPaths = flag;
|
||||
if (flag == YES) {
|
||||
if (_maskingLayer != nil) {
|
||||
(void)([_maskingLayer release]), _maskingLayer = nil;
|
||||
}
|
||||
_maskingLayer = [(IJSVGLayer*)self.mask retain];
|
||||
self.mask = nil;
|
||||
} else {
|
||||
self.mask = _maskingLayer;
|
||||
(void)([_maskingLayer release]), _maskingLayer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applySublayerMaskToContext:(CGContextRef)context
|
||||
forSublayer:(IJSVGLayer*)sublayer
|
||||
withOffset:(CGPoint)offset
|
||||
{
|
||||
// apply any transforms needed
|
||||
CGPoint layerOffset = offset;
|
||||
CGAffineTransform sublayerTransform = CATransform3DGetAffineTransform(sublayer.transform);
|
||||
CGContextConcatCTM(context, CGAffineTransformInvert(sublayerTransform));
|
||||
|
||||
// walk up the superlayer chain
|
||||
CALayer* superlayer = self.superlayer;
|
||||
if (IJSVGIsSVGLayer(superlayer) == YES) {
|
||||
[(IJSVGLayer*)superlayer applySublayerMaskToContext:context
|
||||
forSublayer:(IJSVGLayer*)self
|
||||
withOffset:layerOffset];
|
||||
}
|
||||
|
||||
// grab the masking layer
|
||||
IJSVGShapeLayer* maskingLayer = [self maskingLayer];
|
||||
|
||||
// if its a group we need to get the lowest level children
|
||||
// and walk up the chain again
|
||||
if ([maskingLayer isKindOfClass:[IJSVGGroupLayer class]]) {
|
||||
NSArray* subs = [IJSVGLayer deepestSublayersOfLayer:maskingLayer];
|
||||
for (IJSVGLayer* subLayer in subs) {
|
||||
[subLayer applySublayerMaskToContext:context
|
||||
forSublayer:(IJSVGLayer*)self
|
||||
withOffset:layerOffset];
|
||||
}
|
||||
} else if ([maskingLayer isKindOfClass:[IJSVGShapeLayer class]]) {
|
||||
// is a shape, go for it!
|
||||
CGPathRef maskPath = maskingLayer.path;
|
||||
CGContextTranslateCTM(context, -layerOffset.x, -layerOffset.y);
|
||||
CGContextAddPath(context, maskPath);
|
||||
CGContextClip(context);
|
||||
CGContextTranslateCTM(context, layerOffset.x, layerOffset.y);
|
||||
}
|
||||
CGContextConcatCTM(context, sublayerTransform);
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)rootLayer
|
||||
{
|
||||
return [self.class rootLayerForLayer:self];
|
||||
}
|
||||
|
||||
- (CGAffineTransform)absoluteTransform
|
||||
{
|
||||
return [IJSVGLayer absoluteTransformForLayer:self];
|
||||
}
|
||||
|
||||
- (BOOL)requiresBackingScaleHelp
|
||||
{
|
||||
return _maskLayer != nil || _clipLayer != nil;
|
||||
}
|
||||
|
||||
- (IJSVGShapeLayer*)maskingLayer
|
||||
{
|
||||
return (IJSVGShapeLayer*)_maskingLayer ?: nil;
|
||||
}
|
||||
|
||||
- (void)renderInContext:(CGContextRef)ctx
|
||||
{
|
||||
[IJSVGLayer renderLayer:self
|
||||
inContext:ctx];
|
||||
}
|
||||
|
||||
- (id<CAAction>)actionForKey:(NSString*)event
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (CGRect)absoluteFrame
|
||||
{
|
||||
return [self.class absoluteFrameForLayer:self];
|
||||
}
|
||||
|
||||
- (CGRect)boundingBox
|
||||
{
|
||||
return CGRectIsNull(_boundingBox) == NO ? _boundingBox : self.frame;
|
||||
}
|
||||
|
||||
- (CGRect)outerBoundingBox
|
||||
{
|
||||
return CGRectIsNull(_outerBoundingBox) == NO ? _outerBoundingBox : self.frame;
|
||||
}
|
||||
|
||||
- (CGRect)outerBoundingBoxBounds
|
||||
{
|
||||
return (CGRect) {
|
||||
.origin = CGPointZero,
|
||||
.size = self.outerBoundingBox.size
|
||||
};
|
||||
}
|
||||
|
||||
- (CGRect)boundingBoxBounds
|
||||
{
|
||||
return (CGRect) {
|
||||
.origin = CGPointZero,
|
||||
.size = self.boundingBox.size
|
||||
};
|
||||
}
|
||||
|
||||
- (CGRect)strokeBoundingBox
|
||||
{
|
||||
return self.boundingBox;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer> *)referencingLayer
|
||||
{
|
||||
return _referencingLayer ?: self.superlayer;
|
||||
}
|
||||
|
||||
-(NSArray<CALayer<IJSVGDrawableLayer>*>*)debugLayers
|
||||
{
|
||||
return self.sublayers;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,138 +0,0 @@
|
||||
//
|
||||
// IJSVGPatternLayer.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGPatternLayer.h>
|
||||
#import <IJSVG/IJSVGTransform.h>
|
||||
#import <IJSVG/IJSVGUnitRect.h>
|
||||
#import <IJSVG/IJSVGViewBox.h>
|
||||
|
||||
@interface IJSVGPatternLayer ()
|
||||
|
||||
@property (nonatomic, assign, readonly) CGSize cellSize;
|
||||
@property (nonatomic, assign) CGRect viewBox;
|
||||
|
||||
@end
|
||||
|
||||
@implementation IJSVGPatternLayer
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_pattern release]), _pattern = nil;
|
||||
(void)([_patternNode release]), _patternNode = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)requiresBackingScaleHelp
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
void IJSVGPatternDrawingCallBack(void* info, CGContextRef ctx)
|
||||
{
|
||||
// reassign the layer
|
||||
IJSVGPatternLayer* layer = (IJSVGPatternLayer*)info;
|
||||
CGSize size = layer.cellSize;
|
||||
CGContextSaveGState(ctx);
|
||||
CGRect rect = CGRectMake(0.f, 0.f, size.width, size.height);
|
||||
CGContextClipToRect(ctx, rect);
|
||||
|
||||
IJSVGViewBoxAlignment alignment = layer.patternNode.viewBoxAlignment;
|
||||
IJSVGViewBoxMeetOrSlice meetOrSlice = layer.patternNode.viewBoxMeetOrSlice;
|
||||
CGRect viewBox = layer.viewBox;
|
||||
|
||||
[IJSVGViewBox drawViewBox:viewBox
|
||||
inRect:rect
|
||||
alignment:alignment
|
||||
meetOrSlice:meetOrSlice
|
||||
inContext:ctx
|
||||
drawingBlock:^(CGSize size) {
|
||||
[layer.pattern renderInContext:ctx];
|
||||
}];
|
||||
CGContextSaveGState(ctx);
|
||||
};
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)referencingLayer
|
||||
{
|
||||
return [super referencingLayer] ?: self.superlayer;
|
||||
}
|
||||
|
||||
- (void)drawInContext:(CGContextRef)ctx
|
||||
{
|
||||
// holder for callback
|
||||
static const CGPatternCallbacks callbacks = { 0, &IJSVGPatternDrawingCallBack, NULL };
|
||||
|
||||
// create base pattern space
|
||||
CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
|
||||
CGContextSetFillColorSpace(ctx, patternSpace);
|
||||
CGColorSpaceRelease(patternSpace);
|
||||
|
||||
CGRect rect = self.referencingLayer.boundingBoxBounds;
|
||||
|
||||
IJSVGUnitLength* wLength = _patternNode.width;
|
||||
IJSVGUnitLength* hLength = _patternNode.height;
|
||||
|
||||
if(self.patternNode.units == IJSVGUnitObjectBoundingBox ||
|
||||
self.patternNode.contentUnits == IJSVGUnitObjectBoundingBox) {
|
||||
wLength = wLength.lengthByMatchingPercentage;
|
||||
hLength = hLength.lengthByMatchingPercentage;
|
||||
}
|
||||
|
||||
CGFloat width = [wLength computeValue:rect.size.width];
|
||||
CGFloat height = [hLength computeValue:rect.size.height];
|
||||
_cellSize = CGSizeMake(width, height);
|
||||
|
||||
CALayer<IJSVGDrawableLayer>* layer = (CALayer<IJSVGDrawableLayer>*)self.referencingLayer;
|
||||
|
||||
// transform us back into the correct space
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
if (self.patternNode.units == IJSVGUnitUserSpaceOnUse) {
|
||||
CGRect frame = layer.boundingBox;
|
||||
transform = [IJSVGLayer absoluteTransformForLayer:layer];
|
||||
transform = CGAffineTransformTranslate(transform,
|
||||
-CGRectGetMinX(frame),
|
||||
-CGRectGetMinY(frame));
|
||||
}
|
||||
|
||||
transform = CGAffineTransformConcat(transform, IJSVGConcatTransforms(self.patternNode.transforms));
|
||||
// transform the X and Y shift
|
||||
transform = CGAffineTransformTranslate(transform,
|
||||
[_patternNode.x computeValue:rect.size.width],
|
||||
[_patternNode.y computeValue:rect.size.height]);
|
||||
|
||||
// who knew that patterns have viewBoxes? Not me, but here is an implementation
|
||||
// of it anyway
|
||||
if(_patternNode.viewBox != nil && _patternNode.viewBox.isZeroRect == NO) {
|
||||
if(_patternNode.units == IJSVGUnitObjectBoundingBox) {
|
||||
IJSVGUnitRect* viewBox = nil;
|
||||
viewBox = [[_patternNode.viewBox copyByConvertingToUnitsLengthType:IJSVGUnitLengthTypePercentage] autorelease];
|
||||
_viewBox = [viewBox computeValue:rect.size];
|
||||
}
|
||||
}
|
||||
|
||||
// create the pattern
|
||||
CGRect selfBounds = self.boundingBoxBounds;
|
||||
CGPatternRef ref = CGPatternCreate((void*)self, selfBounds,
|
||||
transform, width, height,
|
||||
kCGPatternTilingConstantSpacing,
|
||||
true, &callbacks);
|
||||
|
||||
// set the pattern then release it
|
||||
CGFloat alpha = 1.f;
|
||||
CGContextSetFillPattern(ctx, ref, &alpha);
|
||||
CGPatternRelease(ref);
|
||||
|
||||
// fill it
|
||||
CGContextFillRect(ctx, selfBounds);
|
||||
}
|
||||
|
||||
- (NSArray<CALayer<IJSVGDrawableLayer>*>*)debugLayers
|
||||
{
|
||||
return @[self.pattern];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,23 +0,0 @@
|
||||
//
|
||||
// IJSVGRootLayer.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 15/04/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVG.h>
|
||||
|
||||
@interface IJSVGRootLayer : IJSVGGroupLayer {
|
||||
|
||||
@private
|
||||
BOOL _disableBackingScalePropagation;
|
||||
|
||||
}
|
||||
|
||||
- (void)renderInContext:(CGContextRef)ctx
|
||||
viewPort:(CGRect)viewPort
|
||||
backingScale:(CGFloat)backingScale
|
||||
quality:(IJSVGRenderQuality)quality;
|
||||
|
||||
@end
|
||||
@@ -1,71 +0,0 @@
|
||||
//
|
||||
// IJSVGRootLayer.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 15/04/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGRootLayer.h"
|
||||
|
||||
@implementation IJSVGRootLayer
|
||||
|
||||
- (void)performRenderInContext:(CGContextRef)ctx
|
||||
{
|
||||
if(self.viewBox != nil) {
|
||||
CGRect viewBox = [self.viewBox computeValue:CGSizeZero];
|
||||
__block IJSVGRootLayer* weakSelf = self;
|
||||
IJSVGViewBoxDrawingBlock drawingBlock = ^(CGSize size) {
|
||||
// we have to make sure we set the backing scale factor once
|
||||
// we know how scale this will be drawn at
|
||||
weakSelf.backingScaleFactor *= MAX(size.width, size.height);
|
||||
[super performRenderInContext:ctx];
|
||||
};
|
||||
[IJSVGViewBox drawViewBox:viewBox
|
||||
inRect:self.boundingBoxBounds
|
||||
alignment:self.viewBoxAlignment
|
||||
meetOrSlice:self.viewBoxMeetOrSlice
|
||||
inContext:ctx
|
||||
drawingBlock:drawingBlock];
|
||||
return;
|
||||
}
|
||||
[super performRenderInContext:ctx];
|
||||
}
|
||||
|
||||
- (void)setBackingScaleFactor:(CGFloat)backingScaleFactor
|
||||
{
|
||||
[super setBackingScaleFactor:backingScaleFactor];
|
||||
if(_disableBackingScalePropagation == YES) {
|
||||
return;
|
||||
}
|
||||
[self propagateBackingScalePropertiesToSublayers];
|
||||
}
|
||||
|
||||
- (void)propagateBackingScalePropertiesToSublayers
|
||||
{
|
||||
__block IJSVGRootLayer* weakSelf = self;
|
||||
for(CALayer<IJSVGDrawableLayer>* layer in self.sublayers) {
|
||||
[IJSVGLayer recursivelyWalkLayer:layer
|
||||
withBlock:^(CALayer<IJSVGDrawableLayer>* propLayer, BOOL *stop) {
|
||||
propLayer.renderQuality = weakSelf.renderQuality;
|
||||
propLayer.backingScaleFactor = weakSelf.backingScaleFactor;
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)renderInContext:(CGContextRef)ctx
|
||||
viewPort:(CGRect)viewPort
|
||||
backingScale:(CGFloat)backingScale
|
||||
quality:(IJSVGRenderQuality)quality
|
||||
{
|
||||
CGRect frame = viewPort;
|
||||
self.frame = frame;
|
||||
_disableBackingScalePropagation = YES;
|
||||
self.backingScaleFactor = backingScale;
|
||||
self.renderQuality = quality;
|
||||
_disableBackingScalePropagation = NO;
|
||||
[self propagateBackingScalePropertiesToSublayers];
|
||||
[self renderInContext:ctx];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// IJSVGShapeLayer.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGLayer.h>
|
||||
#import <IJSVG/IJSVGUtils.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@interface IJSVGShapeLayer : CAShapeLayer <IJSVGDrawableLayer, IJSVGPathableLayer> {
|
||||
|
||||
@private
|
||||
IJSVGLayer* _maskingLayer;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) IJSVGGradientLayer* gradientFillLayer;
|
||||
@property (nonatomic, assign) IJSVGPatternLayer* patternFillLayer;
|
||||
@property (nonatomic, assign) IJSVGStrokeLayer* strokeLayer;
|
||||
@property (nonatomic, assign) IJSVGGradientLayer* gradientStrokeLayer;
|
||||
@property (nonatomic, assign) IJSVGPatternLayer* patternStrokeLayer;
|
||||
@property (nonatomic, assign) CGFloat backingScaleFactor;
|
||||
@property (nonatomic, readonly) BOOL requiresBackingScaleHelp;
|
||||
@property (nonatomic, assign) IJSVGRenderQuality renderQuality;
|
||||
@property (nonatomic, assign) CGBlendMode blendingMode;
|
||||
@property (nonatomic, assign) CGPoint absoluteOrigin;
|
||||
@property (nonatomic, assign) CGPoint originalPathOrigin;
|
||||
@property (nonatomic, assign) BOOL convertMasksToPaths;
|
||||
@property (nonatomic, assign) IJSVGPrimitivePathType primitiveType;
|
||||
@property (nonatomic, readonly) CGRect computedFrame;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* clipLayer;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* maskLayer;
|
||||
@property (nonatomic, readonly) CALayer<IJSVGDrawableLayer>* rootLayer;
|
||||
@property (nonatomic, readonly) CGRect absoluteFrame;
|
||||
@property (nonatomic, assign) CGRect boundingBox;
|
||||
@property (nonatomic, assign) CGRect outerBoundingBox;
|
||||
@property (nonatomic, readonly) CGRect boundingBoxBounds;
|
||||
@property (nonatomic, assign) CALayer<IJSVGDrawableLayer>* referencingLayer;
|
||||
@property (nonatomic, assign) CGRect strokeBoundingBox;
|
||||
@property (nonatomic, copy) CAShapeLayerFillRule clipRule;
|
||||
|
||||
- (void)applySublayerMaskToContext:(CGContextRef)context
|
||||
forSublayer:(IJSVGLayer*)sublayer
|
||||
withOffset:(CGPoint)offset;
|
||||
|
||||
@end
|
||||
@@ -1,166 +0,0 @@
|
||||
//
|
||||
// IJSVGShapeLayer.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 07/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGGroupLayer.h"
|
||||
#import "IJSVGShapeLayer.h"
|
||||
|
||||
@implementation IJSVGShapeLayer
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_clipLayer release]), _clipLayer = nil;
|
||||
(void)([_maskLayer release]), _maskLayer = nil;
|
||||
(void)([_maskingLayer release]), _maskingLayer = nil;
|
||||
(void)([_clipRule release]), _clipRule = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer> *)rootLayer
|
||||
{
|
||||
return [IJSVGLayer rootLayerForLayer:self];
|
||||
}
|
||||
|
||||
- (CGRect)absoluteFrame
|
||||
{
|
||||
return [IJSVGLayer absoluteFrameForLayer:self];
|
||||
}
|
||||
|
||||
- (CGAffineTransform)absoluteTransform
|
||||
{
|
||||
return [IJSVGLayer absoluteTransformForLayer:self];
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer> *)referencingLayer
|
||||
{
|
||||
return _referencingLayer ?: self.superlayer;
|
||||
}
|
||||
|
||||
- (CGRect)boundingBoxBounds
|
||||
{
|
||||
return (CGRect) {
|
||||
.origin = CGPointZero,
|
||||
.size = self.boundingBox.size
|
||||
};
|
||||
}
|
||||
|
||||
- (BOOL)requiresBackingScaleHelp
|
||||
{
|
||||
return _maskLayer != nil || _clipLayer != nil;
|
||||
}
|
||||
|
||||
- (void)setBackingScaleFactor:(CGFloat)newFactor
|
||||
{
|
||||
if (_backingScaleFactor == newFactor) {
|
||||
return;
|
||||
}
|
||||
|
||||
_backingScaleFactor = newFactor;
|
||||
self.contentsScale = newFactor;
|
||||
self.rasterizationScale = newFactor;
|
||||
|
||||
// make sure its applied to any mask or clipPath
|
||||
_maskLayer.backingScaleFactor = newFactor;
|
||||
_clipLayer.backingScaleFactor = newFactor;
|
||||
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)performRenderInContext:(CGContextRef)ctx
|
||||
{
|
||||
if(_maskLayer != nil) {
|
||||
[IJSVGLayer clipContextWithMask:_maskLayer
|
||||
toLayer:self
|
||||
inContext:ctx
|
||||
drawingBlock:^{
|
||||
[super renderInContext:ctx];
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[super renderInContext:ctx];
|
||||
}
|
||||
|
||||
- (void)setConvertMasksToPaths:(BOOL)flag
|
||||
{
|
||||
if (_convertMasksToPaths == flag) {
|
||||
return;
|
||||
}
|
||||
_convertMasksToPaths = flag;
|
||||
if (flag == YES) {
|
||||
if (_maskingLayer != nil) {
|
||||
(void)([_maskingLayer release]), _maskingLayer = nil;
|
||||
}
|
||||
_maskingLayer = [(IJSVGLayer*)self.mask retain];
|
||||
self.mask = nil;
|
||||
} else {
|
||||
self.mask = _maskingLayer;
|
||||
(void)([_maskingLayer release]), _maskingLayer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applySublayerMaskToContext:(CGContextRef)context
|
||||
forSublayer:(IJSVGLayer*)sublayer
|
||||
withOffset:(CGPoint)offset
|
||||
{
|
||||
// apply any transforms needed
|
||||
CGPoint layerOffset = offset;
|
||||
CGAffineTransform sublayerTransform = CATransform3DGetAffineTransform(sublayer.transform);
|
||||
CGContextConcatCTM(context, CGAffineTransformInvert(sublayerTransform));
|
||||
|
||||
// walk up the superlayer chain
|
||||
CALayer* superlayer = self.superlayer;
|
||||
if (IJSVGIsSVGLayer(superlayer) == YES) {
|
||||
[(IJSVGLayer*)superlayer applySublayerMaskToContext:context
|
||||
forSublayer:(IJSVGLayer*)self
|
||||
withOffset:layerOffset];
|
||||
}
|
||||
|
||||
// grab the masking layer
|
||||
IJSVGShapeLayer* maskingLayer = [self maskingLayer];
|
||||
|
||||
// if its a group we need to get the lowest level children
|
||||
// and walk up the chain again
|
||||
if ([maskingLayer isKindOfClass:[IJSVGGroupLayer class]]) {
|
||||
NSArray* subs = [IJSVGLayer deepestSublayersOfLayer:maskingLayer];
|
||||
for (IJSVGLayer* subLayer in subs) {
|
||||
[subLayer applySublayerMaskToContext:context
|
||||
forSublayer:(IJSVGLayer*)self
|
||||
withOffset:layerOffset];
|
||||
}
|
||||
} else if ([maskingLayer isKindOfClass:[IJSVGShapeLayer class]]) {
|
||||
// is a shape, go for it!
|
||||
CGPathRef maskPath = maskingLayer.path;
|
||||
CGContextTranslateCTM(context, -layerOffset.x, -layerOffset.y);
|
||||
CGContextAddPath(context, maskPath);
|
||||
CGContextClip(context);
|
||||
CGContextTranslateCTM(context, layerOffset.x, layerOffset.y);
|
||||
}
|
||||
CGContextConcatCTM(context, sublayerTransform);
|
||||
}
|
||||
|
||||
- (IJSVGShapeLayer*)maskingLayer
|
||||
{
|
||||
return (IJSVGShapeLayer*)_maskingLayer ?: nil;
|
||||
}
|
||||
|
||||
- (void)renderInContext:(CGContextRef)ctx
|
||||
{
|
||||
[IJSVGLayer renderLayer:(IJSVGLayer*)self
|
||||
inContext:ctx];
|
||||
}
|
||||
|
||||
- (id<CAAction>)actionForKey:(NSString*)event
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(NSArray<CALayer<IJSVGDrawableLayer>*>*)debugLayers
|
||||
{
|
||||
return self.sublayers;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// IJSVGStrokeLayer.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 09/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGStrokeLayer.h"
|
||||
|
||||
@implementation IJSVGStrokeLayer
|
||||
|
||||
- (CGRect)outerBoundingBox
|
||||
{
|
||||
return CGRectMake(-self.lineWidth / 2.f, -self.lineWidth / 2.f,
|
||||
self.boundingBox.size.width + self.lineWidth,
|
||||
self.boundingBox.size.height + self.lineWidth);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// IJSVGTransformLayer.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 31/03/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <IJSVG/IJSVGLayer.h>
|
||||
|
||||
@interface IJSVGTransformLayer : CATransformLayer <IJSVGDrawableLayer>
|
||||
|
||||
@property (nonatomic, assign) CGBlendMode blendingMode;
|
||||
@property (nonatomic, retain) CALayer<IJSVGDrawableLayer>* clipLayer;
|
||||
@property (nonatomic, readonly) CGPoint absoluteOrigin;
|
||||
@property (nonatomic, readonly) CGRect computedFrame;
|
||||
@property (nonatomic, readonly) CALayer<IJSVGDrawableLayer>* referencedLayer;
|
||||
@property (nonatomic, assign) CALayer<IJSVGDrawableLayer>* referencingLayer;
|
||||
|
||||
@end
|
||||
@@ -1,69 +0,0 @@
|
||||
//
|
||||
// IJSVGTransformLayer.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 31/03/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGTransformLayer.h"
|
||||
|
||||
@implementation IJSVGTransformLayer
|
||||
|
||||
@synthesize backingScaleFactor;
|
||||
@synthesize renderQuality;
|
||||
@synthesize requiresBackingScaleHelp;
|
||||
@synthesize maskLayer = _maskLayer;
|
||||
@synthesize fillRule = _fillRule;
|
||||
@synthesize clipRule = _clipRule;
|
||||
@synthesize absoluteFrame;
|
||||
@synthesize boundingBox;
|
||||
@synthesize boundingBoxBounds;
|
||||
@synthesize strokeBoundingBox;
|
||||
@synthesize outerBoundingBox;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_maskLayer release], _maskLayer = nil;
|
||||
(void)[_fillRule release], _fillRule = nil;
|
||||
(void)[_clipRule release], _clipRule = nil;
|
||||
(void)[_clipLayer release], _clipLayer = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer> *)referencedLayer
|
||||
{
|
||||
return self.sublayers.firstObject;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer> *)referencingLayer {
|
||||
return _referencingLayer ?: self.superlayer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)rootLayer
|
||||
{
|
||||
return [IJSVGLayer rootLayerForLayer:self];
|
||||
}
|
||||
|
||||
- (BOOL)requiresBackingScaleHelp
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)renderInContext:(CGContextRef)ctx
|
||||
{
|
||||
[IJSVGLayer renderLayer:self
|
||||
inContext:ctx];
|
||||
}
|
||||
|
||||
- (void)performRenderInContext:(CGContextRef)ctx
|
||||
{
|
||||
[super renderInContext:ctx];
|
||||
}
|
||||
|
||||
- (NSArray<CALayer<IJSVGDrawableLayer>*>*)debugLayers
|
||||
{
|
||||
return self.sublayers;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// IJSVGColorNode.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 29/03/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGNode.h>
|
||||
|
||||
@interface IJSVGColorNode : IJSVGNode {
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSColor* color;
|
||||
|
||||
+ (IJSVGNode*)colorNodeWithColor:(NSColor*)color;
|
||||
|
||||
- (id)initWithColor:(NSColor*)color;
|
||||
|
||||
@end
|
||||
@@ -1,39 +0,0 @@
|
||||
//
|
||||
// IJSVGColorNode.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 29/03/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGColorNode.h"
|
||||
|
||||
@implementation IJSVGColorNode
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_color release], _color = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (IJSVGNode*)colorNodeWithColor:(NSColor *)color
|
||||
{
|
||||
return [[[self alloc] initWithColor:color] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithColor:(NSColor*)color {
|
||||
if((self = [super init]) != nil) {
|
||||
[self addTraits:IJSVGNodeTraitPaintable];
|
||||
self.color = color;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)applyPropertiesFromNode:(IJSVGNode*)node
|
||||
{
|
||||
if([node isKindOfClass:self.class]) {
|
||||
self.color = ((IJSVGColorNode*)node).color;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// IJSVGGradient.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 03/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <IJSVG/IJSVGColorList.h>
|
||||
#import <IJSVG/IJSVGDef.h>
|
||||
#import <IJSVG/IJSVGTransform.h>
|
||||
#import <IJSVG/IJSVGGroup.h>
|
||||
|
||||
@interface IJSVGGradient : IJSVGGroup
|
||||
|
||||
@property (nonatomic, retain) NSGradient* gradient;
|
||||
@property (nonatomic, assign) CGGradientRef CGGradient;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* x1;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* x2;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* y1;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* y2;
|
||||
@property (nonatomic, retain) IJSVGColorList* colorList;
|
||||
|
||||
+ (CGFloat*)computeColorStops:(IJSVGGradient*)gradient
|
||||
colors:(NSArray**)someColors;
|
||||
|
||||
- (CGGradientRef)CGGradient;
|
||||
- (void)drawInContextRef:(CGContextRef)ctx
|
||||
objectRect:(NSRect)objectRect
|
||||
absoluteTransform:(CGAffineTransform)absoluteTransform
|
||||
viewPort:(CGRect)viewBox;
|
||||
|
||||
- (void)_debugStart:(CGPoint)startPoint
|
||||
end:(CGPoint)endPoint
|
||||
context:(CGContextRef)ctx;
|
||||
|
||||
- (IJSVGColorList*)colorList;
|
||||
- (IJSVGColorList*)computedColorList;
|
||||
|
||||
@end
|
||||
@@ -1,142 +0,0 @@
|
||||
//
|
||||
// IJSVGGradient.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 03/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGGradient.h"
|
||||
#import "IJSVGParser.h"
|
||||
|
||||
@implementation IJSVGGradient
|
||||
|
||||
@synthesize colorList = _privateColorList;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_x1 release]), _x1 = nil;
|
||||
(void)([_x2 release]), _x2 = nil;
|
||||
(void)([_y1 release]), _y1 = nil;
|
||||
(void)([_y2 release]), _y2 = nil;
|
||||
(void)([_gradient release]), _gradient = nil;
|
||||
(void)([_privateColorList release]), _privateColorList = nil;
|
||||
if (_CGGradient != nil) {
|
||||
CGGradientRelease(_CGGradient);
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGGradient* clone = [super copyWithZone:zone];
|
||||
clone.gradient = [[self.gradient copy] autorelease];
|
||||
return clone;
|
||||
}
|
||||
|
||||
- (void)setColorList:(IJSVGColorList*)list
|
||||
{
|
||||
(void)([_privateColorList release]), _privateColorList = nil;
|
||||
_privateColorList = list.retain;
|
||||
if (_CGGradient != nil) {
|
||||
CGGradientRelease(_CGGradient);
|
||||
_CGGradient = nil;
|
||||
}
|
||||
}
|
||||
|
||||
+ (CGFloat *)computeColorStops:(IJSVGGradient*)gradient
|
||||
colors:(NSArray**)someColors
|
||||
{
|
||||
NSArray<IJSVGNode*>* stops = gradient.children;
|
||||
NSMutableArray* colors = [[[NSMutableArray alloc] initWithCapacity:stops.count] autorelease];
|
||||
CGFloat* stopsParams = (CGFloat*)malloc(stops.count * sizeof(CGFloat));
|
||||
|
||||
NSInteger i = 0;
|
||||
for(IJSVGNode* stopNode in stops) {
|
||||
NSColor* color = ((IJSVGColorNode*)(stopNode.fill)).color;
|
||||
CGFloat opacity = stopNode.fillOpacity.value;
|
||||
CGFloat offset = stopNode.offset.value;
|
||||
stopsParams[i++] = offset;
|
||||
if(color == nil) {
|
||||
color = [IJSVGColor colorFromHEXInteger:0x000000];
|
||||
if(opacity != 1.f) {
|
||||
color = [IJSVGColor changeAlphaOnColor:color
|
||||
to:opacity];
|
||||
}
|
||||
}
|
||||
[colors addObject:color];
|
||||
}
|
||||
*someColors = (NSArray*)colors;
|
||||
return stopsParams;
|
||||
}
|
||||
|
||||
- (IJSVGColorList*)colorList
|
||||
{
|
||||
IJSVGColorList* sheet = [[[IJSVGColorList alloc] init] autorelease];
|
||||
NSInteger num = self.gradient.numberOfColorStops;
|
||||
for (NSInteger i = 0; i < num; i++) {
|
||||
NSColor* color;
|
||||
[self.gradient getColor:&color
|
||||
location:nil
|
||||
atIndex:i];
|
||||
IJSVGColorType* type = [IJSVGColorType typeWithColor:color
|
||||
flags:IJSVGColorTypeFlagStop];
|
||||
[sheet addColor:type];
|
||||
}
|
||||
return sheet;
|
||||
}
|
||||
|
||||
- (IJSVGColorList*)computedColorList
|
||||
{
|
||||
return _privateColorList;
|
||||
}
|
||||
|
||||
- (CGGradientRef)CGGradient
|
||||
{
|
||||
// store it in the cache
|
||||
if (_CGGradient != nil) {
|
||||
return _CGGradient;
|
||||
}
|
||||
|
||||
// actually create the gradient
|
||||
NSInteger num = self.gradient.numberOfColorStops;
|
||||
CGFloat* locations = (CGFloat*)malloc(sizeof(CGFloat) * num);
|
||||
CFMutableArrayRef colors = CFArrayCreateMutable(kCFAllocatorDefault, (CFIndex)num,
|
||||
&kCFTypeArrayCallBacks);
|
||||
for (NSInteger i = 0; i < num; i++) {
|
||||
NSColor* color;
|
||||
[self.gradient getColor:&color
|
||||
location:&locations[i]
|
||||
atIndex:i];
|
||||
if (_privateColorList != nil) {
|
||||
color = [_privateColorList proposedColorForColor:color];
|
||||
}
|
||||
CFArrayAppendValue(colors, color.CGColor);
|
||||
}
|
||||
CGGradientRef result = CGGradientCreateWithColors(_gradient.colorSpace.CGColorSpace,
|
||||
colors, locations);
|
||||
CFRelease(colors);
|
||||
free(locations);
|
||||
return _CGGradient = result;
|
||||
}
|
||||
|
||||
- (void)drawInContextRef:(CGContextRef)ctx
|
||||
objectRect:(NSRect)objectRect
|
||||
absoluteTransform:(CGAffineTransform)absoluteTransform
|
||||
viewPort:(CGRect)viewBox
|
||||
{
|
||||
}
|
||||
|
||||
- (void)_debugStart:(CGPoint)startPoint
|
||||
end:(CGPoint)endPoint
|
||||
context:(CGContextRef)ctx
|
||||
{
|
||||
CGContextSaveGState(ctx);
|
||||
CGContextSetStrokeColorWithColor(ctx, NSColor.blackColor.CGColor);
|
||||
CGContextSetLineWidth(ctx, 1.f);
|
||||
CGContextMoveToPoint(ctx, startPoint.x, startPoint.y);
|
||||
CGContextAddLineToPoint(ctx, endPoint.x, endPoint.y);
|
||||
CGContextStrokePath(ctx);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// IJSVGGroup.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGGroup.h"
|
||||
|
||||
@implementation IJSVGGroup
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_children release]), _children = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
_children = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)prepareFromCopy
|
||||
{
|
||||
if(_children != nil) {
|
||||
(void)[_children release], _children = nil;
|
||||
}
|
||||
_children = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGGroup* node = [super copyWithZone:zone];
|
||||
[node prepareFromCopy];
|
||||
|
||||
for (IJSVGNode* childNode in _children) {
|
||||
childNode = [[childNode copy] autorelease];
|
||||
childNode.parentNode = node;
|
||||
[node addChild:childNode];
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
- (void)addChild:(IJSVGNode*)child
|
||||
{
|
||||
if(child == nil || (child.parentNode == self && [_children containsObject:child])) {
|
||||
return;
|
||||
}
|
||||
child.parentNode = self;
|
||||
[_children addObject:child];
|
||||
}
|
||||
|
||||
- (void)removeChild:(IJSVGNode*)child
|
||||
{
|
||||
if(child.parentNode == self) {
|
||||
[child detach];
|
||||
}
|
||||
[_children removeObject:child];
|
||||
}
|
||||
|
||||
- (CGRect)bounds
|
||||
{
|
||||
CGRect rect = CGRectZero;
|
||||
for(IJSVGNode* node in self.children) {
|
||||
rect = CGRectUnion(rect, node.bounds);
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (NSArray<IJSVGNode*>*)children
|
||||
{
|
||||
return _children;
|
||||
}
|
||||
|
||||
- (NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ - %@",
|
||||
[super description], self.children];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// IJSVGImage.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 28/05/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGNode.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class IJSVGPath;
|
||||
|
||||
@interface IJSVGImage : IJSVGNode {
|
||||
CGImageRef CGImage;
|
||||
}
|
||||
|
||||
@property (nonatomic, readonly) CGSize intrinsicSize;
|
||||
@property (nonatomic, readonly) CGRect intrinsicBounds;
|
||||
@property (nonatomic, readonly) CGAffineTransform intrinsicTransform;
|
||||
@property (nonatomic, retain) NSImage* image;
|
||||
|
||||
- (CGImageRef)CGImage;
|
||||
- (void)loadFromString:(NSString*)encodedString;
|
||||
- (void)loadFromURL:(NSURL*)aURL;
|
||||
|
||||
@end
|
||||
@@ -1,98 +0,0 @@
|
||||
//
|
||||
// IJSVGImage.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 28/05/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGImage.h"
|
||||
#import "IJSVGPath.h"
|
||||
#import "IJSVGTransform.h"
|
||||
|
||||
@implementation IJSVGImage
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)(CGImageRelease(CGImage)), CGImage = nil;
|
||||
(void)([_image release]), _image = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)loadFromString:(NSString*)encodedString
|
||||
{
|
||||
if ([encodedString hasPrefix:@"data:"]) {
|
||||
encodedString = [encodedString stringByReplacingOccurrencesOfString:@"\\s+"
|
||||
withString:@""
|
||||
options:NSRegularExpressionSearch
|
||||
range:NSMakeRange(0, encodedString.length)];
|
||||
}
|
||||
NSURL* url = [NSURL URLWithString:encodedString];
|
||||
if(url != nil) {
|
||||
[self loadFromURL:url];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadFromURL:(NSURL*)aURL
|
||||
{
|
||||
NSData* data = [NSData dataWithContentsOfURL:aURL];
|
||||
|
||||
// no data, just ignore...invalid probably
|
||||
if (data == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set the image against the container
|
||||
NSImage* anImage = [[[NSImage alloc] initWithData:data] autorelease];
|
||||
[self setImage:anImage];
|
||||
}
|
||||
|
||||
- (void)setImage:(NSImage*)anImage
|
||||
{
|
||||
if (_image != nil) {
|
||||
(void)([_image release]), _image = nil;
|
||||
}
|
||||
_image = [anImage retain];
|
||||
_intrinsicSize = (CGSize)_image.size;
|
||||
|
||||
if (CGImage != nil) {
|
||||
CGImageRelease(CGImage);
|
||||
CGImage = nil;
|
||||
}
|
||||
|
||||
NSRect rect = NSMakeRect(0.f, 0.f, _intrinsicSize.width, _intrinsicSize.height);
|
||||
CGImage = [_image CGImageForProposedRect:&rect
|
||||
context:nil
|
||||
hints:nil];
|
||||
|
||||
CGImageRetain(CGImage);
|
||||
}
|
||||
|
||||
- (CGImageRef)CGImage
|
||||
{
|
||||
return CGImage;
|
||||
}
|
||||
|
||||
- (CGRect)intrinsicBounds
|
||||
{
|
||||
CGRect rect = CGRectZero;
|
||||
rect.size.width = _intrinsicSize.width;
|
||||
rect.size.height = _intrinsicSize.height;
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (CGAffineTransform)intrinsicTransform
|
||||
{
|
||||
CGFloat widthRatio = self.width.value / _intrinsicSize.width;
|
||||
CGFloat heightRatio = self.height.value / _intrinsicSize.height;
|
||||
return CGAffineTransformMakeScale(widthRatio, heightRatio);
|
||||
}
|
||||
|
||||
- (CGRect)bounds
|
||||
{
|
||||
return CGRectMake(0.f, 0.f,
|
||||
self.width.value,
|
||||
self.height.value);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,85 +0,0 @@
|
||||
//
|
||||
// IJSVGGradient.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 03/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGLinearGradient.h"
|
||||
#import "IJSVGUtils.h"
|
||||
#import "IJSVGParser.h"
|
||||
|
||||
@implementation IJSVGLinearGradient
|
||||
|
||||
+ (NSGradient*)parseGradient:(NSXMLElement*)element
|
||||
gradient:(IJSVGLinearGradient*)aGradient
|
||||
{
|
||||
// just ask unit for the value
|
||||
NSString* x1 = ([element attributeForName:IJSVGAttributeX1].stringValue ?: @"0");
|
||||
NSString* x2 = ([element attributeForName:IJSVGAttributeX2].stringValue ?: @"100%");
|
||||
NSString* y1 = ([element attributeForName:IJSVGAttributeY1].stringValue ?: @"0");
|
||||
NSString* y2 = ([element attributeForName:IJSVGAttributeY2].stringValue ?: @"0");
|
||||
aGradient.x1 = [IJSVGGradientUnitLength unitWithString:x1 fromUnitType:aGradient.units];
|
||||
aGradient.x2 = [IJSVGGradientUnitLength unitWithString:x2 fromUnitType:aGradient.units];
|
||||
aGradient.y1 = [IJSVGGradientUnitLength unitWithString:y1 fromUnitType:aGradient.units];
|
||||
aGradient.y2 = [IJSVGGradientUnitLength unitWithString:y2 fromUnitType:aGradient.units];
|
||||
|
||||
// compute the color stops and colours
|
||||
NSArray* colors = nil;
|
||||
CGFloat* stopsParams = [self.class computeColorStops:aGradient
|
||||
colors:&colors];
|
||||
|
||||
// create the gradient with the colours
|
||||
NSGradient* grad = [[NSGradient alloc] initWithColors:colors
|
||||
atLocations:stopsParams
|
||||
colorSpace:IJSVGColor.defaultColorSpace];
|
||||
|
||||
free(stopsParams);
|
||||
return [grad autorelease];
|
||||
}
|
||||
|
||||
- (void)drawInContextRef:(CGContextRef)ctx
|
||||
objectRect:(NSRect)objectRect
|
||||
absoluteTransform:(CGAffineTransform)absoluteTransform
|
||||
viewPort:(CGRect)viewBox
|
||||
{
|
||||
BOOL inUserSpace = self.units == IJSVGUnitUserSpaceOnUse;
|
||||
|
||||
CGPoint gradientStartPoint = CGPointZero;
|
||||
CGPoint gradientEndPoint = CGPointZero;
|
||||
CGAffineTransform selfTransform = IJSVGConcatTransforms(self.transforms);
|
||||
|
||||
CGRect boundingBox = inUserSpace ? viewBox : objectRect;
|
||||
|
||||
// make sure we apply the absolute position to
|
||||
// transform us back into the correct space
|
||||
if (inUserSpace == YES) {
|
||||
CGContextConcatCTM(ctx, absoluteTransform);
|
||||
}
|
||||
|
||||
CGFloat width = CGRectGetWidth(boundingBox);
|
||||
CGFloat height = CGRectGetHeight(boundingBox);
|
||||
gradientStartPoint = CGPointMake([self.x1 computeValue:width],
|
||||
[self.y1 computeValue:height]);
|
||||
|
||||
gradientEndPoint = CGPointMake([self.x2 computeValue:width],
|
||||
[self.y2 computeValue:height]);
|
||||
|
||||
// transform the context
|
||||
CGContextConcatCTM(ctx, selfTransform);
|
||||
|
||||
// draw the gradient
|
||||
CGGradientDrawingOptions options = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
|
||||
|
||||
CGContextDrawLinearGradient(ctx, self.CGGradient, gradientStartPoint,
|
||||
gradientEndPoint, options);
|
||||
|
||||
#ifdef IJSVG_DEBUG
|
||||
[self _debugStart:gradientStartPoint
|
||||
end:gradientEndPoint
|
||||
context:ctx];
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,182 +0,0 @@
|
||||
//
|
||||
// IJSVGNode.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGStyle.h>
|
||||
#import <IJSVG/IJSVGUnitLength.h>
|
||||
#import <IJSVG/IJSVGViewBox.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class IJSVGNode;
|
||||
@class IJSVG;
|
||||
@class IJSVGGroup;
|
||||
@class IJSVGGradient;
|
||||
@class IJSVGGroup;
|
||||
@class IJSVGPattern;
|
||||
@class IJSVGTransform;
|
||||
@class IJSVGRootNode;
|
||||
@class IJSVGUnitRect;
|
||||
|
||||
typedef void (^IJSVGNodeWalkHandler)(IJSVGNode* node, BOOL* allowChildNodes, BOOL* stop);
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, IJSVGNodeTraits) {
|
||||
IJSVGNodeTraitNone = 0,
|
||||
IJSVGNodeTraitStroked = 1 << 0,
|
||||
IJSVGNodeTraitPaintable = 1 << 1
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGNodeType) {
|
||||
IJSVGNodeTypeGroup,
|
||||
IJSVGNodeTypePath,
|
||||
IJSVGNodeTypeDef,
|
||||
IJSVGNodeTypePolygon,
|
||||
IJSVGNodeTypePolyline,
|
||||
IJSVGNodeTypeRect,
|
||||
IJSVGNodeTypeLine,
|
||||
IJSVGNodeTypeCircle,
|
||||
IJSVGNodeTypeEllipse,
|
||||
IJSVGNodeTypeUse,
|
||||
IJSVGNodeTypeLinearGradient,
|
||||
IJSVGNodeTypeRadialGradient,
|
||||
IJSVGNodeTypeClipPath,
|
||||
IJSVGNodeTypeFont,
|
||||
IJSVGNodeTypeGlyph,
|
||||
IJSVGNodeTypeMask,
|
||||
IJSVGNodeTypeImage,
|
||||
IJSVGNodeTypePattern,
|
||||
IJSVGNodeTypeSVG,
|
||||
IJSVGNodeTypeText,
|
||||
IJSVGNodeTypeTextSpan,
|
||||
IJSVGNodeTypeStyle,
|
||||
IJSVGNodeTypeSwitch,
|
||||
IJSVGNodeTypeTitle,
|
||||
IJSVGNodeTypeDesc,
|
||||
IJSVGNodeTypeStop,
|
||||
IJSVGNodeTypeNotFound,
|
||||
IJSVGNodeTypeUnknown,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGWindingRule) {
|
||||
IJSVGWindingRuleNonZero,
|
||||
IJSVGWindingRuleEvenOdd,
|
||||
IJSVGWindingRuleInherit
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGLineCapStyle) {
|
||||
IJSVGLineCapStyleNone,
|
||||
IJSVGLineCapStyleButt,
|
||||
IJSVGLineCapStyleRound,
|
||||
IJSVGLineCapStyleSquare,
|
||||
IJSVGLineCapStyleInherit
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGLineJoinStyle) {
|
||||
IJSVGLineJoinStyleNone,
|
||||
IJSVGLineJoinStyleMiter,
|
||||
IJSVGLineJoinStyleRound,
|
||||
IJSVGLineJoinStyleBevel,
|
||||
IJSVGLineJoinStyleInherit
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSInteger, IJSVGFontTraits) {
|
||||
IJSVGFontTraitNone = 1 << 0,
|
||||
IJSVGFontTraitBold = 1 << 1,
|
||||
IJSVGFontTraitItalic = 1 << 2
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGBlendMode) {
|
||||
IJSVGBlendModeNormal = kCGBlendModeNormal,
|
||||
IJSVGBlendModeMultiply = kCGBlendModeMultiply,
|
||||
IJSVGBlendModeScreen = kCGBlendModeScreen,
|
||||
IJSVGBlendModeOverlay = kCGBlendModeOverlay,
|
||||
IJSVGBlendModeDarken = kCGBlendModeDarken,
|
||||
IJSVGBlendModeLighten = kCGBlendModeLighten,
|
||||
IJSVGBlendModeColorDodge = kCGBlendModeColorDodge,
|
||||
IJSVGBlendModeColorBurn = kCGBlendModeColorBurn,
|
||||
IJSVGBlendModeHardLight = kCGBlendModeHardLight,
|
||||
IJSVGBlendModeSoftLight = kCGBlendModeSoftLight,
|
||||
IJSVGBlendModeDifference = kCGBlendModeDifference,
|
||||
IJSVGBlendModeExclusion = kCGBlendModeExclusion,
|
||||
IJSVGBlendModeHue = kCGBlendModeHue,
|
||||
IJSVGBlendModeSaturation = kCGBlendModeSaturation,
|
||||
IJSVGBlendModeColor = kCGBlendModeColor,
|
||||
IJSVGBlendModeLuminosity = kCGBlendModeLuminosity
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGOverflowVisibility) {
|
||||
IJSVGOverflowVisibilityHidden,
|
||||
IJSVGOverflowVisibilityVisible
|
||||
};
|
||||
|
||||
static CGFloat IJSVGInheritedFloatValue = -99.9999991;
|
||||
|
||||
@interface IJSVGNode : NSObject <NSCopying>
|
||||
|
||||
void IJSVGAssertPaintableObject(id object);
|
||||
|
||||
@property (nonatomic, assign) IJSVGNodeTraits traits;
|
||||
@property (nonatomic, assign, readonly) CGRect bounds;
|
||||
@property (nonatomic, retain) IJSVGUnitRect* viewBox;
|
||||
@property (nonatomic, assign) IJSVGViewBoxAlignment viewBoxAlignment;
|
||||
@property (nonatomic, assign) IJSVGViewBoxMeetOrSlice viewBoxMeetOrSlice;
|
||||
@property (nonatomic, copy) NSString* title;
|
||||
@property (nonatomic, copy) NSString* desc;
|
||||
@property (nonatomic, assign) IJSVGNodeType type;
|
||||
@property (nonatomic, copy) NSString* name;
|
||||
@property (nonatomic, copy) NSString* className;
|
||||
@property (nonatomic, retain) NSArray* classNameList;
|
||||
@property (nonatomic, copy) NSString* unicode;
|
||||
@property (nonatomic, assign) BOOL shouldRender;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* x;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* y;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* width;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* height;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* opacity;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* fillOpacity;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* strokeOpacity;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* strokeWidth;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* offset;
|
||||
@property (nonatomic, retain) IJSVGNode* fill;
|
||||
@property (nonatomic, retain) IJSVGNode* stroke;
|
||||
@property (nonatomic, copy) NSString* identifier;
|
||||
@property (nonatomic, assign) IJSVGNode* parentNode;
|
||||
@property (nonatomic, retain) IJSVGGroup* clipPath;
|
||||
@property (nonatomic, retain) IJSVGGroup* mask;
|
||||
@property (nonatomic, assign) IJSVGWindingRule windingRule;
|
||||
@property (nonatomic, assign) IJSVGLineCapStyle lineCapStyle;
|
||||
@property (nonatomic, assign) IJSVGLineJoinStyle lineJoinStyle;
|
||||
@property (nonatomic, retain) NSArray<IJSVGTransform*>* transforms;
|
||||
@property (nonatomic, assign) CGFloat* strokeDashArray;
|
||||
@property (nonatomic, assign) NSInteger strokeDashArrayCount;
|
||||
@property (nonatomic, readonly) NSArray<NSNumber*>* lineDashPattern;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* strokeDashOffset;
|
||||
@property (nonatomic, retain) IJSVG* svg;
|
||||
@property (nonatomic, assign) IJSVGUnitType contentUnits;
|
||||
@property (nonatomic, assign) IJSVGUnitType units;
|
||||
@property (nonatomic, assign) IJSVGBlendMode blendMode;
|
||||
@property (nonatomic, assign) IJSVGOverflowVisibility overflowVisibility;
|
||||
|
||||
+ (void)walkNodeTree:(IJSVGNode*)node
|
||||
handler:(IJSVGNodeWalkHandler)handler;
|
||||
|
||||
+ (IJSVGNodeType)typeForString:(NSString*)string
|
||||
kind:(NSXMLNodeKind)kind;
|
||||
|
||||
- (void)applyPropertiesFromNode:(IJSVGNode*)node;
|
||||
|
||||
- (IJSVGUnitType)contentUnitsWithReferencingNodeBounds:(CGRect*)bounds;
|
||||
- (IJSVGUnitType)contentUnitsWithReferencingNode:(IJSVGNode**)referencingNode;
|
||||
|
||||
- (instancetype)detach;
|
||||
|
||||
- (void)addTraits:(IJSVGNodeTraits)traits;
|
||||
- (void)removeTraits:(IJSVGNodeTraits)traits;
|
||||
- (BOOL)matchesTraits:(IJSVGNodeTraits)traits;
|
||||
- (void)computeTraits;
|
||||
|
||||
@end
|
||||
@@ -1,448 +0,0 @@
|
||||
//
|
||||
// IJSVGNode.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGDef.h>
|
||||
#import <IJSVG/IJSVGNode.h>
|
||||
#import <IJSVG/IJSVGGroup.h>
|
||||
#import <IJSVG/IJSVGUtils.h>
|
||||
|
||||
@implementation IJSVGNode
|
||||
|
||||
@synthesize fill = _fill;
|
||||
@synthesize stroke = _stroke;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)free(_strokeDashArray), _strokeDashArray = NULL;
|
||||
(void)([_x release]), _x = nil;
|
||||
(void)([_y release]), _y = nil;
|
||||
(void)([_width release]), _width = nil;
|
||||
(void)([_height release]), _height = nil;
|
||||
(void)([_opacity release]), _opacity = nil;
|
||||
(void)([_offset release]), _offset = nil;
|
||||
(void)([_fillOpacity release]), _fillOpacity = nil;
|
||||
(void)([_strokeOpacity release]), _strokeOpacity = nil;
|
||||
(void)([_strokeWidth release]), _strokeWidth = nil;
|
||||
(void)([_strokeDashOffset release]), _strokeDashOffset = nil;
|
||||
(void)([_unicode release]), _unicode = nil;
|
||||
(void)([_fill release]), _fill = nil;
|
||||
(void)([_stroke release]), _stroke = nil;
|
||||
(void)([_transforms release]), _transforms = nil;
|
||||
(void)([_identifier release]), _identifier = nil;
|
||||
(void)([_name release]), _name = nil;
|
||||
(void)([_title release]), _title = nil;
|
||||
(void)([_desc release]), _desc = nil;
|
||||
(void)([_className release]), _className = nil;
|
||||
(void)([_classNameList release]), _classNameList = nil;
|
||||
(void)([_clipPath release]), _clipPath = nil;
|
||||
(void)([_svg release]), _svg = nil;
|
||||
(void)([_mask release]), _mask = nil;
|
||||
(void)([_viewBox release]), _viewBox = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (IJSVGNodeType)typeForString:(NSString*)string
|
||||
kind:(NSXMLNodeKind)kind
|
||||
{
|
||||
// possible fix for older os's that complain
|
||||
if(string == nil || kind == NSXMLCommentKind) {
|
||||
return IJSVGNodeTypeNotFound;
|
||||
}
|
||||
|
||||
const char* name = string.lowercaseString.UTF8String;
|
||||
if(name == NULL) {
|
||||
return IJSVGNodeTypeNotFound;
|
||||
}
|
||||
if (strcmp(name, "style") == 0) {
|
||||
return IJSVGNodeTypeStyle;
|
||||
}
|
||||
if (strcmp(name, "switch") == 0) {
|
||||
return IJSVGNodeTypeSwitch;
|
||||
}
|
||||
if (strcmp(name, "defs") == 0) {
|
||||
return IJSVGNodeTypeDef;
|
||||
}
|
||||
if (strcmp(name, "g") == 0) {
|
||||
return IJSVGNodeTypeGroup;
|
||||
}
|
||||
if (strcmp(name, "path") == 0) {
|
||||
return IJSVGNodeTypePath;
|
||||
}
|
||||
if (strcmp(name, "polygon") == 0) {
|
||||
return IJSVGNodeTypePolygon;
|
||||
}
|
||||
if (strcmp(name, "polyline") == 0) {
|
||||
return IJSVGNodeTypePolyline;
|
||||
}
|
||||
if (strcmp(name, "rect") == 0) {
|
||||
return IJSVGNodeTypeRect;
|
||||
}
|
||||
if (strcmp(name, "line") == 0) {
|
||||
return IJSVGNodeTypeLine;
|
||||
}
|
||||
if (strcmp(name, "circle") == 0) {
|
||||
return IJSVGNodeTypeCircle;
|
||||
}
|
||||
if (strcmp(name, "ellipse") == 0) {
|
||||
return IJSVGNodeTypeEllipse;
|
||||
}
|
||||
if (strcmp(name, "use") == 0) {
|
||||
return IJSVGNodeTypeUse;
|
||||
}
|
||||
if (strcmp(name, "lineargradient") == 0) {
|
||||
return IJSVGNodeTypeLinearGradient;
|
||||
}
|
||||
if (strcmp(name, "radialgradient") == 0) {
|
||||
return IJSVGNodeTypeRadialGradient;
|
||||
}
|
||||
if(strcmp(name, "stop") == 0) {
|
||||
return IJSVGNodeTypeStop;
|
||||
}
|
||||
if (strcmp(name, "glyph") == 0) {
|
||||
return IJSVGNodeTypeGlyph;
|
||||
}
|
||||
if (strcmp(name, "font") == 0) {
|
||||
return IJSVGNodeTypeFont;
|
||||
}
|
||||
if (strcmp(name, "clippath") == 0) {
|
||||
return IJSVGNodeTypeClipPath;
|
||||
}
|
||||
if (strcmp(name, "mask") == 0) {
|
||||
return IJSVGNodeTypeMask;
|
||||
}
|
||||
if (strcmp(name, "image") == 0) {
|
||||
return IJSVGNodeTypeImage;
|
||||
}
|
||||
if (strcmp(name, "pattern") == 0) {
|
||||
return IJSVGNodeTypePattern;
|
||||
}
|
||||
if (strcmp(name, "svg") == 0) {
|
||||
return IJSVGNodeTypeSVG;
|
||||
}
|
||||
if (strcmp(name, "text") == 0) {
|
||||
return IJSVGNodeTypeText;
|
||||
}
|
||||
if (strcmp(name, "tspan") == 0 || kind == NSXMLTextKind) {
|
||||
return IJSVGNodeTypeTextSpan;
|
||||
}
|
||||
if(strcmp(name, "title") == 0) {
|
||||
return IJSVGNodeTypeTitle;
|
||||
}
|
||||
if(strcmp(name, "desc") == 0) {
|
||||
return IJSVGNodeTypeDesc;
|
||||
}
|
||||
return IJSVGNodeTypeUnknown;
|
||||
}
|
||||
|
||||
+ (void)walkNodeTree:(IJSVGNode*)node
|
||||
handler:(IJSVGNodeWalkHandler)handler
|
||||
{
|
||||
BOOL allowChildNodes = YES;
|
||||
BOOL stop = NO;
|
||||
[self _walkNodeTree:node
|
||||
handler:handler
|
||||
allowChildNodes:&allowChildNodes
|
||||
stop:&stop];
|
||||
}
|
||||
|
||||
+ (void)_walkNodeTree:(IJSVGNode*)node
|
||||
handler:(IJSVGNodeWalkHandler)handler
|
||||
allowChildNodes:(BOOL*)allowChildNodes
|
||||
stop:(BOOL*)stop
|
||||
{
|
||||
// run the handler and instantly stop
|
||||
// if stop is set
|
||||
handler(node, allowChildNodes, stop);
|
||||
if(*stop == YES) {
|
||||
return;
|
||||
}
|
||||
|
||||
// child nodes only work for nodes
|
||||
// that are type group
|
||||
if(*allowChildNodes == NO ||
|
||||
[node isKindOfClass:IJSVGGroup.class] == NO) {
|
||||
*allowChildNodes = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
// iterate over the childnodes
|
||||
IJSVGGroup* group = (IJSVGGroup*)node;
|
||||
for(IJSVGNode* childNode in group.children) {
|
||||
[self _walkNodeTree:childNode
|
||||
handler:handler
|
||||
allowChildNodes:allowChildNodes
|
||||
stop:stop];
|
||||
if(*stop == YES) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
self.opacity = [IJSVGUnitLength unitWithFloat:1.f];
|
||||
self.fillOpacity = [IJSVGUnitLength unitWithFloat:1.f];
|
||||
self.fillOpacity.inherit = YES;
|
||||
|
||||
self.strokeDashOffset = [IJSVGUnitLength unitWithFloat:0.f];
|
||||
self.shouldRender = YES;
|
||||
|
||||
self.strokeOpacity = [IJSVGUnitLength unitWithFloat:1.f];
|
||||
self.strokeOpacity.inherit = YES;
|
||||
|
||||
self.strokeWidth = [IJSVGUnitLength unitWithFloat:1.f];
|
||||
self.strokeWidth.inherit = YES;
|
||||
|
||||
self.windingRule = IJSVGWindingRuleInherit;
|
||||
self.lineCapStyle = IJSVGLineCapStyleInherit;
|
||||
self.lineJoinStyle = IJSVGLineJoinStyleInherit;
|
||||
self.units = IJSVGUnitInherit;
|
||||
self.contentUnits = IJSVGUnitInherit;
|
||||
|
||||
self.blendMode = IJSVGBlendModeNormal;
|
||||
self.overflowVisibility = IJSVGOverflowVisibilityVisible;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)applyPropertiesFromNode:(IJSVGNode*)node
|
||||
{
|
||||
self.title = node.title;
|
||||
self.desc = node.desc;
|
||||
|
||||
self.name = node.name;
|
||||
self.type = node.type;
|
||||
self.unicode = node.unicode;
|
||||
self.className = node.className;
|
||||
self.classNameList = node.classNameList;
|
||||
|
||||
self.viewBox = node.viewBox;
|
||||
self.viewBoxAlignment = node.viewBoxAlignment;
|
||||
self.viewBoxMeetOrSlice = node.viewBoxMeetOrSlice;
|
||||
|
||||
self.x = node.x;
|
||||
self.y = node.y;
|
||||
self.width = node.width;
|
||||
self.height = node.height;
|
||||
|
||||
self.fill = node.fill;
|
||||
self.stroke = node.stroke;
|
||||
self.clipPath = node.clipPath;
|
||||
|
||||
self.units = node.units;
|
||||
self.contentUnits = node.contentUnits;
|
||||
|
||||
self.opacity = node.opacity;
|
||||
self.strokeWidth = node.strokeWidth;
|
||||
self.fillOpacity = node.fillOpacity;
|
||||
self.strokeOpacity = node.strokeOpacity;
|
||||
|
||||
self.identifier = node.identifier;
|
||||
|
||||
self.transforms = node.transforms;
|
||||
self.windingRule = node.windingRule;
|
||||
self.lineCapStyle = node.lineCapStyle;
|
||||
self.lineJoinStyle = node.lineJoinStyle;
|
||||
self.parentNode = node.parentNode;
|
||||
|
||||
self.shouldRender = node.shouldRender;
|
||||
self.blendMode = node.blendMode;
|
||||
self.overflowVisibility = node.overflowVisibility;
|
||||
|
||||
// dash array needs physical memory copied
|
||||
CGFloat* nStrokeDashArray = (CGFloat*)malloc(node.strokeDashArrayCount * sizeof(CGFloat));
|
||||
memcpy(self.strokeDashArray, nStrokeDashArray, node.strokeDashArrayCount * sizeof(CGFloat));
|
||||
self.strokeDashArray = nStrokeDashArray;
|
||||
self.strokeDashArrayCount = node.strokeDashArrayCount;
|
||||
self.strokeDashOffset = node.strokeDashOffset;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGNode* node = [self.class allocWithZone:zone];
|
||||
[node applyPropertiesFromNode:self];
|
||||
return node;
|
||||
}
|
||||
|
||||
- (void)setFill:(IJSVGNode*)fill
|
||||
{
|
||||
NSAssert([fill matchesTraits:IJSVGNodeTraitPaintable] || fill == nil, @"Fill must a paintable node.");
|
||||
(void)[_fill release], _fill = nil;
|
||||
_fill = [fill retain];
|
||||
}
|
||||
|
||||
- (void)setStroke:(IJSVGNode*)stroke
|
||||
{
|
||||
NSAssert([stroke matchesTraits:IJSVGNodeTraitPaintable]|| stroke == nil, @"Stroke must be a paintable node.");
|
||||
(void)[_stroke release], _stroke = nil;
|
||||
_stroke = [stroke retain];
|
||||
}
|
||||
|
||||
// winding rule can inherit..
|
||||
- (IJSVGWindingRule)windingRule
|
||||
{
|
||||
if (_windingRule == IJSVGWindingRuleInherit && _parentNode != nil) {
|
||||
return _parentNode.windingRule;
|
||||
}
|
||||
return _windingRule;
|
||||
}
|
||||
|
||||
- (IJSVGLineCapStyle)lineCapStyle
|
||||
{
|
||||
if (_lineCapStyle == IJSVGLineCapStyleInherit) {
|
||||
if (_parentNode != nil) {
|
||||
return _parentNode.lineCapStyle;
|
||||
}
|
||||
}
|
||||
return _lineCapStyle;
|
||||
}
|
||||
|
||||
- (IJSVGLineJoinStyle)lineJoinStyle
|
||||
{
|
||||
if (_lineJoinStyle == IJSVGLineJoinStyleInherit) {
|
||||
if (_parentNode != nil) {
|
||||
return _parentNode.lineJoinStyle;
|
||||
}
|
||||
}
|
||||
return _lineJoinStyle;
|
||||
}
|
||||
|
||||
// these are all recursive, so go up the chain
|
||||
// if they dont exist on this specific node
|
||||
- (IJSVGUnitLength*)opacity
|
||||
{
|
||||
if (_opacity.inherit && _parentNode != nil) {
|
||||
return _parentNode.opacity;
|
||||
}
|
||||
return _opacity;
|
||||
}
|
||||
|
||||
// these are all recursive, so go up the chain
|
||||
// if they dont exist on this specific node
|
||||
- (IJSVGUnitLength*)fillOpacity
|
||||
{
|
||||
if (_fillOpacity.inherit && _parentNode != nil) {
|
||||
return _parentNode.fillOpacity;
|
||||
}
|
||||
return _fillOpacity;
|
||||
}
|
||||
|
||||
// these are all recursive, so go up the chain
|
||||
// if they dont exist on this specific node
|
||||
- (IJSVGUnitLength*)strokeWidth
|
||||
{
|
||||
if (_strokeWidth.inherit && _parentNode != nil) {
|
||||
return _parentNode.strokeWidth;
|
||||
}
|
||||
return _strokeWidth;
|
||||
}
|
||||
|
||||
- (NSArray<NSNumber*>*)lineDashPattern
|
||||
{
|
||||
NSMutableArray* arr = [[[NSMutableArray alloc] initWithCapacity:self.strokeDashArrayCount] autorelease];
|
||||
for (NSInteger i = 0; i < self.strokeDashArrayCount; i++) {
|
||||
[arr addObject:@((CGFloat)self.strokeDashArray[i])];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
// these are all recursive, so go up the chain
|
||||
// if they dont exist on this specific node
|
||||
- (IJSVGNode*)stroke
|
||||
{
|
||||
if (_stroke == nil && _parentNode != nil) {
|
||||
return _parentNode.stroke;
|
||||
}
|
||||
return _stroke;
|
||||
}
|
||||
|
||||
- (IJSVGUnitLength*)strokeOpacity
|
||||
{
|
||||
if (_strokeOpacity.inherit && _parentNode != nil) {
|
||||
return _parentNode.strokeOpacity;
|
||||
}
|
||||
return _strokeOpacity;
|
||||
}
|
||||
|
||||
// even though the spec explicity states fill color
|
||||
// must be on the path, it can also be on the
|
||||
- (IJSVGNode*)fill
|
||||
{
|
||||
if (_fill == nil && _parentNode != nil) {
|
||||
return _parentNode.fill;
|
||||
}
|
||||
return _fill;
|
||||
}
|
||||
|
||||
- (IJSVGUnitType)units
|
||||
{
|
||||
if(_units == IJSVGUnitInherit && _parentNode != nil) {
|
||||
return _parentNode.units;
|
||||
}
|
||||
return _units;
|
||||
}
|
||||
|
||||
- (IJSVGUnitType)contentUnits
|
||||
{
|
||||
if(_contentUnits == IJSVGUnitInherit && _parentNode != nil) {
|
||||
return _parentNode.contentUnits;
|
||||
}
|
||||
return _contentUnits;
|
||||
}
|
||||
|
||||
- (IJSVGUnitType)contentUnitsWithReferencingNodeBounds:(CGRect*)bounds
|
||||
{
|
||||
IJSVGNode* node = nil;
|
||||
IJSVGUnitType type = [self contentUnitsWithReferencingNode:&node];
|
||||
*bounds = node.parentNode.bounds;
|
||||
return type;
|
||||
}
|
||||
|
||||
- (IJSVGUnitType)contentUnitsWithReferencingNode:(IJSVGNode**)referencingNode
|
||||
{
|
||||
if(_contentUnits == IJSVGUnitInherit && _parentNode != nil) {
|
||||
return [_parentNode contentUnitsWithReferencingNode:referencingNode];
|
||||
}
|
||||
*referencingNode = self;
|
||||
return _contentUnits;
|
||||
}
|
||||
|
||||
- (void)addTraits:(IJSVGNodeTraits)traits
|
||||
{
|
||||
_traits |= traits;
|
||||
}
|
||||
|
||||
- (void)removeTraits:(IJSVGNodeTraits)traits
|
||||
{
|
||||
_traits = _traits & ~traits;
|
||||
}
|
||||
|
||||
- (BOOL)matchesTraits:(IJSVGNodeTraits)traits
|
||||
{
|
||||
return (_traits & traits) == traits;
|
||||
}
|
||||
|
||||
- (void)computeTraits
|
||||
{
|
||||
// by default this does nothing
|
||||
}
|
||||
|
||||
- (instancetype)detach
|
||||
{
|
||||
self.parentNode = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ %@ %@",self.name,self.classNameList,self.identifier];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// IJSVGPath.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGNode.h>
|
||||
#import <IJSVG/IJSVGColorNode.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class IJSVGGroup;
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGPrimitivePathType) {
|
||||
kIJSVGPrimitivePathTypePath,
|
||||
kIJSVGPrimitivePathTypeRect,
|
||||
kIJSVGPrimitivePathTypePolygon,
|
||||
kIJSVGPrimitivePathTypePolyLine,
|
||||
kIJSVGPrimitivePathTypeCircle,
|
||||
kIJSVGPrimitivePathTypeEllipse,
|
||||
kIJSVGPrimitivePathTypeLine
|
||||
};
|
||||
|
||||
@interface IJSVGPath : IJSVGNode {
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) IJSVGPrimitivePathType primitiveType;
|
||||
@property (nonatomic, assign) CGMutablePathRef path;
|
||||
@property (nonatomic, assign) CGPoint lastControlPoint;
|
||||
@property (nonatomic, readonly) CGRect controlPointBoundingBox;
|
||||
@property (nonatomic, readonly) CGRect pathBoundingBox;
|
||||
|
||||
- (void)close;
|
||||
- (NSPoint)currentPoint;
|
||||
|
||||
@end
|
||||
@@ -1,91 +0,0 @@
|
||||
//
|
||||
// IJSVGPath.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGPath.h>
|
||||
|
||||
@implementation IJSVGPath
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if(_path != NULL) {
|
||||
(void)CGPathRelease(_path), _path = NULL;
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
_primitiveType = kIJSVGPrimitivePathTypePath;
|
||||
_path = CGPathCreateMutable();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CGRect)bounds
|
||||
{
|
||||
return self.pathBoundingBox;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGPath* node = [super copyWithZone:zone];
|
||||
node.path = _path;
|
||||
return node;
|
||||
}
|
||||
|
||||
- (void)setPath:(CGMutablePathRef)path
|
||||
{
|
||||
// this will automatically copy any path into a mutable path
|
||||
// regardless of if it was a mutable path to begin with
|
||||
if(_path != NULL) {
|
||||
(void)CGPathRelease(_path), _path = NULL;
|
||||
}
|
||||
_path = CGPathCreateMutableCopy(path);
|
||||
}
|
||||
|
||||
- (CGRect)pathBoundingBox
|
||||
{
|
||||
return CGPathGetPathBoundingBox(_path);
|
||||
}
|
||||
|
||||
- (CGRect)controlPointBoundingBox
|
||||
{
|
||||
return CGPathGetBoundingBox(_path);
|
||||
}
|
||||
|
||||
- (NSPoint)currentPoint
|
||||
{
|
||||
return CGPathGetCurrentPoint(_path);
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
CGPathCloseSubpath(_path);
|
||||
}
|
||||
|
||||
#pragma mark Traits
|
||||
|
||||
- (void)computeTraits
|
||||
{
|
||||
if(self.stroke != nil) {
|
||||
// by default we can just add this on
|
||||
[self addTraits:IJSVGNodeTraitStroked];
|
||||
|
||||
// if we detect the stroke was a color, we need to check its alpha
|
||||
// component to then remove the trait if its 0.f
|
||||
if([self.stroke isKindOfClass:IJSVGColorNode.class] == YES) {
|
||||
IJSVGColorNode* strokeColor = (IJSVGColorNode*)self.stroke;
|
||||
if(strokeColor.color.alphaComponent == 0.f) {
|
||||
[self removeTraits:IJSVGNodeTraitStroked];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// IJSVGPattern.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 27/05/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGPattern.h"
|
||||
#import "IJSVGUnitRect.h"
|
||||
|
||||
@implementation IJSVGPattern
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if((self = [super init]) != nil) {
|
||||
self.viewBox = nil;
|
||||
self.viewBoxAlignment = IJSVGViewBoxAlignmentXMidYMid;
|
||||
self.viewBoxMeetOrSlice = IJSVGViewBoxMeetOrSliceMeet;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// IJSVGRadialGradient.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 03/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGGradient.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface IJSVGRadialGradient : IJSVGGradient
|
||||
|
||||
@property (nonatomic, retain) IJSVGUnitLength* cx;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* cy;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* fx;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* fy;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* fr;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* r;
|
||||
|
||||
+ (NSGradient*)parseGradient:(NSXMLElement*)element
|
||||
gradient:(IJSVGRadialGradient*)gradient;
|
||||
|
||||
@end
|
||||
@@ -1,185 +0,0 @@
|
||||
//
|
||||
// IJSVGRadialGradient.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 03/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGRadialGradient.h>
|
||||
#import <IJSVG/IJSVGParser.h>
|
||||
|
||||
@implementation IJSVGRadialGradient
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_cx release]), _cx = nil;
|
||||
(void)([_cy release]), _cy = nil;
|
||||
(void)([_fx release]), _fx = nil;
|
||||
(void)([_fy release]), _fy = nil;
|
||||
(void)([_fr release]), _fr = nil;
|
||||
(void)([_r release]), _r = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGRadialGradient* grad = [super copyWithZone:zone];
|
||||
grad.fx = _fx;
|
||||
grad.fy = _fy;
|
||||
grad.fr = _fr;
|
||||
grad.cx = _cx;
|
||||
grad.cy = _cy;
|
||||
grad.r = _r;
|
||||
return grad;
|
||||
}
|
||||
|
||||
+ (NSGradient*)parseGradient:(NSXMLElement*)element
|
||||
gradient:(IJSVGRadialGradient*)gradient
|
||||
{
|
||||
// cx defaults to 50% if not specified
|
||||
NSDictionary* kv = @{
|
||||
IJSVGAttributeCX : @"cx",
|
||||
IJSVGAttributeCY : @"cy",
|
||||
IJSVGAttributeR : @"r" };
|
||||
|
||||
for (NSString* key in kv.allKeys) {
|
||||
NSString* str = [element attributeForName:key].stringValue;
|
||||
IJSVGUnitLength* unit = nil;
|
||||
if (str != nil) {
|
||||
unit = [IJSVGUnitLength unitWithString:str
|
||||
fromUnitType:gradient.units];
|
||||
} else {
|
||||
// spec says to say 50% for missing property default
|
||||
unit = [IJSVGUnitLength unitWithPercentageFloat:.5f];
|
||||
}
|
||||
[gradient setValue:unit
|
||||
forKey:kv[key]];
|
||||
}
|
||||
|
||||
// fr
|
||||
NSString* fr = [element attributeForName:IJSVGAttributeFR].stringValue;
|
||||
if(fr != nil) {
|
||||
gradient.fr = [IJSVGUnitLength unitWithString:fr
|
||||
fromUnitType:gradient.units];
|
||||
} else {
|
||||
gradient.fr = [IJSVGUnitLength unitWithPercentageFloat:0.f];
|
||||
}
|
||||
|
||||
// fx and fy are the same unless specified otherwise
|
||||
gradient.fx = gradient.cx;
|
||||
gradient.fy = gradient.cy;
|
||||
|
||||
// needs fixing
|
||||
NSString* fx = [element attributeForName:IJSVGAttributeFX].stringValue;
|
||||
if (fx != nil) {
|
||||
gradient.fx = [IJSVGUnitLength unitWithString:fx
|
||||
fromUnitType:gradient.units];
|
||||
}
|
||||
|
||||
NSString* fy = [element attributeForName:IJSVGAttributeFY].stringValue;
|
||||
if (fy != nil) {
|
||||
gradient.fy = [IJSVGUnitLength unitWithString:fy
|
||||
fromUnitType:gradient.units];
|
||||
}
|
||||
|
||||
if (gradient.gradient != nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray* colors = nil;
|
||||
CGFloat* colorStops = [self.class computeColorStops:gradient
|
||||
colors:&colors];
|
||||
|
||||
NSGradient* ret = [[[NSGradient alloc] initWithColors:colors
|
||||
atLocations:colorStops
|
||||
colorSpace:IJSVGColor.defaultColorSpace] autorelease];
|
||||
free(colorStops);
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (void)drawInContextRef:(CGContextRef)ctx
|
||||
objectRect:(NSRect)objectRect
|
||||
absoluteTransform:(CGAffineTransform)absoluteTransform
|
||||
viewPort:(CGRect)viewBox
|
||||
{
|
||||
CGContextSaveGState(ctx);
|
||||
BOOL inUserSpace = self.units == IJSVGUnitUserSpaceOnUse;
|
||||
CGFloat radius = 0.f;
|
||||
CGPoint startPoint = CGPointZero;
|
||||
CGPoint gradientStartPoint = CGPointZero;
|
||||
CGPoint gradientEndPoint = CGPointZero;
|
||||
|
||||
// transforms
|
||||
CGAffineTransform selfTransform = IJSVGConcatTransforms(self.transforms);
|
||||
|
||||
CGRect boundingBox = inUserSpace ? viewBox : objectRect;
|
||||
|
||||
// compute size based on percentages
|
||||
CGFloat width = CGRectGetWidth(boundingBox);
|
||||
CGFloat height = CGRectGetHeight(boundingBox);
|
||||
CGFloat cx = [_cx computeValue:width];
|
||||
CGFloat cy = [_cy computeValue:height];
|
||||
startPoint = CGPointMake(cx, cy);
|
||||
CGFloat val = MIN(width, height);
|
||||
radius = [_r computeValue:val];
|
||||
CGFloat focalRadius = [_fr computeValue:val];
|
||||
|
||||
CGFloat fx = [_fx computeValue:width];
|
||||
CGFloat fy = [_fy computeValue:height];
|
||||
|
||||
gradientEndPoint = CGPointMake(fx, fy);
|
||||
gradientStartPoint = startPoint;
|
||||
|
||||
// transform if width or height is not equal - this can only
|
||||
// be done if we are using objectBoundingBox
|
||||
if(inUserSpace == YES) {
|
||||
CGFloat rad = 2.f * radius;
|
||||
CGRect rect = CGRectMake(startPoint.x, startPoint.y, rad, rad);
|
||||
rect = CGRectApplyAffineTransform(rect, selfTransform);
|
||||
rect = CGRectApplyAffineTransform(rect, absoluteTransform);
|
||||
radius = CGRectGetHeight(rect) / 2.f;
|
||||
CGContextConcatCTM(ctx, absoluteTransform);
|
||||
} else if(width != height) {
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
CGAffineTransform invert = CGAffineTransformIdentity;
|
||||
CGPoint invPoint = CGPointZero;
|
||||
CGFloat* radiusScale;
|
||||
if(width > height) {
|
||||
transform = CGAffineTransformMakeScale(1.f, height / width);
|
||||
radiusScale = &invPoint.y;
|
||||
} else {
|
||||
transform = CGAffineTransformMakeScale(width / height, 1.f);
|
||||
radiusScale = &invPoint.x;
|
||||
}
|
||||
invert = CGAffineTransformInvert(transform);
|
||||
invPoint.x = invert.a;
|
||||
invPoint.y = invert.d;
|
||||
gradientStartPoint.x *= invPoint.x;
|
||||
gradientStartPoint.y *= invPoint.y;
|
||||
gradientEndPoint.x *= invPoint.x;
|
||||
gradientEndPoint.y *= invPoint.y;
|
||||
radius *= *radiusScale;
|
||||
focalRadius *= *radiusScale;
|
||||
selfTransform = CGAffineTransformConcat(transform, selfTransform);
|
||||
}
|
||||
|
||||
// transform the context
|
||||
CGContextConcatCTM(ctx, selfTransform);
|
||||
|
||||
// draw the gradient
|
||||
CGGradientDrawingOptions options = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
|
||||
CGContextDrawRadialGradient(ctx, self.CGGradient,
|
||||
gradientEndPoint, focalRadius,
|
||||
gradientStartPoint,
|
||||
radius, options);
|
||||
CGContextRestoreGState(ctx);
|
||||
|
||||
//#ifdef IJSVG_DEBUG_GRADIENTS
|
||||
// [self _debugStart:gradientStartPoint
|
||||
// end:gradientEndPoint
|
||||
// context:ctx];
|
||||
//#endif
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// IJSVGRootNode.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 28/03/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVG.h>
|
||||
#import <IJSVG/IJSVGGroup.h>
|
||||
#import <IJSVG/IJSVGUnitSize.h>
|
||||
|
||||
@interface IJSVGRootNode : IJSVGGroup
|
||||
|
||||
@property (nonatomic, retain) IJSVGUnitSize* intrinsicSize;
|
||||
@property (nonatomic, readonly) CGRect bounds;
|
||||
|
||||
@end
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// IJSVGRootNode.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 28/03/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGRootNode.h"
|
||||
|
||||
@implementation IJSVGRootNode
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_intrinsicSize release], _intrinsicSize = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if((self = [super init]) != nil) {
|
||||
self.viewBoxAlignment = IJSVGViewBoxAlignmentXMidYMid;
|
||||
self.viewBoxMeetOrSlice = IJSVGViewBoxMeetOrSliceMeet;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CGRect)bounds
|
||||
{
|
||||
return [self.viewBox computeValue:CGSizeZero];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,42 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandParser.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 23/12/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <xlocale.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, IJSVGPathDataSequence) {
|
||||
kIJSVGPathDataSequenceTypeFloat,
|
||||
kIJSVGPathDataSequenceTypeFlag
|
||||
};
|
||||
|
||||
static NSUInteger const IJSVG_STREAM_FLOAT_BLOCK_SIZE = 50;
|
||||
static NSUInteger const IJSVG_STREAM_CHAR_BLOCK_SIZE = 20;
|
||||
|
||||
typedef struct {
|
||||
CGFloat* floatBuffer;
|
||||
NSInteger floatCount;
|
||||
char* charBuffer;
|
||||
NSInteger charCount;
|
||||
} IJSVGPathDataStream;
|
||||
|
||||
@interface IJSVGCommandParser : NSObject
|
||||
|
||||
IJSVGPathDataStream* IJSVGPathDataStreamCreateDefault(void);
|
||||
IJSVGPathDataStream* IJSVGPathDataStreamCreate(NSUInteger floatCount, NSUInteger charCount);
|
||||
void IJSVGPathDataStreamRelease(IJSVGPathDataStream* buffer);
|
||||
|
||||
IJSVGPathDataSequence* IJSVGPathDataSequenceCreateWithType(IJSVGPathDataSequence type, NSInteger length);
|
||||
CGFloat* _Nullable IJSVGParsePathDataStreamSequence(const char* commandChars, NSInteger commandCharLength,
|
||||
IJSVGPathDataStream* dataStream, IJSVGPathDataSequence* _Nullable sequence,
|
||||
NSInteger commandLength, NSInteger* _Nullable commandsFound);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,249 +0,0 @@
|
||||
//
|
||||
// IJSVGCommandParser.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 23/12/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGCommandParser.h"
|
||||
|
||||
@implementation IJSVGCommandParser
|
||||
|
||||
#define VALID_DIGIT(c) ((c ^ '0') <= 9)
|
||||
|
||||
IJSVGPathDataSequence* IJSVGPathDataSequenceCreateWithType(IJSVGPathDataSequence type, NSInteger length)
|
||||
{
|
||||
size_t size = sizeof(IJSVGPathDataSequence) * length;
|
||||
IJSVGPathDataSequence* sequence = (IJSVGPathDataSequence*)malloc(size);
|
||||
memset(sequence, (int)type, size);
|
||||
return sequence;
|
||||
};
|
||||
|
||||
// Datastreams work by setting up one stream of bits/memory per SVG
|
||||
// so that each SVG has a reusable memory block to read and parse paths into.
|
||||
// As its all linear and one SVG per thread, this saves alot of memory allocation
|
||||
// calls as we simple can just reuse the buffer that already exists - this also
|
||||
// allows us to specify the default allocation size, so when parsing viewBox we
|
||||
// can simply allocate (4*sizeof(CGFloat)) instead of the default 50 slots
|
||||
IJSVGPathDataStream* IJSVGPathDataStreamCreateDefault(void)
|
||||
{
|
||||
return IJSVGPathDataStreamCreate(IJSVG_STREAM_FLOAT_BLOCK_SIZE,
|
||||
IJSVG_STREAM_CHAR_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
IJSVGPathDataStream* IJSVGPathDataStreamCreate(NSUInteger floatCount, NSUInteger charCount)
|
||||
{
|
||||
floatCount = floatCount ?: IJSVG_STREAM_FLOAT_BLOCK_SIZE;
|
||||
charCount = charCount ?: IJSVG_STREAM_CHAR_BLOCK_SIZE;
|
||||
IJSVGPathDataStream* buffer = (IJSVGPathDataStream*)malloc(sizeof(IJSVGPathDataStream));
|
||||
buffer->floatBuffer = (CGFloat*)malloc(sizeof(CGFloat) * floatCount);
|
||||
buffer->floatCount = floatCount;
|
||||
buffer->charBuffer = (char*)calloc(sizeof(char), charCount);
|
||||
buffer->charCount = charCount;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void IJSVGPathDataStreamRelease(IJSVGPathDataStream* buffer)
|
||||
{
|
||||
free(buffer->charBuffer);
|
||||
free(buffer->floatBuffer);
|
||||
free(buffer);
|
||||
};
|
||||
|
||||
CGFloat* _Nullable IJSVGParsePathDataStreamSequence(const char* commandChars, NSInteger commandCharLength,
|
||||
IJSVGPathDataStream* dataStream, IJSVGPathDataSequence* _Nullable sequence,
|
||||
NSInteger commandLength, NSInteger* _Nullable commandsFound)
|
||||
{
|
||||
// if no command length, its completely pointless function,
|
||||
// so just return null and set commandsFound to 0, if we dont
|
||||
// we get a arithmetic error later on due to zero
|
||||
if (commandLength == 0) {
|
||||
*commandsFound = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// default memory size for the float
|
||||
NSInteger i = 0;
|
||||
NSInteger counter = 0;
|
||||
|
||||
const char* cString = commandChars;
|
||||
const char* validChars = "+-.";
|
||||
|
||||
// this is much faster then doing strlen as it doesnt need
|
||||
// to compute the length
|
||||
NSInteger sLength = commandCharLength;
|
||||
NSInteger sLengthMinusOne = sLength - 1;
|
||||
|
||||
bool isDecimal = false;
|
||||
int bufferCount = 0;
|
||||
|
||||
while (i < sLength) {
|
||||
char currentChar = *cString++;
|
||||
|
||||
// work out next char
|
||||
char nextChar = (char)0;
|
||||
if (i < sLengthMinusOne) {
|
||||
nextChar = *cString++;
|
||||
cString--;
|
||||
}
|
||||
|
||||
// check for validator
|
||||
bool isE = (currentChar | ('E' ^ 'e')) == 'e';
|
||||
bool isValid = VALID_DIGIT(currentChar) || isE || strchr(validChars, currentChar) != NULL;
|
||||
|
||||
// in order to work out the split, its either because the next char is
|
||||
// a hyphen or a plus, or next char is a decimal and the current number is a decimal
|
||||
bool nIsSign = nextChar == '-' || nextChar == '+';
|
||||
bool wantsEnd = nIsSign || (nextChar == '.' && isDecimal);
|
||||
|
||||
// work our what the sequence is...
|
||||
IJSVGPathDataSequence seq = kIJSVGPathDataSequenceTypeFloat;
|
||||
if (sequence != NULL) {
|
||||
seq = sequence[counter % commandLength];
|
||||
}
|
||||
|
||||
// is a flag, consists of one value
|
||||
// if its invalid, make sure we free the memory
|
||||
// and return null - or hell breaks lose
|
||||
if (isValid == YES && seq == kIJSVGPathDataSequenceTypeFlag) {
|
||||
if (bufferCount != 0 || (currentChar != '0' && currentChar != '1')) {
|
||||
return NULL;
|
||||
}
|
||||
wantsEnd = YES;
|
||||
}
|
||||
|
||||
// could be a float like 5.334e-5 so dont break on the hypen
|
||||
if (wantsEnd && isE && nIsSign) {
|
||||
wantsEnd = false;
|
||||
}
|
||||
|
||||
// make sure its a valid string
|
||||
if (isValid == YES) {
|
||||
// alloc the buffer if needed
|
||||
if ((bufferCount + 1) == dataStream->charCount) {
|
||||
// realloc the buffer, incase the string is overflowing the
|
||||
// allocated memory
|
||||
dataStream->charCount += IJSVG_STREAM_CHAR_BLOCK_SIZE;
|
||||
dataStream->charBuffer = (char*)realloc(dataStream->charBuffer,
|
||||
sizeof(char) * dataStream->charCount);
|
||||
}
|
||||
// set the actual char against it
|
||||
if (currentChar == '.') {
|
||||
isDecimal = true;
|
||||
}
|
||||
dataStream->charBuffer[bufferCount++] = currentChar;
|
||||
} else {
|
||||
// if its an invalid char, just stop it
|
||||
wantsEnd = true;
|
||||
}
|
||||
|
||||
// is at end of string, or wants to be stopped
|
||||
// buffer has to actually exist or its completly
|
||||
// useless and will cause a crash
|
||||
if (bufferCount != 0 && (wantsEnd || i == sLengthMinusOne)) {
|
||||
// make sure there is enough room in the float pool
|
||||
if ((counter + 1) == dataStream->floatCount) {
|
||||
dataStream->floatCount += IJSVG_STREAM_FLOAT_BLOCK_SIZE;
|
||||
dataStream->floatBuffer = (CGFloat*)realloc(dataStream->floatBuffer,
|
||||
sizeof(CGFloat) * dataStream->floatCount);
|
||||
}
|
||||
|
||||
// add the float - for performance reasons, we can simply set the
|
||||
// null value of the end of the string instead of nulling out
|
||||
// with memset \0 - huzzah!
|
||||
dataStream->charBuffer[bufferCount] = '\0';
|
||||
dataStream->floatBuffer[counter++] = IJSVGParseFloat(dataStream->charBuffer);
|
||||
|
||||
// reset
|
||||
isDecimal = false;
|
||||
bufferCount = 0;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// set commands found - only if there is one
|
||||
if (commandsFound != NULL) {
|
||||
*commandsFound = (NSInteger)round(counter / commandLength);
|
||||
}
|
||||
|
||||
// allocate the new buffer from memory
|
||||
CGFloat* floats = (CGFloat*)malloc(sizeof(CGFloat) * counter);
|
||||
memcpy(floats, dataStream->floatBuffer, counter * sizeof(CGFloat));
|
||||
|
||||
// return the floats just set into the memory
|
||||
return floats;
|
||||
}
|
||||
|
||||
// this method is finely tuned to just handle the buffer
|
||||
// that IJSVGParsePathDataSequence produces for each float
|
||||
// it does not look or skip white space as the previous method
|
||||
// handles this for us
|
||||
// inspired and modified from http://www.leapsecond.com/tools/fast_atof.c
|
||||
CGFloat IJSVGParseFloat(char* buffer)
|
||||
{
|
||||
int fraction;
|
||||
double sign, value, scale;
|
||||
|
||||
// work out a sign, if any, might not be, who knows
|
||||
sign = 1.f;
|
||||
if (*buffer == '-') {
|
||||
sign = -1.f;
|
||||
buffer += 1;
|
||||
} else if (*buffer == '+') {
|
||||
buffer += 1;
|
||||
}
|
||||
|
||||
// get numbers before decimal point or exponent
|
||||
for (value = 0.f; VALID_DIGIT(*buffer); buffer += 1) {
|
||||
value = value * 10.f + (*buffer - '0');
|
||||
}
|
||||
|
||||
// get digits after decimal point
|
||||
if (*buffer == '.') {
|
||||
double pow10 = 10.f;
|
||||
buffer += 1;
|
||||
while (VALID_DIGIT(*buffer)) {
|
||||
value += (*buffer - '0') / pow10;
|
||||
pow10 *= 10.f;
|
||||
buffer += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// handle exponent
|
||||
fraction = 0;
|
||||
scale = 1.f;
|
||||
if ((*buffer | ('E' ^ 'e')) == 'e') {
|
||||
unsigned int exponent;
|
||||
buffer += 1;
|
||||
if (*buffer == '-') {
|
||||
fraction = 1;
|
||||
buffer += 1;
|
||||
} else if (*buffer == '+') {
|
||||
buffer += 1;
|
||||
}
|
||||
for (exponent = 0; VALID_DIGIT(*buffer); buffer += 1) {
|
||||
exponent = exponent * 10 + (*buffer - '0');
|
||||
}
|
||||
if (exponent > 308) {
|
||||
exponent = 308;
|
||||
}
|
||||
while (exponent >= 50) {
|
||||
scale *= 1E50;
|
||||
exponent -= 50;
|
||||
}
|
||||
while (exponent >= 8) {
|
||||
scale *= 1E8;
|
||||
exponent -= 8;
|
||||
}
|
||||
while (exponent > 0) {
|
||||
scale *= 10.f;
|
||||
exponent -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure we cast this to a CGFloat before return
|
||||
return (CGFloat)(sign * (fraction ? (value / scale) : (value * scale)));
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,126 +0,0 @@
|
||||
//
|
||||
// IJSVGParser.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGColor.h>
|
||||
#import <IJSVG/IJSVGCommand.h>
|
||||
#import <IJSVG/IJSVGDef.h>
|
||||
#import <IJSVG/IJSVGError.h>
|
||||
#import <IJSVG/IJSVGForeignObject.h>
|
||||
#import <IJSVG/IJSVGGroup.h>
|
||||
#import <IJSVG/IJSVGColorNode.h>
|
||||
#import <IJSVG/IJSVGImage.h>
|
||||
#import <IJSVG/IJSVGLinearGradient.h>
|
||||
#import <IJSVG/IJSVGPath.h>
|
||||
#import <IJSVG/IJSVGPattern.h>
|
||||
#import <IJSVG/IJSVGRadialGradient.h>
|
||||
#import <IJSVG/IJSVGStyleSheet.h>
|
||||
#import <IJSVG/IJSVGText.h>
|
||||
#import <IJSVG/IJSVGTransform.h>
|
||||
#import <IJSVG/IJSVGUnitRect.h>
|
||||
#import <IJSVG/IJSVGUtils.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern NSString* const IJSVGAttributeViewBox;
|
||||
extern NSString* const IJSVGAttributePreserveAspectRatio;
|
||||
extern NSString* const IJSVGAttributeID;
|
||||
extern NSString* const IJSVGAttributeClass;
|
||||
extern NSString* const IJSVGAttributeX;
|
||||
extern NSString* const IJSVGAttributeY;
|
||||
extern NSString* const IJSVGAttributeWidth;
|
||||
extern NSString* const IJSVGAttributeHeight;
|
||||
extern NSString* const IJSVGAttributeOpacity;
|
||||
extern NSString* const IJSVGAttributeStrokeOpacity;
|
||||
extern NSString* const IJSVGAttributeStrokeWidth;
|
||||
extern NSString* const IJSVGAttributeStrokeDashOffset;
|
||||
extern NSString* const IJSVGAttributeFillOpacity;
|
||||
extern NSString* const IJSVGAttributeClipPath;
|
||||
extern NSString* const IJSVGAttributeMask;
|
||||
extern NSString* const IJSVGAttributeGradientUnits;
|
||||
extern NSString* const IJSVGAttributePatternContentUnits;
|
||||
extern NSString* const IJSVGAttributeMaskUnits;
|
||||
extern NSString* const IJSVGAttributeMaskContentUnits;
|
||||
extern NSString* const IJSVGAttributeTransform;
|
||||
extern NSString* const IJSVGAttributeGradientTransform;
|
||||
extern NSString* const IJSVGAttributeUnicode;
|
||||
extern NSString* const IJSVGAttributeStrokeLineCap;
|
||||
extern NSString* const IJSVGAttributeLineJoin;
|
||||
extern NSString* const IJSVGAttributeStroke;
|
||||
extern NSString* const IJSVGAttributeStrokeDashArray;
|
||||
extern NSString* const IJSVGAttributeFill;
|
||||
extern NSString* const IJSVGAttributeFillRule;
|
||||
extern NSString* const IJSVGAttributeBlendMode;
|
||||
extern NSString* const IJSVGAttributeDisplay;
|
||||
extern NSString* const IJSVGAttributeStyle;
|
||||
extern NSString* const IJSVGAttributeD;
|
||||
extern NSString* const IJSVGAttributeXLink;
|
||||
extern NSString* const IJSVGAttributeX1;
|
||||
extern NSString* const IJSVGAttributeX2;
|
||||
extern NSString* const IJSVGAttributeY1;
|
||||
extern NSString* const IJSVGAttributeY2;
|
||||
extern NSString* const IJSVGAttributeRX;
|
||||
extern NSString* const IJSVGAttributeRY;
|
||||
extern NSString* const IJSVGAttributeCX;
|
||||
extern NSString* const IJSVGAttributeCY;
|
||||
extern NSString* const IJSVGAttributeR;
|
||||
extern NSString* const IJSVGAttributeFR;
|
||||
extern NSString* const IJSVGAttributeFX;
|
||||
extern NSString* const IJSVGAttributeFY;
|
||||
extern NSString* const IJSVGAttributePoints;
|
||||
extern NSString* const IJSVGAttributeOffset;
|
||||
extern NSString* const IJSVGAttributeStopColor;
|
||||
extern NSString* const IJSVGAttributeStopOpacity;
|
||||
extern NSString* const IJSVGAttributeHref;
|
||||
extern NSString* const IJSVGAttributeOverflow;
|
||||
|
||||
|
||||
@class IJSVGParser;
|
||||
|
||||
@protocol IJSVGParserDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
- (void)svgParser:(IJSVGParser*)svg
|
||||
foundSubSVG:(IJSVG*)subSVG
|
||||
withSVGString:(NSString*)string;
|
||||
|
||||
@end
|
||||
|
||||
@interface IJSVGParser : NSObject {
|
||||
|
||||
@private
|
||||
id<IJSVGParserDelegate> _delegate;
|
||||
NSXMLDocument* _document;
|
||||
|
||||
struct {
|
||||
unsigned int handleSubSVG : 1;
|
||||
} _respondsTo;
|
||||
|
||||
IJSVGPathDataStream* _commandDataStream;
|
||||
IJSVGStyleSheet* _styleSheet;
|
||||
NSMapTable<IJSVGNode*, NSMutableDictionary<NSString*, NSXMLElement*>*>* _detachedElements;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain, readonly) IJSVGRootNode* rootNode;
|
||||
|
||||
+ (BOOL)isDataSVG:(NSData*)data;
|
||||
|
||||
- (id)initWithSVGString:(NSString*)string
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGParserDelegate>)delegate;
|
||||
|
||||
- (id)initWithFileURL:(NSURL*)aURL
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGParserDelegate>)delegate;
|
||||
+ (IJSVGParser*)groupForFileURL:(NSURL*)aURL;
|
||||
+ (IJSVGParser*)groupForFileURL:(NSURL*)aURL
|
||||
delegate:(id<IJSVGParserDelegate>)delegate;
|
||||
+ (IJSVGParser*)groupForFileURL:(NSURL*)aURL
|
||||
error:(NSError**)error
|
||||
delegate:(id<IJSVGParserDelegate>)delegate;
|
||||
|
||||
@end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// IJSVGLayerTree.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 29/12/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGNode.h>
|
||||
#import <IJSVG/IJSVGRenderingStyle.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
@class IJSVGLayer;
|
||||
@class IJSVGRootLayer;
|
||||
@class IJSVGRootNode;
|
||||
|
||||
@interface IJSVGLayerTree : NSObject {
|
||||
@private
|
||||
NSMutableArray<NSValue*>* _viewPortStack;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) CGRect viewBox;
|
||||
@property (nonatomic, assign) CGFloat backingScale;
|
||||
@property (nonatomic, retain) IJSVGRenderingStyle* style;
|
||||
|
||||
- (id)initWithViewPortRect:(CGRect)viewPort
|
||||
backingScale:(CGFloat)scale;
|
||||
- (IJSVGRootLayer*)rootLayerForRootNode:(IJSVGRootNode*)rootNode;
|
||||
|
||||
@end
|
||||
@@ -1,549 +0,0 @@
|
||||
//
|
||||
// IJSVGLayerTree.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 29/12/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVG.h>
|
||||
#import <IJSVG/IJSVGGradient.h>
|
||||
#import <IJSVG/IJSVGGradientLayer.h>
|
||||
#import <IJSVG/IJSVGGroup.h>
|
||||
#import <IJSVG/IJSVGGroupLayer.h>
|
||||
#import <IJSVG/IJSVGRootLayer.h>
|
||||
#import <IJSVG/IJSVGImage.h>
|
||||
#import <IJSVG/IJSVGImageLayer.h>
|
||||
#import <IJSVG/IJSVGLayer.h>
|
||||
#import <IJSVG/IJSVGLayerTree.h>
|
||||
#import <IJSVG/IJSVGPath.h>
|
||||
#import <IJSVG/IJSVGPattern.h>
|
||||
#import <IJSVG/IJSVGPatternLayer.h>
|
||||
#import <IJSVG/IJSVGShapeLayer.h>
|
||||
#import <IJSVG/IJSVGStrokeLayer.h>
|
||||
#import <IJSVG/IJSVGText.h>
|
||||
#import <IJSVG/IJSVGTransform.h>
|
||||
#import <IJSVG/IJSVGUtils.h>
|
||||
#import <IJSVG/IJSVGTransformLayer.h>
|
||||
|
||||
@implementation IJSVGLayerTree
|
||||
|
||||
@synthesize style = _style;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_viewPortStack release]), _viewPortStack = nil;
|
||||
(void)([_style release]), _style = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithViewPortRect:(CGRect)viewPort
|
||||
backingScale:(CGFloat)scale
|
||||
{
|
||||
if((self = [super init]) != nil) {
|
||||
_viewPortStack = [[NSMutableArray alloc] init];
|
||||
_backingScale = scale;
|
||||
[self pushViewPort:viewPort];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)pushViewPort:(CGRect)viewPort
|
||||
{
|
||||
NSValue* value = [NSValue valueWithRect:NSRectFromCGRect(viewPort)];
|
||||
[_viewPortStack addObject:value];
|
||||
}
|
||||
|
||||
- (CGRect)viewPort
|
||||
{
|
||||
NSValue* value = _viewPortStack.lastObject;
|
||||
return (CGRect)NSRectToCGRect(value.rectValue);
|
||||
}
|
||||
|
||||
- (void)popViewPort
|
||||
{
|
||||
[_viewPortStack removeLastObject];
|
||||
}
|
||||
|
||||
- (IJSVGRootLayer*)rootLayerForRootNode:(IJSVGRootNode*)rootNode
|
||||
{
|
||||
return (IJSVGRootLayer*)[self drawableLayerForNode:rootNode];
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableLayerForNode:(IJSVGNode*)node {
|
||||
CALayer<IJSVGDrawableLayer>* layer = nil;
|
||||
if([node isKindOfClass:IJSVGPath.class]) {
|
||||
layer = [self drawableLayerForPathNode:(IJSVGPath*)node];
|
||||
} else if([node isKindOfClass:IJSVGRootNode.class]) {
|
||||
layer = [self drawableLayerForRootNode:(IJSVGRootNode*)node];
|
||||
} else if([node isKindOfClass:IJSVGGroup.class]) {
|
||||
layer = [self drawableLayerForGroupNode:(IJSVGGroup*)node];
|
||||
} else if([node isKindOfClass:IJSVGImage.class]) {
|
||||
layer = [self drawableLayerForImageNode:(IJSVGImage*)node];
|
||||
}
|
||||
if(layer != nil) {
|
||||
[self applyDefaultsToLayer:layer
|
||||
fromNode:node];
|
||||
return [self applyTransforms:node.transforms
|
||||
toLayer:layer
|
||||
fromNode:node];
|
||||
}
|
||||
return layer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableBasicLayerForPathNode:(IJSVGPath*)node
|
||||
{
|
||||
IJSVGShapeLayer* layer = [IJSVGShapeLayer layer];
|
||||
layer.primitiveType = node.primitiveType;
|
||||
[self applyTransformedPathToShapeLayer:layer
|
||||
fromNode:node];
|
||||
layer.fillColor = nil;
|
||||
layer.fillRule = [IJSVGUtils CGFillRuleForWindingRule:node.windingRule];
|
||||
return layer;
|
||||
}
|
||||
|
||||
- (void)applyTransformedPathToShapeLayer:(CALayer<IJSVGPathableLayer, IJSVGDrawableLayer>*)layer
|
||||
fromNode:(IJSVGPath*)node
|
||||
{
|
||||
CGRect pathBounds = CGPathGetPathBoundingBox(node.path);
|
||||
pathBounds = pathBounds;
|
||||
|
||||
// this will move the path back to a 0 origin as we actually set the origin
|
||||
// with the layer instead (which we can then move around)
|
||||
CGAffineTransform transform = CGAffineTransformMakeTranslation(-pathBounds.origin.x,
|
||||
-pathBounds.origin.y);
|
||||
CGPathRef transformedPath = CGPathCreateCopyByTransformingPath(node.path, &transform);
|
||||
layer.frame = pathBounds;
|
||||
layer.outerBoundingBox = pathBounds;
|
||||
layer.path = transformedPath;
|
||||
|
||||
// note that we store the bounding box at this point, as it can be modified later
|
||||
// with strokes, however, SVG spec defined bounding box is the path without strokes
|
||||
// and without control points.
|
||||
layer.boundingBox = pathBounds;
|
||||
CGPathRelease(transformedPath);
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableLayerForPathNode:(IJSVGPath*)node
|
||||
{
|
||||
IJSVGShapeLayer* layer = (IJSVGShapeLayer*)[self drawableBasicLayerForPathNode:node];
|
||||
|
||||
// color the shape
|
||||
id fill = node.fill;
|
||||
|
||||
// stroke the path
|
||||
IJSVGStrokeLayer* strokeLayer = nil;
|
||||
CGFloat strokeWidthDifference = 0.f;
|
||||
if([node matchesTraits:IJSVGNodeTraitStroked]) {
|
||||
// its highly likely that the stroke layer is larger than the layer its being
|
||||
// drawing into, so we need to increase the layer size to match or any groups
|
||||
// that this is inside wont be the correct frame
|
||||
strokeLayer = (IJSVGStrokeLayer*)[self drawableStrokedLayerForPathNode:node];
|
||||
strokeWidthDifference = strokeLayer.lineWidth * .5f;
|
||||
|
||||
// make sure we update the bounding box as it has changed
|
||||
layer.frame = CGRectInset(layer.frame,
|
||||
-strokeWidthDifference,
|
||||
-strokeWidthDifference);
|
||||
layer.strokeBoundingBox = layer.frame;
|
||||
layer.outerBoundingBox = layer.frame;
|
||||
}
|
||||
|
||||
// generic fill color
|
||||
CALayer<IJSVGDrawableLayer>* fillLayer = nil;
|
||||
switch([IJSVGLayer fillTypeForFill:fill]) {
|
||||
// just a generic fill color
|
||||
case IJSVGLayerFillTypeColor: {
|
||||
IJSVGColorNode* colorNode = (IJSVGColorNode*)fill;
|
||||
NSColor* color = colorNode.color;
|
||||
|
||||
// change the fill color opacity if required
|
||||
if(node.fillOpacity.value != 1.f) {
|
||||
color = [IJSVGColor changeAlphaOnColor:color
|
||||
to:node.fillOpacity.value];
|
||||
}
|
||||
|
||||
// set the color against the layer — we cant just use fill layer due to how
|
||||
// the stroke is position within the frame, we have to create another
|
||||
// layer to draw the colour into!
|
||||
IJSVGShapeLayer* shape = (IJSVGShapeLayer*)[self drawableBasicLayerForPathNode:node];
|
||||
shape.fillColor = color.CGColor;
|
||||
CGRect shapeRect = shape.frame;
|
||||
|
||||
// reset back to 0, later on this will move in enough for the stroke
|
||||
// to be half over the edge
|
||||
shapeRect.origin.x = 0.f;
|
||||
shapeRect.origin.y = 0.f;
|
||||
shape.frame = shapeRect;
|
||||
fillLayer = shape;
|
||||
break;
|
||||
}
|
||||
|
||||
// pattern fill
|
||||
case IJSVGLayerFillTypePattern: {
|
||||
fillLayer = [self drawablePatternLayerForPathNode:node
|
||||
pattern:(IJSVGPattern*)node.fill
|
||||
layer:layer];
|
||||
break;
|
||||
}
|
||||
|
||||
// gradient fill
|
||||
case IJSVGLayerFillTypeGradient: {
|
||||
fillLayer = [self drawableGradientLayerForPathNode:node
|
||||
gradient:(IJSVGGradient*)node.fill
|
||||
layer:layer];
|
||||
break;
|
||||
}
|
||||
|
||||
// unknown
|
||||
default: {
|
||||
layer.fillColor = NSColor.blackColor.CGColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(fillLayer != nil) {
|
||||
fillLayer.affineTransform = CGAffineTransformTranslate(fillLayer.affineTransform,
|
||||
strokeWidthDifference,
|
||||
strokeWidthDifference);
|
||||
[layer addSublayer:fillLayer];
|
||||
}
|
||||
|
||||
|
||||
// stroke the path
|
||||
if(strokeLayer != nil) {
|
||||
// its highly likely that the stroke layer is larger than the layer its being
|
||||
// drawing into, so we need to increase the layer size to match or any groups
|
||||
// that this is inside wont be the correct frame
|
||||
// layer.borderColor = NSColor.greenColor.CGColor;
|
||||
// layer.borderWidth = 1.f;
|
||||
|
||||
CGRect strokeLayerFrame = strokeLayer.frame;
|
||||
strokeLayerFrame.origin.x = strokeLayerFrame.origin.y = strokeWidthDifference;
|
||||
strokeLayer.frame = strokeLayerFrame;
|
||||
|
||||
// we need to work out what type of fill we need for the layer
|
||||
switch([IJSVGLayer fillTypeForFill:node.stroke]) {
|
||||
// patterns
|
||||
case IJSVGLayerFillTypePattern: {
|
||||
IJSVGPatternLayer* patternLayer = nil;
|
||||
patternLayer = [self drawableBasicPatternLayerForLayer:strokeLayer
|
||||
pattern:(IJSVGPattern*)node.stroke];
|
||||
patternLayer.referencingLayer = layer;
|
||||
patternLayer.frame = CGRectInset(strokeLayer.frame,
|
||||
-strokeWidthDifference,
|
||||
-strokeWidthDifference);
|
||||
|
||||
strokeLayer.strokeColor = NSColor.whiteColor.CGColor;
|
||||
patternLayer.maskLayer = strokeLayer;
|
||||
[layer addSublayer:patternLayer];
|
||||
break;
|
||||
}
|
||||
|
||||
// gradients
|
||||
case IJSVGLayerFillTypeGradient: {
|
||||
IJSVGGradientLayer* gradientLayer = nil;
|
||||
gradientLayer = [self drawableBasicGradientLayerForLayer:strokeLayer
|
||||
gradient:(IJSVGGradient*)node.stroke];
|
||||
gradientLayer.referencingLayer = layer;
|
||||
gradientLayer.frame = CGRectInset(strokeLayer.frame,
|
||||
-strokeWidthDifference,
|
||||
-strokeWidthDifference);
|
||||
|
||||
strokeLayer.strokeColor = NSColor.whiteColor.CGColor;
|
||||
gradientLayer.maskLayer = strokeLayer;
|
||||
[layer addSublayer:gradientLayer];
|
||||
break;
|
||||
}
|
||||
|
||||
// generic
|
||||
default: {
|
||||
[layer addSublayer:strokeLayer];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableStrokedLayerForPathNode:(IJSVGPath*)node
|
||||
{
|
||||
IJSVGStrokeLayer* layer = [IJSVGStrokeLayer layer];
|
||||
[self applyTransformedPathToShapeLayer:layer
|
||||
fromNode:node];
|
||||
|
||||
// reset the frame back to zero
|
||||
CGRect frame = layer.frame;
|
||||
frame.origin.x = 0.f;
|
||||
frame.origin.y = 0.f;
|
||||
layer.frame = frame;
|
||||
|
||||
// compute the color
|
||||
NSColor* strokeColor = NSColor.blackColor;
|
||||
if([node.stroke isKindOfClass:IJSVGColorNode.class]) {
|
||||
IJSVGColorNode* colorNode = (IJSVGColorNode*)node.stroke;
|
||||
strokeColor = colorNode.color;
|
||||
}
|
||||
|
||||
// set the color
|
||||
layer.fillColor = nil;
|
||||
layer.strokeColor = strokeColor.CGColor;
|
||||
|
||||
// work out line width
|
||||
CGFloat lineWidth = 1.f;
|
||||
lineWidth = node.strokeWidth.value;
|
||||
|
||||
// work out line styles
|
||||
IJSVGLineCapStyle lineCapStyle = node.lineCapStyle;
|
||||
IJSVGLineJoinStyle lineJoinStyle = node.lineJoinStyle;
|
||||
|
||||
// apply the properties
|
||||
layer.lineWidth = lineWidth;
|
||||
layer.lineCap = [IJSVGUtils CGLineCapForCapStyle:lineCapStyle];
|
||||
layer.lineJoin = [IJSVGUtils CGLineJoinForJoinStyle:lineJoinStyle];
|
||||
|
||||
CGFloat strokeOpacity = 1.f;
|
||||
if(node.strokeOpacity.value != 0.f) {
|
||||
strokeOpacity = node.strokeOpacity.value;
|
||||
}
|
||||
layer.opacity = strokeOpacity;
|
||||
|
||||
// dashing
|
||||
layer.lineDashPhase = node.strokeDashOffset.value;
|
||||
if(node.strokeDashArrayCount != 0.f) {
|
||||
layer.lineDashPattern = node.lineDashPattern;
|
||||
}
|
||||
|
||||
// lets resize the layer as we have computed everything at this point
|
||||
// CGFloat increase = layer.lineWidth / 2.f;
|
||||
//// frame = CGRectInset(frame, -increase, -increase);
|
||||
|
||||
// now we know what to do, we need to transform the path
|
||||
// CGAffineTransform transform = CGAffineTransformMakeTranslation(increase, increase);
|
||||
// CGPathRef path = CGPathCreateCopyByTransformingPath(layer.path, &transform);
|
||||
layer.frame = frame;
|
||||
layer.path = layer.path;
|
||||
// layer.borderColor = NSColor.redColor.CGColor;
|
||||
// layer.borderWidth = 1.f;
|
||||
// CGPathRelease(path);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableLayerForRootNode:(IJSVGRootNode*)node
|
||||
{
|
||||
IJSVGRootLayer* layer = [IJSVGRootLayer layer];
|
||||
layer.viewBox = node.viewBox;
|
||||
layer.viewBoxAlignment = node.viewBoxAlignment;
|
||||
layer.viewBoxMeetOrSlice = node.viewBoxMeetOrSlice;
|
||||
layer.backingScaleFactor = _backingScale;
|
||||
|
||||
// we are the top most SVG, not a nested one,
|
||||
// we can simply use the viewport given to us
|
||||
CGRect frame = CGRectZero;
|
||||
if(_viewPortStack.count == 1) {
|
||||
frame.size = self.viewPort.size;
|
||||
} else {
|
||||
frame = CGRectMake(0.f, 0.f,
|
||||
node.intrinsicSize.width.value,
|
||||
node.intrinsicSize.height.value);
|
||||
}
|
||||
layer.frame = frame;
|
||||
[self pushViewPort:layer.frame];
|
||||
layer.sublayers = [self drawableLayersForNodes:node.children];
|
||||
[self popViewPort];
|
||||
return layer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableLayerForGroupNode:(IJSVGGroup*)node
|
||||
{
|
||||
NSArray<CALayer<IJSVGDrawableLayer>*>* layers = [self drawableLayersForNodes:node.children];
|
||||
return [self drawableLayerForGroupNode:node
|
||||
sublayers:layers];
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableLayerForGroupNode:(IJSVGNode*)node
|
||||
sublayers:(NSArray<CALayer<IJSVGDrawableLayer>*>*)sublayers
|
||||
{
|
||||
IJSVGGroupLayer* layer = [IJSVGGroupLayer layer];
|
||||
layer.boundingBox = [IJSVGLayer calculateFrameForSublayers:sublayers];
|
||||
layer.outerBoundingBox = layer.boundingBox;
|
||||
layer.sublayers = sublayers;
|
||||
return layer;
|
||||
}
|
||||
|
||||
- (NSArray<CALayer<IJSVGDrawableLayer>*>*)drawableLayersForNodes:(NSArray<IJSVGNode*>*)nodes
|
||||
{
|
||||
NSMutableArray<CALayer<IJSVGDrawableLayer>*>* layers = nil;
|
||||
layers = [[[NSMutableArray alloc] initWithCapacity:nodes.count] autorelease];
|
||||
for(IJSVGNode* node in nodes) {
|
||||
CALayer<IJSVGDrawableLayer>* layer = [self drawableLayerForNode:node];
|
||||
if(layer != nil) {
|
||||
[layers addObject:layer];
|
||||
}
|
||||
}
|
||||
return layers;
|
||||
}
|
||||
|
||||
#pragma mark Gradients and Patterns
|
||||
|
||||
- (IJSVGGradientLayer*)drawableBasicGradientLayerForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
gradient:(IJSVGGradient*)gradient
|
||||
{
|
||||
// gradient fill
|
||||
IJSVGGradientLayer* gradientLayer = [IJSVGGradientLayer layer];
|
||||
gradientLayer.backingScaleFactor = _backingScale;
|
||||
gradientLayer.gradient = gradient;
|
||||
gradientLayer.frame = layer.boundingBoxBounds;
|
||||
gradientLayer.viewBox = self.viewPort;
|
||||
[gradientLayer setNeedsDisplay];
|
||||
return gradientLayer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawableGradientLayerForPathNode:(IJSVGPath*)node
|
||||
gradient:(IJSVGGradient*)gradient
|
||||
layer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
// gradient fill
|
||||
IJSVGGradientLayer* gradientLayer = [self drawableBasicGradientLayerForLayer:layer
|
||||
gradient:gradient];
|
||||
|
||||
// we must clip the fill to the path that we are drawing in, its simply just a matter
|
||||
// of asking the tree for a path based on the layer passed in, but then moving
|
||||
// it back to our current coordinate space
|
||||
CALayer<IJSVGDrawableLayer>* clipLayer = [self drawableBasicLayerForPathNode:node];
|
||||
gradientLayer.clipRule = layer.fillRule;
|
||||
gradientLayer.clipLayer = clipLayer;
|
||||
clipLayer.frame = clipLayer.bounds;
|
||||
return gradientLayer;
|
||||
}
|
||||
|
||||
- (IJSVGPatternLayer*)drawableBasicPatternLayerForLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
pattern:(IJSVGPattern*)pattern
|
||||
{
|
||||
// pattern fill
|
||||
IJSVGPatternLayer* patternLayer = [IJSVGPatternLayer layer];
|
||||
patternLayer.patternNode = pattern;
|
||||
patternLayer.frame = layer.boundingBoxBounds;
|
||||
|
||||
CALayer<IJSVGDrawableLayer>* patternFill = [self drawableLayerForNode:pattern];
|
||||
patternFill.referencingLayer = patternLayer;
|
||||
patternLayer.pattern = patternFill;
|
||||
[patternLayer setNeedsDisplay];
|
||||
return patternLayer;
|
||||
}
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)drawablePatternLayerForPathNode:(IJSVGPath*)node
|
||||
pattern:(IJSVGPattern*)pattern
|
||||
layer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
{
|
||||
// pattern fill
|
||||
IJSVGPatternLayer* patternLayer = [self drawableBasicPatternLayerForLayer:layer
|
||||
pattern:pattern];
|
||||
|
||||
// we must clip the fill to the path that we are drawing in, its simply just a matter
|
||||
// of asking the tree for a path based on the layer passed in, but then moving
|
||||
// it back to our current coordinate space
|
||||
CALayer<IJSVGDrawableLayer>* clipLayer = [self drawableBasicLayerForPathNode:node];
|
||||
patternLayer.clipRule = layer.fillRule;
|
||||
patternLayer.clipLayer = clipLayer;
|
||||
clipLayer.frame = clipLayer.bounds;
|
||||
[patternLayer setNeedsDisplay];
|
||||
return patternLayer;
|
||||
}
|
||||
|
||||
#pragma mark Defaults
|
||||
|
||||
- (void)applyDefaultsToLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
fromNode:(IJSVGNode*)node
|
||||
{
|
||||
// mask the layer
|
||||
if(node.mask != nil) {
|
||||
layer.maskLayer = [self drawableLayerForNode:node.mask];
|
||||
}
|
||||
|
||||
// add the clip mask if any
|
||||
if(node.clipPath != nil) {
|
||||
layer.clipRule = layer.fillRule;
|
||||
layer.clipLayer = [self drawableLayerForNode:node.clipPath];
|
||||
}
|
||||
|
||||
// setup the opacity
|
||||
CGFloat opacity = node.opacity.value;
|
||||
if(opacity != 1.f) {
|
||||
layer.opacity = opacity;
|
||||
}
|
||||
|
||||
// Blending mode
|
||||
if (node.blendMode != IJSVGBlendModeNormal) {
|
||||
layer.blendingMode = (CGBlendMode)node.blendMode;
|
||||
}
|
||||
|
||||
// Should this even be displayed?
|
||||
if (node.shouldRender == NO) {
|
||||
layer.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark Transforms
|
||||
|
||||
- (CALayer<IJSVGDrawableLayer>*)applyTransforms:(NSArray<IJSVGTransform*>*)transforms
|
||||
toLayer:(CALayer<IJSVGDrawableLayer>*)layer
|
||||
fromNode:(IJSVGNode*)node
|
||||
|
||||
{
|
||||
// any x and y?
|
||||
CGRect frame = layer.bounds;
|
||||
CGFloat x = [node.x computeValue:frame.size.width];
|
||||
CGFloat y = [node.y computeValue:frame.size.height];
|
||||
|
||||
// no need to do anything if no transform, or x or y == 0
|
||||
if (transforms.count == 0 && x == 0.f && y == 0.f) {
|
||||
return layer;
|
||||
}
|
||||
|
||||
// simply cascade all the transforms onto the identity
|
||||
CGAffineTransform identity = CGAffineTransformIdentity;
|
||||
if (x != 0.f || y != 0.f) {
|
||||
identity = CGAffineTransformTranslate(identity, x, y);
|
||||
}
|
||||
|
||||
// this used to be done with each transform being added to its own
|
||||
// group layer, but we can simply use one and then apply
|
||||
// the transforms in reverse order, has same outcome with less memory
|
||||
IJSVGTransformLayer* parentLayer = [IJSVGTransformLayer layer];
|
||||
for(IJSVGTransform* transform in transforms.reverseObjectEnumerator) {
|
||||
identity = CGAffineTransformConcat(identity,
|
||||
transform.CGAffineTransform);
|
||||
}
|
||||
parentLayer.affineTransform = identity;
|
||||
[parentLayer addSublayer:layer];
|
||||
return parentLayer;
|
||||
}
|
||||
|
||||
#pragma mark To Refactor
|
||||
|
||||
- (IJSVGLayer*)drawableLayerForImageNode:(IJSVGImage*)image
|
||||
{
|
||||
IJSVGImageLayer* layer = [[[IJSVGImageLayer alloc] initWithImage:image] autorelease];
|
||||
// make sure we set the width and height correctly,
|
||||
// as this may not be exactly the same as the size of the
|
||||
// given image
|
||||
CGRect frame = layer.frame;
|
||||
frame.size.width = image.width.value;
|
||||
frame.size.height = image.height.value;
|
||||
layer.frame = frame;
|
||||
[layer setNeedsLayout];
|
||||
return layer;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// IJSVGRendering.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 14/03/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef CGFloat (^IJSVGRenderingBackingScaleFactorHelper)(void);
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGRenderQuality) {
|
||||
kIJSVGRenderQualityFullResolution, // slowest to render
|
||||
kIJSVGRenderQualityOptimized, // best of both worlds
|
||||
kIJSVGRenderQualityLow // fast rendering
|
||||
};
|
||||
|
||||
@interface IJSVGRendering : NSObject
|
||||
|
||||
@end
|
||||
@@ -1,13 +0,0 @@
|
||||
//
|
||||
// IJSVGRendering.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 14/03/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGRendering.h"
|
||||
|
||||
@implementation IJSVGRendering
|
||||
|
||||
@end
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// IJSVGStyleList.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 09/07/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGColorList.h>
|
||||
#import <IJSVG/IJSVGNode.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@interface IJSVGRenderingStyle : NSObject
|
||||
|
||||
@property (nonatomic, assign) IJSVGLineCapStyle lineCapStyle;
|
||||
@property (nonatomic, assign) IJSVGLineJoinStyle lineJoinStyle;
|
||||
@property (nonatomic, assign) CGFloat lineWidth;
|
||||
@property (nonatomic, retain) IJSVGColorList* colorList;
|
||||
@property (nonatomic, retain) NSColor* fillColor;
|
||||
@property (nonatomic, retain) NSColor* strokeColor;
|
||||
|
||||
+ (NSArray<NSString*>*)observableProperties;
|
||||
|
||||
@end
|
||||
@@ -1,43 +0,0 @@
|
||||
//
|
||||
// IJSVGStyleList.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 09/07/2019.
|
||||
// Copyright © 2019 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGRenderingStyle.h"
|
||||
|
||||
@implementation IJSVGRenderingStyle
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([_fillColor release]), _fillColor = nil;
|
||||
(void)([_strokeColor release]), _strokeColor = nil;
|
||||
(void)([_colorList release]), _colorList = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
_lineCapStyle = IJSVGLineCapStyleNone;
|
||||
_lineJoinStyle = IJSVGLineJoinStyleNone;
|
||||
_lineWidth = IJSVGInheritedFloatValue;
|
||||
_colorList = [[IJSVGColorList alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (NSArray<NSString*>*)observableProperties
|
||||
{
|
||||
static NSArray* array = nil;
|
||||
if (array == nil) {
|
||||
array = @[ @"lineCapStyle", @"lineJoinStyle", @"lineWidth",
|
||||
@"colorList", @"fillColor", @"strokeColor" ]
|
||||
.retain;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// IJSVGStyleSheetRule.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 16/01/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGStyle.h>
|
||||
#import <IJSVG/IJSVGStyleSheetSelector.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class IJSVGNode;
|
||||
|
||||
@interface IJSVGStyleSheetRule : NSObject {
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSArray* selectors;
|
||||
@property (nonatomic, retain) IJSVGStyle* style;
|
||||
|
||||
- (BOOL)matchesNode:(IJSVGNode*)node
|
||||
selector:(IJSVGStyleSheetSelector**)matchedSelector;
|
||||
|
||||
@end
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// IJSVGStyleSheetSelectorRaw.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 16/01/2016.
|
||||
// Copyright © 2016 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGStyleSheetSelectorRaw.h"
|
||||
|
||||
@implementation IJSVGStyleSheetSelectorRaw
|
||||
|
||||
@synthesize classes;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)([classes release]), classes = nil;
|
||||
(void)([_identifier release]), _identifier = nil;
|
||||
(void)([_tag release]), _tag = nil;
|
||||
(void)([_combinatorString release]), _combinatorString = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]) != nil) {
|
||||
classes = [[NSMutableArray alloc] init];
|
||||
_combinator = IJSVGStyleSheetSelectorCombinatorDescendant;
|
||||
_combinatorString = @" ";
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addClassName:(NSString*)className
|
||||
{
|
||||
[classes addObject:className];
|
||||
}
|
||||
|
||||
- (NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"Combinator: %@, Tag: %@, Classes: %@, Identifier: %@",
|
||||
_combinatorString, _tag, classes, _identifier];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// IJSVGParsing.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 04/02/2021.
|
||||
// Copyright © 2021 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
char* parameters;
|
||||
} IJSVGParsingStringMethod;
|
||||
|
||||
IJSVGParsingStringMethod* IJSVGParsingStringMethodCreate(void);
|
||||
void IJSVGParsingStringMethodRelease(IJSVGParsingStringMethod* stringMethod);
|
||||
IJSVGParsingStringMethod** IJSVGParsingMethodParseString(const char* string,
|
||||
NSUInteger* count);
|
||||
void IJSVGParsingStringMethodsRelease(IJSVGParsingStringMethod** methods,
|
||||
NSUInteger count);
|
||||
|
||||
@interface IJSVGParsing : NSObject
|
||||
|
||||
@end
|
||||
@@ -1,127 +0,0 @@
|
||||
//
|
||||
// IJSVGParsing.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 04/02/2021.
|
||||
// Copyright © 2021 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGParsing.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
IJSVGParsingStringMethod* IJSVGParsingStringMethodCreate(void)
|
||||
{
|
||||
IJSVGParsingStringMethod* method = (IJSVGParsingStringMethod*)malloc(sizeof(IJSVGParsingStringMethod));
|
||||
method->name = NULL;
|
||||
method->parameters = NULL;
|
||||
return method;
|
||||
}
|
||||
|
||||
void IJSVGParsingStringMethodRelease(IJSVGParsingStringMethod* stringMethod)
|
||||
{
|
||||
if(stringMethod->name != NULL) {
|
||||
(void)free(stringMethod->name), stringMethod->name = NULL;
|
||||
}
|
||||
if(stringMethod->parameters != NULL) {
|
||||
(void)free(stringMethod->parameters), stringMethod->parameters = NULL;
|
||||
}
|
||||
if(stringMethod != NULL) {
|
||||
(void)free(stringMethod), stringMethod = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void IJSVGParsingStringMethodsRelease(IJSVGParsingStringMethod** methods,
|
||||
NSUInteger count)
|
||||
{
|
||||
for(int i = 0; i < count; i++) {
|
||||
IJSVGParsingStringMethodRelease(methods[i]);
|
||||
}
|
||||
(void)free(methods), methods = NULL;
|
||||
}
|
||||
|
||||
IJSVGParsingStringMethod** IJSVGParsingMethodParseString(const char* string,
|
||||
NSUInteger* count)
|
||||
{
|
||||
const char* charString = string;
|
||||
unsigned long length = strlen(string);
|
||||
char* buffer = (char*)calloc(sizeof(char), length);
|
||||
char* originBuffer = buffer;
|
||||
int bufferIndex = 0;
|
||||
|
||||
const size_t defBufferSize = 5;
|
||||
size_t currentBufferSize = defBufferSize;
|
||||
NSUInteger methodCount = 0;
|
||||
|
||||
IJSVGParsingStringMethod* method = NULL;
|
||||
IJSVGParsingStringMethod** methods = NULL;
|
||||
methods = (IJSVGParsingStringMethod**)malloc(sizeof(IJSVGParsingStringMethod*)*currentBufferSize);
|
||||
|
||||
// each command requires a name and parameters, store for later use
|
||||
for(int i = 0; i < length; i++) {
|
||||
char currentChar = *charString++;
|
||||
|
||||
// start of params - store the command name as its current in the buffer
|
||||
if(currentChar == '(') {
|
||||
// rest the pointer to beginning
|
||||
buffer = originBuffer;
|
||||
|
||||
//write here
|
||||
if(method == NULL) {
|
||||
method = IJSVGParsingStringMethodCreate();
|
||||
method->name = (char*)calloc(sizeof(char),bufferIndex+1);
|
||||
memcpy(method->name, buffer, sizeof(char)*bufferIndex);
|
||||
IJSVGTrimCharBuffer(method->name);
|
||||
}
|
||||
|
||||
// write null up until the limit we reached
|
||||
memset(buffer, '\0', bufferIndex);
|
||||
bufferIndex = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// end of params - store the params into the buffer
|
||||
if(currentChar == ')') {
|
||||
// rest the pointer to beginning
|
||||
buffer = originBuffer;
|
||||
|
||||
// there has to be a method at this point, if not, something is wrong
|
||||
// in the syntax
|
||||
if(method != NULL) {
|
||||
method->parameters = (char*)calloc(sizeof(char),bufferIndex+1);
|
||||
memcpy(method->parameters, buffer, sizeof(char)*bufferIndex);
|
||||
IJSVGTrimCharBuffer(method->parameters);
|
||||
|
||||
// now we can add
|
||||
if(methodCount + 1 > currentBufferSize) {
|
||||
currentBufferSize += defBufferSize;
|
||||
*methods = *(IJSVGParsingStringMethod**)realloc(methods, sizeof(IJSVGParsingStringMethod*)*currentBufferSize);
|
||||
}
|
||||
methods[methodCount++] = method;
|
||||
method = NULL;
|
||||
}
|
||||
|
||||
// write null up until the limit we reached
|
||||
memset(buffer, '\0', bufferIndex);
|
||||
bufferIndex = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
// increment the buffer count
|
||||
*buffer++ = currentChar;
|
||||
bufferIndex++;
|
||||
}
|
||||
|
||||
// left over
|
||||
if(method != NULL) {
|
||||
(void)IJSVGParsingStringMethodRelease(method), method = NULL;
|
||||
}
|
||||
|
||||
buffer = originBuffer;
|
||||
*count = methodCount;
|
||||
(void)free(buffer), buffer = NULL;
|
||||
return methods;
|
||||
}
|
||||
|
||||
@implementation IJSVGParsing
|
||||
|
||||
@end
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// IJSVGTransaction.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 11/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGTransaction.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
BOOL IJSVGIsMainThread(void) { return NSThread.isMainThread; };
|
||||
|
||||
BOOL IJSVGBeginTransaction(void)
|
||||
{
|
||||
if(IJSVGIsMainThread() == YES) {
|
||||
return NO;
|
||||
}
|
||||
// use nsanimationcontext as this sets a private flag of 0x4
|
||||
// of the catransaction for background composites
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
[CATransaction lock];
|
||||
return YES;
|
||||
};
|
||||
|
||||
void IJSVGEndTransaction(void)
|
||||
{
|
||||
[CATransaction unlock];
|
||||
[CATransaction commit];
|
||||
};
|
||||
@@ -1,62 +0,0 @@
|
||||
//
|
||||
// IJSVGTransform.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 01/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGUtils.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class IJSVGTransform;
|
||||
|
||||
typedef CGFloat (^IJSVGTransformParameterModifier)(NSInteger index, CGFloat value);
|
||||
typedef void (^IJSVGTransformApplyBlock)(IJSVGTransform* transform);
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGTransformCommand) {
|
||||
IJSVGTransformCommandMatrix,
|
||||
IJSVGTransformCommandTranslate,
|
||||
IJSVGTransformCommandTranslateX,
|
||||
IJSVGTransformCommandTranslateY,
|
||||
IJSVGTransformCommandScale,
|
||||
IJSVGTransformCommandRotate,
|
||||
IJSVGTransformCommandSkewX,
|
||||
IJSVGTransformCommandSkewY,
|
||||
IJSVGTransformCommandNotImplemented
|
||||
};
|
||||
|
||||
@interface IJSVGTransform : NSObject {
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) IJSVGTransformCommand command;
|
||||
@property (nonatomic, assign) CGFloat* parameters;
|
||||
@property (nonatomic, assign) NSInteger parameterCount;
|
||||
@property (nonatomic, assign) NSInteger sort;
|
||||
|
||||
void IJSVGApplyTransform(NSArray<IJSVGTransform*>* transforms, IJSVGTransformApplyBlock block);
|
||||
BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform affineTransform);
|
||||
CGAffineTransform IJSVGConcatTransforms(NSArray<IJSVGTransform*>* transforms);
|
||||
NSString* IJSVGTransformAttributeString(CGAffineTransform transform);
|
||||
|
||||
+ (NSArray<NSDictionary*>*)affineTransformToSVGTransformComponents:(CGAffineTransform)transform;
|
||||
+ (NSString*)affineTransformToSVGTransformComponentString:(CGAffineTransform)transform
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
+ (NSString*)affineTransformToSVGTransformComponentString:(CGAffineTransform)transform;
|
||||
+ (NSArray<IJSVGTransform*>*)transformsFromAffineTransform:(CGAffineTransform)affineTransform;
|
||||
+ (NSArray<IJSVGTransform*>*)transformsForString:(NSString*)string;
|
||||
+ (NSString*)affineTransformToSVGMatrixString:(CGAffineTransform)affineTransform;
|
||||
+ (NSString*)affineTransformToSVGMatrixString:(CGAffineTransform)transform
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions;
|
||||
- (void)applyBounds:(CGRect)bounds
|
||||
withContentUnits:(IJSVGUnitType)contentUnits;
|
||||
- (CGAffineTransform)CGAffineTransform;
|
||||
- (CGAffineTransform)CGAffineTransformWithModifier:(IJSVGTransformParameterModifier)modifier;
|
||||
- (CGAffineTransform)stackIdentity:(CGAffineTransform)identity;
|
||||
- (void)recalculateWithBounds:(CGRect)bounds;
|
||||
+ (IJSVGTransform*)transformByTranslatingX:(CGFloat)x
|
||||
y:(CGFloat)y;
|
||||
+ (IJSVGTransform*)transformByScaleX:(CGFloat)x
|
||||
y:(CGFloat)y;
|
||||
|
||||
@end
|
||||
@@ -1,641 +0,0 @@
|
||||
//
|
||||
// IJSVGTransform.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 01/09/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGMath.h"
|
||||
#import "IJSVGTransform.h"
|
||||
#import "IJSVGParsing.h"
|
||||
|
||||
@implementation IJSVGTransform
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)free(_parameters);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGTransform* trans = [[self.class alloc] init];
|
||||
trans.command = _command;
|
||||
trans.parameters = (CGFloat*)malloc(sizeof(CGFloat) * _parameterCount);
|
||||
trans.sort = _sort;
|
||||
trans.parameterCount = _parameterCount;
|
||||
memcpy(trans.parameters, _parameters, sizeof(CGFloat) * _parameterCount);
|
||||
return trans;
|
||||
}
|
||||
|
||||
CGAffineTransform IJSVGConcatTransforms(NSArray<IJSVGTransform*>* transforms)
|
||||
{
|
||||
__block CGAffineTransform trans = CGAffineTransformIdentity;
|
||||
IJSVGApplyTransform(transforms, ^(IJSVGTransform* transform) {
|
||||
trans = CGAffineTransformConcat(trans, transform.CGAffineTransform);
|
||||
});
|
||||
return trans;
|
||||
}
|
||||
|
||||
NSString* IJSVGTransformAttributeString(CGAffineTransform transform)
|
||||
{
|
||||
return [IJSVGTransform affineTransformToSVGMatrixString:transform];
|
||||
}
|
||||
|
||||
void IJSVGApplyTransform(NSArray<IJSVGTransform*>* transforms, IJSVGTransformApplyBlock block)
|
||||
{
|
||||
for (IJSVGTransform* transform in transforms) {
|
||||
block(transform);
|
||||
}
|
||||
};
|
||||
|
||||
BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform)
|
||||
{
|
||||
if(transform.tx != 0.f || transform.ty != 0.f) {
|
||||
CGFloat scaleX = sqrt(pow(transform.a, 2.f) + pow(transform.c, 2.f));
|
||||
CGFloat scaleY = sqrt(pow(transform.b, 2.f) + pow(transform.d, 2.f));
|
||||
return scaleX != 1.f || scaleY != 1.f;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (IJSVGTransform*)transformByTranslatingX:(CGFloat)x
|
||||
y:(CGFloat)y
|
||||
{
|
||||
IJSVGTransform* transform = [[[self alloc] init] autorelease];
|
||||
transform.command = IJSVGTransformCommandTranslate;
|
||||
transform.parameterCount = 2;
|
||||
CGFloat* params = (CGFloat*)malloc(sizeof(CGFloat) * 2);
|
||||
params[0] = x;
|
||||
params[1] = y;
|
||||
transform.parameters = params;
|
||||
return transform;
|
||||
}
|
||||
|
||||
+ (IJSVGTransform*)transformByScaleX:(CGFloat)x
|
||||
y:(CGFloat)y
|
||||
{
|
||||
IJSVGTransform* transform = [[[self alloc] init] autorelease];
|
||||
transform.command = IJSVGTransformCommandScale;
|
||||
transform.parameterCount = 2;
|
||||
CGFloat* params = (CGFloat*)malloc(sizeof(CGFloat) * 2);
|
||||
params[0] = x;
|
||||
params[1] = y;
|
||||
transform.parameters = params;
|
||||
return transform;
|
||||
}
|
||||
|
||||
- (void)recalculateWithBounds:(CGRect)bounds
|
||||
{
|
||||
CGFloat max = bounds.size.width > bounds.size.height ? bounds.size.width : bounds.size.height;
|
||||
switch (_command) {
|
||||
case IJSVGTransformCommandRotate: {
|
||||
if (_parameterCount == 1) {
|
||||
return;
|
||||
}
|
||||
_parameters[1] = _parameters[1] * max;
|
||||
_parameters[2] = _parameters[2] * max;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+ (IJSVGTransformCommand)commandForCommandCString:(char*)str
|
||||
{
|
||||
IJSVGCharBufferToLower(str);
|
||||
if (strcmp(str, "matrix") == 0) {
|
||||
return IJSVGTransformCommandMatrix;
|
||||
}
|
||||
if (strcmp(str, "translate") == 0) {
|
||||
return IJSVGTransformCommandTranslate;
|
||||
}
|
||||
if (strcmp(str, "translatex") == 0) {
|
||||
return IJSVGTransformCommandTranslateX;
|
||||
}
|
||||
if (strcmp(str, "translatey") == 0) {
|
||||
return IJSVGTransformCommandTranslateY;
|
||||
}
|
||||
if (strcmp(str, "scale") == 0) {
|
||||
return IJSVGTransformCommandScale;
|
||||
}
|
||||
if (strcmp(str, "skewx") == 0) {
|
||||
return IJSVGTransformCommandSkewX;
|
||||
}
|
||||
if (strcmp(str, "skewy") == 0) {
|
||||
return IJSVGTransformCommandSkewY;
|
||||
}
|
||||
if (strcmp(str, "rotate") == 0) {
|
||||
return IJSVGTransformCommandRotate;
|
||||
}
|
||||
return IJSVGTransformCommandNotImplemented;
|
||||
}
|
||||
|
||||
+ (IJSVGTransformCommand)commandForCommandString:(NSString*)str
|
||||
{
|
||||
str = str.lowercaseString;
|
||||
if ([str isEqualToString:@"matrix"])
|
||||
return IJSVGTransformCommandMatrix;
|
||||
if ([str isEqualToString:@"translate"])
|
||||
return IJSVGTransformCommandTranslate;
|
||||
if ([str isEqualToString:@"translatex"])
|
||||
return IJSVGTransformCommandTranslateX;
|
||||
if ([str isEqualToString:@"translatey"])
|
||||
return IJSVGTransformCommandTranslateY;
|
||||
if ([str isEqualToString:@"scale"])
|
||||
return IJSVGTransformCommandScale;
|
||||
if ([str isEqualToString:@"skewx"])
|
||||
return IJSVGTransformCommandSkewX;
|
||||
if ([str isEqualToString:@"skewy"])
|
||||
return IJSVGTransformCommandSkewY;
|
||||
if ([str isEqualToString:@"rotate"])
|
||||
return IJSVGTransformCommandRotate;
|
||||
return IJSVGTransformCommandNotImplemented;
|
||||
}
|
||||
|
||||
+ (NSInteger)sortForTransformCommand:(IJSVGTransformCommand)command
|
||||
{
|
||||
switch (command) {
|
||||
case IJSVGTransformCommandScale:
|
||||
return 0;
|
||||
case IJSVGTransformCommandRotate:
|
||||
return 1;
|
||||
case IJSVGTransformCommandMatrix:
|
||||
return 2;
|
||||
case IJSVGTransformCommandTranslateX:
|
||||
case IJSVGTransformCommandTranslateY:
|
||||
case IJSVGTransformCommandTranslate:
|
||||
return -1;
|
||||
default:
|
||||
return 10;
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGTransform*>*)transformsForString:(NSString*)string
|
||||
{
|
||||
NSMutableArray<IJSVGTransform*>* transforms = nil;
|
||||
transforms = [[[NSMutableArray alloc] init] autorelease];
|
||||
|
||||
const char* charString = string.UTF8String;
|
||||
IJSVGParsingStringMethod** methods = NULL;
|
||||
NSUInteger count = 0;
|
||||
methods = IJSVGParsingMethodParseString(charString, &count);
|
||||
for(int i = 0; i < count; i++) {
|
||||
IJSVGParsingStringMethod* method = methods[i];
|
||||
IJSVGTransformCommand commandType;
|
||||
commandType = [self.class commandForCommandCString:method->name];
|
||||
if(commandType == IJSVGTransformCommandNotImplemented) {
|
||||
(void)IJSVGParsingStringMethodRelease(method), method = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// create a new transform object and parse the parameters
|
||||
NSInteger count = 0;
|
||||
IJSVGTransform* transform = [[[self.class alloc] init] autorelease];
|
||||
transform.command = commandType;
|
||||
transform.sort = [self.class sortForTransformCommand:commandType];
|
||||
transform.parameters = [IJSVGUtils scanFloatsFromCString:method->parameters
|
||||
size:&count];
|
||||
transform.parameterCount = count;
|
||||
|
||||
// add to the list of transforms to return
|
||||
[transforms addObject:transform];
|
||||
(void)IJSVGParsingStringMethodRelease(method), method = NULL;
|
||||
}
|
||||
(void)free(methods), methods = NULL;
|
||||
return transforms;
|
||||
}
|
||||
|
||||
- (void)applyBounds:(CGRect)bounds
|
||||
withContentUnits:(IJSVGUnitType)contentUnits
|
||||
{
|
||||
if(contentUnits != IJSVGUnitObjectBoundingBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(self.command) {
|
||||
case IJSVGTransformCommandTranslate: {
|
||||
self.parameters[0] *= bounds.size.width;
|
||||
if(self.parameterCount == 2) {
|
||||
self.parameters[1] *= bounds.size.height;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (CGAffineTransform)CGAffineTransform
|
||||
{
|
||||
return [self stackIdentity:CGAffineTransformIdentity];
|
||||
}
|
||||
|
||||
- (CGAffineTransform)stackIdentity:(CGAffineTransform)identity
|
||||
{
|
||||
switch (_command) {
|
||||
|
||||
// translate
|
||||
case IJSVGTransformCommandTranslate: {
|
||||
if (_parameterCount == 1) {
|
||||
return CGAffineTransformTranslate(identity, _parameters[0], 0.f);
|
||||
}
|
||||
return CGAffineTransformTranslate(identity, _parameters[0], _parameters[1]);
|
||||
}
|
||||
|
||||
// translateX
|
||||
case IJSVGTransformCommandTranslateX: {
|
||||
return CGAffineTransformTranslate(identity, _parameters[0], 0.f);
|
||||
}
|
||||
|
||||
// translateY
|
||||
case IJSVGTransformCommandTranslateY: {
|
||||
return CGAffineTransformTranslate(identity, 0.f, _parameters[0]);
|
||||
}
|
||||
|
||||
// rotate
|
||||
case IJSVGTransformCommandRotate: {
|
||||
if (_parameterCount == 1) {
|
||||
return CGAffineTransformRotate(identity, (_parameters[0] / 180) * M_PI);
|
||||
}
|
||||
CGFloat p0 = _parameters[0];
|
||||
CGFloat p1 = _parameters[1];
|
||||
CGFloat p2 = _parameters[2];
|
||||
CGFloat angle = p0 * (M_PI / 180.f);
|
||||
|
||||
identity = CGAffineTransformTranslate(identity, p1, p2);
|
||||
identity = CGAffineTransformRotate(identity, angle);
|
||||
return CGAffineTransformTranslate(identity, -1.f * p1, -1.f * p2);
|
||||
}
|
||||
|
||||
// scale
|
||||
case IJSVGTransformCommandScale: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
if (_parameterCount == 1) {
|
||||
return CGAffineTransformScale(identity, p0, p0);
|
||||
}
|
||||
CGFloat p1 = _parameters[1];
|
||||
return CGAffineTransformScale(identity, p0, p1);
|
||||
}
|
||||
|
||||
// matrix
|
||||
case IJSVGTransformCommandMatrix: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
CGFloat p1 = _parameters[1];
|
||||
CGFloat p2 = _parameters[2];
|
||||
CGFloat p3 = _parameters[3];
|
||||
CGFloat p4 = _parameters[4];
|
||||
CGFloat p5 = _parameters[5];
|
||||
return CGAffineTransformMake(p0, p1, p2, p3, p4, p5);
|
||||
}
|
||||
|
||||
// skewX
|
||||
case IJSVGTransformCommandSkewX: {
|
||||
CGFloat degrees = _parameters[0];
|
||||
CGFloat radians = degrees * M_PI / 180.f;
|
||||
return CGAffineTransformMake(1.f, 0.f, tan(radians), 1.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
// skewY
|
||||
case IJSVGTransformCommandSkewY: {
|
||||
CGFloat degrees = _parameters[0];
|
||||
CGFloat radians = degrees * M_PI / 180.f;
|
||||
return CGAffineTransformMake(1.f, tan(radians), 0.f, 1.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
case IJSVGTransformCommandNotImplemented: {
|
||||
return CGAffineTransformIdentity;
|
||||
}
|
||||
}
|
||||
return CGAffineTransformIdentity;
|
||||
}
|
||||
|
||||
- (CGAffineTransform)CGAffineTransformWithModifier:(IJSVGTransformParameterModifier)modifier
|
||||
{
|
||||
switch (_command) {
|
||||
// matrix
|
||||
case IJSVGTransformCommandMatrix: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
CGFloat p1 = _parameters[1];
|
||||
CGFloat p2 = _parameters[2];
|
||||
CGFloat p3 = _parameters[3];
|
||||
CGFloat p4 = _parameters[4];
|
||||
CGFloat p5 = _parameters[5];
|
||||
if (modifier != nil) {
|
||||
p0 = modifier(0, p0);
|
||||
p1 = modifier(1, p1);
|
||||
p2 = modifier(2, p2);
|
||||
p3 = modifier(3, p3);
|
||||
p4 = modifier(4, p4);
|
||||
p5 = modifier(5, p5);
|
||||
}
|
||||
return CGAffineTransformMake(p0, p1, p2, p3, p4, p5);
|
||||
}
|
||||
|
||||
// translate
|
||||
case IJSVGTransformCommandTranslate: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
if (_parameterCount == 1) {
|
||||
return CGAffineTransformMakeTranslation(p0, 0);
|
||||
}
|
||||
CGFloat p1 = _parameters[1];
|
||||
if (modifier != nil) {
|
||||
p0 = modifier(0, p0);
|
||||
p1 = modifier(1, p1);
|
||||
}
|
||||
return CGAffineTransformMakeTranslation(p0, p1);
|
||||
}
|
||||
|
||||
// translateX
|
||||
case IJSVGTransformCommandTranslateX: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
if (modifier != nil) {
|
||||
p0 = modifier(0, p0);
|
||||
}
|
||||
return CGAffineTransformMakeTranslation(p0, 0.f);
|
||||
}
|
||||
|
||||
// translateY
|
||||
case IJSVGTransformCommandTranslateY: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
if (modifier != nil) {
|
||||
p0 = modifier(0, p0);
|
||||
}
|
||||
return CGAffineTransformMakeTranslation(0.f, p0);
|
||||
}
|
||||
|
||||
// scale
|
||||
case IJSVGTransformCommandScale: {
|
||||
CGFloat p0 = _parameters[0];
|
||||
if (_parameterCount == 1) {
|
||||
return CGAffineTransformMakeScale(p0, p0);
|
||||
}
|
||||
CGFloat p1 = _parameters[1];
|
||||
if (modifier != nil) {
|
||||
p0 = modifier(0, p0);
|
||||
p1 = modifier(1, p1);
|
||||
}
|
||||
return CGAffineTransformMakeScale(p0, p1);
|
||||
}
|
||||
|
||||
// skewX
|
||||
case IJSVGTransformCommandSkewX: {
|
||||
CGFloat degrees = _parameters[0];
|
||||
if (modifier != nil) {
|
||||
degrees = modifier(0, degrees);
|
||||
}
|
||||
CGFloat radians = degrees * M_PI / 180.f;
|
||||
return CGAffineTransformMake(1.f, 0.f, tan(radians), 1.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
// skewY
|
||||
case IJSVGTransformCommandSkewY: {
|
||||
CGFloat degrees = _parameters[0];
|
||||
if (modifier != nil) {
|
||||
degrees = modifier(0, degrees);
|
||||
}
|
||||
CGFloat radians = degrees * M_PI / 180.f;
|
||||
return CGAffineTransformMake(1.f, tan(radians), 0.f, 1.f, 0.f, 0.f);
|
||||
}
|
||||
|
||||
// rotate
|
||||
case IJSVGTransformCommandRotate: {
|
||||
if (_parameterCount == 1) {
|
||||
return CGAffineTransformMakeRotation((_parameters[0] / 180) * M_PI);
|
||||
} else {
|
||||
CGFloat p0 = _parameters[0];
|
||||
CGFloat p1 = _parameters[1];
|
||||
CGFloat p2 = _parameters[2];
|
||||
if (modifier != nil) {
|
||||
p0 = modifier(0, p0);
|
||||
p1 = modifier(1, p1);
|
||||
p2 = modifier(2, p2);
|
||||
}
|
||||
CGFloat angle = p0 * (M_PI / 180.f);
|
||||
CGAffineTransform def = CGAffineTransformIdentity;
|
||||
def = CGAffineTransformTranslate(def, p1, p2);
|
||||
def = CGAffineTransformRotate(def, angle);
|
||||
def = CGAffineTransformTranslate(def, -1.f * p1, -1.f * p2);
|
||||
return def;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// do nothing
|
||||
case IJSVGTransformCommandNotImplemented: {
|
||||
return CGAffineTransformIdentity;
|
||||
}
|
||||
}
|
||||
return CGAffineTransformIdentity;
|
||||
}
|
||||
|
||||
+ (NSArray<IJSVGTransform*>*)transformsFromAffineTransform:(CGAffineTransform)affineTransform
|
||||
{
|
||||
NSString* matrix = [self affineTransformToSVGMatrixString:affineTransform];
|
||||
return [self transformsForString:matrix];
|
||||
}
|
||||
|
||||
+ (NSString*)affineTransformToSVGTransformComponentString:(CGAffineTransform)transform
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
NSArray<NSDictionary*>* trans = [self affineTransformToSVGTransformComponents:transform];
|
||||
trans = [self filterUselessAffineTransformComponents:trans];
|
||||
NSMutableArray<NSString*>* strings = [[[NSMutableArray alloc] initWithCapacity:trans.count] autorelease];
|
||||
for (NSDictionary* dict in trans) {
|
||||
NSArray<NSNumber*>* data = dict[@"data"];
|
||||
NSString* method = dict[@"name"];
|
||||
NSMutableArray* dataStrings = [[[NSMutableArray alloc] initWithCapacity:data.count] autorelease];
|
||||
for (NSNumber* number in data) {
|
||||
[dataStrings addObject:IJSVGShortFloatStringWithOptions(number.floatValue,
|
||||
floatingPointOptions)];
|
||||
}
|
||||
[strings addObject:[NSString stringWithFormat:@"%@(%@)", method,
|
||||
IJSVGCompressFloatParameterArray(dataStrings)]];
|
||||
}
|
||||
NSString* componentsString = [strings componentsJoinedByString:@" "];
|
||||
NSString* matrixString = [self affineTransformToSVGMatrixString:transform
|
||||
floatingPointOptions:floatingPointOptions];
|
||||
return componentsString.length < matrixString.length ? componentsString : matrixString;
|
||||
}
|
||||
|
||||
+ (NSString*)affineTransformToSVGTransformComponentString:(CGAffineTransform)transform
|
||||
{
|
||||
NSArray<NSDictionary*>* trans = [self affineTransformToSVGTransformComponents:transform];
|
||||
trans = [self filterUselessAffineTransformComponents:trans];
|
||||
NSMutableArray<NSString*>* strings = [[[NSMutableArray alloc] initWithCapacity:trans.count] autorelease];
|
||||
for (NSDictionary* dict in trans) {
|
||||
NSArray<NSNumber*>* data = dict[@"data"];
|
||||
NSString* method = dict[@"name"];
|
||||
NSMutableArray* dataStrings = [[[NSMutableArray alloc] initWithCapacity:data.count] autorelease];
|
||||
for (NSNumber* number in data) {
|
||||
[dataStrings addObject:IJSVGShortFloatString(number.floatValue)];
|
||||
}
|
||||
[strings addObject:[NSString stringWithFormat:@"%@(%@)", method,
|
||||
IJSVGCompressFloatParameterArray(dataStrings)]];
|
||||
}
|
||||
NSString* componentsString = [strings componentsJoinedByString:@" "];
|
||||
NSString* matrixString = [self affineTransformToSVGMatrixString:transform];
|
||||
return componentsString.length < matrixString.length ? componentsString : matrixString;
|
||||
}
|
||||
|
||||
+ (NSString*)affineTransformToSVGMatrixString:(CGAffineTransform)transform
|
||||
floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions
|
||||
{
|
||||
NSArray<NSString*>* numbers = @[
|
||||
IJSVGShortFloatStringWithOptions(transform.a, floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(transform.b, floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(transform.c, floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(transform.d, floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(transform.tx, floatingPointOptions),
|
||||
IJSVGShortFloatStringWithOptions(transform.ty, floatingPointOptions)
|
||||
];
|
||||
return [NSString stringWithFormat:@"matrix(%@)", IJSVGCompressFloatParameterArray(numbers)];
|
||||
}
|
||||
|
||||
+ (NSString*)affineTransformToSVGMatrixString:(CGAffineTransform)transform
|
||||
{
|
||||
NSArray<NSString*>* numbers = @[
|
||||
IJSVGShortFloatString(transform.a),
|
||||
IJSVGShortFloatString(transform.b),
|
||||
IJSVGShortFloatString(transform.c),
|
||||
IJSVGShortFloatString(transform.d),
|
||||
IJSVGShortFloatString(transform.tx),
|
||||
IJSVGShortFloatString(transform.ty)
|
||||
];
|
||||
return [NSString stringWithFormat:@"matrix(%@)",
|
||||
IJSVGCompressFloatParameterArray(numbers)];
|
||||
}
|
||||
|
||||
+ (NSArray<NSDictionary*>*)filterUselessAffineTransformComponents:(NSArray<NSDictionary*>*)components
|
||||
{
|
||||
NSMutableArray* comps = [[[NSMutableArray alloc] initWithCapacity:components.count] autorelease];
|
||||
NSArray<NSString*>* names = @[ @"translate", @"rotate", @"skewX", @"skewY" ];
|
||||
for (NSDictionary* transform in components) {
|
||||
NSString* name = transform[@"name"];
|
||||
NSArray<NSNumber*>* data = transform[@"data"];
|
||||
if ([names containsObject:name] && (data.count == 1 || [name isEqualToString:@"rotate"]) && data[0].floatValue == 0.f) {
|
||||
continue;
|
||||
} else if ([name isEqualToString:@"translate"] && data[0].floatValue == 0.f && data[1].floatValue == 0.f) {
|
||||
continue;
|
||||
} else if ([name isEqualToString:@"scale"] && data[0].floatValue == 1.f && (data.count < 2 || (data.count == 2 && data[1].floatValue == 1.f))) {
|
||||
continue;
|
||||
} else if ([name isEqualToString:@"matrix"] && data[0].floatValue == 1.f && data[3].floatValue == 1.f && !(data[1].floatValue != 0.f || data[2].floatValue != 0.f || data[4].floatValue != 0.f || data[5].floatValue != 0.f)) {
|
||||
continue;
|
||||
}
|
||||
[comps addObject:transform];
|
||||
}
|
||||
return comps;
|
||||
}
|
||||
|
||||
+ (NSArray<NSDictionary*>*)affineTransformToSVGTransformComponents:(CGAffineTransform)transform
|
||||
{
|
||||
const NSUInteger precision = 5;
|
||||
CGFloat data[6] = {
|
||||
IJSVGMathToFixed(transform.a, precision),
|
||||
IJSVGMathToFixed(transform.b, precision),
|
||||
IJSVGMathToFixed(transform.c, precision),
|
||||
IJSVGMathToFixed(transform.d, precision),
|
||||
IJSVGMathToFixed(transform.tx, precision),
|
||||
IJSVGMathToFixed(transform.ty, precision)
|
||||
};
|
||||
|
||||
CGFloat sx = IJSVGMathToFixed(hypotf(data[0], data[1]), precision);
|
||||
CGFloat sy = IJSVGMathToFixed(((data[0] * data[3] - data[1] * data[2]) / sx), precision);
|
||||
CGFloat colSum = data[0] * data[2] + data[1] * data[3];
|
||||
CGFloat rowSum = data[0] * data[1] + data[2] * data[3];
|
||||
BOOL scaleBefore = rowSum != 0.f || sx == sy;
|
||||
|
||||
NSMutableArray* transforms = [[[NSMutableArray alloc] init] autorelease];
|
||||
|
||||
// tx, ty -> translate
|
||||
if (data[4] != 0.f || data[5] != 0.f) {
|
||||
[transforms addObject:@{
|
||||
@"name" : @"translate",
|
||||
@"data" : @[ @(data[4]), @(data[5]) ]
|
||||
}];
|
||||
}
|
||||
|
||||
// [sx, 0, tan(a).sy, sy, 0, 0] -> skewX(a).scale(sx,sy)
|
||||
if (data[1] == 0.f && data[2] != 0.f) {
|
||||
[transforms addObject:@{
|
||||
@"name" : @"skewX",
|
||||
@"data" : @[ @(IJSVGMathToFixed(IJSVGMathAtan(data[2] / sy), precision)) ]
|
||||
}];
|
||||
|
||||
// [sx, sy.tan(a), 0, sy, 0, 0] -> skewX(a).scale(sx, sy)
|
||||
} else if (data[1] != 0.f && data[2] == 0.f) {
|
||||
[transforms addObject:@{
|
||||
@"name" : @"skewY",
|
||||
@"data" : @[ @(IJSVGMathToFixed(IJSVGMathAtan(data[1] / data[0]), precision)) ]
|
||||
}];
|
||||
sx = data[0];
|
||||
sy = data[3];
|
||||
} else if (colSum == 0.f || (sx == 1.f && sy == 1.f) || !scaleBefore) {
|
||||
if (!scaleBefore) {
|
||||
sx = (data[0] < 0.f ? -1.f : 1.f) * hypotf(data[0], data[2]);
|
||||
sy = (data[3] < 0.f ? -1.f : 1.f) * hypotf(data[1], data[3]);
|
||||
if (sx != 1.f || sy != 1.f) {
|
||||
[transforms addObject:@{
|
||||
@"name" : @"scale",
|
||||
@"data" : (sx == sy) ? @[ @(sx) ] : @[ @(sx), @(sy) ]
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
CGFloat angle = MIN(MAX(-1.f, data[0] / sx), 1.f);
|
||||
NSMutableArray<NSNumber*>* rotate = [[[NSMutableArray alloc] initWithCapacity:3] autorelease];
|
||||
[rotate addObject:@(IJSVGMathToFixed(IJSVGMathAcos(angle), precision) * ((scaleBefore ? 1.f : sy) * data[1] < 0.f ? -1.f : 1.f))];
|
||||
|
||||
if (rotate[0].floatValue != 0.f) {
|
||||
[transforms addObject:@{
|
||||
@"name" : @"rotate",
|
||||
@"data" : rotate
|
||||
}];
|
||||
}
|
||||
|
||||
if (rowSum != 0.f && colSum != 0.f) {
|
||||
[transforms addObject:@{
|
||||
@"name" : @"skewX",
|
||||
@"data" : @[ @(IJSVGMathToFixed(IJSVGMathAtan(colSum / (sx * sx)), precision)) ]
|
||||
}];
|
||||
}
|
||||
|
||||
// rotate can consume translate
|
||||
if (rotate[0].floatValue != 0.f && (data[4] != 0.f || data[5] != 0.f)) {
|
||||
[transforms removeObjectAtIndex:0];
|
||||
CGFloat cos = data[0] / sx;
|
||||
CGFloat sin = data[1] / (scaleBefore ? sx : sy);
|
||||
CGFloat x = data[4] * (scaleBefore ? 1.f : sy);
|
||||
CGFloat y = data[5] * (scaleBefore ? 1.f : sx);
|
||||
CGFloat denom = (powf(1.f - cos, 2.f) + powf(sin, 2.f)) * (scaleBefore ? 1.f : (sx * sy));
|
||||
[rotate addObject:@(((1.f - cos) * x - sin * y) / denom)];
|
||||
[rotate addObject:@(((1.f - cos) * y + sin * x) / denom)];
|
||||
}
|
||||
} else if (data[1] != 0.f || data[2] != 0.f) {
|
||||
NSDictionary* trans = @{
|
||||
@"name" : @"matrix",
|
||||
@"data" : @[ @(data[0]), @(data[1]), @(data[2]), @(data[3]), @(data[4]), @(data[5]) ]
|
||||
};
|
||||
return @[ trans ];
|
||||
}
|
||||
|
||||
if (scaleBefore == YES && ((sx != 1.f || sy != 1.f) || transforms.count == 0)) {
|
||||
NSDictionary* trans = @{
|
||||
@"name" : @"scale",
|
||||
@"data" : (sx == sy) ? @[ @(sx) ] : @[ @(sx), @(sy) ]
|
||||
};
|
||||
[transforms addObject:trans];
|
||||
}
|
||||
|
||||
return transforms;
|
||||
}
|
||||
|
||||
- (NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ %@", [super description],
|
||||
[self.class affineTransformToSVGTransformComponentString:self.CGAffineTransform]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitLength.h
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 13/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef struct {
|
||||
BOOL round;
|
||||
int precision;
|
||||
} IJSVGFloatingPointOptions;
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGUnitLengthType) {
|
||||
IJSVGUnitLengthTypeNumber,
|
||||
IJSVGUnitLengthTypePercentage,
|
||||
IJSVGUnitLengthTypeCM,
|
||||
IJSVGUnitLengthTypeMM,
|
||||
IJSVGUnitLengthTypeIN,
|
||||
IJSVGUnitLengthTypePT,
|
||||
IJSVGUnitLengthTypePC,
|
||||
IJSVGUnitLengthTypePX
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGUnitType) {
|
||||
IJSVGUnitUserSpaceOnUse,
|
||||
IJSVGUnitObjectBoundingBox,
|
||||
IJSVGUnitInherit
|
||||
};
|
||||
|
||||
@interface IJSVGUnitLength : NSObject <NSCopying>
|
||||
|
||||
@property (nonatomic, assign) IJSVGUnitLengthType type;
|
||||
@property (nonatomic, assign) IJSVGUnitLengthType originalType;
|
||||
@property (nonatomic, assign) CGFloat value;
|
||||
@property (nonatomic, assign) BOOL inherit;
|
||||
|
||||
+ (IJSVGUnitLength*)zeroUnitLength;
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithFloat:(CGFloat)number;
|
||||
+ (IJSVGUnitLength*)unitWithFloat:(CGFloat)number
|
||||
type:(IJSVGUnitLengthType)type;
|
||||
+ (IJSVGUnitLength*)unitWithPercentageFloat:(CGFloat)number;
|
||||
+ (IJSVGUnitLength*)unitWithString:(NSString*)string;
|
||||
+ (IJSVGUnitLength*)unitWithPercentageString:(NSString*)string;
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithString:(NSString*)string
|
||||
fromUnitType:(IJSVGUnitType)units;
|
||||
|
||||
- (IJSVGUnitLength*)lengthWithUnitType:(IJSVGUnitLengthType)type;
|
||||
- (IJSVGUnitLength*)lengthByMatchingPercentage;
|
||||
- (CGFloat)valueAsPercentage;
|
||||
- (CGFloat)computeValue:(CGFloat)anotherValue;
|
||||
- (NSString*)stringValue;
|
||||
- (NSString*)stringValueWithFloatingPointOptions:(IJSVGFloatingPointOptions)options;
|
||||
|
||||
@end
|
||||
@@ -1,264 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitLength.m
|
||||
// IJSVGExample
|
||||
//
|
||||
// Created by Curtis Hard on 13/01/2017.
|
||||
// Copyright © 2017 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGNode.h"
|
||||
#import "IJSVGUnitLength.h"
|
||||
#import "IJSVGUtils.h"
|
||||
|
||||
@implementation IJSVGUnitLength
|
||||
|
||||
+ (IJSVGUnitLength*)zeroUnitLength
|
||||
{
|
||||
return [self unitWithFloat:0.f
|
||||
type:IJSVGUnitLengthTypeNumber];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithFloat:(CGFloat)number
|
||||
{
|
||||
IJSVGUnitLength* unit = [[[self alloc] init] autorelease];
|
||||
unit.value = number;
|
||||
unit.type = IJSVGUnitLengthTypeNumber;
|
||||
return unit;
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithString:(NSString*)string
|
||||
fromUnitType:(IJSVGUnitType)units
|
||||
{
|
||||
if (units == IJSVGUnitObjectBoundingBox) {
|
||||
return [self unitWithPercentageString:string];
|
||||
}
|
||||
return [self unitWithString:string];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithFloat:(CGFloat)number
|
||||
type:(IJSVGUnitLengthType)type
|
||||
{
|
||||
IJSVGUnitLength* unit = [[[self alloc] init] autorelease];
|
||||
unit.value = number;
|
||||
unit.type = type;
|
||||
return unit;
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithPercentageFloat:(CGFloat)number
|
||||
{
|
||||
return [self unitWithFloat:number
|
||||
type:IJSVGUnitLengthTypePercentage];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithPercentageString:(NSString*)string
|
||||
{
|
||||
IJSVGUnitLength* unit = [self unitWithString:string];
|
||||
unit.type = IJSVGUnitLengthTypePercentage;
|
||||
return unit;
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLengthType)typeForCString:(const char*)chars
|
||||
{
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "%")) {
|
||||
return IJSVGUnitLengthTypePercentage;
|
||||
}
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "cm")) {
|
||||
return IJSVGUnitLengthTypeCM;
|
||||
}
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "mm")) {
|
||||
return IJSVGUnitLengthTypeMM;
|
||||
}
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "in")) {
|
||||
return IJSVGUnitLengthTypeIN;
|
||||
}
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "pt")) {
|
||||
return IJSVGUnitLengthTypePT;
|
||||
}
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "pc")) {
|
||||
return IJSVGUnitLengthTypePC;
|
||||
}
|
||||
if(IJSVGCharBufferHasSuffix((char*)chars, "px")) {
|
||||
return IJSVGUnitLengthTypePX;
|
||||
}
|
||||
return IJSVGUnitLengthTypeNumber;
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLengthType)typeForString:(NSString*)string
|
||||
{
|
||||
if([string hasSuffix:@"%"] == YES) {
|
||||
return IJSVGUnitLengthTypePercentage;
|
||||
}
|
||||
if([string hasSuffix:@"cm"] == YES) {
|
||||
return IJSVGUnitLengthTypeCM;
|
||||
}
|
||||
if([string hasSuffix:@"mm"] == YES) {
|
||||
return IJSVGUnitLengthTypeMM;
|
||||
}
|
||||
if([string hasSuffix:@"in"] == YES) {
|
||||
return IJSVGUnitLengthTypeIN;
|
||||
}
|
||||
if([string hasSuffix:@"pt"] == YES) {
|
||||
return IJSVGUnitLengthTypePT;
|
||||
}
|
||||
if([string hasSuffix:@"pc"] == YES) {
|
||||
return IJSVGUnitLengthTypePC;
|
||||
}
|
||||
if([string hasSuffix:@"px"] == YES) {
|
||||
return IJSVGUnitLengthTypePX;
|
||||
}
|
||||
return IJSVGUnitLengthTypeNumber;
|
||||
}
|
||||
|
||||
+ (CGFloat)convertUnitValue:(CGFloat)unit
|
||||
toBaseFromUnitLengthType:(IJSVGUnitLengthType)type
|
||||
{
|
||||
switch(type) {
|
||||
case IJSVGUnitLengthTypeCM: {
|
||||
return unit * (96.f / 2.54f);
|
||||
}
|
||||
case IJSVGUnitLengthTypeMM: {
|
||||
return [self convertUnitValue:unit
|
||||
toBaseFromUnitLengthType:IJSVGUnitLengthTypeCM] / 10.f;
|
||||
}
|
||||
case IJSVGUnitLengthTypePercentage: {
|
||||
return unit / 100.f;
|
||||
}
|
||||
case IJSVGUnitLengthTypeIN: {
|
||||
// 1in = 96px
|
||||
return unit * 96.f;
|
||||
}
|
||||
case IJSVGUnitLengthTypePT: {
|
||||
// 1pt = 1.333...px
|
||||
return unit * 1.3333333f;
|
||||
}
|
||||
case IJSVGUnitLengthTypePC: {
|
||||
// 1pc = 16px
|
||||
return unit * 16.f;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
||||
+ (IJSVGUnitLength*)unitWithString:(NSString*)string
|
||||
{
|
||||
// just return noting for inherit, node will deal
|
||||
// with the rest...hopefully
|
||||
if(string == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
char* chars = IJSVGTimmedCharBufferCreate(string.UTF8String);
|
||||
|
||||
// is inherit or just nothing
|
||||
size_t strl = strlen(chars);
|
||||
if (strcmp(chars, "inherit") == 0 || strl == 0) {
|
||||
(void)free(chars), chars = NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// grab the float value from the string
|
||||
NSInteger length;
|
||||
CGFloat* floats = [IJSVGUtils scanFloatsFromCString:chars
|
||||
floatCount:1
|
||||
charCount:(NSUInteger)strl
|
||||
size:&length];
|
||||
// not sure how this ended up but nothing returned
|
||||
// even though there should had been
|
||||
if(length == 0) {
|
||||
(void)free(floats), floats = NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
IJSVGUnitLength* unit = [[[self alloc] init] autorelease];
|
||||
unit.value = floats[0];
|
||||
unit.type = IJSVGUnitLengthTypeNumber;
|
||||
|
||||
|
||||
IJSVGUnitLengthType type = [self typeForCString:chars];
|
||||
unit.originalType = type;
|
||||
|
||||
// memory free
|
||||
(void)(free(floats)), floats = NULL;
|
||||
(void)free(chars), chars = NULL;
|
||||
|
||||
switch(type) {
|
||||
case IJSVGUnitLengthTypePercentage: {
|
||||
unit.value = [self convertUnitValue:unit.value
|
||||
toBaseFromUnitLengthType:type];
|
||||
unit.type = IJSVGUnitLengthTypePercentage;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
unit.value = [self convertUnitValue:unit.value
|
||||
toBaseFromUnitLengthType:type];
|
||||
break;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGUnitLength* length = [[IJSVGUnitLength alloc] init];
|
||||
length.value = self.value;
|
||||
length.type = self.type;
|
||||
length.originalType = self.originalType;
|
||||
length.inherit = self.inherit;
|
||||
return length;
|
||||
}
|
||||
|
||||
- (IJSVGUnitLength*)lengthWithUnitType:(IJSVGUnitLengthType)type
|
||||
{
|
||||
return [self.class unitWithFloat:self.value
|
||||
type:type];
|
||||
}
|
||||
|
||||
- (IJSVGUnitLength*)lengthByMatchingPercentage
|
||||
{
|
||||
if(self.type != IJSVGUnitLengthTypePercentage && self.value <= 1.f) {
|
||||
return [self.class unitWithFloat:self.value
|
||||
type:IJSVGUnitLengthTypePercentage];
|
||||
}
|
||||
return [self.class unitWithFloat:self.value
|
||||
type:self.type];
|
||||
}
|
||||
|
||||
- (CGFloat)computeValue:(CGFloat)anotherValue
|
||||
{
|
||||
if (self.type == IJSVGUnitLengthTypePercentage) {
|
||||
return ((anotherValue / 100.f) * (_value * 100.f));
|
||||
}
|
||||
return self.value;
|
||||
}
|
||||
|
||||
- (CGFloat)valueAsPercentage
|
||||
{
|
||||
return self.value / 100;
|
||||
}
|
||||
|
||||
- (NSString*)stringValue
|
||||
{
|
||||
if (self.type == IJSVGUnitLengthTypePercentage) {
|
||||
return [NSString stringWithFormat:@"%@%%",
|
||||
IJSVGShortFloatString(self.value * 100.f)];
|
||||
}
|
||||
return IJSVGShortFloatString(self.value);
|
||||
}
|
||||
|
||||
- (NSString*)stringValueWithFloatingPointOptions:(IJSVGFloatingPointOptions)options
|
||||
{
|
||||
if (_type == IJSVGUnitLengthTypePercentage) {
|
||||
return [NSString stringWithFormat:@"%@%%",
|
||||
IJSVGShortFloatStringWithOptions(_value * 100.f, options)];
|
||||
}
|
||||
return IJSVGShortFloatStringWithOptions(_value, options);
|
||||
}
|
||||
|
||||
- (NSString*)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"%f%@",
|
||||
_value, (_value == IJSVGUnitLengthTypePercentage ? @"%" : @"")];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitPoint.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 12/02/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGUnitLength.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface IJSVGUnitPoint : NSObject <NSCopying>
|
||||
|
||||
@property (nonatomic, retain) IJSVGUnitLength* x;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* y;
|
||||
@property (nonatomic, readonly) CGPoint value;
|
||||
|
||||
+ (IJSVGUnitPoint*)pointWithX:(IJSVGUnitLength*)x
|
||||
y:(IJSVGUnitLength*)y;
|
||||
|
||||
- (void)convertUnitsToLengthType:(IJSVGUnitLengthType)lengthType;
|
||||
- (CGPoint)computeValue:(CGSize)size;
|
||||
|
||||
@end
|
||||
@@ -1,53 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitPoint.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 12/02/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGUnitPoint.h"
|
||||
|
||||
@implementation IJSVGUnitPoint
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_x release], _x = nil;
|
||||
(void)[_y release], _y = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitPoint*)pointWithX:(IJSVGUnitLength*)x
|
||||
y:(IJSVGUnitLength*)y
|
||||
{
|
||||
IJSVGUnitPoint* point = [[[self alloc] init] autorelease];
|
||||
point.x = x;
|
||||
point.y = y;
|
||||
return point;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGUnitPoint* point = [[self.class alloc] init];
|
||||
point.x = [_x.copy autorelease];
|
||||
point.y = [_y.copy autorelease];
|
||||
return point;
|
||||
}
|
||||
|
||||
- (void)convertUnitsToLengthType:(IJSVGUnitLengthType)lengthType
|
||||
{
|
||||
_x.type = _y.type = lengthType;
|
||||
}
|
||||
|
||||
- (CGPoint)computeValue:(CGSize)size
|
||||
{
|
||||
return CGPointMake([_x computeValue:size.width],
|
||||
[_y computeValue:size.height]);
|
||||
}
|
||||
|
||||
- (CGPoint)value
|
||||
{
|
||||
return [self computeValue:CGSizeZero];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitRect.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 12/02/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGUnitPoint.h>
|
||||
#import <IJSVG/IJSVGUnitSize.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface IJSVGUnitRect : NSObject <NSCopying>
|
||||
|
||||
@property (nonatomic, retain) IJSVGUnitSize* size;
|
||||
@property (nonatomic, retain) IJSVGUnitPoint* origin;
|
||||
@property (nonatomic, readonly) BOOL isZeroRect;
|
||||
@property (nonatomic, readonly) CGRect value;
|
||||
|
||||
+ (IJSVGUnitRect*)rectWithCGRect:(CGRect)rect;
|
||||
+ (IJSVGUnitRect*)rectWithOrigin:(IJSVGUnitPoint*)origin
|
||||
size:(IJSVGUnitSize*)size;
|
||||
+ (IJSVGUnitRect*)rectWithX:(CGFloat)x
|
||||
y:(CGFloat)y
|
||||
width:(CGFloat)width
|
||||
height:(CGFloat)height;
|
||||
|
||||
- (CGRect)computeValue:(CGSize)size;
|
||||
|
||||
- (IJSVGUnitRect*)copyByConvertingToUnitsLengthType:(IJSVGUnitLengthType)type;
|
||||
- (void)convertUnitsLengthType:(IJSVGUnitLengthType)type;
|
||||
|
||||
@end
|
||||
@@ -1,90 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitRect.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 12/02/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGUnitRect.h"
|
||||
|
||||
@implementation IJSVGUnitRect
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_size release], _size = nil;
|
||||
(void)[_origin release], _origin = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitRect*)rectWithOrigin:(IJSVGUnitPoint*)origin
|
||||
size:(IJSVGUnitSize*)size
|
||||
{
|
||||
IJSVGUnitRect* rect = [[[self alloc] init] autorelease];
|
||||
rect.origin = origin;
|
||||
rect.size = size;
|
||||
return rect;
|
||||
}
|
||||
|
||||
+ (IJSVGUnitRect*)rectWithCGRect:(CGRect)rect
|
||||
{
|
||||
return [self rectWithX:rect.origin.x
|
||||
y:rect.origin.y
|
||||
width:rect.size.width
|
||||
height:rect.size.height];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitRect*)rectWithX:(CGFloat)x
|
||||
y:(CGFloat)y
|
||||
width:(CGFloat)width
|
||||
height:(CGFloat)height
|
||||
{
|
||||
IJSVGUnitPoint* origin = [IJSVGUnitPoint pointWithX:[IJSVGUnitLength unitWithFloat:x]
|
||||
y:[IJSVGUnitLength unitWithFloat:y]];
|
||||
IJSVGUnitSize* size = [IJSVGUnitSize sizeWithWidth:[IJSVGUnitLength unitWithFloat:width]
|
||||
height:[IJSVGUnitLength unitWithFloat:height]];
|
||||
return [self rectWithOrigin:origin
|
||||
size:size];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
IJSVGUnitRect* rect = [[self.class alloc] init];
|
||||
rect.size = [_size.copy autorelease];
|
||||
rect.origin = [_origin.copy autorelease];
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (CGRect)computeValue:(CGSize)size
|
||||
{
|
||||
return CGRectMake([_origin.x computeValue:size.width],
|
||||
[_origin.y computeValue:size.height],
|
||||
[_size.width computeValue:size.width],
|
||||
[_size.height computeValue:size.height]);
|
||||
}
|
||||
|
||||
- (BOOL)isZeroRect
|
||||
{
|
||||
CGRect computed = [self computeValue:CGSizeZero];
|
||||
return CGRectIsNull(computed) == YES || CGRectEqualToRect(computed, CGRectZero);
|
||||
}
|
||||
|
||||
- (IJSVGUnitRect*)copyByConvertingToUnitsLengthType:(IJSVGUnitLengthType)type
|
||||
{
|
||||
IJSVGUnitRect* rect = self.copy;
|
||||
[rect convertUnitsLengthType:type];
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (void)convertUnitsLengthType:(IJSVGUnitLengthType)type
|
||||
{
|
||||
[_origin convertUnitsToLengthType:type];
|
||||
[_size convertUnitsToLengthType:type];
|
||||
}
|
||||
|
||||
- (CGRect)value
|
||||
{
|
||||
return [self computeValue:CGSizeZero];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitSize.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 12/02/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGUnitLength.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface IJSVGUnitSize : NSObject <NSCopying>
|
||||
|
||||
@property (nonatomic, retain) IJSVGUnitLength* width;
|
||||
@property (nonatomic, retain) IJSVGUnitLength* height;
|
||||
@property (nonatomic, readonly) CGSize value;
|
||||
|
||||
+ (IJSVGUnitSize*)sizeWithWidth:(IJSVGUnitLength*)width
|
||||
height:(IJSVGUnitLength*)height;
|
||||
|
||||
- (void)convertUnitsToLengthType:(IJSVGUnitLengthType)lengthType;
|
||||
- (CGSize)computeValue:(CGSize)size;
|
||||
|
||||
@end
|
||||
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// IJSVGUnitSize.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 12/02/2020.
|
||||
// Copyright © 2020 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGUnitSize.h"
|
||||
|
||||
@implementation IJSVGUnitSize
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
(void)[_width release], _width = nil;
|
||||
(void)[_height release], _height = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (IJSVGUnitSize*)sizeWithWidth:(IJSVGUnitLength*)width
|
||||
height:(IJSVGUnitLength*)height
|
||||
{
|
||||
IJSVGUnitSize* size = [[[self alloc] init] autorelease];
|
||||
size.width = width;
|
||||
size.height = height;
|
||||
return size;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
IJSVGUnitSize* size = [[self.class alloc] init];
|
||||
size.width = [_width.copy autorelease];
|
||||
size.height = [_height.copy autorelease];
|
||||
return size;
|
||||
}
|
||||
|
||||
- (void)convertUnitsToLengthType:(IJSVGUnitLengthType)lengthType
|
||||
{
|
||||
_width.type = _height.type = lengthType;
|
||||
}
|
||||
|
||||
- (CGSize)computeValue:(CGSize)size
|
||||
{
|
||||
return CGSizeMake([_width computeValue:size.width],
|
||||
[_height computeValue:size.height]);
|
||||
}
|
||||
|
||||
- (CGSize)value
|
||||
{
|
||||
return [self computeValue:CGSizeZero];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,87 +0,0 @@
|
||||
//
|
||||
// IJSVGUtils.h
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <IJSVG/IJSVGCommand.h>
|
||||
#import <IJSVG/IJSVGGradientUnitLength.h>
|
||||
#import <IJSVG/IJSVGStringAdditions.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface IJSVGUtils : NSObject
|
||||
|
||||
CGFloat magnitude(CGPoint point);
|
||||
CGFloat ratio(CGPoint a, CGPoint b);
|
||||
CGFloat angle(CGPoint a, CGPoint b);
|
||||
CGFloat radians_to_degrees(CGFloat radians);
|
||||
CGFloat degrees_to_radians(CGFloat degrees);
|
||||
|
||||
BOOL IJSVGCharBufferIsHEX(char* buffer);
|
||||
BOOL IJSVGCharBufferHasPrefix(char* pre, char* str);
|
||||
BOOL IJSVGCharBufferHasSuffix(char* s1, char* s2);
|
||||
char* IJSVGTimmedCharBufferCreate(const char* buffer);
|
||||
void IJSVGTrimCharBuffer(char* buffer);
|
||||
void IJSVGCharBufferToLower(char* buffer);
|
||||
size_t IJSVGCharBufferHash(char* buffer);
|
||||
CGPoint IJSVGPathGetLastQuadraticCommandPoint(CGPathRef path);
|
||||
|
||||
IJSVGFloatingPointOptions IJSVGFloatingPointOptionsDefault(void);
|
||||
IJSVGFloatingPointOptions IJSVGFloatingPointOptionsMake(BOOL round, int precision);
|
||||
|
||||
NSString* IJSVGCompressFloatParameterArray(NSArray<NSString*>* stringToCompress);
|
||||
NSString* IJSVGShortFloatStringWithOptions(CGFloat f, IJSVGFloatingPointOptions options);
|
||||
NSString* IJSVGShortenFloatString(NSString* string);
|
||||
NSString* IJSVGPointToCommandString(CGPoint point);
|
||||
NSString* IJSVGShortFloatString(CGFloat f);
|
||||
NSString* IJSVGShortFloatStringWithPrecision(CGFloat f, NSInteger precision);
|
||||
|
||||
BOOL IJSVGIsLegalCommandCharacter(unichar aChar);
|
||||
BOOL IJSVGIsSVGLayer(CALayer* layer);
|
||||
+ (IJSVGCommandType)typeForCommandChar:(char)commandChar;
|
||||
+ (CGFloat*)commandParameters:(NSString*)command
|
||||
count:(NSInteger*)count;
|
||||
+ (CGFloat*)parseViewBox:(NSString*)string;
|
||||
+ (IJSVGWindingRule)windingRuleForString:(NSString*)string;
|
||||
+ (IJSVGLineJoinStyle)lineJoinStyleForString:(NSString*)string;
|
||||
+ (IJSVGLineCapStyle)lineCapStyleForString:(NSString*)string;
|
||||
+ (IJSVGLineJoinStyle)lineJoinStyleForCGLineJoin:(CGLineJoin)lineJoin;
|
||||
+ (IJSVGLineCapStyle)lineCapStyleForCGLineCap:(CGLineCap)lineCap;
|
||||
+ (IJSVGUnitType)unitTypeForString:(NSString*)string;
|
||||
+ (IJSVGBlendMode)blendModeForString:(NSString*)string;
|
||||
+ (NSString* _Nullable)mixBlendingModeForBlendMode:(IJSVGBlendMode)blendMode;
|
||||
+ (NSRange)rangeOfParentheses:(NSString*)string;
|
||||
|
||||
+ (void)logParameters:(CGFloat*)param
|
||||
count:(NSInteger)count;
|
||||
+ (CGFloat)floatValue:(NSString*)string;
|
||||
+ (CGFloat)angleBetweenPointA:(NSPoint)point
|
||||
pointb:(NSPoint)point;
|
||||
+ (NSString* _Nullable)defURL:(NSString*)string;
|
||||
+ (CGFloat)floatValue:(NSString*)string
|
||||
fallBackForPercent:(CGFloat)viewBox;
|
||||
+ (CGFloat*)scanFloatsFromString:(NSString*)string
|
||||
size:(NSInteger*)length;
|
||||
+ (CGFloat*)scanFloatsFromCString:(const char*)buffer
|
||||
size:(NSInteger*)length;
|
||||
+ (CGFloat*)scanFloatsFromCString:(const char*)buffer
|
||||
floatCount:(NSUInteger)floatCount
|
||||
charCount:(NSUInteger)charCount
|
||||
size:(NSInteger*)length;
|
||||
+ (IJSVGFontTraits)fontStyleStringForString:(NSString*)string;
|
||||
+ (IJSVGFontTraits)fontWeightTraitForString:(NSString*)string
|
||||
weight:(CGFloat*)weight;
|
||||
|
||||
+ (CGPathRef)newFlippedCGPath:(CGPathRef)path;
|
||||
|
||||
+ (CAShapeLayerLineJoin)CGLineJoinForJoinStyle:(IJSVGLineJoinStyle)joinStyle;
|
||||
+ (CAShapeLayerLineCap)CGLineCapForCapStyle:(IJSVGLineCapStyle)capStyle;
|
||||
+ (CAShapeLayerFillRule)CGFillRuleForWindingRule:(IJSVGWindingRule)rule;
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,626 +0,0 @@
|
||||
//
|
||||
// IJSVGUtils.m
|
||||
// IconJar
|
||||
//
|
||||
// Created by Curtis Hard on 30/08/2014.
|
||||
// Copyright (c) 2014 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGLayer.h"
|
||||
#import "IJSVGShapeLayer.h"
|
||||
#import "IJSVGUtils.h"
|
||||
#import "IJSVGExporterPathInstruction.h"
|
||||
#import "IJSVGParsing.h"
|
||||
|
||||
@implementation IJSVGUtils
|
||||
|
||||
BOOL IJSVGCharBufferIsHEX(char* buffer) {
|
||||
char c;
|
||||
while((c = *buffer++)) {
|
||||
BOOL flag = ((c == '#') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
(c >= 'a' && c <= 'f') ||
|
||||
(c >= 'A' && c <= 'F'));
|
||||
if(flag == NO) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
BOOL IJSVGCharBufferHasPrefix(char *str, char *pre)
|
||||
{
|
||||
return strncmp(pre, str, strlen(pre)) == 0;
|
||||
}
|
||||
|
||||
BOOL IJSVGCharBufferHasSuffix(char* s1, char* s2)
|
||||
{
|
||||
size_t slen = strlen(s1);
|
||||
size_t tlen = strlen(s2);
|
||||
if (tlen > slen) {
|
||||
return NO;
|
||||
}
|
||||
return strcmp(s1 + slen - tlen, s2) == 0;
|
||||
}
|
||||
|
||||
char* IJSVGTimmedCharBufferCreate(const char* buffer)
|
||||
{
|
||||
unsigned long start = 0;
|
||||
unsigned long length = strlen(buffer);
|
||||
while(length-1 > 0 && isspace(buffer[length-1])) {
|
||||
length--;
|
||||
}
|
||||
while(isspace(buffer[start])) {
|
||||
start++;
|
||||
}
|
||||
char* chars = (char*)malloc(sizeof(char)*((length-start)+1) ?: sizeof(char));
|
||||
memcpy(chars, &buffer[start], length-start);
|
||||
chars[length] = '\0';
|
||||
return chars;
|
||||
}
|
||||
|
||||
void IJSVGTrimCharBuffer(char* buffer) {
|
||||
char* ptr = buffer;
|
||||
unsigned long length = strlen(ptr);
|
||||
while(length-1 > 0 && isspace(ptr[length-1])) {
|
||||
ptr[--length] = '\0';
|
||||
}
|
||||
while(*ptr && isspace(*ptr)) {
|
||||
++ptr;
|
||||
--length;
|
||||
}
|
||||
memmove(buffer, ptr, length+1);
|
||||
}
|
||||
|
||||
void IJSVGCharBufferToLower(char* buffer)
|
||||
{
|
||||
for(char *p = buffer; *p; p++) {
|
||||
*p = tolower(*p);
|
||||
}
|
||||
}
|
||||
|
||||
size_t IJSVGCharBufferHash(char* buffer)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int c;
|
||||
while ((c = *buffer++)) {
|
||||
hash = ((hash << 5) + hash) + c;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
NSString* IJSVGShortenFloatString(NSString* string)
|
||||
{
|
||||
const char* chars = string.UTF8String;
|
||||
if (chars[0] == '-' && chars[1] == '0' && strstr(chars, ".") != NULL) {
|
||||
return [NSString stringWithFormat:@"-%@", [string substringFromIndex:2]];
|
||||
} else if (chars[0] == '0' && chars[1] == '.') {
|
||||
return [string substringFromIndex:1];
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
IJSVGFloatingPointOptions IJSVGFloatingPointOptionsDefault(void)
|
||||
{
|
||||
return IJSVGFloatingPointOptionsMake(NO, kIJSVGExporterPathInstructionFloatPrecision);
|
||||
}
|
||||
|
||||
IJSVGFloatingPointOptions IJSVGFloatingPointOptionsMake(BOOL round, int precision)
|
||||
{
|
||||
return (IJSVGFloatingPointOptions) {
|
||||
.round = round,
|
||||
.precision = precision
|
||||
};
|
||||
}
|
||||
|
||||
NSString* IJSVGShortFloatStringWithOptions(CGFloat f, IJSVGFloatingPointOptions options)
|
||||
{
|
||||
if (options.round == YES) {
|
||||
f = IJSVGExporterPathFloatToFixed(f, options.precision);
|
||||
}
|
||||
return IJSVGShortFloatString(f);
|
||||
};
|
||||
|
||||
NSString* IJSVGShortFloatString(CGFloat f)
|
||||
{
|
||||
return IJSVGShortenFloatString([NSString stringWithFormat:@"%g", f]);
|
||||
};
|
||||
|
||||
NSString* IJSVGCompressFloatParameterArray(NSArray<NSString*>* strings)
|
||||
{
|
||||
char* lastCommandChars = NULL;
|
||||
NSInteger index = 0;
|
||||
NSMutableString* string = [[[NSMutableString alloc] init] autorelease];
|
||||
for (NSString* dataString in strings) {
|
||||
const char* chars = dataString.UTF8String;
|
||||
|
||||
// work out if the command is signed and or decimal
|
||||
BOOL isSigned = chars[0] == '-';
|
||||
BOOL isDecimal = (isSigned == NO && chars[0] == '.') || (isSigned == YES && chars[1] == '.');
|
||||
|
||||
// we also need to know if the previous command was a decimal or not
|
||||
BOOL lastWasDecimal = NO;
|
||||
if (lastCommandChars != NULL) {
|
||||
lastWasDecimal = strchr(lastCommandChars, '.') != NULL;
|
||||
}
|
||||
|
||||
// we only need a space if the current command is not signed
|
||||
// a decimal and the previous command was decimal too
|
||||
if (index++ == 0 || isSigned || (isDecimal == YES && lastWasDecimal == YES)) {
|
||||
[string appendString:dataString];
|
||||
} else {
|
||||
[string appendFormat:@" %@", dataString];
|
||||
}
|
||||
|
||||
// store last command chars
|
||||
lastCommandChars = (char*)chars;
|
||||
}
|
||||
return string;
|
||||
};
|
||||
|
||||
NSString* IJSVGShortFloatStringWithPrecision(CGFloat f, NSInteger precision)
|
||||
{
|
||||
NSString* format = [NSString stringWithFormat:@"%@.%ld%@", @"%", precision, @"f"];
|
||||
NSString* ret = [NSString stringWithFormat:format, f];
|
||||
if (ret.floatValue == (float)ret.integerValue) {
|
||||
ret = [NSString stringWithFormat:@"%ld", ret.integerValue];
|
||||
}
|
||||
return IJSVGShortenFloatString(ret);
|
||||
};
|
||||
|
||||
NSString* IJSVGPointToCommandString(CGPoint point)
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@ %@",
|
||||
IJSVGShortFloatString(point.x),
|
||||
IJSVGShortFloatString(point.y)];
|
||||
};
|
||||
|
||||
BOOL IJSVGIsLegalCommandCharacter(unichar aChar)
|
||||
{
|
||||
if ((aChar | ('M' ^ 'm')) == 'm' ||
|
||||
(aChar | ('Z' ^ 'z')) == 'z' ||
|
||||
(aChar | ('C' ^ 'c')) == 'c' ||
|
||||
(aChar | ('L' ^ 'l')) == 'l' ||
|
||||
(aChar | ('S' ^ 's')) == 's' ||
|
||||
(aChar | ('Q' ^ 'q')) == 'q' ||
|
||||
(aChar | ('H' ^ 'h')) == 'h' ||
|
||||
(aChar | ('V' ^ 'v')) == 'v' ||
|
||||
(aChar | ('T' ^ 't')) == 't' ||
|
||||
(aChar | ('A' ^ 'a')) == 'a') {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
void IJSVGPathGetLastQuadraticCommandPointEnumerationCallback(void *info, const CGPathElement *element)
|
||||
{
|
||||
// this will just iterate over the path and keep changing the point
|
||||
// when we come across a quad curve, we cant break when we find one as we
|
||||
// dont know when the last one is.
|
||||
CGPoint* point = (CGPoint*)info;
|
||||
if(element->type == kCGPathElementAddQuadCurveToPoint) {
|
||||
CGPoint curvePoint = element->points[0];
|
||||
point->x = curvePoint.x;
|
||||
point->y = curvePoint.y;
|
||||
}
|
||||
}
|
||||
|
||||
CGPoint IJSVGPathGetLastQuadraticCommandPoint(CGPathRef path)
|
||||
{
|
||||
CGPoint point = CGPointZero;
|
||||
CGPathApply(path, &point,
|
||||
IJSVGPathGetLastQuadraticCommandPointEnumerationCallback);
|
||||
return point;
|
||||
}
|
||||
|
||||
BOOL IJSVGIsSVGLayer(CALayer* layer)
|
||||
{
|
||||
return [layer isKindOfClass:IJSVGLayer.class] ||
|
||||
[layer isKindOfClass:IJSVGShapeLayer.class];
|
||||
}
|
||||
|
||||
CGFloat angle(CGPoint a, CGPoint b)
|
||||
{
|
||||
return [IJSVGUtils angleBetweenPointA:a
|
||||
pointb:b];
|
||||
}
|
||||
|
||||
CGFloat ratio(CGPoint a, CGPoint b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y) / (magnitude(a) * magnitude(b));
|
||||
}
|
||||
|
||||
CGFloat magnitude(CGPoint point)
|
||||
{
|
||||
return sqrtf(powf(point.x, 2) + powf(point.y, 2));
|
||||
}
|
||||
|
||||
CGFloat radians_to_degrees(CGFloat radians)
|
||||
{
|
||||
return ((radians) * (180.0 / M_PI));
|
||||
}
|
||||
|
||||
CGFloat degrees_to_radians(CGFloat degrees)
|
||||
{
|
||||
return ((degrees) / 180.0 * M_PI);
|
||||
}
|
||||
|
||||
+ (IJSVGCommandType)typeForCommandChar:(char)commandChar
|
||||
{
|
||||
return isupper(commandChar) ? kIJSVGCommandTypeAbsolute : kIJSVGCommandTypeRelative;
|
||||
}
|
||||
|
||||
+ (NSRange)rangeOfParentheses:(NSString*)string
|
||||
{
|
||||
NSRange range = NSMakeRange(NSNotFound, 0);
|
||||
const char* characters = string.UTF8String;
|
||||
unsigned long length = strlen(characters);
|
||||
for (NSInteger i = 0; i < length; i++) {
|
||||
char c = *characters++;
|
||||
if (c == '(') {
|
||||
range.location = i + 1;
|
||||
} else if (c == ')') {
|
||||
range.length = i - range.location;
|
||||
}
|
||||
}
|
||||
return range;
|
||||
}
|
||||
|
||||
+ (NSString* _Nullable)defURL:(NSString*)string
|
||||
{
|
||||
const char* str = string.UTF8String;
|
||||
NSUInteger count = 0;
|
||||
IJSVGParsingStringMethod** methods;
|
||||
methods = IJSVGParsingMethodParseString(str, &count);
|
||||
if(count == 0) {
|
||||
IJSVGParsingStringMethodsRelease(methods, count);
|
||||
return nil;
|
||||
}
|
||||
|
||||
// what type of method is it?
|
||||
IJSVGParsingStringMethod* method = methods[0];
|
||||
IJSVGCharBufferToLower(method->name);
|
||||
if(strcmp(method->name, "url") != 0) {
|
||||
(void)IJSVGParsingStringMethodsRelease(methods, count), methods = NULL;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// remove the #
|
||||
char* parameters = method->parameters;
|
||||
if(parameters[0] == '#') {
|
||||
parameters++;
|
||||
}
|
||||
|
||||
// make the nsstring
|
||||
NSString* foundID = [NSString stringWithUTF8String:parameters];
|
||||
|
||||
// release the stuff
|
||||
(void)IJSVGParsingStringMethodsRelease(methods, count), methods = NULL;
|
||||
return foundID;
|
||||
}
|
||||
|
||||
+ (IJSVGFontTraits)fontWeightTraitForString:(NSString*)string
|
||||
weight:(CGFloat*)weight
|
||||
{
|
||||
*weight = string.floatValue;
|
||||
if ([string isEqualToString:@"bold"])
|
||||
return IJSVGFontTraitBold;
|
||||
return IJSVGFontTraitNone;
|
||||
}
|
||||
|
||||
+ (IJSVGFontTraits)fontStyleStringForString:(NSString*)string
|
||||
{
|
||||
if ([string isEqualToString:@"italic"])
|
||||
return IJSVGFontTraitItalic;
|
||||
return IJSVGFontTraitNone;
|
||||
}
|
||||
|
||||
+ (IJSVGWindingRule)windingRuleForString:(NSString*)string
|
||||
{
|
||||
if ([string isEqualToString:@"evenodd"])
|
||||
return IJSVGWindingRuleEvenOdd;
|
||||
if ([string isEqualToString:@"inherit"])
|
||||
return IJSVGWindingRuleInherit;
|
||||
return IJSVGWindingRuleNonZero;
|
||||
}
|
||||
|
||||
+ (IJSVGLineJoinStyle)lineJoinStyleForString:(NSString*)string
|
||||
{
|
||||
if ([string isEqualToString:@"mitre"])
|
||||
return IJSVGLineJoinStyleMiter;
|
||||
if ([string isEqualToString:@"round"])
|
||||
return IJSVGLineJoinStyleRound;
|
||||
if ([string isEqualToString:@"bevel"])
|
||||
return IJSVGLineJoinStyleBevel;
|
||||
if ([string isEqualToString:@"inherit"])
|
||||
return IJSVGLineJoinStyleInherit;
|
||||
return IJSVGLineJoinStyleMiter;
|
||||
}
|
||||
|
||||
+ (IJSVGLineCapStyle)lineCapStyleForString:(NSString*)string
|
||||
{
|
||||
if ([string isEqualToString:@"butt"])
|
||||
return IJSVGLineCapStyleButt;
|
||||
if ([string isEqualToString:@"square"])
|
||||
return IJSVGLineCapStyleSquare;
|
||||
if ([string isEqualToString:@"round"])
|
||||
return IJSVGLineCapStyleRound;
|
||||
if ([string isEqualToString:@"inherit"])
|
||||
return IJSVGLineCapStyleInherit;
|
||||
return IJSVGLineCapStyleButt;
|
||||
}
|
||||
|
||||
+ (IJSVGLineCapStyle)lineCapStyleForCGLineCap:(CGLineCap)lineCap
|
||||
{
|
||||
switch(lineCap) {
|
||||
case kCGLineCapButt: {
|
||||
return IJSVGLineCapStyleButt;
|
||||
}
|
||||
case kCGLineCapRound: {
|
||||
return IJSVGLineCapStyleRound;
|
||||
}
|
||||
case kCGLineCapSquare: {
|
||||
return IJSVGLineCapStyleSquare;
|
||||
}
|
||||
default: {
|
||||
return IJSVGLineCapStyleInherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (IJSVGLineJoinStyle)lineJoinStyleForCGLineJoin:(CGLineJoin)lineJoin
|
||||
{
|
||||
switch(lineJoin) {
|
||||
case kCGLineJoinRound: {
|
||||
return IJSVGLineJoinStyleRound;
|
||||
}
|
||||
case kCGLineJoinMiter: {
|
||||
return IJSVGLineJoinStyleMiter;
|
||||
}
|
||||
case kCGLineJoinBevel: {
|
||||
return IJSVGLineJoinStyleBevel;
|
||||
}
|
||||
default: {
|
||||
return IJSVGLineJoinStyleInherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (IJSVGUnitType)unitTypeForString:(NSString*)string
|
||||
{
|
||||
if ([string isEqualToString:@"userSpaceOnUse"]) {
|
||||
return IJSVGUnitUserSpaceOnUse;
|
||||
}
|
||||
return IJSVGUnitObjectBoundingBox;
|
||||
}
|
||||
|
||||
+ (IJSVGBlendMode)blendModeForString:(NSString*)string
|
||||
{
|
||||
string = string.lowercaseString;
|
||||
if ([string isEqualToString:@"normal"])
|
||||
return IJSVGBlendModeNormal;
|
||||
if ([string isEqualToString:@"multiply"])
|
||||
return IJSVGBlendModeMultiply;
|
||||
if ([string isEqualToString:@"screen"])
|
||||
return IJSVGBlendModeScreen;
|
||||
if ([string isEqualToString:@"overlay"])
|
||||
return IJSVGBlendModeOverlay;
|
||||
if ([string isEqualToString:@"darken"])
|
||||
return IJSVGBlendModeDarken;
|
||||
if ([string isEqualToString:@"lighten"])
|
||||
return IJSVGBlendModeLighten;
|
||||
if ([string isEqualToString:@"color-dodge"])
|
||||
return IJSVGBlendModeColorDodge;
|
||||
if ([string isEqualToString:@"color-burn"])
|
||||
return IJSVGBlendModeColorBurn;
|
||||
if ([string isEqualToString:@"hard-light"])
|
||||
return IJSVGBlendModeHardLight;
|
||||
if ([string isEqualToString:@"soft-light"])
|
||||
return IJSVGBlendModeSoftLight;
|
||||
if ([string isEqualToString:@"difference"])
|
||||
return IJSVGBlendModeDifference;
|
||||
if ([string isEqualToString:@"exclusion"])
|
||||
return IJSVGBlendModeExclusion;
|
||||
if ([string isEqualToString:@"hue"])
|
||||
return IJSVGBlendModeHue;
|
||||
if ([string isEqualToString:@"saturation"])
|
||||
return IJSVGBlendModeSaturation;
|
||||
if ([string isEqualToString:@"color"])
|
||||
return IJSVGBlendModeColor;
|
||||
if ([string isEqualToString:@"luminosity"])
|
||||
return IJSVGBlendModeLuminosity;
|
||||
return IJSVGBlendModeNormal;
|
||||
}
|
||||
|
||||
+ (NSString* _Nullable)mixBlendingModeForBlendMode:(IJSVGBlendMode)blendMode
|
||||
{
|
||||
switch (blendMode) {
|
||||
case IJSVGBlendModeMultiply: {
|
||||
return @"multiple";
|
||||
}
|
||||
case IJSVGBlendModeScreen: {
|
||||
return @"screen";
|
||||
}
|
||||
case IJSVGBlendModeOverlay: {
|
||||
return @"overlay";
|
||||
}
|
||||
case IJSVGBlendModeDarken: {
|
||||
return @"darken";
|
||||
}
|
||||
case IJSVGBlendModeLighten: {
|
||||
return @"lighten";
|
||||
}
|
||||
case IJSVGBlendModeColorDodge: {
|
||||
return @"color-dodge";
|
||||
}
|
||||
case IJSVGBlendModeColorBurn: {
|
||||
return @"color-burn";
|
||||
}
|
||||
case IJSVGBlendModeHardLight: {
|
||||
return @"hard-light";
|
||||
}
|
||||
case IJSVGBlendModeSoftLight: {
|
||||
return @"soft-light";
|
||||
}
|
||||
case IJSVGBlendModeDifference: {
|
||||
return @"difference";
|
||||
}
|
||||
case IJSVGBlendModeExclusion: {
|
||||
return @"exclusion";
|
||||
}
|
||||
case IJSVGBlendModeHue: {
|
||||
return @"hue";
|
||||
}
|
||||
case IJSVGBlendModeSaturation: {
|
||||
return @"saturation";
|
||||
}
|
||||
case IJSVGBlendModeColor: {
|
||||
return @"color";
|
||||
}
|
||||
case IJSVGBlendModeLuminosity: {
|
||||
return @"luminosity";
|
||||
}
|
||||
case IJSVGBlendModeNormal:
|
||||
default: {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (CGFloat*)commandParameters:(NSString*)command
|
||||
count:(NSInteger*)count
|
||||
{
|
||||
return [self.class scanFloatsFromString:command
|
||||
size:count];
|
||||
}
|
||||
|
||||
+ (CGFloat*)scanFloatsFromString:(NSString*)string
|
||||
size:(NSInteger*)length
|
||||
{
|
||||
return [self.class scanFloatsFromCString:string.UTF8String
|
||||
size:length];
|
||||
}
|
||||
|
||||
+ (CGFloat*)scanFloatsFromCString:(const char*)buffer
|
||||
size:(NSInteger*)length
|
||||
{
|
||||
IJSVGPathDataStream* stream = IJSVGPathDataStreamCreateDefault();
|
||||
CGFloat* floats = IJSVGParsePathDataStreamSequence(buffer, strlen(buffer),
|
||||
stream, NULL, 1, length);
|
||||
IJSVGPathDataStreamRelease(stream);
|
||||
return floats;
|
||||
}
|
||||
|
||||
+ (CGFloat*)scanFloatsFromCString:(const char*)buffer
|
||||
floatCount:(NSUInteger)floatCount
|
||||
charCount:(NSUInteger)charCount
|
||||
size:(NSInteger*)length
|
||||
{
|
||||
IJSVGPathDataStream* stream = IJSVGPathDataStreamCreate(floatCount, charCount);
|
||||
CGFloat* floats = IJSVGParsePathDataStreamSequence(buffer, strlen(buffer),
|
||||
stream, NULL, 1, length);
|
||||
IJSVGPathDataStreamRelease(stream);
|
||||
return floats;
|
||||
}
|
||||
|
||||
+ (CGFloat*)parseViewBox:(NSString*)string
|
||||
{
|
||||
IJSVGPathDataStream* stream = IJSVGPathDataStreamCreate(4,
|
||||
IJSVG_STREAM_CHAR_BLOCK_SIZE);
|
||||
const char* str = string.UTF8String;
|
||||
CGFloat* floats = IJSVGParsePathDataStreamSequence(str, strlen(str),
|
||||
stream, NULL, 1, NULL);
|
||||
IJSVGPathDataStreamRelease(stream);
|
||||
return floats;
|
||||
}
|
||||
|
||||
+ (CGFloat)floatValue:(NSString*)string
|
||||
fallBackForPercent:(CGFloat)fallBack
|
||||
{
|
||||
CGFloat val = [string floatValue];
|
||||
if ([string rangeOfString:@"%"].location != NSNotFound) {
|
||||
val = (fallBack * val) / 100;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
+ (void)logParameters:(CGFloat*)param
|
||||
count:(NSInteger)count
|
||||
{
|
||||
NSMutableString* str = [[[NSMutableString alloc] init] autorelease];
|
||||
for (NSInteger i = 0; i < count; i++) {
|
||||
[str appendFormat:@"%f ", param[i]];
|
||||
}
|
||||
NSLog(@"%@", str);
|
||||
}
|
||||
|
||||
+ (CGFloat)floatValue:(NSString*)string
|
||||
{
|
||||
if ([string isEqualToString:@"inherit"]) {
|
||||
return IJSVGInheritedFloatValue;
|
||||
}
|
||||
return [string floatValue];
|
||||
}
|
||||
|
||||
+ (CGFloat)angleBetweenPointA:(NSPoint)point1
|
||||
pointb:(NSPoint)point2
|
||||
{
|
||||
return (point1.x * point2.y < point1.y * point2.x ? -1 : 1) * acosf(ratio(point1, point2));
|
||||
}
|
||||
|
||||
+ (CGPathRef)newFlippedCGPath:(CGPathRef)path
|
||||
{
|
||||
CGRect boundingBox = CGPathGetPathBoundingBox(path);
|
||||
CGAffineTransform scale = CGAffineTransformMakeScale(1.f, -1.f);
|
||||
CGAffineTransform translate = CGAffineTransformTranslate(scale, 0.f, boundingBox.size.height);
|
||||
CGPathRef transformPath = CGPathCreateCopyByTransformingPath(path, &translate);
|
||||
return transformPath;
|
||||
}
|
||||
|
||||
#pragma mark CG conversions
|
||||
|
||||
+ (CAShapeLayerLineJoin)CGLineJoinForJoinStyle:(IJSVGLineJoinStyle)joinStyle
|
||||
{
|
||||
switch (joinStyle) {
|
||||
default:
|
||||
case IJSVGLineJoinStyleMiter: {
|
||||
return kCALineJoinMiter;
|
||||
}
|
||||
case IJSVGLineJoinStyleBevel: {
|
||||
return kCALineJoinBevel;
|
||||
}
|
||||
case IJSVGLineJoinStyleRound: {
|
||||
return kCALineJoinRound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (CAShapeLayerLineCap)CGLineCapForCapStyle:(IJSVGLineCapStyle)capStyle
|
||||
{
|
||||
switch (capStyle) {
|
||||
default:
|
||||
case IJSVGLineCapStyleButt: {
|
||||
return kCALineCapButt;
|
||||
}
|
||||
case IJSVGLineCapStyleRound: {
|
||||
return kCALineCapRound;
|
||||
}
|
||||
case IJSVGLineCapStyleSquare: {
|
||||
return kCALineCapSquare;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (CAShapeLayerFillRule)CGFillRuleForWindingRule:(IJSVGWindingRule)rule
|
||||
{
|
||||
switch (rule) {
|
||||
case IJSVGWindingRuleEvenOdd: {
|
||||
return kCAFillRuleEvenOdd;
|
||||
}
|
||||
default: {
|
||||
return kCAFillRuleNonZero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// IJSVGViewBox.h
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 14/04/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Quartz/Quartz.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGViewBoxAlignment) {
|
||||
IJSVGViewBoxAlignmentUnknown,
|
||||
IJSVGViewBoxAlignmentNone,
|
||||
IJSVGViewBoxAlignmentXMinYMin,
|
||||
IJSVGViewBoxAlignmentXMidYMin,
|
||||
IJSVGViewBoxAlignmentXMaxYMin,
|
||||
IJSVGViewBoxAlignmentXMinYMid,
|
||||
IJSVGViewBoxAlignmentXMidYMid,
|
||||
IJSVGViewBoxAlignmentXMaxYMid,
|
||||
IJSVGViewBoxAlignmentXMinYMax,
|
||||
IJSVGViewBoxAlignmentXMidYMax,
|
||||
IJSVGViewBoxAlignmentXMaxYMax,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, IJSVGViewBoxMeetOrSlice) {
|
||||
IJSVGViewBoxMeetOrSliceUnknown,
|
||||
IJSVGViewBoxMeetOrSliceMeet,
|
||||
IJSVGViewBoxMeetOrSliceSlice,
|
||||
};
|
||||
|
||||
@interface IJSVGViewBox : NSObject
|
||||
|
||||
typedef void (^IJSVGViewBoxDrawingBlock)(CGSize scale);
|
||||
|
||||
+ (IJSVGViewBoxAlignment)alignmentForString:(NSString*)string
|
||||
meetOrSlice:(IJSVGViewBoxMeetOrSlice*)meetOrSlice;
|
||||
+ (IJSVGViewBoxAlignment)alignmentForString:(NSString*)string;
|
||||
+ (IJSVGViewBoxMeetOrSlice)meetOrSliceForString:(NSString*)string;
|
||||
|
||||
+ (void)drawViewBox:(CGRect)viewBox
|
||||
inRect:(CGRect)drawingRect
|
||||
alignment:(IJSVGViewBoxAlignment)alignment
|
||||
meetOrSlice:(IJSVGViewBoxMeetOrSlice)meetOrSlice
|
||||
inContext:(CGContextRef)ctx
|
||||
drawingBlock:(IJSVGViewBoxDrawingBlock)block;
|
||||
|
||||
@end
|
||||
@@ -1,382 +0,0 @@
|
||||
//
|
||||
// IJSVGViewBox.m
|
||||
// IJSVG
|
||||
//
|
||||
// Created by Curtis Hard on 14/04/2022.
|
||||
// Copyright © 2022 Curtis Hard. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IJSVGViewBox.h"
|
||||
#import "IJSVGStringAdditions.h"
|
||||
|
||||
@implementation IJSVGViewBox
|
||||
|
||||
+ (IJSVGViewBoxAlignment)alignmentForString:(NSString*)string
|
||||
meetOrSlice:(IJSVGViewBoxMeetOrSlice*)meetOrSlice
|
||||
{
|
||||
NSArray<NSString*>* parts = [string ijsvg_componentsSplitByWhiteSpace];
|
||||
if(parts.count == 1) {
|
||||
*meetOrSlice = IJSVGViewBoxMeetOrSliceMeet;
|
||||
return [self alignmentForString:parts[0]];
|
||||
}
|
||||
*meetOrSlice = [self meetOrSliceForString:parts[1]];
|
||||
return [self alignmentForString:parts[0]];
|
||||
}
|
||||
|
||||
+ (IJSVGViewBoxMeetOrSlice)meetOrSliceForString:(NSString*)string
|
||||
{
|
||||
if(string == nil) {
|
||||
return IJSVGViewBoxMeetOrSliceUnknown;
|
||||
}
|
||||
|
||||
const char* name = string.lowercaseString.UTF8String;
|
||||
if(name == NULL) {
|
||||
return IJSVGViewBoxMeetOrSliceUnknown;
|
||||
}
|
||||
if(strcmp(name, "meet") == 0) {
|
||||
return IJSVGViewBoxMeetOrSliceMeet;
|
||||
}
|
||||
if(strcmp(name, "slice") == 0) {
|
||||
return IJSVGViewBoxMeetOrSliceSlice;
|
||||
}
|
||||
return IJSVGViewBoxMeetOrSliceUnknown;
|
||||
}
|
||||
|
||||
+ (IJSVGViewBoxAlignment)alignmentForString:(NSString*)string
|
||||
{
|
||||
if(string == nil) {
|
||||
return IJSVGViewBoxAlignmentUnknown;
|
||||
}
|
||||
|
||||
const char* name = string.lowercaseString.UTF8String;
|
||||
if(name == NULL) {
|
||||
return IJSVGViewBoxAlignmentUnknown;
|
||||
}
|
||||
if(strcmp(name, "none") == 0) {
|
||||
return IJSVGViewBoxAlignmentNone;
|
||||
}
|
||||
if(strcmp(name, "xminymin") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMinYMin;
|
||||
}
|
||||
if(strcmp(name, "xmidymin") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMidYMin;
|
||||
}
|
||||
if(strcmp(name, "xmaxymin") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMaxYMin;
|
||||
}
|
||||
if(strcmp(name, "xminymid") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMinYMid;
|
||||
}
|
||||
if(strcmp(name, "xmidymid") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMidYMid;
|
||||
}
|
||||
if(strcmp(name, "xmaxymid") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMaxYMid;
|
||||
}
|
||||
if(strcmp(name, "xminymax") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMinYMax;
|
||||
}
|
||||
if(strcmp(name, "xmidymax") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMidYMax;
|
||||
}
|
||||
if(strcmp(name, "xmaxymax") == 0) {
|
||||
return IJSVGViewBoxAlignmentXMaxYMax;
|
||||
}
|
||||
return IJSVGViewBoxAlignmentUnknown;
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMidYMid(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width / 2.f - (viewBox.size.width * ratio) / 2.f,
|
||||
drawingRect.size.height / 2.f - (viewBox.size.height * ratio) / 2.f);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMinYMid(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.f,
|
||||
drawingRect.size.height / 2.f - ((viewBox.size.height * ratio)) / 2.f);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMaxYMid(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width - (viewBox.size.width * ratio),
|
||||
drawingRect.size.height / 2.f - ((viewBox.size.height * ratio)) / 2.f);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMidYMin(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width / 2.f - ((viewBox.size.width * ratio)) / 2.f,
|
||||
0.f);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMinYMin(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.f, 0.f);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMidYMax(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width / 2.f - ((viewBox.size.width * ratio)) / 2.f,
|
||||
drawingRect.size.height - (viewBox.size.height * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMaxYMin(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width - viewBox.size.width,
|
||||
0.f);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMinYMax(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(0.f,
|
||||
drawingRect.size.height - viewBox.size.height);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeXMaxYMax(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
CGFloat ratio = meetOrSlice == IJSVGViewBoxMeetOrSliceMeet ? MIN(width, height) : MAX(width, height);
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(ratio, ratio));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width - viewBox.size.width,
|
||||
drawingRect.size.height - viewBox.size.height);
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * ratio),
|
||||
-(viewBox.origin.y * ratio));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(ratio, ratio);
|
||||
}
|
||||
|
||||
CGSize IJSVGViewBoxComputeNone(CGContextRef ctx, CGRect viewBox,
|
||||
CGRect drawingRect, IJSVGViewBoxMeetOrSlice meetOrSlice)
|
||||
{
|
||||
CGFloat width = drawingRect.size.width / viewBox.size.width;
|
||||
CGFloat height = drawingRect.size.height / viewBox.size.height;
|
||||
|
||||
// scale the viewBox into the drawingRect
|
||||
CGAffineTransform transform = CGAffineTransformIdentity;
|
||||
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeScale(width, height));
|
||||
|
||||
// translate it
|
||||
CGAffineTransform translate = CGAffineTransformMakeTranslation(drawingRect.size.width / 2.f - ((viewBox.size.width * width)) / 2.f,
|
||||
drawingRect.size.height - (viewBox.size.height * height));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
translate = CGAffineTransformMakeTranslation(-(viewBox.origin.x * width),
|
||||
-(viewBox.origin.y * height));
|
||||
transform = CGAffineTransformConcat(transform, translate);
|
||||
CGContextConcatCTM(ctx, transform);
|
||||
|
||||
return CGSizeMake(width, height);
|
||||
}
|
||||
|
||||
+ (void)drawViewBox:(CGRect)viewBox
|
||||
inRect:(CGRect)drawingRect
|
||||
alignment:(IJSVGViewBoxAlignment)alignment
|
||||
meetOrSlice:(IJSVGViewBoxMeetOrSlice)meetOrSlice
|
||||
inContext:(CGContextRef)ctx
|
||||
drawingBlock:(IJSVGViewBoxDrawingBlock)block
|
||||
{
|
||||
// this is equal to none, dont do anything fancy
|
||||
if(CGRectIsNull(viewBox) == YES ||
|
||||
CGRectEqualToRect(viewBox, CGRectZero) == YES) {
|
||||
block(CGSizeMake(1.f, 1.f));
|
||||
return;
|
||||
}
|
||||
|
||||
CGContextSaveGState(ctx);
|
||||
if(meetOrSlice == IJSVGViewBoxMeetOrSliceSlice) {
|
||||
CGContextClipToRect(ctx, drawingRect);
|
||||
}
|
||||
CGSize scale = CGSizeZero;
|
||||
switch(alignment) {
|
||||
case IJSVGViewBoxAlignmentNone: {
|
||||
scale = IJSVGViewBoxComputeNone(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentUnknown:
|
||||
case IJSVGViewBoxAlignmentXMidYMid: {
|
||||
scale = IJSVGViewBoxComputeXMidYMid(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMinYMid: {
|
||||
scale = IJSVGViewBoxComputeXMinYMid(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMaxYMid: {
|
||||
scale = IJSVGViewBoxComputeXMaxYMid(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMidYMin: {
|
||||
scale = IJSVGViewBoxComputeXMidYMin(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMidYMax: {
|
||||
scale = IJSVGViewBoxComputeXMidYMax(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMinYMin: {
|
||||
scale = IJSVGViewBoxComputeXMinYMin(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMaxYMin: {
|
||||
scale = IJSVGViewBoxComputeXMaxYMin(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMinYMax: {
|
||||
scale = IJSVGViewBoxComputeXMinYMax(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
case IJSVGViewBoxAlignmentXMaxYMax: {
|
||||
scale = IJSVGViewBoxComputeXMaxYMax(ctx, viewBox, drawingRect, meetOrSlice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
block(scale);
|
||||
CGContextRestoreGState(ctx);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -7,40 +7,87 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
59069A2922D0ED85004DDEA5 /* compuserver_msn_Ford_Focus.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59069A2822D0ED85004DDEA5 /* compuserver_msn_Ford_Focus.svg */; };
|
||||
59069A2B22D0EE0E004DDEA5 /* test (1).svg in Resources */ = {isa = PBXBuildFile; fileRef = 59069A2A22D0EE0E004DDEA5 /* test (1).svg */; };
|
||||
343A19181FB2212C000652A2 /* IJSVGGradientUnitLength.m in Sources */ = {isa = PBXBuildFile; fileRef = 343A19171FB2212C000652A2 /* IJSVGGradientUnitLength.m */; };
|
||||
590C87EB201F9888004A1554 /* json.svg in Resources */ = {isa = PBXBuildFile; fileRef = 590C87EA201F9888004A1554 /* json.svg */; };
|
||||
590C87ED201FA08C004A1554 /* intertwingly.svg in Resources */ = {isa = PBXBuildFile; fileRef = 590C87EC201FA08C004A1554 /* intertwingly.svg */; };
|
||||
590C87EF201FA093004A1554 /* NewTux.svg in Resources */ = {isa = PBXBuildFile; fileRef = 590C87EE201FA092004A1554 /* NewTux.svg */; };
|
||||
590C87F1201FBF27004A1554 /* AJ_Digital_Camera.svg in Resources */ = {isa = PBXBuildFile; fileRef = 590C87F0201FBF27004A1554 /* AJ_Digital_Camera.svg */; };
|
||||
590C87F4201FC9E4004A1554 /* radialgradient2.svg in Resources */ = {isa = PBXBuildFile; fileRef = 590C87F3201FC9E3004A1554 /* radialgradient2.svg */; };
|
||||
590C87F6201FD0D4004A1554 /* car.svg in Resources */ = {isa = PBXBuildFile; fileRef = 590C87F5201FD0D4004A1554 /* car.svg */; };
|
||||
591704CC1E2016E400012644 /* IJSVGExporter.m in Sources */ = {isa = PBXBuildFile; fileRef = 591704CB1E2016E400012644 /* IJSVGExporter.m */; };
|
||||
591A13E11E19838F001D1629 /* IJSVGText.m in Sources */ = {isa = PBXBuildFile; fileRef = 591A13E01E19838F001D1629 /* IJSVGText.m */; };
|
||||
59265CE81C4F840400F333F0 /* css.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59265CE71C4F840400F333F0 /* css.svg */; };
|
||||
59265CEB1C4F843E00F333F0 /* SVGExampleView6.m in Sources */ = {isa = PBXBuildFile; fileRef = 59265CEA1C4F843E00F333F0 /* SVGExampleView6.m */; };
|
||||
592840B11E153F3D002F9AF0 /* IJSVGLayerTree.m in Sources */ = {isa = PBXBuildFile; fileRef = 592840B01E153F3D002F9AF0 /* IJSVGLayerTree.m */; };
|
||||
592840B41E155308002F9AF0 /* IJSVGGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 592840B31E155308002F9AF0 /* IJSVGGradientLayer.m */; };
|
||||
5941DAFD1CF9BC9B00B3A911 /* IJSVGImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 5941DAFA1CF9BC9B00B3A911 /* IJSVGImage.m */; };
|
||||
5941DAFE1CF9BC9B00B3A911 /* IJSVGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 5941DAFC1CF9BC9B00B3A911 /* IJSVGPattern.m */; };
|
||||
59459CEC19B906FE00CE493B /* clipped.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59459CEB19B906FE00CE493B /* clipped.svg */; };
|
||||
59459CEF19B9074F00CE493B /* SVGExampleView4.m in Sources */ = {isa = PBXBuildFile; fileRef = 59459CEE19B9074F00CE493B /* SVGExampleView4.m */; };
|
||||
5948DED51BB2BFE5004156FF /* IJSVGFontConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5948DED21BB2BFE5004156FF /* IJSVGFontConverter.m */; };
|
||||
5948DED61BB2BFE5004156FF /* IJSVGWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 5948DED41BB2BFE5004156FF /* IJSVGWriter.m */; };
|
||||
5956657D19B62F4600D805FF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956657C19B62F4600D805FF /* main.m */; };
|
||||
5956658019B62F4600D805FF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956657F19B62F4600D805FF /* AppDelegate.m */; };
|
||||
5956658219B62F4600D805FF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5956658119B62F4600D805FF /* Images.xcassets */; };
|
||||
5956658519B62F4600D805FF /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5956658319B62F4600D805FF /* MainMenu.xib */; };
|
||||
5956659119B62F4700D805FF /* IJSVGExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956659019B62F4700D805FF /* IJSVGExampleTests.m */; };
|
||||
595665DC19B6302600D805FF /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 595665C619B6302600D805FF /* README.md */; };
|
||||
595665DE19B6309C00D805FF /* test.svg in Resources */ = {isa = PBXBuildFile; fileRef = 595665DD19B6309C00D805FF /* test.svg */; };
|
||||
595665E119B630B600D805FF /* SVGView.m in Sources */ = {isa = PBXBuildFile; fileRef = 595665E019B630B600D805FF /* SVGView.m */; };
|
||||
597AC83322CFD0FC007C0E42 /* home.svg in Resources */ = {isa = PBXBuildFile; fileRef = 597AC83222CFD0FC007C0E42 /* home.svg */; };
|
||||
597046A21E24352700A60138 /* IJSVGStrokeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 597046A11E24352700A60138 /* IJSVGStrokeLayer.m */; };
|
||||
5986308719BA104800CF15EA /* linecap.svg in Resources */ = {isa = PBXBuildFile; fileRef = 5986308619BA104800CF15EA /* linecap.svg */; };
|
||||
5986308A19BA106D00CF15EA /* SVGExampleView5.m in Sources */ = {isa = PBXBuildFile; fileRef = 5986308919BA106D00CF15EA /* SVGExampleView5.m */; };
|
||||
5986308C19BA180E00CF15EA /* dashed.svg in Resources */ = {isa = PBXBuildFile; fileRef = 5986308B19BA180E00CF15EA /* dashed.svg */; };
|
||||
598759F61E242C850024CC3F /* IJSVGExporterPathInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = 598759F51E242C850024CC3F /* IJSVGExporterPathInstruction.m */; };
|
||||
5991A2A9201E30E600913E3B /* gradients.svg in Resources */ = {isa = PBXBuildFile; fileRef = 5991A2A8201E30E600913E3B /* gradients.svg */; };
|
||||
5991A2AB201E310200913E3B /* heart.svg in Resources */ = {isa = PBXBuildFile; fileRef = 5991A2AA201E310200913E3B /* heart.svg */; };
|
||||
599465DC1C4AA87200A2EEF3 /* IJSVGStyleSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 599465D51C4AA87200A2EEF3 /* IJSVGStyleSheet.m */; };
|
||||
599465DD1C4AA87200A2EEF3 /* IJSVGStyleSheetRule.m in Sources */ = {isa = PBXBuildFile; fileRef = 599465D71C4AA87200A2EEF3 /* IJSVGStyleSheetRule.m */; };
|
||||
599465DE1C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.m in Sources */ = {isa = PBXBuildFile; fileRef = 599465D91C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.m */; };
|
||||
599465DF1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.m in Sources */ = {isa = PBXBuildFile; fileRef = 599465DB1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.m */; };
|
||||
59A11E6C19B89CEA00E44498 /* SVGExampleView1.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A11E6B19B89CEA00E44498 /* SVGExampleView1.m */; };
|
||||
59A11E6F19B89D2000E44498 /* SVGExampleView2.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A11E6E19B89D2000E44498 /* SVGExampleView2.m */; };
|
||||
59A11E7219B89D6600E44498 /* SVGExampleView3.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A11E7119B89D6600E44498 /* SVGExampleView3.m */; };
|
||||
59A3DA6D1E283022003E59A9 /* IJSVGTransaction.m in Sources */ = {isa = PBXBuildFile; fileRef = 59A3DA6C1E283022003E59A9 /* IJSVGTransaction.m */; };
|
||||
59B93C6D19B7D1840063E823 /* paperplane.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59B93C6C19B7D1840063E823 /* paperplane.svg */; };
|
||||
59B93C6F19B7D32C0063E823 /* products.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59B93C6E19B7D32C0063E823 /* products.svg */; };
|
||||
59D1E39E2022577500C54672 /* IJSVGQuartzRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59D1E39D2022577500C54672 /* IJSVGQuartzRenderer.m */; };
|
||||
59D1E3A0202279CA00C54672 /* Group.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59D1E39F202279CA00C54672 /* Group.svg */; };
|
||||
59E0F5ED1E29964700F757F7 /* IJSVGUnitLength.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E0F5EC1E29964700F757F7 /* IJSVGUnitLength.m */; };
|
||||
59E2645119BA240D008A6FDB /* IJSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2641C19BA240D008A6FDB /* IJSVG.m */; };
|
||||
59E2645219BA240D008A6FDB /* IJSVGBezierPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2641E19BA240D008A6FDB /* IJSVGBezierPathAdditions.m */; };
|
||||
59E2645319BA240D008A6FDB /* IJSVGCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642019BA240D008A6FDB /* IJSVGCache.m */; };
|
||||
59E2645419BA240D008A6FDB /* IJSVGColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642219BA240D008A6FDB /* IJSVGColor.m */; };
|
||||
59E2645519BA240D008A6FDB /* IJSVGCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642419BA240D008A6FDB /* IJSVGCommand.m */; };
|
||||
59E2645619BA240D008A6FDB /* IJSVGCommandArc.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642619BA240D008A6FDB /* IJSVGCommandArc.m */; };
|
||||
59E2645719BA240D008A6FDB /* IJSVGCommandClose.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642819BA240D008A6FDB /* IJSVGCommandClose.m */; };
|
||||
59E2645819BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642A19BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.m */; };
|
||||
59E2645919BA240D008A6FDB /* IJSVGCommandCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642C19BA240D008A6FDB /* IJSVGCommandCurve.m */; };
|
||||
59E2645A19BA240D008A6FDB /* IJSVGCommandHorizontalLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2642E19BA240D008A6FDB /* IJSVGCommandHorizontalLine.m */; };
|
||||
59E2645B19BA240D008A6FDB /* IJSVGCommandLineTo.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643019BA240D008A6FDB /* IJSVGCommandLineTo.m */; };
|
||||
59E2645C19BA240D008A6FDB /* IJSVGCommandMove.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643219BA240D008A6FDB /* IJSVGCommandMove.m */; };
|
||||
59E2645D19BA240D008A6FDB /* IJSVGCommandQuadraticCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643419BA240D008A6FDB /* IJSVGCommandQuadraticCurve.m */; };
|
||||
59E2645E19BA240D008A6FDB /* IJSVGCommandSmoothCurve.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643619BA240D008A6FDB /* IJSVGCommandSmoothCurve.m */; };
|
||||
59E2645F19BA240D008A6FDB /* IJSVGCommandVerticalLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643819BA240D008A6FDB /* IJSVGCommandVerticalLine.m */; };
|
||||
59E2646019BA240D008A6FDB /* IJSVGDef.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643A19BA240D008A6FDB /* IJSVGDef.m */; };
|
||||
59E2646119BA240D008A6FDB /* IJSVGForeignObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643C19BA240D008A6FDB /* IJSVGForeignObject.m */; };
|
||||
59E2646219BA240D008A6FDB /* IJSVGGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2643E19BA240D008A6FDB /* IJSVGGradient.m */; };
|
||||
59E2646319BA240D008A6FDB /* IJSVGGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644019BA240D008A6FDB /* IJSVGGroup.m */; };
|
||||
59E2646419BA240D008A6FDB /* IJSVGLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644219BA240D008A6FDB /* IJSVGLinearGradient.m */; };
|
||||
59E2646519BA240D008A6FDB /* IJSVGNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644419BA240D008A6FDB /* IJSVGNode.m */; };
|
||||
59E2646619BA240D008A6FDB /* IJSVGParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644619BA240D008A6FDB /* IJSVGParser.m */; };
|
||||
59E2646719BA240D008A6FDB /* IJSVGPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644819BA240D008A6FDB /* IJSVGPath.m */; };
|
||||
59E2646819BA240D008A6FDB /* IJSVGRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644A19BA240D008A6FDB /* IJSVGRadialGradient.m */; };
|
||||
59E2646919BA240D008A6FDB /* IJSVGStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644C19BA240D008A6FDB /* IJSVGStyle.m */; };
|
||||
59E2646A19BA240D008A6FDB /* IJSVGTransform.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2644E19BA240D008A6FDB /* IJSVGTransform.m */; };
|
||||
59E2646B19BA240D008A6FDB /* IJSVGUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E2645019BA240D008A6FDB /* IJSVGUtils.m */; };
|
||||
59E8ABEA1E2102A30032A80C /* IJSVGPatternLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E8ABE91E2102A30032A80C /* IJSVGPatternLayer.m */; };
|
||||
59E8ABED1E211EBE0032A80C /* IJSVGLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E8ABEC1E211EBE0032A80C /* IJSVGLayer.m */; };
|
||||
59E8ABF01E211EDB0032A80C /* IJSVGShapeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E8ABEF1E211EDB0032A80C /* IJSVGShapeLayer.m */; };
|
||||
59E8ABF31E2167D90032A80C /* IJSVGImageLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E8ABF21E2167D90032A80C /* IJSVGImageLayer.m */; };
|
||||
59E8ABF61E2176340032A80C /* IJSVGGroupLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E8ABF51E2176340032A80C /* IJSVGGroupLayer.m */; };
|
||||
59E8ABF91E219C860032A80C /* IJSVGMath.m in Sources */ = {isa = PBXBuildFile; fileRef = 59E8ABF81E219C860032A80C /* IJSVGMath.m */; };
|
||||
59F799E219B880CE00096CB7 /* htc_one.svg in Resources */ = {isa = PBXBuildFile; fileRef = 59F799E119B880CE00096CB7 /* htc_one.svg */; };
|
||||
59FB54BE280B03E600D148FA /* IJSVG.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 59FB54B8280B038200D148FA /* IJSVG.framework */; };
|
||||
59FB54C0280B03F400D148FA /* IJSVG.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 59FB54B8280B038200D148FA /* IJSVG.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -51,51 +98,40 @@
|
||||
remoteGlobalIDString = 5956657619B62F4600D805FF;
|
||||
remoteInfo = IJSVGExample;
|
||||
};
|
||||
59FB54B7280B038200D148FA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 59FB54B3280B038200D148FA /* IJSVG.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 594CF46F238FF38E009B251B;
|
||||
remoteInfo = IJSVG;
|
||||
};
|
||||
59FB54BB280B03E100D148FA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 59FB54B3280B038200D148FA /* IJSVG.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 594CF46E238FF38E009B251B;
|
||||
remoteInfo = IJSVG;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
59FB54BF280B03EE00D148FA /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
59FB54C0280B03F400D148FA /* IJSVG.framework in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
59069A2822D0ED85004DDEA5 /* compuserver_msn_Ford_Focus.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = compuserver_msn_Ford_Focus.svg; sourceTree = "<group>"; };
|
||||
59069A2A22D0EE0E004DDEA5 /* test (1).svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test (1).svg"; sourceTree = "<group>"; };
|
||||
343A19161FB2212C000652A2 /* IJSVGGradientUnitLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGradientUnitLength.h; sourceTree = "<group>"; };
|
||||
343A19171FB2212C000652A2 /* IJSVGGradientUnitLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGradientUnitLength.m; sourceTree = "<group>"; };
|
||||
590C87EA201F9888004A1554 /* json.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = json.svg; sourceTree = "<group>"; };
|
||||
590C87EC201FA08C004A1554 /* intertwingly.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = intertwingly.svg; sourceTree = "<group>"; };
|
||||
590C87EE201FA092004A1554 /* NewTux.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = NewTux.svg; sourceTree = "<group>"; };
|
||||
590C87F0201FBF27004A1554 /* AJ_Digital_Camera.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = AJ_Digital_Camera.svg; sourceTree = "<group>"; };
|
||||
590C87F3201FC9E3004A1554 /* radialgradient2.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = radialgradient2.svg; sourceTree = "<group>"; };
|
||||
590C87F5201FD0D4004A1554 /* car.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = car.svg; sourceTree = "<group>"; };
|
||||
591704CA1E2016E400012644 /* IJSVGExporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGExporter.h; sourceTree = "<group>"; };
|
||||
591704CB1E2016E400012644 /* IJSVGExporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGExporter.m; sourceTree = "<group>"; };
|
||||
591A13DF1E19838F001D1629 /* IJSVGText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGText.h; sourceTree = "<group>"; };
|
||||
591A13E01E19838F001D1629 /* IJSVGText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGText.m; sourceTree = "<group>"; };
|
||||
59265CE71C4F840400F333F0 /* css.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = css.svg; sourceTree = "<group>"; };
|
||||
59265CE91C4F843E00F333F0 /* SVGExampleView6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGExampleView6.h; sourceTree = "<group>"; };
|
||||
59265CEA1C4F843E00F333F0 /* SVGExampleView6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGExampleView6.m; sourceTree = "<group>"; };
|
||||
5934D504280C933300BEF20F /* IJSVGExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = IJSVGExample.entitlements; sourceTree = "<group>"; };
|
||||
592840AF1E153F3D002F9AF0 /* IJSVGLayerTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGLayerTree.h; sourceTree = "<group>"; };
|
||||
592840B01E153F3D002F9AF0 /* IJSVGLayerTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGLayerTree.m; sourceTree = "<group>"; };
|
||||
592840B21E155308002F9AF0 /* IJSVGGradientLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGradientLayer.h; sourceTree = "<group>"; };
|
||||
592840B31E155308002F9AF0 /* IJSVGGradientLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGradientLayer.m; sourceTree = "<group>"; };
|
||||
5941DAF91CF9BC9B00B3A911 /* IJSVGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGImage.h; sourceTree = "<group>"; };
|
||||
5941DAFA1CF9BC9B00B3A911 /* IJSVGImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGImage.m; sourceTree = "<group>"; };
|
||||
5941DAFB1CF9BC9B00B3A911 /* IJSVGPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGPattern.h; sourceTree = "<group>"; };
|
||||
5941DAFC1CF9BC9B00B3A911 /* IJSVGPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGPattern.m; sourceTree = "<group>"; };
|
||||
59459CEB19B906FE00CE493B /* clipped.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = clipped.svg; sourceTree = "<group>"; };
|
||||
59459CED19B9074F00CE493B /* SVGExampleView4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGExampleView4.h; sourceTree = "<group>"; };
|
||||
59459CEE19B9074F00CE493B /* SVGExampleView4.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGExampleView4.m; sourceTree = "<group>"; };
|
||||
5948DED01BB2BFE5004156FF /* IJSVGError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGError.h; sourceTree = "<group>"; };
|
||||
5948DED11BB2BFE5004156FF /* IJSVGFontConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGFontConverter.h; sourceTree = "<group>"; };
|
||||
5948DED21BB2BFE5004156FF /* IJSVGFontConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGFontConverter.m; sourceTree = "<group>"; };
|
||||
5948DED31BB2BFE5004156FF /* IJSVGWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGWriter.h; sourceTree = "<group>"; };
|
||||
5948DED41BB2BFE5004156FF /* IJSVGWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGWriter.m; sourceTree = "<group>"; };
|
||||
5956657719B62F4600D805FF /* IJSVGExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IJSVGExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5956657B19B62F4600D805FF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5956657C19B62F4600D805FF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
@@ -107,27 +143,110 @@
|
||||
5956658F19B62F4700D805FF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5956659019B62F4700D805FF /* IJSVGExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGExampleTests.m; sourceTree = "<group>"; };
|
||||
5956659A19B62F9500D805FF /* IJSVGExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IJSVGExample-Prefix.pch"; sourceTree = "<group>"; };
|
||||
595665C619B6302600D805FF /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../README.md; sourceTree = "<group>"; };
|
||||
595665DD19B6309C00D805FF /* test.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = test.svg; sourceTree = "<group>"; };
|
||||
595665DF19B630B600D805FF /* SVGView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGView.h; sourceTree = "<group>"; };
|
||||
595665E019B630B600D805FF /* SVGView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGView.m; sourceTree = "<group>"; };
|
||||
597AC83222CFD0FC007C0E42 /* home.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = home.svg; sourceTree = "<group>"; };
|
||||
597046A01E24352700A60138 /* IJSVGStrokeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStrokeLayer.h; sourceTree = "<group>"; };
|
||||
597046A11E24352700A60138 /* IJSVGStrokeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStrokeLayer.m; sourceTree = "<group>"; };
|
||||
5986308619BA104800CF15EA /* linecap.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = linecap.svg; sourceTree = "<group>"; };
|
||||
5986308819BA106D00CF15EA /* SVGExampleView5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGExampleView5.h; sourceTree = "<group>"; };
|
||||
5986308919BA106D00CF15EA /* SVGExampleView5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGExampleView5.m; sourceTree = "<group>"; };
|
||||
5986308B19BA180E00CF15EA /* dashed.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dashed.svg; sourceTree = "<group>"; };
|
||||
598759F41E242C850024CC3F /* IJSVGExporterPathInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGExporterPathInstruction.h; sourceTree = "<group>"; };
|
||||
598759F51E242C850024CC3F /* IJSVGExporterPathInstruction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGExporterPathInstruction.m; sourceTree = "<group>"; };
|
||||
5991A2A8201E30E600913E3B /* gradients.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = gradients.svg; sourceTree = "<group>"; };
|
||||
5991A2AA201E310200913E3B /* heart.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = heart.svg; sourceTree = "<group>"; };
|
||||
599465D41C4AA87200A2EEF3 /* IJSVGStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheet.h; sourceTree = "<group>"; };
|
||||
599465D51C4AA87200A2EEF3 /* IJSVGStyleSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheet.m; sourceTree = "<group>"; };
|
||||
599465D61C4AA87200A2EEF3 /* IJSVGStyleSheetRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheetRule.h; sourceTree = "<group>"; };
|
||||
599465D71C4AA87200A2EEF3 /* IJSVGStyleSheetRule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheetRule.m; sourceTree = "<group>"; };
|
||||
599465D81C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheetSelector.h; sourceTree = "<group>"; };
|
||||
599465D91C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheetSelector.m; sourceTree = "<group>"; };
|
||||
599465DA1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyleSheetSelectorRaw.h; sourceTree = "<group>"; };
|
||||
599465DB1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyleSheetSelectorRaw.m; sourceTree = "<group>"; };
|
||||
59A11E6A19B89CEA00E44498 /* SVGExampleView1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGExampleView1.h; sourceTree = "<group>"; };
|
||||
59A11E6B19B89CEA00E44498 /* SVGExampleView1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGExampleView1.m; sourceTree = "<group>"; };
|
||||
59A11E6D19B89D2000E44498 /* SVGExampleView2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGExampleView2.h; sourceTree = "<group>"; };
|
||||
59A11E6E19B89D2000E44498 /* SVGExampleView2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGExampleView2.m; sourceTree = "<group>"; };
|
||||
59A11E7019B89D6600E44498 /* SVGExampleView3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGExampleView3.h; sourceTree = "<group>"; };
|
||||
59A11E7119B89D6600E44498 /* SVGExampleView3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGExampleView3.m; sourceTree = "<group>"; };
|
||||
59A3DA6B1E283022003E59A9 /* IJSVGTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGTransaction.h; sourceTree = "<group>"; };
|
||||
59A3DA6C1E283022003E59A9 /* IJSVGTransaction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGTransaction.m; sourceTree = "<group>"; };
|
||||
59B93C6C19B7D1840063E823 /* paperplane.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = paperplane.svg; sourceTree = "<group>"; };
|
||||
59B93C6E19B7D32C0063E823 /* products.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = products.svg; sourceTree = "<group>"; };
|
||||
59D1E39C2022577500C54672 /* IJSVGQuartzRenderer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IJSVGQuartzRenderer.h; sourceTree = "<group>"; };
|
||||
59D1E39D2022577500C54672 /* IJSVGQuartzRenderer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IJSVGQuartzRenderer.m; sourceTree = "<group>"; };
|
||||
59D1E39F202279CA00C54672 /* Group.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Group.svg; sourceTree = "<group>"; };
|
||||
59E0F5EB1E29964700F757F7 /* IJSVGUnitLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGUnitLength.h; sourceTree = "<group>"; };
|
||||
59E0F5EC1E29964700F757F7 /* IJSVGUnitLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGUnitLength.m; sourceTree = "<group>"; };
|
||||
59E2641B19BA240D008A6FDB /* IJSVG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVG.h; sourceTree = "<group>"; };
|
||||
59E2641C19BA240D008A6FDB /* IJSVG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVG.m; sourceTree = "<group>"; };
|
||||
59E2641D19BA240D008A6FDB /* IJSVGBezierPathAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGBezierPathAdditions.h; sourceTree = "<group>"; };
|
||||
59E2641E19BA240D008A6FDB /* IJSVGBezierPathAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGBezierPathAdditions.m; sourceTree = "<group>"; };
|
||||
59E2641F19BA240D008A6FDB /* IJSVGCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCache.h; sourceTree = "<group>"; };
|
||||
59E2642019BA240D008A6FDB /* IJSVGCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCache.m; sourceTree = "<group>"; };
|
||||
59E2642119BA240D008A6FDB /* IJSVGColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGColor.h; sourceTree = "<group>"; };
|
||||
59E2642219BA240D008A6FDB /* IJSVGColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGColor.m; sourceTree = "<group>"; };
|
||||
59E2642319BA240D008A6FDB /* IJSVGCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommand.h; sourceTree = "<group>"; };
|
||||
59E2642419BA240D008A6FDB /* IJSVGCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommand.m; sourceTree = "<group>"; };
|
||||
59E2642519BA240D008A6FDB /* IJSVGCommandArc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandArc.h; sourceTree = "<group>"; };
|
||||
59E2642619BA240D008A6FDB /* IJSVGCommandArc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandArc.m; sourceTree = "<group>"; };
|
||||
59E2642719BA240D008A6FDB /* IJSVGCommandClose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandClose.h; sourceTree = "<group>"; };
|
||||
59E2642819BA240D008A6FDB /* IJSVGCommandClose.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandClose.m; sourceTree = "<group>"; };
|
||||
59E2642919BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandCommandSmoothQuadraticCurve.h; sourceTree = "<group>"; };
|
||||
59E2642A19BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandCommandSmoothQuadraticCurve.m; sourceTree = "<group>"; };
|
||||
59E2642B19BA240D008A6FDB /* IJSVGCommandCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandCurve.h; sourceTree = "<group>"; };
|
||||
59E2642C19BA240D008A6FDB /* IJSVGCommandCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandCurve.m; sourceTree = "<group>"; };
|
||||
59E2642D19BA240D008A6FDB /* IJSVGCommandHorizontalLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandHorizontalLine.h; sourceTree = "<group>"; };
|
||||
59E2642E19BA240D008A6FDB /* IJSVGCommandHorizontalLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandHorizontalLine.m; sourceTree = "<group>"; };
|
||||
59E2642F19BA240D008A6FDB /* IJSVGCommandLineTo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandLineTo.h; sourceTree = "<group>"; };
|
||||
59E2643019BA240D008A6FDB /* IJSVGCommandLineTo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandLineTo.m; sourceTree = "<group>"; };
|
||||
59E2643119BA240D008A6FDB /* IJSVGCommandMove.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandMove.h; sourceTree = "<group>"; };
|
||||
59E2643219BA240D008A6FDB /* IJSVGCommandMove.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandMove.m; sourceTree = "<group>"; };
|
||||
59E2643319BA240D008A6FDB /* IJSVGCommandQuadraticCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandQuadraticCurve.h; sourceTree = "<group>"; };
|
||||
59E2643419BA240D008A6FDB /* IJSVGCommandQuadraticCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandQuadraticCurve.m; sourceTree = "<group>"; };
|
||||
59E2643519BA240D008A6FDB /* IJSVGCommandSmoothCurve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandSmoothCurve.h; sourceTree = "<group>"; };
|
||||
59E2643619BA240D008A6FDB /* IJSVGCommandSmoothCurve.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandSmoothCurve.m; sourceTree = "<group>"; };
|
||||
59E2643719BA240D008A6FDB /* IJSVGCommandVerticalLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGCommandVerticalLine.h; sourceTree = "<group>"; };
|
||||
59E2643819BA240D008A6FDB /* IJSVGCommandVerticalLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGCommandVerticalLine.m; sourceTree = "<group>"; };
|
||||
59E2643919BA240D008A6FDB /* IJSVGDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGDef.h; sourceTree = "<group>"; };
|
||||
59E2643A19BA240D008A6FDB /* IJSVGDef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGDef.m; sourceTree = "<group>"; };
|
||||
59E2643B19BA240D008A6FDB /* IJSVGForeignObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGForeignObject.h; sourceTree = "<group>"; };
|
||||
59E2643C19BA240D008A6FDB /* IJSVGForeignObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGForeignObject.m; sourceTree = "<group>"; };
|
||||
59E2643D19BA240D008A6FDB /* IJSVGGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGradient.h; sourceTree = "<group>"; };
|
||||
59E2643E19BA240D008A6FDB /* IJSVGGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGradient.m; sourceTree = "<group>"; };
|
||||
59E2643F19BA240D008A6FDB /* IJSVGGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGroup.h; sourceTree = "<group>"; };
|
||||
59E2644019BA240D008A6FDB /* IJSVGGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGroup.m; sourceTree = "<group>"; };
|
||||
59E2644119BA240D008A6FDB /* IJSVGLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGLinearGradient.h; sourceTree = "<group>"; };
|
||||
59E2644219BA240D008A6FDB /* IJSVGLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGLinearGradient.m; sourceTree = "<group>"; };
|
||||
59E2644319BA240D008A6FDB /* IJSVGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGNode.h; sourceTree = "<group>"; };
|
||||
59E2644419BA240D008A6FDB /* IJSVGNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGNode.m; sourceTree = "<group>"; };
|
||||
59E2644519BA240D008A6FDB /* IJSVGParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGParser.h; sourceTree = "<group>"; };
|
||||
59E2644619BA240D008A6FDB /* IJSVGParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGParser.m; sourceTree = "<group>"; };
|
||||
59E2644719BA240D008A6FDB /* IJSVGPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGPath.h; sourceTree = "<group>"; };
|
||||
59E2644819BA240D008A6FDB /* IJSVGPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGPath.m; sourceTree = "<group>"; };
|
||||
59E2644919BA240D008A6FDB /* IJSVGRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGRadialGradient.h; sourceTree = "<group>"; };
|
||||
59E2644A19BA240D008A6FDB /* IJSVGRadialGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGRadialGradient.m; sourceTree = "<group>"; };
|
||||
59E2644B19BA240D008A6FDB /* IJSVGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGStyle.h; sourceTree = "<group>"; };
|
||||
59E2644C19BA240D008A6FDB /* IJSVGStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGStyle.m; sourceTree = "<group>"; };
|
||||
59E2644D19BA240D008A6FDB /* IJSVGTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGTransform.h; sourceTree = "<group>"; };
|
||||
59E2644E19BA240D008A6FDB /* IJSVGTransform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGTransform.m; sourceTree = "<group>"; };
|
||||
59E2644F19BA240D008A6FDB /* IJSVGUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGUtils.h; sourceTree = "<group>"; };
|
||||
59E2645019BA240D008A6FDB /* IJSVGUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGUtils.m; sourceTree = "<group>"; };
|
||||
59E8ABE81E2102A30032A80C /* IJSVGPatternLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGPatternLayer.h; sourceTree = "<group>"; };
|
||||
59E8ABE91E2102A30032A80C /* IJSVGPatternLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGPatternLayer.m; sourceTree = "<group>"; };
|
||||
59E8ABEB1E211EBE0032A80C /* IJSVGLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGLayer.h; sourceTree = "<group>"; };
|
||||
59E8ABEC1E211EBE0032A80C /* IJSVGLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGLayer.m; sourceTree = "<group>"; };
|
||||
59E8ABEE1E211EDB0032A80C /* IJSVGShapeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGShapeLayer.h; sourceTree = "<group>"; };
|
||||
59E8ABEF1E211EDB0032A80C /* IJSVGShapeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGShapeLayer.m; sourceTree = "<group>"; };
|
||||
59E8ABF11E2167D90032A80C /* IJSVGImageLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGImageLayer.h; sourceTree = "<group>"; };
|
||||
59E8ABF21E2167D90032A80C /* IJSVGImageLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGImageLayer.m; sourceTree = "<group>"; };
|
||||
59E8ABF41E2176340032A80C /* IJSVGGroupLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGGroupLayer.h; sourceTree = "<group>"; };
|
||||
59E8ABF51E2176340032A80C /* IJSVGGroupLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGGroupLayer.m; sourceTree = "<group>"; };
|
||||
59E8ABF71E219C860032A80C /* IJSVGMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJSVGMath.h; sourceTree = "<group>"; };
|
||||
59E8ABF81E219C860032A80C /* IJSVGMath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJSVGMath.m; sourceTree = "<group>"; };
|
||||
59F799E119B880CE00096CB7 /* htc_one.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = htc_one.svg; sourceTree = "<group>"; };
|
||||
59FB54B3280B038200D148FA /* IJSVG.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = IJSVG.xcodeproj; path = ../Framework/IJSVG/IJSVG.xcodeproj; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -135,7 +254,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
59FB54BE280B03E600D148FA /* IJSVG.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -152,11 +270,9 @@
|
||||
5956656E19B62F4600D805FF = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59FB54B3280B038200D148FA /* IJSVG.xcodeproj */,
|
||||
5956657919B62F4600D805FF /* IJSVGExample */,
|
||||
5956658D19B62F4700D805FF /* IJSVGExampleTests */,
|
||||
5956657819B62F4600D805FF /* Products */,
|
||||
59FB54BD280B03E600D148FA /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -172,7 +288,7 @@
|
||||
5956657919B62F4600D805FF /* IJSVGExample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5934D504280C933300BEF20F /* IJSVGExample.entitlements */,
|
||||
5956659B19B62FA400D805FF /* IJSVG */,
|
||||
5956657E19B62F4600D805FF /* AppDelegate.h */,
|
||||
5956657F19B62F4600D805FF /* AppDelegate.m */,
|
||||
5956658119B62F4600D805FF /* Images.xcassets */,
|
||||
@@ -199,9 +315,6 @@
|
||||
5956657A19B62F4600D805FF /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59069A2A22D0EE0E004DDEA5 /* test (1).svg */,
|
||||
59069A2822D0ED85004DDEA5 /* compuserver_msn_Ford_Focus.svg */,
|
||||
597AC83222CFD0FC007C0E42 /* home.svg */,
|
||||
59D1E39F202279CA00C54672 /* Group.svg */,
|
||||
590C87F5201FD0D4004A1554 /* car.svg */,
|
||||
590C87F3201FC9E3004A1554 /* radialgradient2.svg */,
|
||||
@@ -243,19 +356,124 @@
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
59FB54B4280B038200D148FA /* Products */ = {
|
||||
5956659B19B62FA400D805FF /* IJSVG */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59FB54B8280B038200D148FA /* IJSVG.framework */,
|
||||
59E2641A19BA240D008A6FDB /* source */,
|
||||
595665C619B6302600D805FF /* README.md */,
|
||||
);
|
||||
name = Products;
|
||||
name = IJSVG;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
59FB54BD280B03E600D148FA /* Frameworks */ = {
|
||||
59E2641A19BA240D008A6FDB /* source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
59A3DA6B1E283022003E59A9 /* IJSVGTransaction.h */,
|
||||
59A3DA6C1E283022003E59A9 /* IJSVGTransaction.m */,
|
||||
598759F41E242C850024CC3F /* IJSVGExporterPathInstruction.h */,
|
||||
598759F51E242C850024CC3F /* IJSVGExporterPathInstruction.m */,
|
||||
5941DAF91CF9BC9B00B3A911 /* IJSVGImage.h */,
|
||||
5941DAFA1CF9BC9B00B3A911 /* IJSVGImage.m */,
|
||||
5941DAFB1CF9BC9B00B3A911 /* IJSVGPattern.h */,
|
||||
5941DAFC1CF9BC9B00B3A911 /* IJSVGPattern.m */,
|
||||
599465D41C4AA87200A2EEF3 /* IJSVGStyleSheet.h */,
|
||||
599465D51C4AA87200A2EEF3 /* IJSVGStyleSheet.m */,
|
||||
599465D61C4AA87200A2EEF3 /* IJSVGStyleSheetRule.h */,
|
||||
599465D71C4AA87200A2EEF3 /* IJSVGStyleSheetRule.m */,
|
||||
599465D81C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.h */,
|
||||
599465D91C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.m */,
|
||||
599465DA1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.h */,
|
||||
599465DB1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.m */,
|
||||
5948DED01BB2BFE5004156FF /* IJSVGError.h */,
|
||||
5948DED11BB2BFE5004156FF /* IJSVGFontConverter.h */,
|
||||
5948DED21BB2BFE5004156FF /* IJSVGFontConverter.m */,
|
||||
5948DED31BB2BFE5004156FF /* IJSVGWriter.h */,
|
||||
5948DED41BB2BFE5004156FF /* IJSVGWriter.m */,
|
||||
59E2641B19BA240D008A6FDB /* IJSVG.h */,
|
||||
59E2641C19BA240D008A6FDB /* IJSVG.m */,
|
||||
59E2641D19BA240D008A6FDB /* IJSVGBezierPathAdditions.h */,
|
||||
59E2641E19BA240D008A6FDB /* IJSVGBezierPathAdditions.m */,
|
||||
59E2641F19BA240D008A6FDB /* IJSVGCache.h */,
|
||||
59E2642019BA240D008A6FDB /* IJSVGCache.m */,
|
||||
59E2642119BA240D008A6FDB /* IJSVGColor.h */,
|
||||
59E2642219BA240D008A6FDB /* IJSVGColor.m */,
|
||||
59E2642319BA240D008A6FDB /* IJSVGCommand.h */,
|
||||
59E2642419BA240D008A6FDB /* IJSVGCommand.m */,
|
||||
59E2642519BA240D008A6FDB /* IJSVGCommandArc.h */,
|
||||
59E2642619BA240D008A6FDB /* IJSVGCommandArc.m */,
|
||||
59E2642719BA240D008A6FDB /* IJSVGCommandClose.h */,
|
||||
59E2642819BA240D008A6FDB /* IJSVGCommandClose.m */,
|
||||
59E2642919BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.h */,
|
||||
59E2642A19BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.m */,
|
||||
59E2642B19BA240D008A6FDB /* IJSVGCommandCurve.h */,
|
||||
59E2642C19BA240D008A6FDB /* IJSVGCommandCurve.m */,
|
||||
59E2642D19BA240D008A6FDB /* IJSVGCommandHorizontalLine.h */,
|
||||
59E2642E19BA240D008A6FDB /* IJSVGCommandHorizontalLine.m */,
|
||||
59E2642F19BA240D008A6FDB /* IJSVGCommandLineTo.h */,
|
||||
59E2643019BA240D008A6FDB /* IJSVGCommandLineTo.m */,
|
||||
59E2643119BA240D008A6FDB /* IJSVGCommandMove.h */,
|
||||
59E2643219BA240D008A6FDB /* IJSVGCommandMove.m */,
|
||||
59E2643319BA240D008A6FDB /* IJSVGCommandQuadraticCurve.h */,
|
||||
59E2643419BA240D008A6FDB /* IJSVGCommandQuadraticCurve.m */,
|
||||
59E2643519BA240D008A6FDB /* IJSVGCommandSmoothCurve.h */,
|
||||
59E2643619BA240D008A6FDB /* IJSVGCommandSmoothCurve.m */,
|
||||
59E2643719BA240D008A6FDB /* IJSVGCommandVerticalLine.h */,
|
||||
59E2643819BA240D008A6FDB /* IJSVGCommandVerticalLine.m */,
|
||||
59E2643919BA240D008A6FDB /* IJSVGDef.h */,
|
||||
59E2643A19BA240D008A6FDB /* IJSVGDef.m */,
|
||||
59E2643B19BA240D008A6FDB /* IJSVGForeignObject.h */,
|
||||
59E2643C19BA240D008A6FDB /* IJSVGForeignObject.m */,
|
||||
59E2643D19BA240D008A6FDB /* IJSVGGradient.h */,
|
||||
59E2643E19BA240D008A6FDB /* IJSVGGradient.m */,
|
||||
343A19161FB2212C000652A2 /* IJSVGGradientUnitLength.h */,
|
||||
343A19171FB2212C000652A2 /* IJSVGGradientUnitLength.m */,
|
||||
59E2643F19BA240D008A6FDB /* IJSVGGroup.h */,
|
||||
59E2644019BA240D008A6FDB /* IJSVGGroup.m */,
|
||||
59E2644119BA240D008A6FDB /* IJSVGLinearGradient.h */,
|
||||
59E2644219BA240D008A6FDB /* IJSVGLinearGradient.m */,
|
||||
59E2644319BA240D008A6FDB /* IJSVGNode.h */,
|
||||
59E2644419BA240D008A6FDB /* IJSVGNode.m */,
|
||||
59E2644519BA240D008A6FDB /* IJSVGParser.h */,
|
||||
59E2644619BA240D008A6FDB /* IJSVGParser.m */,
|
||||
59E2644719BA240D008A6FDB /* IJSVGPath.h */,
|
||||
59E2644819BA240D008A6FDB /* IJSVGPath.m */,
|
||||
59E2644919BA240D008A6FDB /* IJSVGRadialGradient.h */,
|
||||
59E2644A19BA240D008A6FDB /* IJSVGRadialGradient.m */,
|
||||
59E2644B19BA240D008A6FDB /* IJSVGStyle.h */,
|
||||
59E2644C19BA240D008A6FDB /* IJSVGStyle.m */,
|
||||
59E2644D19BA240D008A6FDB /* IJSVGTransform.h */,
|
||||
59E2644E19BA240D008A6FDB /* IJSVGTransform.m */,
|
||||
59E2644F19BA240D008A6FDB /* IJSVGUtils.h */,
|
||||
59E2645019BA240D008A6FDB /* IJSVGUtils.m */,
|
||||
592840AF1E153F3D002F9AF0 /* IJSVGLayerTree.h */,
|
||||
592840B01E153F3D002F9AF0 /* IJSVGLayerTree.m */,
|
||||
592840B21E155308002F9AF0 /* IJSVGGradientLayer.h */,
|
||||
592840B31E155308002F9AF0 /* IJSVGGradientLayer.m */,
|
||||
591A13DF1E19838F001D1629 /* IJSVGText.h */,
|
||||
591A13E01E19838F001D1629 /* IJSVGText.m */,
|
||||
591704CA1E2016E400012644 /* IJSVGExporter.h */,
|
||||
591704CB1E2016E400012644 /* IJSVGExporter.m */,
|
||||
59E8ABE81E2102A30032A80C /* IJSVGPatternLayer.h */,
|
||||
59E8ABE91E2102A30032A80C /* IJSVGPatternLayer.m */,
|
||||
59E8ABEB1E211EBE0032A80C /* IJSVGLayer.h */,
|
||||
59E8ABEC1E211EBE0032A80C /* IJSVGLayer.m */,
|
||||
59E8ABEE1E211EDB0032A80C /* IJSVGShapeLayer.h */,
|
||||
59E8ABEF1E211EDB0032A80C /* IJSVGShapeLayer.m */,
|
||||
59E8ABF11E2167D90032A80C /* IJSVGImageLayer.h */,
|
||||
59E8ABF21E2167D90032A80C /* IJSVGImageLayer.m */,
|
||||
59E8ABF41E2176340032A80C /* IJSVGGroupLayer.h */,
|
||||
59E8ABF51E2176340032A80C /* IJSVGGroupLayer.m */,
|
||||
59E8ABF71E219C860032A80C /* IJSVGMath.h */,
|
||||
59E8ABF81E219C860032A80C /* IJSVGMath.m */,
|
||||
597046A01E24352700A60138 /* IJSVGStrokeLayer.h */,
|
||||
597046A11E24352700A60138 /* IJSVGStrokeLayer.m */,
|
||||
59E0F5EB1E29964700F757F7 /* IJSVGUnitLength.h */,
|
||||
59E0F5EC1E29964700F757F7 /* IJSVGUnitLength.m */,
|
||||
59D1E39C2022577500C54672 /* IJSVGQuartzRenderer.h */,
|
||||
59D1E39D2022577500C54672 /* IJSVGQuartzRenderer.m */,
|
||||
);
|
||||
name = Frameworks;
|
||||
name = source;
|
||||
path = ../../source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@@ -268,12 +486,10 @@
|
||||
5956657319B62F4600D805FF /* Sources */,
|
||||
5956657419B62F4600D805FF /* Frameworks */,
|
||||
5956657519B62F4600D805FF /* Resources */,
|
||||
59FB54BF280B03EE00D148FA /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
59FB54BC280B03E100D148FA /* PBXTargetDependency */,
|
||||
);
|
||||
name = IJSVGExample;
|
||||
productName = IJSVGExample;
|
||||
@@ -321,19 +537,12 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 5956656E19B62F4600D805FF;
|
||||
productRefGroup = 5956657819B62F4600D805FF /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 59FB54B4280B038200D148FA /* Products */;
|
||||
ProjectRef = 59FB54B3280B038200D148FA /* IJSVG.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
5956657619B62F4600D805FF /* IJSVGExample */,
|
||||
@@ -342,16 +551,6 @@
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
59FB54B8280B038200D148FA /* IJSVG.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = IJSVG.framework;
|
||||
remoteRef = 59FB54B7280B038200D148FA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
5956657519B62F4600D805FF /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
@@ -361,17 +560,14 @@
|
||||
5956658219B62F4600D805FF /* Images.xcassets in Resources */,
|
||||
590C87ED201FA08C004A1554 /* intertwingly.svg in Resources */,
|
||||
590C87F1201FBF27004A1554 /* AJ_Digital_Camera.svg in Resources */,
|
||||
59069A2B22D0EE0E004DDEA5 /* test (1).svg in Resources */,
|
||||
590C87EF201FA093004A1554 /* NewTux.svg in Resources */,
|
||||
59265CE81C4F840400F333F0 /* css.svg in Resources */,
|
||||
595665DE19B6309C00D805FF /* test.svg in Resources */,
|
||||
597AC83322CFD0FC007C0E42 /* home.svg in Resources */,
|
||||
590C87EB201F9888004A1554 /* json.svg in Resources */,
|
||||
59D1E3A0202279CA00C54672 /* Group.svg in Resources */,
|
||||
59F799E219B880CE00096CB7 /* htc_one.svg in Resources */,
|
||||
59B93C6F19B7D32C0063E823 /* products.svg in Resources */,
|
||||
5991A2A9201E30E600913E3B /* gradients.svg in Resources */,
|
||||
59069A2922D0ED85004DDEA5 /* compuserver_msn_Ford_Focus.svg in Resources */,
|
||||
5986308719BA104800CF15EA /* linecap.svg in Resources */,
|
||||
5956658519B62F4600D805FF /* MainMenu.xib in Resources */,
|
||||
590C87F4201FC9E4004A1554 /* radialgradient2.svg in Resources */,
|
||||
@@ -396,15 +592,67 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
59E2645419BA240D008A6FDB /* IJSVGColor.m in Sources */,
|
||||
59E2646919BA240D008A6FDB /* IJSVGStyle.m in Sources */,
|
||||
59E2646419BA240D008A6FDB /* IJSVGLinearGradient.m in Sources */,
|
||||
595665DC19B6302600D805FF /* README.md in Sources */,
|
||||
59D1E39E2022577500C54672 /* IJSVGQuartzRenderer.m in Sources */,
|
||||
5941DAFD1CF9BC9B00B3A911 /* IJSVGImage.m in Sources */,
|
||||
599465DE1C4AA87200A2EEF3 /* IJSVGStyleSheetSelector.m in Sources */,
|
||||
5948DED61BB2BFE5004156FF /* IJSVGWriter.m in Sources */,
|
||||
599465DD1C4AA87200A2EEF3 /* IJSVGStyleSheetRule.m in Sources */,
|
||||
5986308A19BA106D00CF15EA /* SVGExampleView5.m in Sources */,
|
||||
59E2645619BA240D008A6FDB /* IJSVGCommandArc.m in Sources */,
|
||||
59E8ABF91E219C860032A80C /* IJSVGMath.m in Sources */,
|
||||
343A19181FB2212C000652A2 /* IJSVGGradientUnitLength.m in Sources */,
|
||||
59265CEB1C4F843E00F333F0 /* SVGExampleView6.m in Sources */,
|
||||
5941DAFE1CF9BC9B00B3A911 /* IJSVGPattern.m in Sources */,
|
||||
59E8ABF01E211EDB0032A80C /* IJSVGShapeLayer.m in Sources */,
|
||||
599465DC1C4AA87200A2EEF3 /* IJSVGStyleSheet.m in Sources */,
|
||||
59E2645319BA240D008A6FDB /* IJSVGCache.m in Sources */,
|
||||
599465DF1C4AA87200A2EEF3 /* IJSVGStyleSheetSelectorRaw.m in Sources */,
|
||||
59E8ABEA1E2102A30032A80C /* IJSVGPatternLayer.m in Sources */,
|
||||
59E2646619BA240D008A6FDB /* IJSVGParser.m in Sources */,
|
||||
595665E119B630B600D805FF /* SVGView.m in Sources */,
|
||||
59E2645719BA240D008A6FDB /* IJSVGCommandClose.m in Sources */,
|
||||
59E2645A19BA240D008A6FDB /* IJSVGCommandHorizontalLine.m in Sources */,
|
||||
59E2645B19BA240D008A6FDB /* IJSVGCommandLineTo.m in Sources */,
|
||||
59E2645F19BA240D008A6FDB /* IJSVGCommandVerticalLine.m in Sources */,
|
||||
59E8ABF61E2176340032A80C /* IJSVGGroupLayer.m in Sources */,
|
||||
59E2646819BA240D008A6FDB /* IJSVGRadialGradient.m in Sources */,
|
||||
59E8ABF31E2167D90032A80C /* IJSVGImageLayer.m in Sources */,
|
||||
59E2645919BA240D008A6FDB /* IJSVGCommandCurve.m in Sources */,
|
||||
5956658019B62F4600D805FF /* AppDelegate.m in Sources */,
|
||||
59E2646519BA240D008A6FDB /* IJSVGNode.m in Sources */,
|
||||
591A13E11E19838F001D1629 /* IJSVGText.m in Sources */,
|
||||
59A11E6C19B89CEA00E44498 /* SVGExampleView1.m in Sources */,
|
||||
59A3DA6D1E283022003E59A9 /* IJSVGTransaction.m in Sources */,
|
||||
59E2646A19BA240D008A6FDB /* IJSVGTransform.m in Sources */,
|
||||
59E2646B19BA240D008A6FDB /* IJSVGUtils.m in Sources */,
|
||||
592840B41E155308002F9AF0 /* IJSVGGradientLayer.m in Sources */,
|
||||
59E2646019BA240D008A6FDB /* IJSVGDef.m in Sources */,
|
||||
59E2645C19BA240D008A6FDB /* IJSVGCommandMove.m in Sources */,
|
||||
59E2646219BA240D008A6FDB /* IJSVGGradient.m in Sources */,
|
||||
598759F61E242C850024CC3F /* IJSVGExporterPathInstruction.m in Sources */,
|
||||
59E2645E19BA240D008A6FDB /* IJSVGCommandSmoothCurve.m in Sources */,
|
||||
59E2645819BA240D008A6FDB /* IJSVGCommandCommandSmoothQuadraticCurve.m in Sources */,
|
||||
59E2645D19BA240D008A6FDB /* IJSVGCommandQuadraticCurve.m in Sources */,
|
||||
59E2646719BA240D008A6FDB /* IJSVGPath.m in Sources */,
|
||||
59E8ABED1E211EBE0032A80C /* IJSVGLayer.m in Sources */,
|
||||
591704CC1E2016E400012644 /* IJSVGExporter.m in Sources */,
|
||||
59E2645519BA240D008A6FDB /* IJSVGCommand.m in Sources */,
|
||||
59A11E7219B89D6600E44498 /* SVGExampleView3.m in Sources */,
|
||||
59E0F5ED1E29964700F757F7 /* IJSVGUnitLength.m in Sources */,
|
||||
5956657D19B62F4600D805FF /* main.m in Sources */,
|
||||
59A11E6F19B89D2000E44498 /* SVGExampleView2.m in Sources */,
|
||||
5948DED51BB2BFE5004156FF /* IJSVGFontConverter.m in Sources */,
|
||||
59E2646319BA240D008A6FDB /* IJSVGGroup.m in Sources */,
|
||||
59459CEF19B9074F00CE493B /* SVGExampleView4.m in Sources */,
|
||||
597046A21E24352700A60138 /* IJSVGStrokeLayer.m in Sources */,
|
||||
59E2646119BA240D008A6FDB /* IJSVGForeignObject.m in Sources */,
|
||||
59E2645219BA240D008A6FDB /* IJSVGBezierPathAdditions.m in Sources */,
|
||||
59E2645119BA240D008A6FDB /* IJSVG.m in Sources */,
|
||||
592840B11E153F3D002F9AF0 /* IJSVGLayerTree.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -424,11 +672,6 @@
|
||||
target = 5956657619B62F4600D805FF /* IJSVGExample */;
|
||||
targetProxy = 5956658B19B62F4700D805FF /* PBXContainerItemProxy */;
|
||||
};
|
||||
59FB54BC280B03E100D148FA /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = IJSVG;
|
||||
targetProxy = 59FB54BB280B03E100D148FA /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
@@ -525,7 +768,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = IJSVGExample/IJSVGExample.entitlements;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = IJSVGExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
@@ -537,7 +779,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = IJSVGExample/IJSVGExample.entitlements;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = IJSVGExample/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user