KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using the following code to perform some manipulations on the image that I loaded, but I find that the display becomes blurry when it is on the retina display - (UIImage*)createImageSection:(UIImage*)image section:(CGRect)section { float originalWidth = image.size.width ; float originalHeight = image.size.height ; int w = originalWidth * section.size.width; int h = originalHeight * section.size.height; CGContextRef ctx = CGBitmapContextCreate(nil, w, h, 8, w * 8,CGImageGetColorSpace([image CGImage]), kCGImageAlphaPremultipliedLast); CGContextClearRect(ctx, CGRectMake(0, 0, originalWidth * section.size.width, originalHeight * section.size.height)); // w + h before CGContextTranslateCTM(ctx, (float)-originalWidth * section.origin.x, (float)-originalHeight * section.origin.y); CGContextDrawImage(ctx, CGRectMake(0, 0, originalWidth, originalHeight), [image CGImage]); CGImageRef cgImage = CGBitmapContextCreateImage(ctx); UIImage* resultImage = [[UIImage alloc] initWithCGImage:cgImage]; CGContextRelease(ctx); CGImageRelease(cgImage); return resultImage; } How do I change this to make it retina compatible. Thanks in advance for your help Best, DV
Tags (comma-separated)
Save Edits
Cancel