-(void)drawRect:(CGRect)rect
{
NSString* imageName = [[NSString alloc]initWithFormat:@"b%d.png",m_Index];
UIImage* aImage = [UIImage imageNamed:imageName];
[imageName release];
int width = aImage.size.width;
int height = aImage.size.height;
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(nil,width,height,8,0, colorSpace,kCGImageAlphaPremultipliedLast);
CFRelease(colorSpace);
CGContextDrawImage(context, CGRectMake(0, 0, width,height), aImage.CGImage);
CGImageRef image = CGBitmapContextCreateImage(context);
CGContextRelease(context);
UIImage* display = [UIImage imageWithCGImage:image];
[display drawInRect:CGRectMake((480-width)/2, (320-height)/2,width,height)];
}
双缓冲 iphone
最新推荐文章于 2025-09-10 14:51:55 发布
