//get character image
CGImageRef tmp = CGImageCreateWithImageInRect( [_uc.image CGImage], CGRectMake(0, 28, 100, 95));
UIImage *_character = [UIImage resizeImage:[UIImage imageWithCGImage:tmp] width:72 height:72];
UIImage *_bg = [UIImage imageNamed:@"characterbox_bg.png"];
//combine background image + character image
UIGraphicsBeginImageContext(_bg.size);
[_bg drawInRect:CGRectMake(0, 0, _bg.size.width, _bg.size.height)];
[_character drawInRect:CGRectMake(0, 0, _character.size.width, _character.size.height)];
UIImage *_result_img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
=======================================================================
CCSprite *sprite = [CCSprite spriteWithTexture:
[[CCTexture2D alloc] initWithImage:
[_u.image imageByScalingAndCroppingForSize:CGSizeMake(95, 95) withTargetPoint:CGPointMake(5, 5)]]];
댓글 없음:
댓글 쓰기