├── Example SVGgh ├── Example SVGghTests │ ├── SVGgh.framework │ │ ├── Versions │ │ │ ├── Current │ │ │ └── A │ │ │ │ ├── SVGgh │ │ │ │ └── Headers │ │ │ │ ├── AttributedObject.h │ │ │ │ ├── SVGgh.h │ │ │ │ ├── GHPathDescription.h │ │ │ │ ├── GHAttributedObject.h │ │ │ │ ├── SVGRenderer.h │ │ │ │ └── SVGParser.h │ │ ├── SVGgh │ │ └── Headers │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Example SVGghTests-Info.plist │ └── Example_SVGghTests.m └── Example SVGgh │ ├── en.lproj │ └── InfoPlist.strings │ ├── ExampleSVGghDelegate.h │ ├── Example SVGgh-Prefix.pch │ ├── ExampleSVGghViewController.h │ ├── main.m │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json │ ├── Artwork │ ├── ShareButton.svg │ └── MenuButton.svg │ ├── Example SVGgh-Info.plist │ ├── ExampleSVGghViewController.m │ └── ExampleSVGghDelegate.m ├── SVGghTests ├── en.lproj │ └── InfoPlist.strings ├── SVGghTests-Bridging-Header.h ├── SVGghTests-Info.plist ├── Info.plist ├── CSSTests.m ├── CGPath+Iterate.swift └── SVGPathTests.swift ├── SVGgh Debugging App ├── en.lproj │ └── InfoPlist.strings ├── Images.xcassets │ ├── Contents.json │ └── AppIcon.appiconset │ │ ├── Star_29.png │ │ ├── Star_40.png │ │ ├── Star_58.png │ │ ├── Star_76.png │ │ ├── Star_80.png │ │ ├── Star_87.png │ │ ├── Star_120.png │ │ ├── Star_152.png │ │ ├── Star_167.png │ │ ├── Star_180.png │ │ ├── Star_58-1.png │ │ ├── Star_80-1.png │ │ ├── Star_120-1.png │ │ └── Contents.json ├── TVAssets.xcassets │ ├── Contents.json │ └── Brand Assets.brandassets │ │ ├── App Icon - Large.imagestack │ │ ├── Back.imagestacklayer │ │ │ ├── Contents.json │ │ │ └── Content.imageset │ │ │ │ └── Contents.json │ │ ├── Front.imagestacklayer │ │ │ ├── Contents.json │ │ │ └── Content.imageset │ │ │ │ └── Contents.json │ │ ├── Middle.imagestacklayer │ │ │ ├── Contents.json │ │ │ └── Content.imageset │ │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── App Icon - Small.imagestack │ │ ├── Back.imagestacklayer │ │ │ ├── Contents.json │ │ │ └── Content.imageset │ │ │ │ └── Contents.json │ │ ├── Front.imagestacklayer │ │ │ ├── Contents.json │ │ │ └── Content.imageset │ │ │ │ └── Contents.json │ │ ├── Middle.imagestacklayer │ │ │ ├── Contents.json │ │ │ └── Content.imageset │ │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Top Shelf Image.imageset │ │ └── Contents.json │ │ ├── Top Shelf Image Wide-2.imageset │ │ └── Contents.json │ │ ├── Top Shelf Image Wide.imageset │ │ └── Contents.json │ │ └── Contents.json ├── Artwork.xcassets │ ├── Contents.json │ ├── EyesZipped.dataset │ │ ├── EyesZipped.svgz │ │ └── Contents.json │ ├── Eye.dataset │ │ ├── Contents.json │ │ └── Eye.svg │ ├── Eyes.dataset │ │ └── Contents.json │ ├── Test.dataset │ │ ├── Contents.json │ │ └── test.svg │ ├── Button.dataset │ │ ├── Contents.json │ │ └── Button.svg │ ├── Helmet.dataset │ │ ├── Contents.json │ │ └── Helmet.svg │ ├── Segment.dataset │ │ ├── Contents.json │ │ └── Segment.svg │ ├── Widgets.dataset │ │ ├── Contents.json │ │ └── Widgets.svg │ ├── Buttterfly.dataset │ │ ├── Contents.json │ │ └── Butterfly.svg │ ├── Creatures.dataset │ │ └── Contents.json │ ├── Frog.dataset │ │ ├── Contents.json │ │ └── FrogHead.svg │ ├── Superstar.dataset │ │ └── Contents.json │ ├── PrintButton.dataset │ │ ├── Contents.json │ │ └── PrintButton.svg │ ├── ReloadButton.dataset │ │ ├── Contents.json │ │ └── ReloadButton.svg │ └── TextOnCurve.dataset │ │ ├── Contents.json │ │ └── TextOnCurve.svg ├── Cards.xcassets │ ├── Contents.json │ ├── Jack_Clubs.dataset │ │ ├── Contents.json │ │ └── Club_J.svg │ ├── King_Clubs.dataset │ │ ├── Contents.json │ │ └── Club_K.svg │ ├── Card_Back.dataset │ │ └── Contents.json │ ├── Card_Icon.dataset │ │ ├── Contents.json │ │ └── Q_Hearts.svg │ ├── Jack_Hearts.dataset │ │ ├── Contents.json │ │ └── Heart_J.svg │ ├── Jack_Spades.dataset │ │ ├── Contents.json │ │ └── Spade_J.svg │ ├── King_Hearts.dataset │ │ ├── Contents.json │ │ └── Heart_K.svg │ ├── King_Spades.dataset │ │ ├── Contents.json │ │ └── Spade_K.svg │ ├── Queen_Clubs.dataset │ │ ├── Contents.json │ │ └── Club_Q.svg │ ├── Queen_Hearts.dataset │ │ ├── Contents.json │ │ └── Heart_Q.svg │ ├── Queen_Spades.dataset │ │ ├── Contents.json │ │ └── Spade_Q.svg │ ├── Jack_Diamonds.dataset │ │ ├── Contents.json │ │ └── Diamond_J.svg │ ├── King_Diamonds.dataset │ │ ├── Contents.json │ │ └── Diamond_K.svg │ └── Queen_Diamonds.dataset │ │ ├── Contents.json │ │ └── Diamond_Q.svg ├── Artwork │ ├── EyesZipped.svgz │ ├── PrintButton.svg │ ├── Segment.svg │ ├── test.svg │ ├── ReloadButton.svg │ ├── Button.svg │ ├── Helmet.svg │ ├── Widgets.svg │ ├── Butterfly.svg │ ├── Frog.svg │ ├── TextOnCurve.svg │ └── Eye.svg ├── SVGgh Debugging App-Bridging-Header.h ├── SVGgh Debugging App.entitlements ├── SVGgh Debugging App-Prefix.pch ├── main.m ├── SVGgh Debugging App-Info.plist ├── Info.plist ├── SVGghDebuggingAppDelegate.h ├── SVGghDebuggingViewController.h ├── ButtonsDemoViewController.swift ├── SVGghDebuggingViewController.swift └── SegmentedDemoViewController.swift ├── Shared ├── Assets.xcassets │ ├── Contents.json │ ├── AccentColor.colorset │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── SVGgh_TesterApp.swift └── ContentView.swift ├── TestSVGgh ├── Assets.xcassets │ ├── Contents.json │ ├── AccentColor.colorset │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── TestSVGgh.entitlements ├── TestSVGghApp.swift └── ContentView.swift ├── SVGgh TV Debugging App ├── Assets.xcassets │ ├── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── SVGgh TV Debugging App-Bridging-Header.h ├── SVGghTVDebuggingAppDelegate.h ├── main.m ├── Info.plist └── SVGghTVDebuggingAppDelegate.m ├── SVGgh-Tester--macOS--Info.plist ├── SVGgh ├── SVGgh-Prefix.pch ├── SVG │ ├── CrossPlatformImage.m │ ├── CrossPlatformImage.h │ ├── GHPathDescription.h │ ├── GHTextLine.h │ ├── SVGGradientUtilities.h │ ├── SVGGradientUtilities.m │ ├── GHText.h │ ├── GHCSSStyle.h │ ├── GHAttributedObject.h │ └── GHCSSStyle.m ├── Info.plist ├── Third Party │ ├── GzipInputStream.h │ ├── NSData+IDZGunzip.h │ └── NSData+IDZGunzip.m ├── Utilities │ ├── SVGghLoader.h │ └── SVGghLoader.m ├── Views and Layers │ ├── SVGTabBarItem.h │ └── SVGRendererLayer.h ├── SVGgh.m ├── SVGRenderer │ ├── GHGradient.h │ ├── SVGPrinter.h │ ├── SVGtoPDFConverter.h │ └── SVGtoPDFConverter.m └── SVGgh.h ├── .gitignore ├── SVGghtv ├── SVGghtv.h └── Info.plist ├── SVGgh.podspec ├── SVGghtvTests ├── Info.plist └── SVGghtvTests.m ├── SVGgh Debugging AppTests ├── Info.plist ├── SVGgh_Debugging_AppTests.m └── DebugApp_UI_Tests.m ├── SVGgh copy-Info.plist ├── LICENSE ├── SVGgh+SwiftUI └── SVGView.swift └── SVGgh.xcodeproj └── xcshareddata └── xcschemes ├── SVGgh Mac.xcscheme └── SVGgh Tester (macOS).xcscheme /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/SVGgh: -------------------------------------------------------------------------------- 1 | Versions/Current/SVGgh -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /SVGghTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /SVGgh Debugging App/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Shared/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /TestSVGgh/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SVGgh TV Debugging App/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/EyesZipped.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Artwork/EyesZipped.svgz -------------------------------------------------------------------------------- /TestSVGgh/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SVGghTests/SVGghTests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/SVGgh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/SVGgh -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_29.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_40.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_58.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_76.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_80.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_87.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_120.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_152.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_167.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_180.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_58-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_58-1.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_80-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_80-1.png -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/EyesZipped.dataset/EyesZipped.svgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Artwork.xcassets/EyesZipped.dataset/EyesZipped.svgz -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_120-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GenerallyHelpfulSoftware/SVGgh/HEAD/SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Star_120-1.png -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SVGgh TV Debugging App/SVGgh TV Debugging App-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGgh Debugging App-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | 6 | #import "SVGghDebuggingViewController.h" 7 | -------------------------------------------------------------------------------- /SVGgh-Tester--macOS--Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Shared/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /TestSVGgh/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SVGgh/SVGgh-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Eye.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Eye.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Eyes.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Eyes.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Test.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "test.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Button.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Button.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Helmet.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Helmet.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Segment.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Segment.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Widgets.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Widgets.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Buttterfly.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Butterfly.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Creatures.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Creatures.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Frog.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "FrogHead.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Superstar.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "Superstar.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Clubs.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Club_J.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Clubs.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Club_K.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/EyesZipped.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode", 5 | "universal-type-identifier" : "public.zip-archive" 6 | }, 7 | "data" : [ 8 | { 9 | "idiom" : "universal", 10 | "filename" : "EyesZipped.svgz" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/PrintButton.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "PrintButton.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/ReloadButton.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "ReloadButton.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/TextOnCurve.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "data" : [ 7 | { 8 | "idiom" : "universal", 9 | "filename" : "TextOnCurve.svg", 10 | "universal-type-identifier" : "public.svg-image" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Card_Back.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Card_Back.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Card_Icon.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Q_Hearts.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Hearts.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Heart_J.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Spades.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Spade_J.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Hearts.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Heart_K.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Spades.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Spade_K.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Clubs.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Club_Q.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Hearts.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Heart_Q.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Spades.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Spade_Q.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Diamonds.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Diamond_J.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Diamonds.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Diamond_K.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Diamonds.dataset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "data" : [ 3 | { 4 | "filename" : "Diamond_Q.svg", 5 | "idiom" : "universal", 6 | "universal-type-identifier" : "public.svg-image" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/Top Shelf Image.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/Top Shelf Image Wide-2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/Top Shelf Image Wide.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TestSVGgh/TestSVGgh.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TestSVGgh/TestSVGghApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestSVGghApp.swift 3 | // TestSVGgh 4 | // 5 | // Created by Glenn Howes on 9/18/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @main 12 | struct TestSVGghApp: App { 13 | var body: some Scene { 14 | WindowGroup { 15 | ContentView() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Shared/SVGgh_TesterApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SVGgh_TesterApp.swift 3 | // Shared 4 | // 5 | // Created by Glenn Howes on 9/7/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @main 12 | struct SVGgh_TesterApp: App { 13 | var body: some Scene { 14 | WindowGroup { 15 | ContentView() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "tv", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "tv", 9 | "scale" : "2x" 10 | } 11 | ], 12 | "info" : { 13 | "author" : "xcode", 14 | "version" : 1 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/ExampleSVGghDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Example SVGgh 4 | // 5 | // Created by Glenn Howes on 1/29/14. 6 | // Copyright (c) 2014 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ExampleSVGghDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Large.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/App Icon - Small.imagestack/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "layers" : [ 3 | { 4 | "filename" : "Front.imagestacklayer" 5 | }, 6 | { 7 | "filename" : "Middle.imagestacklayer" 8 | }, 9 | { 10 | "filename" : "Back.imagestacklayer" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGgh Debugging App.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | com.apple.security.print 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SVGgh TV Debugging App/SVGghTVDebuggingAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghTVDebuggingAppDelegate.h 3 | // SVGgh TV Debugging App 4 | // 5 | // Created by Glenn Howes on 9/19/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SVGghTVDebuggingAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # osx 2 | .DS_Store 3 | Icon? 4 | *.swp 5 | 6 | # Thumbnails 7 | ._* 8 | 9 | # Files that might appear on external disk 10 | .Spotlight-V100 11 | .Trashes 12 | 13 | # Xcode 14 | build/* 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | *.xcworkspace 24 | !default.xcworkspace 25 | xcuserdata 26 | profile 27 | *.moved-aside 28 | build 29 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/Example SVGgh-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGgh Debugging App-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/ExampleSVGghViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Example SVGgh 4 | // 5 | // Created by Glenn Howes on 1/29/14. 6 | // Copyright (c) 2014 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | #import 10 | #include 11 | 12 | @interface ExampleSVGghViewController : UIViewController 13 | @property(nonatomic, weak) IBOutlet SVGDocumentView* svgView; 14 | -(IBAction)share:(id)sender; 15 | @end 16 | -------------------------------------------------------------------------------- /SVGgh TV Debugging App/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SVGgh TV Debugging App 4 | // 5 | // Created by Glenn Howes on 9/19/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "SVGghTVDebuggingAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SVGghTVDebuggingAppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Example SVGgh 4 | // 5 | // Created by Glenn Howes on 1/29/14. 6 | // Copyright (c) 2014 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "ExampleSVGghDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([ExampleSVGghDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Shared/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Shared 4 | // 5 | // Created by Glenn Howes on 9/7/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | Text("Hello, world!") 14 | .padding() 15 | } 16 | } 17 | 18 | struct ContentView_Previews: PreviewProvider { 19 | static var previews: some View { 20 | ContentView() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /TestSVGgh/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // TestSVGgh 4 | // 5 | // Created by Glenn Howes on 9/18/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | Text("Hello, world!") 14 | .padding() 15 | } 16 | } 17 | 18 | struct ContentView_Previews: PreviewProvider { 19 | static var previews: some View { 20 | ContentView() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SVGgh/SVG/CrossPlatformImage.m: -------------------------------------------------------------------------------- 1 | // 2 | // CrossPlatformImage.m 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 9/17/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CrossPlatformImage.h" 12 | 13 | @implementation GHImageWrapper 14 | -(instancetype) initWithCGImage:(CGImageARCRef)image 15 | { 16 | if(NULL != (self = [super init])) 17 | { 18 | self.cgImage = image; 19 | } 20 | return self; 21 | } 22 | @end 23 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/Artwork/ShareButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh Debugging App/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SVGgh Debugging App 4 | // 5 | // Created by Glenn Howes on 6/11/15. 6 | // Copyright (c) 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #if !__has_feature(modules) 10 | #import 11 | #else 12 | @import UIKit; 13 | #endif 14 | 15 | 16 | #import "SVGghDebuggingAppDelegate.h" 17 | 18 | int main(int argc, char * argv[]) { 19 | @autoreleasepool { 20 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SVGghDebuggingAppDelegate class])); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/PrintButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh TV Debugging App/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "tv", 6 | "minimum-system-version" : "11.0", 7 | "orientation" : "landscape", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "extent" : "full-screen", 12 | "idiom" : "tv", 13 | "minimum-system-version" : "9.0", 14 | "orientation" : "landscape", 15 | "scale" : "1x" 16 | } 17 | ], 18 | "info" : { 19 | "author" : "xcode", 20 | "version" : 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SVGghtv/SVGghtv.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghtv.h 3 | // SVGghtv 4 | // 5 | // Created by Glenn Howes on 9/19/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for SVGghtv. 12 | FOUNDATION_EXPORT double SVGghtvVersionNumber; 13 | 14 | //! Project version string for SVGghtv. 15 | FOUNDATION_EXPORT const unsigned char SVGghtvVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/PrintButton.dataset/PrintButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Segment.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/Artwork/MenuButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Segment.dataset/Segment.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/test.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Test.dataset/test.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/ReloadButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Button.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/ReloadButton.dataset/ReloadButton.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Button.dataset/Button.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Helmet.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Helmet.dataset/Helmet.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh/SVG/CrossPlatformImage.h: -------------------------------------------------------------------------------- 1 | // 2 | // CrossPlatformImage.h 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 9/17/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #ifndef CrossPlatformImage_h 10 | #define CrossPlatformImage_h 11 | 12 | #if defined(__has_feature) && __has_feature(modules) 13 | @import Foundation; 14 | @import QuartzCore; 15 | #else 16 | #import 17 | #endif 18 | 19 | NS_ASSUME_NONNULL_BEGIN 20 | typedef CGImageRef CGImageARCRef __attribute__((NSObject)); 21 | 22 | @interface GHImageWrapper : NSObject 23 | @property(nonatomic, retain) CGImageARCRef cgImage; 24 | -(instancetype) initWithCGImage:(CGImageARCRef)image; 25 | @end 26 | 27 | #endif /* CrossPlatformImage_h */ 28 | 29 | 30 | NS_ASSUME_NONNULL_END 31 | -------------------------------------------------------------------------------- /SVGgh.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = 'SVGgh' 4 | s.version = '1.12.1' 5 | s.license = 'MIT' 6 | s.tvos.deployment_target = '9.0' 7 | s.ios.deployment_target = '9.0' 8 | 9 | s.summary = "SVG Rendering Library for iOS" 10 | s.homepage = 'https://github.com/GenerallyHelpfulSoftware/SVGgh' 11 | s.author = { 'Glenn R. Howes' => 'glenn@genhelp.com' } 12 | s.source = { :git => 'https://github.com/GenerallyHelpfulSoftware/SVGgh.git', :tag => "v1.12.1" } 13 | 14 | s.ios.source_files = 'SVGgh/**/*{.h,m}' 15 | s.tvos.source_files = 'SVGgh/**/*{.h,m}' 16 | s.framework = 'CoreGraphics', 'CoreImage', 'CoreText', 'UIKit', 'Foundation', 'CoreServices' 17 | s.libraries = 'z' 18 | s.prefix_header_file = 'SVGgh/SVGgh-Prefix.pch' 19 | s.requires_arc = true 20 | 21 | end 22 | -------------------------------------------------------------------------------- /SVGghTests/SVGghTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.genhelp.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/Example SVGghTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /SVGghTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SVGghtvTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/Example_SVGghTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Example_SVGghTests.m 3 | // Example SVGghTests 4 | // 5 | // Created by Glenn Howes on 1/29/14. 6 | // Copyright (c) 2014 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Example_SVGghTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Example_SVGghTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /SVGgh Debugging App/TVAssets.xcassets/Brand Assets.brandassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets" : [ 3 | { 4 | "filename" : "App Icon - Large.imagestack", 5 | "idiom" : "tv", 6 | "role" : "primary-app-icon", 7 | "size" : "1280x768" 8 | }, 9 | { 10 | "filename" : "App Icon - Small.imagestack", 11 | "idiom" : "tv", 12 | "role" : "primary-app-icon", 13 | "size" : "400x240" 14 | }, 15 | { 16 | "filename" : "Top Shelf Image Wide-2.imageset", 17 | "idiom" : "tv", 18 | "role" : "top-shelf-image-wide", 19 | "size" : "2320x720" 20 | }, 21 | { 22 | "filename" : "Top Shelf Image.imageset", 23 | "idiom" : "tv", 24 | "role" : "top-shelf-image", 25 | "size" : "1920x720" 26 | } 27 | ], 28 | "info" : { 29 | "author" : "xcode", 30 | "version" : 1 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SVGgh Debugging AppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.genhelp.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Widgets.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SVGgh/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SVGgh copy-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SVGghtv/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Widgets.dataset/Widgets.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/Headers/AttributedObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // AttributedObject.h 3 | // Vectored 4 | // 5 | // Created by Glenn Howes on 2/3/13. 6 | // Copyright (c) 2013 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @interface AttributedObject : NSObject 13 | @property (strong, nonatomic, readonly) NSDictionary* attributes; 14 | 15 | -(id) initWithDictionary:(NSDictionary*)theAttributes; 16 | -(id) initWithAttributes:(NSDictionary*)theAttributes; 17 | 18 | 19 | -(NSUInteger)calculatedHash; // attributed objects are immutable, I can calculate their hash once and be done with it. 20 | @end 21 | 22 | 23 | 24 | 25 | extern NSString* const kAttributesElementName; 26 | extern NSString* const kContentsElementName; 27 | extern NSString* const kElementName; 28 | extern NSString* const kElementText; 29 | extern NSString* const kElementData; 30 | extern NSString* const kLengthIntoParentsContents; 31 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Butterfly.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Card_Icon.dataset/Q_Hearts.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Buttterfly.dataset/Butterfly.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /SVGghTests/CSSTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSSTests.m 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 3/19/16. 6 | // Copyright © 2016 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CSSTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation CSSTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /SVGgh/Third Party/GzipInputStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // GzipInputStream.h 3 | // 4 | // Copyright 2012 Eric U Kong Wong 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | @interface GzipInputStream : NSInputStream 22 | 23 | /** You must use GzipInputStream only with a file 24 | 25 | @see `-initWithFileAtPath:` */ 26 | - (id)initWithData:(NSData *)data NS_UNAVAILABLE; 27 | 28 | - (NSString *)readLine; 29 | - (NSData *)readData:(NSUInteger)bufferSize; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /SVGghtvTests/SVGghtvTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghtvTests.m 3 | // SVGghtvTests 4 | // 5 | // Created by Glenn Howes on 9/19/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SVGghtvTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation SVGghtvTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /SVGgh Debugging AppTests/SVGgh_Debugging_AppTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGgh_Debugging_AppTests.m 3 | // SVGgh Debugging AppTests 4 | // 5 | // Created by Glenn Howes on 6/11/15. 6 | // Copyright (c) 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface SVGgh_Debugging_AppTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation SVGgh_Debugging_AppTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Generally Helpful Software 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /SVGgh TV Debugging App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIcons 10 | 11 | CFBundleIcons~ipad 12 | 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1 27 | LSRequiresIPhoneOS 28 | 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | arm64 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /TestSVGgh/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SVGgh Debugging AppTests/DebugApp_UI_Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DebugApp_UI_Tests.m 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 9/4/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DebugApp_UI_Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DebugApp_UI_Tests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | } 27 | 28 | - (void)tearDown { 29 | // Put teardown code here. This method is called after the invocation of each test method in the class. 30 | [super tearDown]; 31 | } 32 | 33 | - (void)testExample { 34 | // Use recording to get started writing UI tests. 35 | // Use XCTAssert and related functions to verify your tests produce the correct results. 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Frog.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Frog.dataset/FrogHead.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SVGgh/Utilities/SVGghLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghLoader.h 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 4/27/16. 6 | // Copyright © 2016 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import 10 | NS_ASSUME_NONNULL_BEGIN 11 | @class SVGRenderer; 12 | 13 | @protocol SVGghLoader 14 | /*! @brief method to retrieve an SVGRenderer 15 | * @param identifier (a subPath or an XCAsset name for instance 16 | * @param bundle usually nil 17 | * @return an SVGRender if one can be found 18 | */ 19 | -(nullable SVGRenderer*) loadRenderForSVGIdentifier:(NSString*)identifier inBundle:(nullable NSBundle*)bundle; 20 | @end 21 | 22 | typedef NS_ENUM(NSInteger, SVGghLoaderType) 23 | { 24 | SVGghLoaderTypeDefault, 25 | SVGghLoaderTypePath, 26 | SVGghLoaderTypeDataXCAsset // only available on iOS 9 or above 27 | }; 28 | 29 | 30 | @interface SVGghLoaderManager: NSObject 31 | /*! @brief method to retrieve the loader used by the UI elements 32 | * @return the loader 33 | */ 34 | +(id) loader; 35 | 36 | 37 | /*! @brief method to retrieve an SVGRenderer 38 | * @param loader the loader to use by the widget classes. 39 | */ 40 | +(void) setLoader:(nullable id)loader; // call only once, passing null will return to th 41 | 42 | +(void) setLoaderToType:(SVGghLoaderType)type; 43 | 44 | @end 45 | 46 | 47 | NS_ASSUME_NONNULL_END -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/Example SVGgh-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGgh Debugging App-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.genhelp.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /SVGgh/Third Party/NSData+IDZGunzip.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+IDZGunzip.h 3 | // 4 | // Copyright (c) 2013 iOSDeveloperZone.com 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | #import 25 | 26 | extern NSString* const IDZGunzipErrorDomain; 27 | 28 | @interface NSData (IDZGunzip) 29 | 30 | - (NSData*)gunzip:(NSError**)error; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /SVGgh/Views and Layers/SVGTabBarItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGTabBarItem.h 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 7/9/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #if defined(__has_feature) && __has_feature(modules) 10 | @import Foundation; 11 | @import UIKit; 12 | #else 13 | #import 14 | #import 15 | #endif 16 | 17 | 18 | NS_ASSUME_NONNULL_BEGIN 19 | 20 | @interface SVGTabBarItem : UITabBarItem 21 | /*! @property artworkPath 22 | * @brief optional subpath to an svg file inside the resources folder, svg is displayed inside the button at appropriate size 23 | * @attention do not append '.svg' 24 | */ 25 | @property(nonatomic, copy) IBInspectable NSString* artworkPath; 26 | /*! @property selectedArtworkPath 27 | * @brief optional subpath to an svg file inside the resources folder, svg is displayed inside the button at appropriate size. When button is in selected state. 28 | * @attention do not append '.svg' 29 | */ 30 | @property(nonatomic, strong) IBInspectable NSString* __nullable selectedArtworkPath; 31 | /*! @property baseColor 32 | * @brief currentColor used when the tab is not selected 33 | */ 34 | @property(nonatomic, strong) IBInspectable UIColor* __nullable baseColor; 35 | /*! @property baseColor 36 | * @brief currentColor used when the tab is selected 37 | */ 38 | @property(nonatomic, strong) IBInspectable UIColor* __nullable selectedColor; 39 | 40 | 41 | +(void)makeSureLoaded; 42 | @end 43 | 44 | 45 | NS_ASSUME_NONNULL_END 46 | -------------------------------------------------------------------------------- /SVGgh/SVGgh.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGgh.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import "SVGgh.h" 28 | 29 | void MakeSureSVGghLinks() 30 | { 31 | #if TARGET_OS_OSX 32 | #else 33 | [SVGDocumentView makeSureLoaded]; 34 | [GHButton makeSureLoaded]; 35 | [GHSegmentedControl makeSureLoaded]; 36 | [SVGTabBarItem makeSureLoaded]; 37 | #endif 38 | } 39 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/Headers/SVGgh.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGgh.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import 27 | 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import -------------------------------------------------------------------------------- /SVGgh Debugging App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SVGgh+SwiftUI/SVGView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SVGView.swift 3 | // SVGgh Debugging App 4 | // 5 | // Created by Glenn Howes on 9/20/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import SVGgh 11 | import os.log 12 | 13 | @available(iOS 14.0.0, *) 14 | struct SVGView: UIViewRepresentable, Identifiable { 15 | var id: String 16 | 17 | private var svgView : SVGDocumentView 18 | @State var currentColor : Color? 19 | 20 | init(resourceName : String, bundle : Bundle? = nil) 21 | { 22 | self.id = resourceName 23 | self.svgView = SVGDocumentView() 24 | let renderer = SVGRenderer(dataAssetNamed: resourceName, with: bundle) 25 | if(renderer == nil) 26 | { 27 | os_log("No SVG resource named %@", type: .debug, resourceName) 28 | } 29 | self.svgView.renderer = renderer 30 | self.svgView.backgroundColor = UIColor.clear 31 | self.svgView.contentMode = .scaleAspectFit 32 | } 33 | 34 | func makeUIView(context: Context) -> SVGDocumentView { 35 | let result = self.svgView 36 | 37 | return result 38 | } 39 | 40 | func updateUIView(_ uiView: SVGDocumentView, context: Context) { 41 | 42 | } 43 | 44 | typealias UIViewType = SVGDocumentView 45 | 46 | public func currentColor(_ currentColor : Color) -> SVGView 47 | { 48 | self.svgView.defaultColor = UIColor(currentColor) 49 | return self 50 | } 51 | 52 | } 53 | 54 | @available(iOS 14.0.0, *) 55 | struct SVGView_Previews: PreviewProvider { 56 | static var previews: some View { 57 | SVGView(resourceName: "Eyes", bundle: nil) 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGghDebuggingAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghDebuggingAppDelegate.h 3 | // SVGgh Debugging App 4 | // 5 | // Created by Glenn Howes on 1/30/14. 6 | 7 | // The MIT License (MIT) 8 | 9 | // Copyright (c) 2011-2014 Glenn R. Howes 10 | 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to deal 13 | // in the Software without restriction, including without limitation the rights 14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | // copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | // THE SOFTWARE. 28 | 29 | 30 | #if defined(__has_feature) && __has_feature(modules) 31 | @import Foundation; 32 | @import UIKit; 33 | #else 34 | #import 35 | #import 36 | #endif 37 | 38 | @interface SVGghDebuggingAppDelegate : UIResponder 39 | 40 | @property (strong, nonatomic) UIWindow *window; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGghDebuggingViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghDebuggingViewController.h 3 | // SVGgh Debugging App 4 | // 5 | // Created by Glenn Howes on 1/30/14. 6 | // The MIT License (MIT) 7 | 8 | // Copyright (c) 2011-2014 Glenn R. Howes 9 | 10 | // Permission is hereby granted, free of charge, to any person obtaining a copy 11 | // of this software and associated documentation files (the "Software"), to deal 12 | // in the Software without restriction, including without limitation the rights 13 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | // copies of the Software, and to permit persons to whom the Software is 15 | // furnished to do so, subject to the following conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be included in 18 | // all copies or substantial portions of the Software. 19 | 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | // THE SOFTWARE. 27 | 28 | 29 | #if defined(__has_feature) && __has_feature(modules) 30 | @import Foundation; 31 | @import UIKit; 32 | #else 33 | #import 34 | #import 35 | #endif 36 | 37 | @class SVGDocumentView; 38 | @interface SVGghDebuggingViewController : UIViewController 39 | @property(nonatomic, weak) IBOutlet SVGDocumentView* svgView; 40 | -(IBAction)redrawSVG:(id)sender; 41 | -(IBAction)print:(id)sender; 42 | @end 43 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/Headers/GHPathDescription.h: -------------------------------------------------------------------------------- 1 | // 2 | // PathDescription.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | // 28 | // Created by Glenn Howes on 2/4/13. 29 | // 30 | 31 | #import 32 | #import 33 | 34 | /*! @brief a protocol for objects able to provide style information for strokes and fills 35 | */ 36 | @protocol GHPathDescription 37 | @property(nonatomic, readonly) NSString* fillDescription; 38 | @property(nonatomic, readonly) NSString* strokeDescription; 39 | @property(nonatomic, readonly) CGFloat strokeWidth; 40 | @end 41 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Hearts.dataset/Heart_K.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | K 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Diamonds.dataset/Diamond_K.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | K 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Spades.dataset/Spade_K.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | K 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Clubs.dataset/Club_Q.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Q 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/TextOnCurve.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | W––– 18 | 19 | 20 | 21 | 22 | G 23 | ⊥––⊥ 24 | 25 | 26 | 27 | Wavy text oscilating up and down, and then back up. Relaxing really. But it all has to end. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Hearts.dataset/Heart_J.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | J 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Hearts.dataset/Heart_Q.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Q 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Spades.dataset/Spade_Q.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | Q 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SVGgh/SVG/GHPathDescription.h: -------------------------------------------------------------------------------- 1 | // 2 | // PathDescription.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | // 28 | // Created by Glenn Howes on 2/4/13. 29 | // 30 | 31 | 32 | #if defined(__has_feature) && __has_feature(modules) 33 | @import Foundation; 34 | @import CoreGraphics; 35 | #else 36 | #import 37 | #import 38 | #endif 39 | 40 | NS_ASSUME_NONNULL_BEGIN 41 | 42 | /*! @brief a protocol for objects able to provide style information for strokes and fills 43 | */ 44 | @protocol GHPathDescription 45 | @property(nonatomic, readonly) NSString* __nullable fillDescription; 46 | @property(nonatomic, readonly) NSString* __nullable strokeDescription; 47 | @property(nonatomic, readonly) CGFloat strokeWidth; 48 | @end 49 | 50 | 51 | NS_ASSUME_NONNULL_END 52 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Queen_Diamonds.dataset/Diamond_Q.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Q 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Clubs.dataset/Club_J.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | J 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Diamonds.dataset/Diamond_J.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | J 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/King_Clubs.dataset/Club_K.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | K 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Cards.xcassets/Jack_Spades.dataset/Spade_J.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | J 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/TextOnCurve.dataset/TextOnCurve.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | W––– 18 | 19 | 20 | 21 | 22 | G 23 | ⊥––⊥ 24 | 25 | 26 | 27 | Wavy text oscilating up and down, and then back up. Relaxing really. But it all has to end. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/Headers/GHAttributedObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // AttributedObject.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // Created by Glenn Howes on 2/3/13. 26 | 27 | 28 | #import 29 | 30 | /*! @brief basically just a wrapper around an NSDictionary. A convenient object when generating from XML 31 | */ 32 | @interface GHAttributedObject : NSObject 33 | @property (strong, nonatomic, readonly) NSDictionary* attributes; 34 | 35 | -(id) initWithDictionary:(NSDictionary*)theAttributes; 36 | -(id) initWithAttributes:(NSDictionary*)theAttributes; 37 | 38 | 39 | -(NSUInteger)calculatedHash; // attributed objects are immutable, I can calculate their hash once and be done with it. 40 | @end 41 | 42 | // useful in parsing XML 43 | extern NSString* const kAttributesElementName; 44 | extern NSString* const kContentsElementName; 45 | extern NSString* const kElementName; 46 | extern NSString* const kElementText; 47 | extern NSString* const kElementData; 48 | extern NSString* const kLengthIntoParentsContents; 49 | -------------------------------------------------------------------------------- /SVGgh/SVG/GHTextLine.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHTextLine.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // Created by Glenn Howes on 2/6/13. 27 | 28 | 29 | #if defined(__has_feature) && __has_feature(modules) 30 | @import Foundation; 31 | @import CoreText; 32 | #else 33 | #import 34 | #import 35 | #endif 36 | 37 | #import "GHAttributedObject.h" 38 | #import "GHPathDescription.h" 39 | #import "GHGlyph.h" 40 | 41 | NS_ASSUME_NONNULL_BEGIN 42 | 43 | /*! @brief manifestation of an SVG 'tspan' entity a collection of other entities 44 | */ 45 | @interface GHTextLine : GHAttributedObject 46 | /*! @brief init method that takes a a CTLineRef 47 | */ 48 | -(instancetype) initWithAttributes:(NSDictionary *)theAttributes andTextLine:(CTLineRef)lineRef; 49 | 50 | 51 | /*! @brief return a tight bounding box for the object's content 52 | * @param svgContext state information about the document environment 53 | */ 54 | -(CGRect) getBoundingBoxWithSVGContext:(id)svgContext; 55 | @end 56 | 57 | NS_ASSUME_NONNULL_END 58 | -------------------------------------------------------------------------------- /SVGgh/SVG/SVGGradientUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGGradientUtilities.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // Created by Glenn Howes on 2/11/13. 27 | // 28 | 29 | #if defined(__has_feature) && __has_feature(modules) 30 | @import Foundation; 31 | @import CoreGraphics; 32 | #else 33 | #import 34 | #import 35 | #endif 36 | 37 | NS_ASSUME_NONNULL_BEGIN 38 | 39 | /*! @brief a couple of methods of general use 40 | */ 41 | @interface SVGGradientUtilities : NSObject 42 | /*! @brief no need to keep reallocating the color space 43 | */ 44 | +(CGColorSpaceRef) colorSpace; 45 | 46 | /*! @brief a method to extract an individual fraction from a gradient entity definition 47 | * @param svgFractionOrPercentage the kind of fraction found in the 'cx', 'cy', etc attributes of a SVG gradient 48 | * @param defaultValue if the attribute wasn't set 49 | * @return the fraction used to define the gradient parameter 50 | */ 51 | +(CGFloat) extractFractionFromCoordinateString:(NSString*)svgFractionOrPercentage givenDefault:(CGFloat)defaultValue; 52 | @end 53 | 54 | NS_ASSUME_NONNULL_END 55 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/Headers/SVGRenderer.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGRenderer.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // Created by Glenn Howes on 1/12/11. 27 | 28 | #import 29 | #import "SVGParser.h" 30 | #import "GHRenderable.h" 31 | 32 | /*! @brief a class capable of rendering itself into a core graphics context 33 | */ 34 | @interface SVGRenderer : SVGParser 35 | /*! @property viewRect 36 | * @brief the intrinsic rect declared in the SVG document being rendered 37 | */ 38 | @property (nonatomic, readonly) CGRect viewRect; 39 | 40 | /*! @brief draw the SVG 41 | * @param quartzContext context into which to draw, cold be a CALayer, a PDF, an offscreen bitmap, whatever 42 | */ 43 | -(void)renderIntoContext:(CGContextRef)quartzContext; 44 | 45 | /*! @brief try to locate an object that's been tapped 46 | * @param testPoint a point in the coordinate system of this renderer 47 | * @return an object which implements the GHRenderable protocol 48 | */ 49 | -(id) findRenderableObject:(CGPoint)testPoint; 50 | 51 | @end 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /SVGgh/SVG/SVGGradientUtilities.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGGradientUtilities.m 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | // Created by Glenn Howes on 2/11/13. 28 | // 29 | 30 | #import "SVGGradientUtilities.h" 31 | 32 | @implementation SVGGradientUtilities 33 | +(CGColorSpaceRef) colorSpace 34 | { 35 | static CGColorSpaceRef sResult = 0; 36 | static dispatch_once_t done; 37 | dispatch_once(&done, ^{ 38 | sResult = CGColorSpaceCreateDeviceRGB(); 39 | }); 40 | 41 | 42 | return sResult; 43 | } 44 | 45 | +(CGFloat) extractFractionFromCoordinateString:(NSString*)svgFractionOrPercentage givenDefault:(CGFloat)defaultValue 46 | { 47 | CGFloat result =defaultValue; 48 | if([svgFractionOrPercentage hasSuffix:@"%"] || [svgFractionOrPercentage length] == 0) 49 | { 50 | if([svgFractionOrPercentage length] >= 2) 51 | { 52 | result = [[svgFractionOrPercentage substringToIndex:[svgFractionOrPercentage length]-1] floatValue]/100.0f; 53 | } 54 | } 55 | else 56 | { 57 | result = [svgFractionOrPercentage floatValue]; 58 | } 59 | return result; 60 | } 61 | @end 62 | -------------------------------------------------------------------------------- /SVGgh/SVGRenderer/GHGradient.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHGradient.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2012-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "SVGAttributedObject.h" 28 | 29 | NS_ASSUME_NONNULL_BEGIN 30 | 31 | /*! @brief An abstract implementation of a GHFill that will add gradients to a properly setup Core Graphics Context 32 | */ 33 | @interface GHGradient : GHFill 34 | /*! @brief Given a Core Graphics context which has a non-empty path set up, fill it with a gradient. 35 | * @param quartzContext Core Graphics context to draw into 36 | * @param svgContext a context capable of providing additional information 37 | * @param objectBox This is needed to know the extent of the object being filled. 38 | */ 39 | -(void) fillPathToContext:(CGContextRef)quartzContext withSVGContext:(id)svgContext objectBoundingBox:(CGRect) objectBox; 40 | @end 41 | 42 | /*! @brief GHGradient concrete class that uses CGContextDrawLinearGradient 43 | */ 44 | @interface GHLinearGradient : GHGradient 45 | @end 46 | 47 | /*! @brief GHGradient concrete class that calls CGContextDrawRadialGradient 48 | */ 49 | @interface GHRadialGradient : GHGradient 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | -------------------------------------------------------------------------------- /SVGgh/SVGRenderer/SVGPrinter.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGRenderer+Printing.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // Created by Glenn Howes on 2/4/14. 26 | // 27 | 28 | #if defined(__has_feature) && __has_feature(modules) 29 | @import Foundation; 30 | @import UIKit; 31 | #else 32 | #import 33 | #import 34 | #endif 35 | 36 | @class SVGRenderer; 37 | 38 | typedef enum PrintingResults 39 | { 40 | kSuccessfulPrintingResult = 0, 41 | kCouldntCreatePrintingDataResult, 42 | kCouldntInterfaceWithPrinterResult, 43 | kPrintingErrorResult 44 | }PrintingResults; 45 | 46 | typedef void(^printingCallback_t)(NSError* __nullable error, PrintingResults printingResult); 47 | 48 | NS_ASSUME_NONNULL_BEGIN 49 | 50 | @interface SVGPrinter :NSObject 51 | +(void) printRenderer:(SVGRenderer*)renderer withJobName:(NSString*)jobName withCallback:(printingCallback_t)callback; 52 | 53 | #if TARGET_OS_OSX 54 | 55 | #else 56 | +(void) printRenderer:(SVGRenderer*)renderer withJobName:(NSString*)jobName fromAnchorView:(nullable UIView*)anchorView withCallback:(printingCallback_t)callback; 57 | #endif 58 | @end 59 | 60 | NS_ASSUME_NONNULL_END 61 | -------------------------------------------------------------------------------- /SVGgh/SVGgh.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGgh.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #if defined(__has_feature) && __has_feature(modules) 28 | @import Foundation; 29 | #else 30 | #import 31 | #endif 32 | 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | #import 39 | #import 40 | #import 41 | #if TARGET_OS_OSX 42 | #else 43 | #import 44 | #import 45 | #import 46 | #import 47 | #import 48 | #import 49 | #endif 50 | #import 51 | #import // not yet implemented, somebody want to implement a CSS parser? 52 | 53 | /*! \brief Because views and buttons are dynamically instantiated from Storyboards and Nibs, code for their classes might not link in from a static library. Thus this method to make sure the class gets called at least once from code. 54 | */ 55 | void MakeSureSVGghLinks(void); 56 | -------------------------------------------------------------------------------- /SVGgh/SVG/GHText.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHText.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // Created by Glenn Howes on 5/19/11. 27 | 28 | 29 | #if defined(__has_feature) && __has_feature(modules) 30 | @import Foundation; 31 | @import CoreText; 32 | #else 33 | #import 34 | #import 35 | #endif 36 | 37 | #import "SVGAttributedObject.h" 38 | #import "GHPathDescription.h" 39 | 40 | 41 | NS_ASSUME_NONNULL_BEGIN 42 | 43 | /*! @brief manifestation of an SVG 'text' entity a collection of other entities 44 | */ 45 | @interface GHText : GHRenderableObject 46 | /*! @brief convert the text to an array of positioned GHGlyphs 47 | * @see GHGlyph 48 | * @param glyphList list to Fill with glyphs 49 | * @param svgContext state information to give context to how this object behaves 50 | */ 51 | -(void)addGlyphsToArray:(NSMutableArray*)glyphList withSVGContext:(id)svgContext; 52 | @end 53 | 54 | /*! @brief manifestation of an SVG 'textArea' entity a collection of other entities 55 | */ 56 | @interface GHTextArea : GHText 57 | @property(nonatomic, readonly) NSAttributedString* __nullable text; 58 | @end 59 | 60 | NS_ASSUME_NONNULL_END 61 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/ExampleSVGghViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Example SVGgh 4 | // 5 | // Created by Glenn Howes on 1/29/14. 6 | // Copyright (c) 2014 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | #import "ExampleSVGghViewController.h" 10 | #import 11 | 12 | @interface ExampleSVGghViewController () 13 | 14 | @end 15 | 16 | @implementation ExampleSVGghViewController 17 | 18 | -(IBAction)share:(id)sender 19 | { 20 | [SVGtoPDFConverter createPDFFromRenderer:self.svgView.renderer intoCallback:^(NSData *pdfData) { 21 | if(pdfData.length) 22 | { 23 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ 24 | 25 | NSString* shareText = NSLocalizedString(@"Sharing a PDF as an example", @""); 26 | __block NSArray* itemsToShare = [[NSArray alloc] initWithObjects:shareText, pdfData, nil]; 27 | NSArray* excludedTypes = [[NSArray alloc] initWithObjects:UIActivityTypeAssignToContact, UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypeSaveToCameraRoll, UIActivityTypePostToWeibo, nil]; 28 | if([UIDevice currentDevice].systemVersion.doubleValue >= 7) 29 | { 30 | excludedTypes = [excludedTypes arrayByAddingObject:UIActivityTypeAddToReadingList]; 31 | excludedTypes = [excludedTypes arrayByAddingObject:UIActivityTypePostToFlickr]; 32 | excludedTypes = [excludedTypes arrayByAddingObject:UIActivityTypePostToVimeo]; 33 | } 34 | 35 | UIActivityViewController* activityView = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil]; 36 | activityView.excludedActivityTypes =excludedTypes; 37 | [self presentViewController:activityView animated:YES completion:nil]; 38 | 39 | } 40 | ]; 41 | } 42 | else 43 | { 44 | NSLog(@"Expected a PDF to be made"); 45 | } 46 | }]; 47 | } 48 | - (void)viewDidLoad 49 | { 50 | [super viewDidLoad]; 51 | // Do any additional setup after loading the view, typically from a nib. 52 | } 53 | 54 | - (void)didReceiveMemoryWarning 55 | { 56 | [super didReceiveMemoryWarning]; 57 | // Dispose of any resources that can be recreated. 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /SVGgh Debugging App/ButtonsDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonsDemoViewController.swift 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 4/23/16. 6 | // Copyright © 2016 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SVGgh 11 | 12 | class ButtonCell: UICollectionViewCell 13 | { 14 | @IBOutlet var button : GHButton! 15 | 16 | var colorScheme: ColorScheme? 17 | { 18 | didSet 19 | { 20 | guard let scheme = self.colorScheme else 21 | { 22 | return 23 | } 24 | self.button.schemeNumber = Int(scheme) 25 | } 26 | } 27 | } 28 | 29 | 30 | 31 | class ButtonsDemoViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { 32 | 33 | override func viewDidLoad() { 34 | super.viewDidLoad() 35 | 36 | // Do any additional setup after loading the view. 37 | } 38 | 39 | override func didReceiveMemoryWarning() { 40 | super.didReceiveMemoryWarning() 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | @IBOutlet var collectionView: UICollectionView! 45 | { 46 | didSet 47 | { 48 | collectionView.dataSource = self 49 | collectionView.delegate = self 50 | collectionView.reloadData() 51 | } 52 | } 53 | 54 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 55 | 56 | return kLastColorScheme 57 | } 58 | 59 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 60 | let result = collectionView.dequeueReusableCell(withReuseIdentifier: "ButtonCell", for: indexPath as IndexPath) as! ButtonCell 61 | result.colorScheme = ColorScheme(indexPath.item) 62 | return result 63 | } 64 | 65 | 66 | 67 | @objc func collectionView(_ collectionView: UICollectionView, 68 | layout collectionViewLayout: UICollectionViewLayout, 69 | sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize 70 | { 71 | let baseSize = CGFloat(floor(fmin(self.view.bounds.width, self.view.bounds.height)/5.0)) 72 | return CGSize(width: baseSize, height: baseSize) 73 | } 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGgh/ExampleSVGghDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Example SVGgh 4 | // 5 | // Created by Glenn Howes on 1/29/14. 6 | // Copyright (c) 2014 Generally Helpful Software. All rights reserved. 7 | // 8 | 9 | #import "ExampleSVGghDelegate.h" 10 | #import 11 | 12 | @implementation ExampleSVGghDelegate 13 | 14 | +(void) initialize 15 | { 16 | [super initialize]; 17 | MakeSureSVGghLinks(); 18 | [GHControlFactory setDefaultScheme:kColorSchemeMachine]; 19 | 20 | } 21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 22 | { 23 | // Override point for customization after application launch. 24 | return YES; 25 | } 26 | 27 | - (void)applicationWillResignActive:(UIApplication *)application 28 | { 29 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 30 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 31 | } 32 | 33 | - (void)applicationDidEnterBackground:(UIApplication *)application 34 | { 35 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 36 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 37 | } 38 | 39 | - (void)applicationWillEnterForeground:(UIApplication *)application 40 | { 41 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 42 | } 43 | 44 | - (void)applicationDidBecomeActive:(UIApplication *)application 45 | { 46 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 47 | } 48 | 49 | - (void)applicationWillTerminate:(UIApplication *)application 50 | { 51 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /SVGgh/SVG/GHCSSStyle.h: -------------------------------------------------------------------------------- 1 | // 2 | // GHCSSStyle.h 3 | // SVGgh 4 | // 5 | // The MIT License (MIT) 6 | 7 | // Copyright (c) 2016 Glenn R. Howes 8 | 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | // 28 | // Created by Glenn Howes on 3/19/16. 29 | 30 | #import 31 | 32 | NS_ASSUME_NONNULL_BEGIN 33 | 34 | typedef enum StyleElementType 35 | { 36 | kStyleTypeUnsupported, 37 | kStyleTypeCSS // text/css 38 | }StyleElementType; 39 | 40 | typedef NS_OPTIONS(NSUInteger, CSSPseudoClassFlags) { 41 | kPseudoClassNone = 0, 42 | kPseudoClassActive = (1 << 0), 43 | kPseudoClassFocused = (1 << 1), 44 | kPseudoClassHovering = (1 << 2) 45 | }; 46 | 47 | @interface GHCSSStyle : NSObject 48 | @property(nonatomic, readonly) NSString* cssClass; 49 | @property(nonatomic, readonly) CSSPseudoClassFlags pseudoClassFlags; 50 | @property(nonatomic, readonly) NSDictionary* __nullable attributes; 51 | @property(nonatomic, readonly) NSDictionary* __nullable subClasses; 52 | 53 | 54 | +(NSDictionary*) stylesForString:(NSString*)css; 55 | +( NSString* _Nullable ) attributeNamed:(NSString*)attributeName classes:(nullable NSArray*)listOfClasses entityName:(nullable NSString*)entityName pseudoClass:(CSSPseudoClassFlags)pseudoClassFlags forStyles:(NSDictionary*) cssStyles; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /SVGgh/SVGRenderer/SVGtoPDFConverter.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGRenderer+PDF.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // Created by Glenn Howes on 2/4/14. 26 | // 27 | #if defined(__has_feature) && __has_feature(modules) 28 | @import Foundation; 29 | @import CoreGraphics; 30 | #else 31 | #import 32 | #import 33 | #endif 34 | 35 | @class SVGRenderer; 36 | 37 | NS_ASSUME_NONNULL_BEGIN 38 | 39 | typedef void(^renderPDFCallback_t)(NSData* __nullable pdfData); 40 | 41 | 42 | 43 | @interface SVGtoPDFConverter : NSObject 44 | /*! @brief call to create a PDF, does so on another queue 45 | * @param aRenderer a configured renderer 46 | * @param callback the block to get called when done 47 | * @attention will callback on another queue may return nil pdfData 48 | */ 49 | +(void) createPDFFromRenderer:(SVGRenderer*)aRenderer intoCallback:(renderPDFCallback_t)callback; 50 | @end 51 | 52 | /*! \brief utility method to create a PDF context 53 | * \param mediaRect the resulting PDFs boundary (zero origin preferred) 54 | * \param theData an allocated but empty block of data which will be filled with the PDF 55 | * \return a Core Graphics context. Caller responsible for disposal. 56 | */ 57 | __nullable CGContextRef CreatePDFContext(const CGRect mediaRect, CFMutableDataRef theData); 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /SVGghTests/CGPath+Iterate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CGPath+Iterate.swift 3 | // Scalar2D 4 | // 5 | // Created by Glenn Howes on 8/13/16. 6 | // Copyright © 2016 Generally Helpful Software. All rights reserved. 7 | // 8 | // based upon tutorial found at http://oleb.net/blog/2015/06/c-callbacks-in-swift/ 9 | // 10 | // The MIT License (MIT) 11 | 12 | // Copyright (c) 2016 Glenn R. Howes 13 | 14 | // Permission is hereby granted, free of charge, to any person obtaining a copy 15 | // of this software and associated documentation files (the "Software"), to deal 16 | // in the Software without restriction, including without limitation the rights 17 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | // copies of the Software, and to permit persons to whom the Software is 19 | // furnished to do so, subject to the following conditions: 20 | // 21 | // The above copyright notice and this permission notice shall be included in 22 | // all copies or substantial portions of the Software. 23 | 24 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | // THE SOFTWARE. 31 | // 32 | // 33 | 34 | import Foundation 35 | import CoreGraphics 36 | 37 | extension CGPath 38 | { 39 | /** 40 | Declaration of the closure type which will be called with the elements of a CGPath. 41 | **/ 42 | public typealias ElementIterator = (_ element: CGPathElement)->Void 43 | 44 | /** 45 | 46 | A function that delivers the contents of the CGPath to a provided closure one element at a time. 47 | See the apply or CGPathApply function for details. 48 | - parameters: 49 | - callback: a closure that takes a CGPathElemnt as the sole parameter. 50 | **/ 51 | public func iterate( _ callback: @escaping ElementIterator) 52 | { 53 | var localCallback = callback 54 | 55 | withUnsafeMutablePointer(to: &localCallback) 56 | { callbackPtr in 57 | self.apply(info: callbackPtr) 58 | { 59 | (userInfo, pathElement) in 60 | let callback = userInfo?.assumingMemoryBound(to: ElementIterator.self).pointee 61 | callback?(pathElement.pointee) 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /SVGghTests/SVGPathTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SVGPathTests.swift 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 8/14/16. 6 | // Copyright © 2016 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import SVGgh 11 | 12 | class SVGPathTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testArcs() { 25 | 26 | guard let cgPath = SVGPathGenerator.newCGPath(fromSVGPath: "M0 0 a 10 20 30 0 0 10 10 a 20 20 0 0 1 10 10 a 30 30 0 1 1 25 25 a 40 40 0 1 0 20 20", whileApplying: CGAffineTransform.identity) else 27 | { 28 | XCTFail("Arc not created") 29 | return 30 | } 31 | 32 | let asString = cgPath.asString() 33 | XCTAssert(!asString.isEmpty) 34 | XCTAssertEqual(asString, "M (0.00, 0.00)\nL (-0.00, 0.00)\nC (-1.26, 8.86, 3.14, 13.26, 10.00, 10.00)\nL (10.00, 10.00)\nC (14.44, 12.00, 18.00, 15.56, 20.00, 20.00)\nL (20.00, 20.00)\nC (17.44, 3.63, 28.63, -11.72, 45.00, -14.28)\nC (61.37, -16.84, 76.72, -5.65, 79.28, 10.72)\nC (81.84, 27.09, 70.65, 42.44, 54.28, 45.00)\nC (51.20, 45.48, 48.07, 45.48, 45.00, 45.00)\nL (45.00, 45.00)\nC (24.87, 35.91, 1.17, 44.87, -7.92, 65.00)\nC (-17.00, 85.13, -8.05, 108.83, 12.08, 117.92)\nC (32.22, 127.00, 55.91, 118.05, 65.00, 97.92)\nC (69.72, 87.45, 69.72, 75.46, 65.00, 65.00)\n") 35 | 36 | } 37 | 38 | func testFrog() { 39 | 40 | guard let cgPath = SVGPathGenerator.newCGPath(fromSVGPath: "M 170 207C139 183 40 199 41 109 A18 18 0 1 1 56 75", whileApplying: CGAffineTransform.identity) else 41 | { 42 | XCTFail("Arc not created") 43 | return 44 | } 45 | 46 | let asString = cgPath.asString() 47 | XCTAssert(!asString.isEmpty) 48 | XCTAssertEqual(asString, "M (170.00, 207.00)\nC (139.00, 183.00, 40.00, 199.00, 41.00, 109.00)\nL (41.00, 109.00)\nC (31.61, 104.86, 27.36, 93.89, 31.50, 84.50)\nC (35.64, 75.11, 46.61, 70.86, 56.00, 75.00)\nC (56.00, 75.00, 56.00, 75.00, 56.00, 75.00)\n") 49 | 50 | } 51 | 52 | func testPerformanceExample() { 53 | // This is an example of a performance test case. 54 | self.measure { 55 | // Put the code you want to measure the time of here. 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork/Eye.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "Star_58-1.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "Star_87.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "40x40", 27 | "idiom" : "iphone", 28 | "filename" : "Star_80.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "size" : "40x40", 33 | "idiom" : "iphone", 34 | "filename" : "Star_120.png", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "size" : "60x60", 39 | "idiom" : "iphone", 40 | "filename" : "Star_120-1.png", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "size" : "60x60", 45 | "idiom" : "iphone", 46 | "filename" : "Star_180.png", 47 | "scale" : "3x" 48 | }, 49 | { 50 | "idiom" : "ipad", 51 | "size" : "20x20", 52 | "scale" : "1x" 53 | }, 54 | { 55 | "idiom" : "ipad", 56 | "size" : "20x20", 57 | "scale" : "2x" 58 | }, 59 | { 60 | "size" : "29x29", 61 | "idiom" : "ipad", 62 | "filename" : "Star_29.png", 63 | "scale" : "1x" 64 | }, 65 | { 66 | "size" : "29x29", 67 | "idiom" : "ipad", 68 | "filename" : "Star_58.png", 69 | "scale" : "2x" 70 | }, 71 | { 72 | "size" : "40x40", 73 | "idiom" : "ipad", 74 | "filename" : "Star_40.png", 75 | "scale" : "1x" 76 | }, 77 | { 78 | "size" : "40x40", 79 | "idiom" : "ipad", 80 | "filename" : "Star_80-1.png", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "size" : "76x76", 85 | "idiom" : "ipad", 86 | "filename" : "Star_76.png", 87 | "scale" : "1x" 88 | }, 89 | { 90 | "size" : "76x76", 91 | "idiom" : "ipad", 92 | "filename" : "Star_152.png", 93 | "scale" : "2x" 94 | }, 95 | { 96 | "size" : "83.5x83.5", 97 | "idiom" : "ipad", 98 | "filename" : "Star_167.png", 99 | "scale" : "2x" 100 | }, 101 | { 102 | "idiom" : "ios-marketing", 103 | "size" : "1024x1024", 104 | "scale" : "1x" 105 | } 106 | ], 107 | "info" : { 108 | "version" : 1, 109 | "author" : "xcode" 110 | } 111 | } -------------------------------------------------------------------------------- /SVGgh/Utilities/SVGghLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghLoader.m 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 4/27/16. 6 | // Copyright © 2016 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import "SVGghLoader.h" 10 | #import "SVGRenderer.h" 11 | 12 | static id gLoader = nil; 13 | 14 | @interface SVGghPathLoader : NSObject 15 | 16 | @end 17 | 18 | @interface SVGXCAssetLoader : NSObject 19 | 20 | @end 21 | 22 | @implementation SVGghLoaderManager 23 | 24 | 25 | +(id) loader 26 | { 27 | id result = gLoader; 28 | if(result == nil) 29 | { 30 | static id sDefault = nil; 31 | static dispatch_once_t done; 32 | dispatch_once(&done, ^{ 33 | sDefault = [SVGghPathLoader new]; 34 | 35 | }); 36 | result = sDefault; 37 | } 38 | return result; 39 | } 40 | 41 | +(BOOL) assetLoadingAvailable 42 | { 43 | #if TARGET_OS_OSX 44 | return YES; 45 | #else 46 | NSString* systemVersion = [UIDevice currentDevice].systemVersion; 47 | return systemVersion.doubleValue >= 9.0; 48 | #endif 49 | 50 | } 51 | 52 | +(void) setLoader:(nullable id)loader 53 | { 54 | gLoader = loader; 55 | } 56 | 57 | +(void) setLoaderToType:(SVGghLoaderType)type 58 | { 59 | switch(type) 60 | { 61 | case SVGghLoaderTypeDefault: 62 | [self setLoader:nil]; 63 | break; 64 | case SVGghLoaderTypePath: 65 | [self setLoader:nil]; 66 | break; 67 | case SVGghLoaderTypeDataXCAsset: 68 | { 69 | if([SVGghLoaderManager assetLoadingAvailable]) 70 | { 71 | [self setLoader:[SVGXCAssetLoader new]]; 72 | } 73 | else 74 | { 75 | NSLog(@"Failed to use SVGghLoaderTypeDataXCAsset for pre-iOS 9 target."); 76 | } 77 | } 78 | break; 79 | } 80 | } 81 | 82 | @end 83 | 84 | @implementation SVGghPathLoader 85 | -(nullable SVGRenderer*) loadRenderForSVGIdentifier:(NSString*)identifier inBundle:(NSBundle*)bundle 86 | { 87 | SVGRenderer* result = [[SVGRenderer alloc] initWithResourceName:identifier inBundle:bundle]; 88 | return result; 89 | } 90 | 91 | @end 92 | 93 | @implementation SVGXCAssetLoader 94 | 95 | -(nullable SVGRenderer*) loadRenderForSVGIdentifier:(NSString*)identifier inBundle:(NSBundle*)bundle 96 | { 97 | SVGRenderer* result = [[SVGRenderer alloc] initWithDataAssetNamed:identifier withBundle: bundle]; 98 | return result; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Example SVGgh/Example SVGghTests/SVGgh.framework/Versions/A/Headers/SVGParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGParser.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // Created by Glenn Howes on 2/2/11. 27 | // 28 | 29 | #import 30 | 31 | 32 | /*! @brief object capable of reading in an SVG document in XML form 33 | */ 34 | @interface SVGParser : NSObject 35 | @property(nonatomic, strong) NSError* parserError; 36 | @property(nonatomic, strong) NSDictionary* root; 37 | @property(strong, nonatomic, readonly) NSURL* svgURL; 38 | 39 | /*! @brief init method which takes a URL reference to a .svg file 40 | * @param url a reference to a standard .svg file 41 | */ 42 | - (id)initWithContentsOfURL:(NSURL *)url; 43 | 44 | /*! @brief init method which takes an SVG document which already exists as a string 45 | * @param utf8String string containing the SVG document 46 | */ 47 | -(id)initWithString:(NSString*)utf8String; 48 | 49 | 50 | /*! @brief not allowing a standard init method 51 | */ 52 | -(instancetype) init __attribute__((unavailable("init not available"))); 53 | 54 | /*! @brief method to create a URL relative to the URL used to create this object (assuming use of a URL to create it) 55 | * @param subPath relative path to this parser's svgURL 56 | */ 57 | -(NSURL*) relativeURL:(NSString*)subPath; 58 | 59 | /*! @brief a routine to return an absolute URL 60 | * @param aPath the file path to the resource 61 | */ 62 | -(NSURL*) absoluteURL:(NSString*)aPath; 63 | @end 64 | -------------------------------------------------------------------------------- /SVGgh.xcodeproj/xcshareddata/xcschemes/SVGgh Mac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /SVGgh Debugging App/Artwork.xcassets/Eye.dataset/Eye.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SVGgh/Views and Layers/SVGRendererLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVGRendererLayer.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | // Created by Glenn Howes on 1/15/11. 27 | 28 | #if defined(__has_feature) && __has_feature(modules) 29 | @import Foundation; 30 | @import QuartzCore; 31 | #else 32 | #import 33 | #import 34 | #endif 35 | 36 | #import 37 | 38 | NS_ASSUME_NONNULL_BEGIN 39 | 40 | @protocol FillColorProtocol 41 | -(nullable UIColor*) copyFillColor; 42 | @end 43 | 44 | /*! @brief a layer which takes an SVGRenderer and uses it to draw itself 45 | * @see SVGDocumentView 46 | * @see SVGRenderer 47 | */ 48 | @interface SVGRendererLayer : CALayer 49 | /*! @property renderer 50 | * @brief the object that does the actual drawing. 51 | */ 52 | @property(nonatomic, strong) SVGRenderer* __nullable renderer; 53 | 54 | /*! @property defaultColor 55 | * @brief the value for 'currentColor' when the SVG is rendered from the root element 56 | */ 57 | @property(nonatomic, strong) UIColor* __nullable defaultColor; 58 | 59 | /*! @property beTransparent 60 | * @brief ignore the document's 'viewport-fill' property 61 | */ 62 | @property(nonatomic, assign) BOOL beTransparent; 63 | 64 | /*! @brief method that tries to locate an object located at the given point inside the coordinate system of the layer 65 | * @param testPoint point in the coordinate system of the layer 66 | * @return an object hit by the point 67 | */ 68 | -(nullable id) findRenderableObject:(CGPoint)testPoint; 69 | @end 70 | 71 | @interface CALayer(GH_Utilities) 72 | +(CGFloat) globalContentScale; 73 | @end 74 | 75 | NS_ASSUME_NONNULL_END 76 | -------------------------------------------------------------------------------- /SVGgh TV Debugging App/SVGghTVDebuggingAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghTVDebuggingAppDelegate.m 3 | // SVGgh TV Debugging App 4 | // 5 | // Created by Glenn Howes on 9/19/15. 6 | // Copyright © 2015 Generally Helpful. All rights reserved. 7 | // 8 | 9 | #import "SVGghTVDebuggingAppDelegate.h" 10 | #import "SVGgh.h" 11 | 12 | @interface SVGghTVDebuggingAppDelegate () 13 | 14 | @end 15 | 16 | @implementation SVGghTVDebuggingAppDelegate 17 | 18 | 19 | +(void) initialize 20 | { 21 | [super initialize]; 22 | 23 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0 // otherwise, the asset files will not be properly created. 24 | NSString* systemVersion = [UIDevice currentDevice].systemVersion; 25 | 26 | if(systemVersion.doubleValue >= 9.0) // normally you would not use this option unless your base target was iOS 9 or above 27 | { 28 | [SVGghLoaderManager setLoaderToType:SVGghLoaderTypeDataXCAsset]; 29 | } 30 | #else 31 | // just use default resource method 32 | #endif 33 | 34 | 35 | } 36 | 37 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 38 | // Override point for customization after application launch. 39 | return YES; 40 | } 41 | 42 | - (void)applicationWillResignActive:(UIApplication *)application { 43 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 44 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 45 | } 46 | 47 | - (void)applicationDidEnterBackground:(UIApplication *)application { 48 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 49 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 50 | } 51 | 52 | - (void)applicationWillEnterForeground:(UIApplication *)application { 53 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 54 | } 55 | 56 | - (void)applicationDidBecomeActive:(UIApplication *)application { 57 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 58 | } 59 | 60 | - (void)applicationWillTerminate:(UIApplication *)application { 61 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /SVGgh/SVG/GHAttributedObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // AttributedObject.h 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2013-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // Created by Glenn Howes on 2/3/13. 26 | 27 | 28 | #if defined(__has_feature) && __has_feature(modules) 29 | @import Foundation; 30 | #else 31 | #import 32 | #endif 33 | 34 | NS_ASSUME_NONNULL_BEGIN 35 | 36 | @protocol GHAttributedObjectProtocol 37 | @property (copy, nonatomic, readonly) NSDictionary* attributes; 38 | @property (readonly, nonatomic) NSString* __nullable entityName; 39 | @end 40 | 41 | /*! @brief basically just a wrapper around an NSDictionary. A convenient object when generating from XML 42 | */ 43 | @interface GHAttributedObject : NSObject 44 | @property (copy, nonatomic, readonly) NSDictionary* attributes; 45 | @property (readonly, nonatomic) NSString* __nullable entityName; 46 | 47 | -(instancetype) initWithDictionary:(NSDictionary*)theAttributes; 48 | -(instancetype) initWithAttributes:(NSDictionary*)theAttributes NS_DESIGNATED_INITIALIZER; 49 | -(instancetype) init NS_UNAVAILABLE; 50 | 51 | -(NSUInteger)calculatedHash; // attributed objects are immutable, I can calculate their hash once and be done with it. 52 | 53 | 54 | @end 55 | 56 | @interface GHAttributedObject(Prototyping) 57 | +(NSDictionary*) overideObjectsForPrototype:(id)prototype withDictionary:(NSDictionary*)deltaDictionary; 58 | @end 59 | 60 | // useful in parsing XML 61 | extern NSString* const kAttributesElementName; 62 | extern NSString* const kContentsElementName; 63 | extern NSString* const kElementName; 64 | extern NSString* const kElementText; 65 | extern NSString* const kElementData; 66 | extern NSString* const kLengthIntoParentsContents; 67 | 68 | 69 | NS_ASSUME_NONNULL_END 70 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SVGghDebuggingViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SVGghDebuggingViewController.swift 3 | // SVGgh Debugging App 4 | // 5 | // Created by Glenn Howes on 9/20/21. 6 | // Copyright © 2021 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | import SwiftUI 12 | import SVGgh 13 | 14 | @available(iOS 14.0, *) 15 | struct SVGCardView : View, Animatable 16 | { 17 | var animatableData : Double 18 | { 19 | set 20 | { 21 | self.rotation = newValue 22 | } 23 | 24 | get 25 | { 26 | return self.rotation 27 | } 28 | } 29 | @State var rotation : Double = 0.0 30 | @State var cardName : String = "Jack_Hearts" 31 | 32 | private func pickRandomCard() 33 | { 34 | cardName = ["Queen_Hearts", "King_Hearts", "Jack_Hearts", "Queen_Spades", "King_Spades", "Jack_Spades", "Queen_Diamonds", "King_Diamonds", "Jack_Diamonds", "Queen_Clubs", "King_Clubs", "Jack_Clubs"].randomElement()! 35 | } 36 | 37 | var body : some View 38 | { 39 | VStack(alignment: .center, spacing: 8.0) 40 | { 41 | Spacer() 42 | Text("Tap to Flip").font(.headline) 43 | ZStack 44 | { 45 | if animatableData <= 90.0 46 | { 47 | SVGView(resourceName: cardName) 48 | .aspectRatio(contentMode: .fit) 49 | } 50 | if animatableData >= 90.0 51 | { 52 | SVGView(resourceName: "Card_Back").currentColor(Color.blue) 53 | .aspectRatio(contentMode: .fit) 54 | } 55 | }.rotation3DEffect(Angle(degrees: rotation), axis: (x: 0.0, y: 1.0, z: 0.0)).onTapGesture { 56 | withAnimation 57 | { 58 | let newRotation = (rotation == 0.0) ? 180.0 : 0.0 59 | if newRotation == 0.0 60 | { 61 | pickRandomCard() 62 | } 63 | rotation = newRotation 64 | 65 | } 66 | }.onAppear 67 | { 68 | withAnimation 69 | { 70 | pickRandomCard() 71 | rotation = 180.0 72 | } 73 | } 74 | Spacer() 75 | } 76 | } 77 | } 78 | 79 | @available(iOS 14.0, *) 80 | struct SVGTestView : View 81 | { 82 | var body : some View 83 | { 84 | VStack 85 | { 86 | SVGCardView() 87 | }.background(Color.white) 88 | } 89 | 90 | 91 | } 92 | 93 | extension SVGghDebuggingViewController 94 | { 95 | @available(iOS 14.0, *) 96 | @objc func createSwiftUIExample() -> UIViewController 97 | { 98 | let result = UIHostingController(rootView: SVGTestView()) 99 | result.view.translatesAutoresizingMaskIntoConstraints = true 100 | return result 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /SVGgh/SVG/GHCSSStyle.m: -------------------------------------------------------------------------------- 1 | // 2 | // GHCSSStyle.m 3 | // SVGgh 4 | // 5 | // The MIT License (MIT) 6 | 7 | // Copyright (c) 2016 Glenn R. Howes 8 | 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | // 28 | // Created by Glenn Howes on 3/19/16. 29 | 30 | #import "GHCSSStyle.h" 31 | 32 | @implementation GHCSSStyle 33 | +(NSDictionary*) stylesForString:(NSString*)css 34 | { 35 | NSDictionary* result = [NSDictionary new]; 36 | 37 | 38 | 39 | return result; 40 | } 41 | +(NSString*) attributeNamed:(NSString*)attributeName classes:(nullable NSArray*)listOfClasses entityName:(nullable NSString*)entityName pseudoClass:(CSSPseudoClassFlags)pseudoClassFlags forStyles:(NSDictionary*) cssStyles 42 | { 43 | NSString* result = nil; 44 | GHCSSStyle* entityStyle = nil; 45 | if(entityName.length) 46 | { 47 | entityStyle = [cssStyles valueForKey:entityName]; 48 | if(entityStyle) 49 | { 50 | for(NSString* aClass in listOfClasses) 51 | { 52 | GHCSSStyle* classEntityStyle = [entityStyle.subClasses valueForKey:aClass]; 53 | if(classEntityStyle != nil && classEntityStyle.pseudoClassFlags & pseudoClassFlags) // should this be & or == ? 54 | { 55 | result = [classEntityStyle.attributes valueForKey:attributeName]; 56 | } 57 | } 58 | } 59 | } 60 | 61 | if(result == nil) 62 | { 63 | for(NSString* aClass in listOfClasses) 64 | { 65 | GHCSSStyle* classStyle = [cssStyles valueForKey:aClass]; 66 | if(classStyle && classStyle.pseudoClassFlags & pseudoClassFlags) // should this be & or == ? 67 | { 68 | result = [classStyle.attributes valueForKey:attributeName]; 69 | } 70 | } 71 | } 72 | 73 | if(result == nil) 74 | { 75 | result = [entityStyle valueForKey:attributeName]; 76 | } 77 | 78 | return result; 79 | } 80 | @end 81 | -------------------------------------------------------------------------------- /SVGgh/SVGRenderer/SVGtoPDFConverter.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVGRenderer+PDF.m 3 | // SVGgh 4 | // The MIT License (MIT) 5 | 6 | // Copyright (c) 2011-2014 Glenn R. Howes 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // Created by Glenn Howes on 2/4/14. 26 | // 27 | 28 | #import "SVGgh.h" 29 | #if defined(__has_feature) && __has_feature(modules) 30 | @import QuartzCore; 31 | #else 32 | #import 33 | #endif 34 | 35 | 36 | CGContextRef CreatePDFContext(const CGRect mediaRect, CFMutableDataRef theData) 37 | { 38 | CGContextRef result = 0; 39 | if(theData != 0) 40 | { 41 | CGDataConsumerRef theConsumer = CGDataConsumerCreateWithCFData(theData); 42 | if(theConsumer != 0) 43 | { 44 | result = CGPDFContextCreate(theConsumer, &mediaRect, NULL); 45 | CGDataConsumerRelease(theConsumer); 46 | } 47 | } 48 | return result; 49 | } 50 | 51 | @implementation SVGtoPDFConverter 52 | +(void) createPDFFromRenderer:(SVGRenderer*)aRenderer intoCallback:(renderPDFCallback_t)callback 53 | { 54 | [[SVGRenderer rendererQueue] addOperationWithBlock:^{ 55 | CGRect boundingBox = aRenderer.viewRect; 56 | NSData* theResult = nil; 57 | CFMutableDataRef pdfData = CFDataCreateMutable(NULL, 0); 58 | if(pdfData != 0) 59 | { 60 | CGContextRef quartzContext = CreatePDFContext(boundingBox, pdfData); 61 | CGContextBeginPage(quartzContext, &boundingBox); 62 | CGContextSaveGState(quartzContext); 63 | 64 | CGContextTranslateCTM(quartzContext, 0, boundingBox.size.height); 65 | CGContextScaleCTM(quartzContext, 1.0, -1.0); 66 | [aRenderer renderIntoContext:quartzContext]; 67 | 68 | CGContextEndPage(quartzContext); 69 | CGContextRestoreGState(quartzContext); 70 | CGContextFlush(quartzContext); 71 | 72 | CGContextRelease(quartzContext); 73 | theResult = [(__bridge NSMutableData*)pdfData copy]; 74 | CFRelease(pdfData); 75 | } 76 | callback(theResult); 77 | }]; 78 | } 79 | @end 80 | -------------------------------------------------------------------------------- /SVGgh Debugging App/SegmentedDemoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SegmentedDemoViewController.swift 3 | // SVGgh 4 | // 5 | // Created by Glenn Howes on 4/23/16. 6 | // Copyright © 2016 Generally Helpful. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SVGgh 11 | 12 | class SegmentedDemoTableCell: UITableViewCell 13 | { 14 | @IBOutlet var segmentedControl : GHSegmentedControl! 15 | { 16 | didSet 17 | { 18 | 19 | if let helmetRenderer = SVGghLoaderManager.loader().loadRender(forSVGIdentifier: "Helmet", in: nil) 20 | { 21 | self.segmentedControl.insertSegment(with: helmetRenderer, at: 0, animated: false) 22 | } 23 | 24 | if let eyeRenderer = SVGghLoaderManager.loader().loadRender(forSVGIdentifier: "Eye", in: nil) 25 | { 26 | self.segmentedControl.insertSegment(with: eyeRenderer, at: 1, animated: false) 27 | } 28 | 29 | self.segmentedControl.insertSegment(withTitle: "Demo", at: 2, animated: false) 30 | 31 | self.segmentedControl.selectedSegmentIndex = 1; 32 | 33 | if let myScheme = self.colorScheme 34 | { 35 | 36 | self.segmentedControl.schemeNumber = Int(myScheme) 37 | } 38 | 39 | } 40 | } 41 | var colorScheme: ColorScheme? 42 | { 43 | didSet 44 | { 45 | guard let scheme = self.colorScheme else 46 | { 47 | return 48 | } 49 | self.segmentedControl.schemeNumber = Int(scheme) 50 | } 51 | } 52 | } 53 | 54 | class SegmentedDemoViewController: UIViewController, UITableViewDataSource { 55 | 56 | @IBOutlet var tableView: UITableView! 57 | { 58 | didSet 59 | { 60 | tableView.dataSource = self 61 | tableView.reloadData() 62 | } 63 | } 64 | 65 | override func viewDidLoad() { 66 | super.viewDidLoad() 67 | 68 | // Do any additional setup after loading the view. 69 | } 70 | 71 | override func didReceiveMemoryWarning() { 72 | super.didReceiveMemoryWarning() 73 | // Dispose of any resources that can be recreated. 74 | } 75 | 76 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int 77 | { 78 | return kLastColorScheme 79 | } 80 | 81 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 82 | let result = tableView.dequeueReusableCell(withIdentifier: "SegmentCell", for: indexPath as IndexPath) as! SegmentedDemoTableCell 83 | result.colorScheme = ColorScheme(indexPath.row) 84 | return result 85 | } 86 | 87 | /* 88 | // MARK: - Navigation 89 | 90 | // In a storyboard-based application, you will often want to do a little preparation before navigation 91 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 92 | // Get the new view controller using segue.destinationViewController. 93 | // Pass the selected object to the new view controller. 94 | } 95 | */ 96 | 97 | } 98 | -------------------------------------------------------------------------------- /SVGgh.xcodeproj/xcshareddata/xcschemes/SVGgh Tester (macOS).xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /SVGgh/Third Party/NSData+IDZGunzip.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+IDZGunzip 3 | // 4 | // Copyright (c) 2013 iOSDeveloperZone.com 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | #import "NSData+IDZGunzip.h" 25 | #import 26 | 27 | NSString* const IDZGunzipErrorDomain = @"com.iosdeveloperzone.IDZGunzip"; 28 | 29 | @implementation NSData (IDZGunzip) 30 | 31 | - (NSData*)gunzip:(NSError *__autoreleasing *)error 32 | { 33 | /* 34 | * A minimal gzip header/trailer is 18 bytes long. 35 | * See: RFC 1952 http://www.gzip.org/zlib/rfc-gzip.html 36 | */ 37 | if(self.length < 18) 38 | { 39 | if(error) 40 | *error = [NSError errorWithDomain:IDZGunzipErrorDomain code:Z_DATA_ERROR userInfo:nil]; 41 | return nil; 42 | } 43 | z_stream zStream; 44 | memset(&zStream, 0, sizeof(zStream)); 45 | /* 46 | * 16 is a magic number that allows inflate to handle gzip 47 | * headers. 48 | */ 49 | int iResult = inflateInit2(&zStream, 16); 50 | if(iResult != Z_OK) 51 | { 52 | if(error) 53 | *error = [NSError errorWithDomain:IDZGunzipErrorDomain code:iResult userInfo:nil]; 54 | return nil; 55 | } 56 | /* 57 | * The last four bytes of a gzipped file/buffer contain the the number 58 | * of uncompressed bytes expressed as a 32-bit little endian unsigned integer. 59 | * See: RFC 1952 http://www.gzip.org/zlib/rfc-gzip.html 60 | */ 61 | UInt32 nUncompressedBytes = *(UInt32*)(self.bytes + self.length - 4); 62 | NSMutableData* gunzippedData = [NSMutableData dataWithLength:nUncompressedBytes]; 63 | 64 | zStream.next_in = (Bytef*)self.bytes; 65 | zStream.avail_in = (uInt)self.length; 66 | zStream.next_out = (Bytef*)gunzippedData.bytes; 67 | zStream.avail_out = (uInt)gunzippedData.length; 68 | 69 | iResult = inflate(&zStream, Z_FINISH); 70 | if(iResult != Z_STREAM_END) 71 | { 72 | if(error) 73 | *error = [NSError errorWithDomain:IDZGunzipErrorDomain code:iResult userInfo:nil]; 74 | gunzippedData = nil; 75 | } 76 | inflateEnd(&zStream); 77 | return gunzippedData; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Shared/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | }, 93 | { 94 | "idiom" : "mac", 95 | "scale" : "1x", 96 | "size" : "16x16" 97 | }, 98 | { 99 | "idiom" : "mac", 100 | "scale" : "2x", 101 | "size" : "16x16" 102 | }, 103 | { 104 | "idiom" : "mac", 105 | "scale" : "1x", 106 | "size" : "32x32" 107 | }, 108 | { 109 | "idiom" : "mac", 110 | "scale" : "2x", 111 | "size" : "32x32" 112 | }, 113 | { 114 | "idiom" : "mac", 115 | "scale" : "1x", 116 | "size" : "128x128" 117 | }, 118 | { 119 | "idiom" : "mac", 120 | "scale" : "2x", 121 | "size" : "128x128" 122 | }, 123 | { 124 | "idiom" : "mac", 125 | "scale" : "1x", 126 | "size" : "256x256" 127 | }, 128 | { 129 | "idiom" : "mac", 130 | "scale" : "2x", 131 | "size" : "256x256" 132 | }, 133 | { 134 | "idiom" : "mac", 135 | "scale" : "1x", 136 | "size" : "512x512" 137 | }, 138 | { 139 | "idiom" : "mac", 140 | "scale" : "2x", 141 | "size" : "512x512" 142 | } 143 | ], 144 | "info" : { 145 | "author" : "xcode", 146 | "version" : 1 147 | } 148 | } 149 | --------------------------------------------------------------------------------