Skip to content

Commit

Permalink
Fix canvas creation for true color image
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed May 8, 2022
1 parent f074bac commit cec727c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "Delegate",
"repositoryURL": "https://github.com/onevcat/Delegate.git",
"state": {
"branch": null,
"revision": "45c5ec58d5a9656a9cc729506e0ed3093ca8f772",
"version": "1.1.1"
}
}
]
},
"version": 1
}
4 changes: 3 additions & 1 deletion Source/APNGKit/APNGImageRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,10 @@ extension IHDR {

var bitmapInfo: CGBitmapInfo {
switch colorType {
case .greyscale, .trueColor:
case .greyscale:
return CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue)
case .trueColor:
return CGBitmapInfo(rawValue: CGImageAlphaInfo.noneSkipLast.rawValue)
case .greyscaleWithAlpha, .trueColorWithAlpha, .indexedColor:
return CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
}
Expand Down
2 changes: 1 addition & 1 deletion Source/APNGKit/Chunk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct IHDR: Chunk {
var componentsPerPixel: Int {
switch self {
case .greyscale: return 1
case .trueColor: return 3
case .trueColor: return 4
case .indexedColor: return 1
case .greyscaleWithAlpha: return 2
case .trueColorWithAlpha: return 4
Expand Down

0 comments on commit cec727c

Please sign in to comment.