1
Fork 0

Fix alpha

This commit is contained in:
Joshua Goins 2021-09-29 16:30:57 -04:00
parent 8a83dbc25b
commit a801579bc1

View file

@ -240,7 +240,7 @@ class Document: NSDocument {
return .luminosity
}
return .sourceAtop
return .sourceOver
}
func parseSilicaLayer(archive: Archive, dict: NSDictionary, isMask: Bool) -> SilicaLayer? {
@ -320,7 +320,7 @@ class Document: NSDocument {
let render: CGColorRenderingIntent = .defaultIntent
let rgbColorSpace = isMask ? CGColorSpaceCreateDeviceGray() : info.colorSpace
let bitmapInfo = CGBitmapInfo(rawValue: (isMask ? CGImageAlphaInfo.none : CGImageAlphaInfo.last).rawValue).union(.byteOrder32Big)
let bitmapInfo = CGBitmapInfo(rawValue: (isMask ? CGImageAlphaInfo.none : CGImageAlphaInfo.premultipliedLast).rawValue).union(.byteOrder32Big)
let providerRef: CGDataProvider? = CGDataProvider(data: imageData as CFData)
guard let cgimage = CGImage(width: width, height: height, bitsPerComponent: 8, bitsPerPixel: 8 * numChannels, bytesPerRow: width * numChannels, space: rgbColorSpace, bitmapInfo: bitmapInfo, provider: providerRef!, decode: nil, shouldInterpolate: false, intent: render) else {
@ -505,8 +505,6 @@ class Document: NSDocument {
let kernel = getBlendKernel(layer)
Swift.print(layer.name + " is " + kernel!.name)
if layer.mask != nil {
let grayColorSpace = CGColorSpaceCreateDeviceGray()
let maskBitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue).union(.byteOrder16Big)