Questions tagged [cgcontextref]
90 questions
0
votes
1 answer
CGContextRef inset?
So, I have this code, that draws a circle with a line around it.
- (void)drawRect:(CGRect)rect
{
CGContextRef contextRef = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(contextRef, 40.0);
CGContextSetRGBFillColor(contextRef, 0.0,…

Sjakelien
- 2,255
- 3
- 25
- 43
0
votes
1 answer
Invalid context warnings with CGContextSetFillColorWithColor
I'm writing an app for the iPad and on iOS 7 I get a littany of warnings in the console along the line of:
: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an…

easythrees
- 1,530
- 3
- 16
- 43
0
votes
1 answer
iOS7 screenshot not taking into consideration blur effect
I'm taking screen shot with this code
- (UIImage *)screenshot {
UIGraphicsBeginImageContext(self.bounds.size);
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
…

Avba
- 14,822
- 20
- 92
- 192
0
votes
2 answers
CGContextFillPath(context) gets removed when creating a line
I use the below code for fill path in viewDidLoadit works perfect
UIGraphicsBeginImageContext(_drawingPad.frame.size);
CGContextRef context1 = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context1, 300,…

Karthikeyan T
- 1
- 2
0
votes
0 answers
Invalid context in drawRect
I'm trying to draw some bezier paths in my view's drawRect method, but I keep getting an invalid context error. I don't understand why, because I thought that there was always a context when drawRect is called. Am I missing something? This is the…

LunaEques
- 178
- 2
- 8
0
votes
1 answer
CGContextRef gives Error
i am using CGContextRef to draw one horizontal bar and above-below of bar i am displaying text using drawInRect method of NSString.Here is code:
CGContextRef context = UIGraphicsGetCurrentContext();//set frame for bar
CGRect frame;
…

user2470111
- 43
- 8
0
votes
1 answer
Incompatible pointer types initializing 'CGContextRef *'
Not gonna lie, I'm trying to follow a tutorial in a book and I can't get past this warning.
Incompatible pointer types initializing 'CGContextRef *' (aka 'struct CGContext **') with an expression of type 'CGContextRef' (aka 'struct CGContext *')
The…

nipponese
- 2,813
- 6
- 35
- 51
0
votes
2 answers
UIImage remove some pixels issue
I have the application where user can erase image.
So if user touches some px of the image, alfa of these pixels should become lower.
For instance, if I touched (0,0) pixel of the image one time, (0,0) px opacity should become 0.9. If I touched that…

Paul T.
- 4,938
- 7
- 45
- 93
0
votes
1 answer
Drawing a line between the coordinates in MKMapView
I want to draw the lines between the coordinates in MKMapView..Here is the code
aRoute=[NSArray arrayWithObjects:[[CLLocation alloc] initWithLatitude:40.445418 longitude:-79.942714],[[CLLocation alloc] initWithLatitude:40.444469…

Icoder
- 330
- 3
- 25
0
votes
0 answers
iOS the lower performance of CGContext when draw a lot of gradient rectange
The effect I want to implement:
Here is the code snippet:
for (NSInteger i = 0; i < count; i++) {
key = [NSString stringWithFormat:@"Property%d", i];
barHeigth = valueHeight * ([[_values objectAtIndex:i] floatValue]/valueMax);
…

HeavenSword
- 119
- 1
- 4
0
votes
1 answer
iPhone - draw a transparent (cleared) rectangle with customized border
I'm trying to draw a rectangle, which should have black color border of width 5.0, I am getting the rectangle as seen below,
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextStrokePath(context);
CGContextSetRGBFillColor(context, 0.0,…

Hemang
- 26,840
- 19
- 119
- 186
0
votes
2 answers
Draw 16 dots in Circular path with CGContextRef
How can I add 16 dot in circular path when the user select a location x,y in my View
and the dots should be in a equal distances,
so when the user hit a location in the view, I will complete the circle with 16 dot,
see attachment.
the image is the…

Aziz
- 612
- 1
- 6
- 11
0
votes
1 answer
CGBitmapContextCreate bitsPerComponent for RBG565
I'm trying to create a CGContextRef using CGBitmapContextCreate. The bitmap I want to create is RBG565 (red and blue are 5 bits, green is 6 bits). One of the parameters for CGBitmapContextCreate is bitsPerComponent. Since I have variable…

yeesterbunny
- 1,847
- 2
- 13
- 17
0
votes
1 answer
Misunderstanding with CALayer in CGContextRef
I have a custom view in which I want to display a CALayer with PDF content. To do so I implemented a delegate NSObject subclass as shown in the first answer to Using CALayer Delegate.
Since I have a document-based app, I have a starting window…

BigCola
- 312
- 1
- 4
- 16
0
votes
1 answer
Getting the CGContextRef from a subview
I'm using UIGraphicsGetCurrentContext() to create a gradient background for a UI element, but I guess I misunderstood where the drawing was taking place. I wanted the drawing to take place on a subview, but instead it's happening in the view itself.…

Andrew
- 14,204
- 15
- 60
- 104