Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of the scale of the display to generate the correct dimensions for the blurred image. #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions Classes/UIImage+StackBlur.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ - (UIImage*) stackBlur:(NSUInteger)inradius
CGImageRef imageRef = CGBitmapContextCreateImage(ctx);
CGContextRelease(ctx);

UIImage *finalImage = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
UIImage *finalImage = [[UIImage alloc] initWithCGImage:imageRef scale:[UIScreen mainScreen].scale orientation:self.imageOrientation];
CGImageRelease(imageRef);
CFRelease(m_DataRef);
free(m_PixelBuf);
return finalImage;
Expand Down Expand Up @@ -127,7 +127,7 @@ + (void) applyStackBlurToBuffer:(UInt8*)targetBuffer width:(const int)w height:(

const size_t dvcount = 256 * divsum;
int *dv = malloc(sizeof(int) * dvcount);
for (int i = 0;i < dvcount;i++) {
for (size_t i = 0;i < dvcount;i++) {
dv[i] = (i / divsum);
}

Expand Down Expand Up @@ -321,7 +321,7 @@ - (UIImage *) normalize {
CGContextDrawImage(thumbBitmapCtxt, destRect, self.CGImage);
CGImageRef tmpThumbImage = CGBitmapContextCreateImage(thumbBitmapCtxt);
CGContextRelease(thumbBitmapCtxt);
UIImage *result = [UIImage imageWithCGImage:tmpThumbImage];
UIImage *result = [[UIImage alloc] initWithCGImage:tmpThumbImage scale:[UIScreen mainScreen].scale orientation:self.imageOrientation];
CGImageRelease(tmpThumbImage);

return result;
Expand Down