diff --git a/ImageEditor/HFImageEditorViewController.h b/ImageEditor/HFImageEditorViewController.h index b5e039a..ad84eba 100644 --- a/ImageEditor/HFImageEditorViewController.h +++ b/ImageEditor/HFImageEditorViewController.h @@ -19,6 +19,7 @@ typedef void(^HFImageEditorDoneCallback)(UIImage *image, BOOL canceled); @property(nonatomic,assign) CGFloat outputWidth; @property(nonatomic,assign) CGFloat minimumScale; @property(nonatomic,assign) CGFloat maximumScale; +@property(nonatomic,assign) CGColorRef outputBackgroundColor; @property(nonatomic,assign) BOOL panEnabled; @property(nonatomic,assign) BOOL rotateEnabled; diff --git a/ImageEditor/HFImageEditorViewController.m b/ImageEditor/HFImageEditorViewController.m index b23a5b4..5efd327 100644 --- a/ImageEditor/HFImageEditorViewController.m +++ b/ImageEditor/HFImageEditorViewController.m @@ -79,6 +79,7 @@ - (void)commonInit self.panEnabled = YES; self.scaleEnabled = YES; self.rotateEnabled = YES; + self.outputBackgroundColor = [[UIColor clearColor] CGColor]; } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -610,7 +611,7 @@ - (CGImageRef)newTransformedImage:(CGAffineTransform)transform 0, CGImageGetColorSpace(source), CGImageGetBitmapInfo(source)); - CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]); + CGContextSetFillColorWithColor(context, self.outputBackgroundColor); CGContextFillRect(context, CGRectMake(0, 0, outputSize.width, outputSize.height)); CGAffineTransform uiCoords = CGAffineTransformMakeScale(outputSize.width/cropRect.size.width, diff --git a/README.md b/README.md index cdbcf80..3de93e7 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,10 @@ The width of the cropped image. If not defined, the width of the source image is The bounds for image scaling. If not defined, image zoom is unlimited. #### checkBounds -Set to true to bound the image transform so that you dont' get a black backround on the resulting image. +Set to true to bound the image transform so that you dont' get a backround on the resulting image. + +#### outputBackgroundColor +The color used to fill a background of the resulting image if checkBounds property is set to false and a margin exists. #### panEnabled, rotateEnabled, scaleEnabled, tapToResetEnabled BOOL property to enable/disable specific gestures