             let shadow_color = CIImage(color: shadowColor)
             let shadow = layer.applyingGaussianBlur(sigma: 0.5 * shadowBlur).transformed(by: .translate(x: shadowOffset.width, y: shadowOffset.height))
             
-            let image = shadow_color.cropped(to: extent).applyingFilter("CIBlendWithAlphaMask", parameters: [kCIInputBackgroundImageKey: CIImage.empty(), kCIInputMaskImageKey: shadow])
+            let image = shadow_color.cropped(to: extent).applyingFilter("CIBlendWithAlphaMask", parameters: [kCIInputBackgroundImageKey: GPContext.clear.cropped(to: extent), kCIInputMaskImageKey: shadow])
             
             self.blend_layer(self.apply_clip(image))
         }

        
        mask = mask.cropped(to: extent)
        
        let layer = CIImage(color: color).cropped(to: extent).applyingFilter("CIBlendWithMask", parameters: [kCIInputBackgroundImageKey: CIImage.empty(), kCIInputMaskImageKey: mask])
        
        self.draw_layer(layer)
    }

    
    private var next: GPContext?
    
    public init(width: Int, height: Int) {
        self.width = width
        self.height = height
        self.image = GPContext.clear.cropped(to: CGRect(x: 0, y: 0, width: width, height: height))
    }
}

