iOS app icon !206
5 files changed, +56 −7
Layout: unified · split
ios/Orgstar.xcodeproj/project.pbxproj +10
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | 67AD8B4FFD1ED43852CFC2CA /* Orgstar/Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B6845EF9D6D0093A0394C43 /* Orgstar/Assets.xcassets */; }; | |
| 10 | 11 | 1B78003BBCE8A4B809333342 /* OrgApp in Frameworks */ = {isa = PBXBuildFile; productRef = A2BE626BBE45EA52880B6169 /* OrgApp */; }; |
| 11 | 12 | 1E5861C0EFE1D96CDC21A22F /* OrgApp in Frameworks */ = {isa = PBXBuildFile; productRef = BA239181876756F7732397EB /* OrgApp */; }; |
| 12 | 13 | 2BE799BF03ED43EAA6849F53 /* OrgApp in Frameworks */ = {isa = PBXBuildFile; productRef = EDEF22C5B4F393296F1D17BB /* OrgApp */; }; |
| @@ -68,6 +69,7 @@ | ||
| 68 | 69 | D128CD70D4E88FAA82D23FD9 /* OrgstarShare.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OrgstarShare.appex; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 69 | 70 | D72184D78ACF70837216BCBF /* OrgstarShare/Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = OrgstarShare/Info.plist; sourceTree = "<group>"; }; |
| 70 | 71 | ECD4A6B56983444E4E07CE63 /* Orgstar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Orgstar.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 72 | 0B6845EF9D6D0093A0394C43 /* Orgstar/Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Orgstar/Assets.xcassets; sourceTree = "<group>"; }; | |
| 71 | 73 | F05C9F05F8A61806F30E9328 /* Orgstar/Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Orgstar/Info.plist; sourceTree = "<group>"; }; |
| 72 | 74 | /* End PBXFileReference section */ |
| 73 | 75 | |
| @@ -180,6 +182,7 @@ | ||
| 180 | 182 | 40FCC6CF7BFC065FCDD48D4E /* Support */ = { |
| 181 | 183 | isa = PBXGroup; |
| 182 | 184 | children = ( |
| 185 | 0B6845EF9D6D0093A0394C43 /* Orgstar/Assets.xcassets */, | |
| 183 | 186 | F05C9F05F8A61806F30E9328 /* Orgstar/Info.plist */, |
| 184 | 187 | 008B67FA6385670637488313 /* Orgstar/Orgstar.entitlements */, |
| 185 | 188 | D72184D78ACF70837216BCBF /* OrgstarShare/Info.plist */, |
| @@ -338,6 +341,7 @@ | ||
| 338 | 341 | isa = PBXResourcesBuildPhase; |
| 339 | 342 | buildActionMask = 2147483647; |
| 340 | 343 | files = ( |
| 344 | 67AD8B4FFD1ED43852CFC2CA /* Orgstar/Assets.xcassets in Resources */, | |
| 341 | 345 | ); |
| 342 | 346 | runOnlyForDeploymentPostprocessing = 0; |
| 343 | 347 | }; |
| @@ -481,6 +485,9 @@ | ||
| 481 | 485 | DEVELOPMENT_TEAM = ZCNAX3VL9D; |
| 482 | 486 | GENERATE_INFOPLIST_FILE = NO; |
| 483 | 487 | INFOPLIST_FILE = Orgstar/Info.plist; |
| 488 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |
| 489 | INFOPLIST_KEY_CFBundleDisplayName = orgstar; | |
| 490 | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; | |
| 484 | 491 | LD_RUNPATH_SEARCH_PATHS = ( |
| 485 | 492 | "$(inherited)", |
| 486 | 493 | "@executable_path/Frameworks", |
| @@ -563,6 +570,9 @@ | ||
| 563 | 570 | DEVELOPMENT_TEAM = ZCNAX3VL9D; |
| 564 | 571 | GENERATE_INFOPLIST_FILE = NO; |
| 565 | 572 | INFOPLIST_FILE = Orgstar/Info.plist; |
| 573 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |
| 574 | INFOPLIST_KEY_CFBundleDisplayName = orgstar; | |
| 575 | INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity"; | |
| 566 | 576 | LD_RUNPATH_SEARCH_PATHS = ( |
| 567 | 577 | "$(inherited)", |
| 568 | 578 | "@executable_path/Frameworks", |
ios/Orgstar/Assets.xcassets/AppIcon.appiconset/AppIcon.png added
Binary file not shown.
ios/Orgstar/Assets.xcassets/AppIcon.appiconset/Contents.json added +14
| @@ -0,0 +1,14 @@ | ||
| 1 | { | |
| 2 | "images" : [ | |
| 3 | { | |
| 4 | "filename" : "AppIcon.png", | |
| 5 | "idiom" : "universal", | |
| 6 | "platform" : "ios", | |
| 7 | "size" : "1024x1024" | |
| 8 | } | |
| 9 | ], | |
| 10 | "info" : { | |
| 11 | "author" : "xcode", | |
| 12 | "version" : 1 | |
| 13 | } | |
| 14 | } | |
ios/Orgstar/Assets.xcassets/Contents.json added +6
| @@ -0,0 +1,6 @@ | ||
| 1 | { | |
| 2 | "info" : { | |
| 3 | "author" : "xcode", | |
| 4 | "version" : 1 | |
| 5 | } | |
| 6 | } | |
scripts/make-icon.swift +26 −7
| @@ -1,19 +1,25 @@ | ||
| 1 | // Draws Orgstar's app icon and writes an iconset: an outline's heading star over three | |
| 2 | // indented lines, on a deep blue-to-violet square. Usage: swift scripts/make-icon.swift <dir.iconset> | |
| 1 | // Draws orgstar's app icon: an outline's heading star over three indented lines, on a deep | |
| 2 | // blue-to-violet square. Usage: swift scripts/make-icon.swift <dir.iconset> for the Mac's | |
| 3 | // iconset, or swift scripts/make-icon.swift --ios <file.png> for the iOS app's 1024-pixel icon. | |
| 3 | 4 | import AppKit |
| 4 | 5 | |
| 5 | let folder = URL(fileURLWithPath: CommandLine.arguments[1]) | |
| 6 | try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) | |
| 7 | ||
| 8 | func draw(_ size: CGFloat) -> NSBitmapImageRep { | |
| 6 | /// The Mac's icon sits on the macOS grid, a rounded square inset in a clear canvas; the iOS | |
| 7 | /// icon is the same square filling an opaque canvas, which iOS rounds itself. | |
| 8 | func draw(_ size: CGFloat, fullBleed: Bool = false) -> NSBitmapImageRep { | |
| 9 | 9 | let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: Int(size), pixelsHigh: Int(size), bitsPerSample: 8, |
| 10 | 10 | samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)! |
| 11 | 11 | NSGraphicsContext.saveGraphicsState() |
| 12 | 12 | NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: rep) |
| 13 | 13 | let s = size / 1024 |
| 14 | if fullBleed { | |
| 15 | let transform = NSAffineTransform() | |
| 16 | transform.scale(by: 1024 / 824) | |
| 17 | transform.translateX(by: -100 * s, yBy: -100 * s) | |
| 18 | transform.concat() | |
| 19 | } | |
| 14 | 20 | // The macOS icon grid: an 824-point rounded square in a 1024 canvas. |
| 15 | 21 | let square = NSRect(x: 100 * s, y: 100 * s, width: 824 * s, height: 824 * s) |
| 16 | let shape = NSBezierPath(roundedRect: square, xRadius: 185 * s, yRadius: 185 * s) | |
| 22 | let shape = fullBleed ? NSBezierPath(rect: square) : NSBezierPath(roundedRect: square, xRadius: 185 * s, yRadius: 185 * s) | |
| 17 | 23 | NSGradient(colors: [NSColor(srgbRed: 0.13, green: 0.20, blue: 0.55, alpha: 1), NSColor(srgbRed: 0.40, green: 0.22, blue: 0.70, alpha: 1)])! |
| 18 | 24 | .draw(in: shape, angle: -60) |
| 19 | 25 | // The heading star. |
| @@ -32,6 +38,19 @@ func draw(_ size: CGFloat) -> NSBitmapImageRep { | ||
| 32 | 38 | return rep |
| 33 | 39 | } |
| 34 | 40 | |
| 41 | if CommandLine.arguments[1] == "--ios" { | |
| 42 | // Without an alpha channel, as the App Store requires: drawn, then copied into an opaque image. | |
| 43 | let drawn = draw(1024, fullBleed: true).cgImage! | |
| 44 | let opaque = CGContext(data: nil, width: 1024, height: 1024, bitsPerComponent: 8, bytesPerRow: 0, | |
| 45 | space: CGColorSpace(name: CGColorSpace.sRGB)!, bitmapInfo: CGImageAlphaInfo.noneSkipLast.rawValue)! | |
| 46 | opaque.draw(drawn, in: CGRect(x: 0, y: 0, width: 1024, height: 1024)) | |
| 47 | let file = URL(fileURLWithPath: CommandLine.arguments[2]) | |
| 48 | try NSBitmapImageRep(cgImage: opaque.makeImage()!).representation(using: .png, properties: [:])!.write(to: file) | |
| 49 | exit(0) | |
| 50 | } | |
| 51 | ||
| 52 | let folder = URL(fileURLWithPath: CommandLine.arguments[1]) | |
| 53 | try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) | |
| 35 | 54 | for base in [16, 32, 128, 256, 512] { |
| 36 | 55 | for scale in [1, 2] { |
| 37 | 56 | let name = scale == 1 ? "icon_\(base)x\(base).png" : "icon_\(base)x\(base)@2x.png" |