GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Cosmo/SpriteMap: SpriteMap helps you to extract sprites out of a sprite map. Written in Swift.

BranchesTags
Open more actions menu

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
.swiftpm/xcode/package.xcworkspace
.swiftpm/xcode/package.xcworkspace
 
 
Sources/SpriteMap
Sources/SpriteMap
 
 
Tests
Tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

SpriteMap

SpriteMap helps you to extract sprites out of a sprite map.


Extract Sprites

By coordinates

imageAt(point: CGPoint, size: CGSize) -> CGImage?

Returns an optional CGImage.

Provide the coordinates as CGPoint and the size of your single sprite as CGSize.

Example

To get the last image of a sprite map with the size of 600 × 600 pixels containing 9 sprites (3 × 3), you write:

let sprite = spriteMap.imageAt(point: CGPoint(x: 2, y: 2), size: CGSize(width: 200, height: 200))

By index

imageAt(index: Int, size: CGSize) -> CGImage?`

Returns an optional CGImage.

Provide the index as Int and the size of your single sprite as CGSize.

Example

To get the last image of a sprite map with the size of 600 × 600 pixels containing 9 sprites (3 × 3), you write:

let sprite = spriteMap.imageAt(index: 8, size: CGSize(width: 200, height: 200))

Helpers

Merge multiple images to one

mergeImages(_ images: [CGImage]) -> CGImage?`

Returns an optional CGImage.

Takes multiple CGImage elements and merges them into one.

Useful when you have multiple parts as sprites (body, mouth, eyes).

let image = CGImage.mergeImages([bodyImage, mouthImage, eyesImage])

CGImage.mergeImages()

Contact

  • Devran "Cosmo" Uenal
  • Twitter: @maccosmo
  • LinkedIn: devranuenal

Other Projects

  • BinaryKit — BinaryKit helps you to break down binary data into bits and bytes and easily access specific parts.
  • Clippy — Clippy from Microsoft Office is back and runs on macOS! Written in Swift.
  • GrammaticalNumber — Turns singular words to the plural and vice-versa in Swift.
  • HackMan — Stop writing boilerplate code yourself. Let hackman do it for you via the command line.
  • ISO8859 — Convert ISO8859 1-16 Encoded Text to String in Swift. Supports iOS, tvOS, watchOS and macOS.
  • StringCase — Converts String to lowerCamelCase, UpperCamelCase and snake_case. Tested and written in Swift.
  • 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.

License

SpriteMap is released under the MIT License.

About

SpriteMap helps you to extract sprites out of a sprite map. Written in Swift.

Topics

cgimagespritemapspritesswift

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.