我想重寫蘋果源代碼,GLPaint應用程序重寫GLPaint,但沒有使用像例子OpenGL的,我想用核心圖形庫。但我堅持顯示像GLPaint這樣的紋理。iphone:使用核芯顯卡
這是我的核芯顯卡代碼:
- (void) drawLineFromPoint: (CGPoint) fromPoint toPoint: (CGPoint) toPoint {
UIGraphicsBeginImageContext(self.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[drawImage.image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
UIImage * image = [UIImage imageNamed:@"Particle.png"];
UIColor * color = [UIColor colorWithPatternImage:image];
CGContextSetStrokeColorWithColor(context, color.CGColor);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, 5.0);
CGContextBeginPath(context);
CGContextMoveToPoint(context, fromPoint.x, fromPoint.y);
CGContextAddLineToPoint(context, toPoint.x, toPoint.y);
CGContextStrokePath(context);
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
---但我收到這樣的結果:
---我想有這樣的結果:
請問我的代碼錯了嗎?任何人都可以幫助我呢?非常感謝你。