Answer the question
In order to leave comments, you need to log in
Weird black border around the PNG image, in places of translucency (CoreGraphics/ObjC)
When I try to render PNG images with translucency, I get this
: strange dark pixels in places with translucency, although they obviously should not be there.
Original image - normal:
Render code:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
UIImage* allIcons = retain];
CGRect rect = CGRectMake( 0, 0, allIcons.size.width/nIcons, allIcons.size.height );
UIGraphicsBeginImageContext(rect.size);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextTranslateCTM ( currentContext, 0, allIcons.size.height );
CGContextScaleCTM ( currentContext, 1, -1 );
CGRect clippedRect = CGRectMake(0, 0, rect.size.width, rect.size.height);
CGContextClipToRect( currentContext, clippedRect);
CGRect drawRect = CGRectMake(rect.origin.x * -1, rect.origin.y * -1, allIcons.size.width, allIcons.size.height);
CGContextDrawImage(currentContext, drawRect, allIcons.CGImage);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question