From 3b8b2131c44718aa8a42be108755302cc661a8cb Mon Sep 17 00:00:00 2001 From: Harley-xk Date: Fri, 16 Oct 2020 15:49:40 +0800 Subject: [PATCH] fix blend options for image printer --- MaLiang/Classes/Brush/Printer.swift | 7 ++++--- MaLiang/Classes/MetalBase/MetalView.swift | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MaLiang/Classes/Brush/Printer.swift b/MaLiang/Classes/Brush/Printer.swift index 580cf04..1b49099 100644 --- a/MaLiang/Classes/Brush/Printer.swift +++ b/MaLiang/Classes/Brush/Printer.swift @@ -28,11 +28,12 @@ public final class Printer: Brush { attachment.isBlendingEnabled = true attachment.rgbBlendOperation = .add - attachment.sourceRGBBlendFactor = .one - attachment.destinationRGBBlendFactor = .oneMinusSourceAlpha - attachment.alphaBlendOperation = .add + + attachment.sourceRGBBlendFactor = .sourceAlpha attachment.sourceAlphaBlendFactor = .one + + attachment.destinationRGBBlendFactor = .oneMinusSourceAlpha attachment.destinationAlphaBlendFactor = .oneMinusSourceAlpha } diff --git a/MaLiang/Classes/MetalBase/MetalView.swift b/MaLiang/Classes/MetalBase/MetalView.swift index 9ce636d..56656a8 100644 --- a/MaLiang/Classes/MetalBase/MetalView.swift +++ b/MaLiang/Classes/MetalBase/MetalView.swift @@ -48,7 +48,7 @@ open class MetalView: MTKView { open override var backgroundColor: UIColor? { didSet { - clearColor = (backgroundColor ?? .white).toClearColor() + clearColor = (backgroundColor ?? .black).toClearColor() } }