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

Rounded rect not clip correctly with FICImageFormatStyle8BitGrayscale #109

Open
wongzigii opened this issue Aug 1, 2015 · 2 comments
Open

Comments

@wongzigii
Copy link

Currently, I found that the thumbnail image with FICImageFormatStyle8BitGrayscale are not clipped correctly. The default color one is FICImageFormatStyle32BitBGRA. However, the gray one is not rounded rect, as we hoped for.

img_0030

Here is how the drawingBlockForImage looks like:

- (FICEntityImageDrawingBlock)drawingBlockForImage:(UIImage *)image withFormatName:(NSString *)formatName {
    FICEntityImageDrawingBlock drawingBlock = ^(CGContextRef context, CGSize contextSize) {
        CGRect contextBounds = CGRectZero;
        contextBounds.size = contextSize;
        CGContextClearRect(context, contextBounds);

        // Clip to a rounded rect
        CGPathRef path = _FICDCreateRoundedRectPath(contextBounds, contextSize.width/2);
        CGContextAddPath(context, path);
        CGContextClip(context);

        UIGraphicsPushContext(context);
        [image drawInRect:contextBounds];
        UIGraphicsPopContext();
    };
    return drawingBlock;
}
@wongzigii
Copy link
Author

Please help. If you need any further information, contact me without hesitation.

@luoyibu
Copy link

luoyibu commented Aug 13, 2015

try CGContextEOClip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants