cgcontextref

    0熱度

    1回答

    我想色My字符串,並以矩形繪製它,我的代碼是 CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetTextDrawingMode(context, kCGTextFillStroke); CGContextSetRGBStrokeColor(context, 210.0/255.0f, 0.0f, 0.0f, 1.

    0熱度

    1回答

    在這段代碼中我使用CGContextRef到我UIView創建下一個圖片: CGMutablePathRef arc = CGPathCreateMutable(); CGFloat lineWidth = 16.0; CGContextRef cont = UIGraphicsGetCurrentContext(); CGContextFlush(cont); CGContextSetS

    -1熱度

    1回答

    對不起,但我對CGContext的瞭解相當有限。 我使用的是接受的答案HERE中的代碼在UIView中繪製星星。我想要實現的是以2種不同顏色顯示星星(如評分視圖)。問題是,我似乎無法使用CGContextSetFillColorWithColor()的2種不同顏色。 相關代碼: if (i < 3) { NSLog(@"__BLACK__"); CGContextSetFi

    0熱度

    1回答

    查看GPUImagePosterizeFilter看起來像使用紋理中的像素代替顏色似乎很容易。假設我有一個由10個灰度色組成的圖像。我想用來自10種不同紋理樣本的像素替換來自10種顏色的每個像素範圍。 什麼是創建紋理的正確方法?我使用下面的代碼(我不知道發送到CGBitmapContextCreate的alpha參數)。 CGImageRef spriteImage = [UIImage imag

    1熱度

    1回答

    我想知道當前的CGContext用於圖像,PDF或用於屏幕繪製。在可可我只使用[[NSGraphicsContext currentContext] isDrawingToScreen]([10.10上的NSGraphicsContext currentContextDrawingToScreen])。我怎樣才能從CGContext獲得相同的信息?

    0熱度

    1回答

    我走的屏幕截圖與此代碼 - (UIImage *)screenshot { UIGraphicsBeginImageContext(self.bounds.size); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromC

    0熱度

    2回答

    我試圖在視網膜@ 2x顯示器上創建3像素寬度的線。簡單的想法是創建一個1.5寬度線: UIGraphicsBeginImageContextWithOptions(CGSizeMake(20, 20), NO, 0.0f); CGContextRef aRef = UIGraphicsGetCurrentContext(); CGContextSetAllowsAntialiasing(aRe

    1熱度

    1回答

    任何人都知道如何更新此代碼的iOS 8?我收到此錯誤信息:每行 CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 32 bits/pixel; 3-component color space; kCGImageAlphaPremultipliedFirst; 4294967289

    2熱度

    1回答

    我發現,獲取一個像素的顏色在一個點在這裏的Objective-C代碼的例子: How to get the pixel color on touch? 我需要幫助的代碼的特定部分中,上下文使用CGColorSpaceCreateDeviceRGB創建: ---這是Objective-C代碼 unsigned char pixel[4] = {0}; CGColorSpaceRef colorSp

    0熱度

    1回答

    所以,我有這個代碼,它圍繞它畫一個圓圈。 - (void)drawRect:(CGRect)rect { CGContextRef contextRef = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(contextRef, 40.0); CGContextSetRGBFillColor(contextR