oskare
oskare

Reputation: 1061

CCLayer to UIImage - Anti-aliasing?

When I grab a snapshot of a CCLayer as an UIImage with the help of CCRenderTexture it seems like I'm loosing the anti-aliasing, resulting in the output image looking slightly different from what the screen actually looks like.

Is there a way of getting an output image that corresponds more exactly to what is shown on the screen?

This is how I'm getting my UIImage:

-(UIImage*)layerRepresentation {
    CCLayer *layer1 = self;
    CCRenderTexture *renderer01 = [CCRenderTexture renderTextureWithWidth:layer1.contentSize.width height:layer1.contentSize.height];

    [renderer01 begin];
    [self visit];
    [renderer01 end];

    UIImage *image = [renderer01 getUIImage];
    return image;
}

Upvotes: 1

Views: 467

Answers (1)

Kreiri
Kreiri

Reputation: 7850

When CCRenderTexture is created, it sendssetAliasTexParameters message to its texture. Try

[renderer01.sprite.texture setAntiAliasTexParameters];

Upvotes: 1

Related Questions