目录
目录README.md



Swift Package Manager compatible MIT licensed

Bitmap

Easy low-overhead access to individual pixels.

Bitmap uses low-level data pointers to reduce overhead in working with CGImage.

It allows you to get and set pixels directly through a 2-argument subscript, as well as offering various bulk creation/modification operations.

Example

Identify pixels that are neither fully opaque nor fully transparent and turn them red, clearing the rest.

for y in 0..<bitmap.height {
    for x in 0..<bitmap.width {
        if case 1...254 = bitmap[x, y].alpha {
            bitmap[x, y] = .red
        } else {
            bitmap[x, y] = .clear
        }
    }
}
turns this into this

For more examples, please take a look at the unit tests. All non-trivial public endpoints have documentation attached too, so it shouldn’t be too hard to figure out how everything works if you just play around a little.

关于
498.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号