{"id":17996776,"url":"https://github.com/cosmo/spritemap","last_synced_at":"2025-04-04T06:14:27.186Z","repository":{"id":146387399,"uuid":"208412891","full_name":"Cosmo/SpriteMap","owner":"Cosmo","description":"SpriteMap helps you to extract sprites out of a sprite map. Written in Swift.","archived":false,"fork":false,"pushed_at":"2019-09-29T16:21:03.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T05:47:01.635Z","etag":null,"topics":["cgimage","spritemap","sprites","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cosmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-14T08:40:41.000Z","updated_at":"2023-02-06T16:11:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"aabe9e96-9ba4-4f44-b8e8-484ddf0bdb81","html_url":"https://github.com/Cosmo/SpriteMap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmo%2FSpriteMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmo%2FSpriteMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmo%2FSpriteMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cosmo%2FSpriteMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cosmo","download_url":"https://codeload.github.com/Cosmo/SpriteMap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128753,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgimage","spritemap","sprites","swift"],"created_at":"2024-10-29T21:15:51.267Z","updated_at":"2025-04-04T06:14:27.168Z","avatar_url":"https://github.com/Cosmo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpriteMap\n\nSpriteMap helps you to extract sprites out of a sprite map.\n\n---\n\n# Extract Sprites\n\n## By coordinates\n\n```swift\nimageAt(point: CGPoint, size: CGSize) -\u003e CGImage?\n```\n\nReturns an optional `CGImage`.\n\nProvide the coordinates as `CGPoint` and the size of your single sprite as `CGSize`.\n\n### Example\n\nTo get the last image of a sprite map with the size of 600 × 600 pixels containing 9 sprites (3 × 3), you write:\n\n```swift\nlet sprite = spriteMap.imageAt(point: CGPoint(x: 2, y: 2), size: CGSize(width: 200, height: 200))\n```\n\n\n## By index\n\n```swift\nimageAt(index: Int, size: CGSize) -\u003e CGImage?`\n```\n\nReturns an optional `CGImage`.\n\nProvide the index as `Int` and the size of your single sprite as `CGSize`.\n\n### Example\n\nTo get the last image of a sprite map with the size of 600 × 600 pixels containing 9 sprites (3 × 3), you write:\n\n```swift\nlet sprite = spriteMap.imageAt(index: 8, size: CGSize(width: 200, height: 200))\n```\n\n# Helpers\n\n## Merge multiple images to one\n\n```swift\nmergeImages(_ images: [CGImage]) -\u003e CGImage?`\n```\n\nReturns an optional `CGImage`.\n\nTakes multiple `CGImage` elements and merges them into one.\n\nUseful when you have multiple parts as sprites (body, mouth, eyes).\n\n```swift\nlet image = CGImage.mergeImages([bodyImage, mouthImage, eyesImage])\n```\nCGImage.mergeImages()\n\n## Contact\n\n* Devran \"Cosmo\" Uenal\n* Twitter: [@maccosmo](http://twitter.com/maccosmo)\n* LinkedIn: [devranuenal](https://www.linkedin.com/in/devranuenal)\n\n## Other Projects\n\n* [BinaryKit](https://github.com/Cosmo/BinaryKit) — BinaryKit helps you to break down binary data into bits and bytes and easily access specific parts.\n* [Clippy](https://github.com/Cosmo/Clippy) — Clippy from Microsoft Office is back and runs on macOS! Written in Swift.\n* [GrammaticalNumber](https://github.com/Cosmo/GrammaticalNumber) — Turns singular words to the plural and vice-versa in Swift.\n* [HackMan](https://github.com/Cosmo/HackMan) — Stop writing boilerplate code yourself. Let hackman do it for you via the command line.\n* [ISO8859](https://github.com/Cosmo/ISO8859) — Convert ISO8859 1-16 Encoded Text to String in Swift. Supports iOS, tvOS, watchOS and macOS.\n* [StringCase](https://github.com/Cosmo/StringCase) — Converts String to lowerCamelCase, UpperCamelCase and snake_case. Tested and written in Swift.\n* [TinyConsole](https://github.com/Cosmo/TinyConsole) — TinyConsole is a micro-console that can help you log and display information inside an iOS application, where having a connection to a development computer is not possible.\n\n\n## License\n\nSpriteMap is released under the [MIT License](http://www.opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmo%2Fspritemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosmo%2Fspritemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmo%2Fspritemap/lists"}