Fix alpha
This commit is contained in:
parent
8a83dbc25b
commit
a801579bc1
1 changed files with 3 additions and 5 deletions
|
@ -240,7 +240,7 @@ class Document: NSDocument {
|
||||||
return .luminosity
|
return .luminosity
|
||||||
}
|
}
|
||||||
|
|
||||||
return .sourceAtop
|
return .sourceOver
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseSilicaLayer(archive: Archive, dict: NSDictionary, isMask: Bool) -> SilicaLayer? {
|
func parseSilicaLayer(archive: Archive, dict: NSDictionary, isMask: Bool) -> SilicaLayer? {
|
||||||
|
@ -320,7 +320,7 @@ 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.last).rawValue).union(.byteOrder32Big)
|
let bitmapInfo = CGBitmapInfo(rawValue: (isMask ? CGImageAlphaInfo.none : CGImageAlphaInfo.premultipliedLast).rawValue).union(.byteOrder32Big)
|
||||||
let providerRef: CGDataProvider? = CGDataProvider(data: imageData as CFData)
|
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 {
|
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 {
|
||||||
|
@ -504,9 +504,7 @@ class Document: NSDocument {
|
||||||
var maskContext: CGContext?
|
var maskContext: CGContext?
|
||||||
|
|
||||||
let kernel = getBlendKernel(layer)
|
let kernel = getBlendKernel(layer)
|
||||||
|
|
||||||
Swift.print(layer.name + " is " + kernel!.name)
|
|
||||||
|
|
||||||
if layer.mask != nil {
|
if layer.mask != nil {
|
||||||
let grayColorSpace = CGColorSpaceCreateDeviceGray()
|
let grayColorSpace = CGColorSpaceCreateDeviceGray()
|
||||||
let maskBitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue).union(.byteOrder16Big)
|
let maskBitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue).union(.byteOrder16Big)
|
||||||
|
|
Reference in a new issue