Skip to content

Commit

Permalink
Unify true color type to apply alpha bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
onevcat committed Oct 8, 2023
1 parent 0e8bd63 commit 11390cb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Source/APNGKit/APNGImageRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -492,18 +492,15 @@ extension IHDR {
var colorSpace: CGColorSpace {
switch colorType {
case .greyscale, .greyscaleWithAlpha: return .deviceGray
case .trueColor, .trueColorWithAlpha: return .deviceRGB
case .indexedColor: return .deviceRGB
case .indexedColor, .trueColor, .trueColorWithAlpha: return .deviceRGB
}
}

var bitmapInfo: CGBitmapInfo {
switch colorType {
case .greyscale:
return CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue)
case .trueColor:
return CGBitmapInfo(rawValue: CGImageAlphaInfo.noneSkipLast.rawValue)
case .greyscaleWithAlpha, .trueColorWithAlpha, .indexedColor:
case .indexedColor, .trueColor, .greyscaleWithAlpha, .trueColorWithAlpha:
return CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
}
}
Expand Down

0 comments on commit 11390cb

Please sign in to comment.