Fix byte order preventing some masks from being created
This commit is contained in:
parent
fa70f9094b
commit
18392104cd
1 changed files with 8 additions and 1 deletions
|
@ -201,7 +201,14 @@ class Document: NSDocument {
|
||||||
let render: CGColorRenderingIntent = .defaultIntent
|
let render: CGColorRenderingIntent = .defaultIntent
|
||||||
let rgbColorSpace = isMask ? CGColorSpaceCreateDeviceGray() : info.colorSpace
|
let rgbColorSpace = isMask ? CGColorSpaceCreateDeviceGray() : info.colorSpace
|
||||||
|
|
||||||
let bitmapInfo = CGBitmapInfo(rawValue: (isMask ? CGImageAlphaInfo.none : CGImageAlphaInfo.premultipliedLast).rawValue).union(.byteOrder32Big)
|
var bitmapInfo = CGBitmapInfo(rawValue: (isMask ? CGImageAlphaInfo.none : CGImageAlphaInfo.premultipliedLast).rawValue)
|
||||||
|
|
||||||
|
if isMask {
|
||||||
|
bitmapInfo = bitmapInfo.union(.byteOrderDefault)
|
||||||
|
} else {
|
||||||
|
bitmapInfo = bitmapInfo.union(.byteOrder32Big)
|
||||||
|
}
|
||||||
|
|
||||||
let providerRef: CGDataProvider? = CGDataProvider(data: imageData as CFData)
|
let providerRef: CGDataProvider? = CGDataProvider(data: imageData as CFData)
|
||||||
|
|
||||||
guard let cgimage = CGImage(width: tileWidth,
|
guard let cgimage = CGImage(width: tileWidth,
|
||||||
|
|
Reference in a new issue