Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions GKClasses/GKImageCropView.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,18 @@ - (CGRect)_calcVisibleRectForResizeableCropArea{
return visibleRect = GKScaleRect(visibleRect, sizeScale);
}

-(CGRect)_calcVisibleRectForCropArea{
//scaled width/height in regards of real width to crop width
CGFloat scaleWidth = self.imageToCrop.size.width / self.cropSize.width;
CGFloat scaleHeight = self.imageToCrop.size.height / self.cropSize.height;
CGFloat scale = 0.0f;

if (self.cropSize.width > self.cropSize.height) {
scale = (self.imageToCrop.size.width < self.imageToCrop.size.height ?
MAX(scaleWidth, scaleHeight) :
MIN(scaleWidth, scaleHeight));
}else{
scale = (self.imageToCrop.size.width < self.imageToCrop.size.height ?
MIN(scaleWidth, scaleHeight) :
MAX(scaleWidth, scaleHeight));
}
-(CGRect)_calcVisibleRectForCropArea
{
CGFloat scale = self.imageView.image.size.width / self.imageView.frame.size.width;
scale *= self.scrollView.zoomScale;

//extract visible rect from scrollview and scale it
CGRect visibleRect = [scrollView convertRect:scrollView.bounds toView:imageView];
return visibleRect = GKScaleRect(visibleRect, scale);
visibleRect = GKScaleRect(visibleRect, scale);

return visibleRect;
}


- (CGAffineTransform)_orientationTransformedRectOfImage:(UIImage *)img
{
CGAffineTransform rectTransform;
Expand Down
20 changes: 20 additions & 0 deletions GKImagePicker.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Pod::Spec.new do |s|
s.name = 'GKImagePicker'
s.version = '0.0.2'
s.license = 'MIT'
s.platform = :ios, '5.0'
s.summary = 'Image Picker with support for custom crop areas.'
s.description = 'Ever wanted a custom crop area for the UIImagePickerController?' \
'Now you can have it with GKImagePicker. Just set your custom' \
'crop area and thats it. Just 4 lines of code. If you dont' \
'set it it uses the same crop area as the default' \
'UIImagePickerController.'
s.homepage = 'https://github.com/gekitz/GKImagePicker'
s.author = { 'Georg Kitz' => 'info@aurora-apps.com' }
s.source = { :git => 'https://github.com/fleshgolem/GKImagePicker.git', :commit => '89447bf11bed884824fff865927495ab4cb1f12e' }
s.resources = 'GKImages/*.png'
s.source_files = 'GKClasses/*.{h,m}'
s.preserve_paths = 'GKClasses', 'GKImages'
s.frameworks = 'UIKit'
s.requires_arc = true
end