@@ -24,6 +24,7 @@ public enum InputCorrectionLevel: String {
2424}
2525
2626// Code generators are required to provide these two functions.
27+ @available ( macCatalyst 14 . 0 , * )
2728public protocol RSCodeGenerator {
2829 /** The fill (background) color of the generated barcode. */
2930 var fillColor : UIColor { get set }
@@ -55,6 +56,7 @@ public protocol RSCheckDigitGenerator {
5556}
5657
5758// Abstract code generator, provides default functions for validations and generations.
59+ @available ( macCatalyst 14 . 0 , * )
5860open class RSAbstractCodeGenerator : RSCodeGenerator {
5961
6062 open var fillColor : UIColor = UIColor . white
@@ -112,7 +114,7 @@ open class RSAbstractCodeGenerator : RSCodeGenerator {
112114 height = Int ( targetSize. height / targetSize. width * CGFloat( width) )
113115 }
114116 let size = CGSize ( width: CGFloat ( width) , height: CGFloat ( height) )
115- UIGraphicsBeginImageContextWithOptions ( size, false , 0 )
117+ UIGraphicsBeginImageContextWithOptions ( size, false , 1 )
116118 if let context = UIGraphicsGetCurrentContext ( ) {
117119 context. setShouldAntialias ( false )
118120
@@ -247,7 +249,7 @@ open class RSAbstractCodeGenerator : RSCodeGenerator {
247249 return target
248250 }
249251
250- open class func resizeImage( _ source: UIImage , targetSize: CGSize , contentMode: UIView . ContentMode ) -> UIImage ? {
252+ open class func resizeImage( _ source: UIImage , targetSize: CGSize , contentMode: UIView . ContentMode , scale : CGFloat ? = nil ) -> UIImage ? {
251253 var x : CGFloat = 0
252254 var y : CGFloat = 0
253255 var width = targetSize. width
@@ -298,7 +300,7 @@ open class RSAbstractCodeGenerator : RSCodeGenerator {
298300 }
299301 }
300302
301- UIGraphicsBeginImageContextWithOptions ( targetSize, false , 0 )
303+ UIGraphicsBeginImageContextWithOptions ( targetSize, false , scale ?? 0 )
302304 guard let context = UIGraphicsGetCurrentContext ( ) else { return nil }
303305 context. interpolationQuality = CGInterpolationQuality . none
304306 source. draw ( in: CGRect ( x: x, y: y, width: width, height: height) )
0 commit comments