The CGContextRef opaque type represents a Quartz 2D drawing destination.
Questions tagged [cgcontext]
977 questions
0
votes
1 answer
UIGraphicsGetImageFromCurrentImageContext crop to content and not to bounding box
I have an area where a user can add their signature to an app, to verify an order.
They sign with their touch.
The only thing is, the frame for the signature is large, and if the user were to make a signature very small, when I save the image, I'm…

Dan Hanly
- 7,829
- 13
- 73
- 134
0
votes
1 answer
clearContextBeforeDrawing in TouchEnd Method
I am using the pencil drawing simply. But i have to show it from rough drawing to Smooth drawing. So I am using the code differently in both touchesMoved and touchesEnded.
The codes are as follows:
-(void)touchesMoved:(NSSet *)touches…

Myaaoonn
- 1,001
- 12
- 25
0
votes
1 answer
How can I use CGContextPathContainsPoint() to detect a point?
I used this function to draw a path between two points. I get the coordinates from Google's API, and there's no problem with this. My problem is, how can I specify whether a particular point is within the path I draw or not? I'm trying to use…

mbrmj
- 119
- 10
0
votes
2 answers
CGContext errors while trying to convert text to image
I am trying to convert text to an image and using that image as a subview. However I get a few errors. I got the piece of script from another stackoverflow post;
/* Creates an image with a home-grown graphics context, burns the supplied string into…

Tim Lodder
- 49
- 1
- 12
0
votes
0 answers
Fill UIImage request objective-c for iphone
i have a strange question...
i have a request: i have a image and my operation in this image will be produce the same image with opacity = 40% and fill = 37%..
but I do not understand the fill request...how can I get this on my UIIMage?
this is my…

Safari
- 11,437
- 24
- 91
- 191
-1
votes
1 answer
iOS: How to draw a wedge?
I need to draw a wedge, which is to say a part of a filled ellipse that goes from one angle up to another angle, e.g. 90 degrees to 110 degrees.
Either a filled wedge would be good, or an outline of a wedge.
Anybody here know how to draw such a…
user945620
-1
votes
1 answer
iOS - Detecting path is below another path
Here is my requirement. Basically it is an eraser concept. I have polygon with n sides. (x,y) of all lines are stored in a model. To erase any part in the polygon, user can draw on the polygon over the lines and if the line comes completely under…

iOS
- 3,526
- 3
- 37
- 82
-1
votes
1 answer
Draw text inside pie chart section created using CoreGraphics
I created a simple pie chart on Swift that looks like this:
Current state
But now I need to add text inside each pie section like this:
Expected result
and I'm not sure how to accomplish that.
This is the code I used to create the graph
override…

Ozz
- 3
- 3
-1
votes
1 answer
UIImageView is resized as per UIImage - Objective C
I am making UIImage from CGIImageRef.
CGImageRef drawImage = CGImageCreateWithImageInRect(croppedImage.CGImage, frame);
UIImage *newImage = [UIImage imageWithCGImage:drawImage];
CGImageRelease(drawImage);
And applying it to Image View:
…

Rahul
- 5,594
- 7
- 38
- 92
-1
votes
1 answer
Why is CGContextDrawImage rotating my image
I'm trying to change the color of an area of my UIImage with CGContext then create a new image from the current state. The original image has the correct orientation but after this, the image turns side ways.
CGRect imageRect = CGRectMake(0, 0,…

Peter
- 1,053
- 13
- 29
-1
votes
1 answer
Using CGRect and CGContext to Create ImageView for Signature Box
I create an image view for an app that I have the user use as a signature box. Right now I'm using the following code to create this "box".
imageFrame = CGRectMake(self.view.center.x/2,
…

aramirez
- 87
- 1
- 1
- 8
-1
votes
2 answers
Previously drawn images not retained using iOS CGContext
I am not able to retain previous drawing images in the CGContext:
//draw a rectangle
-(void)drawSquareAndRect:(CGPoint)from endPoint:(CGPoint)to
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor…

abdul sathar
- 2,395
- 2
- 28
- 38
-1
votes
2 answers
If I save and restore the CurrentGraphicsContext, will that revert my drawing back to original state?
I have an iPad app where I draw a grid of dates along the x axis and times down the y axis. I then draw colored bars (using CGContext methods) in specific sections of this grid (see image).
If I change the data that is used to draw the bars, the…

SpokaneDude
- 4,856
- 13
- 64
- 120
-1
votes
1 answer
Draw different shape after line
I am drawing line using Core Graphics.and i want to append different shape after(semi circle) completion of line .Again after semi circle ,i want to draw line.Here is code :
-(void)drawRect:(CGRect)rect { // Drawing code
CGContextRef context =…

user007
- 69
- 8
-1
votes
1 answer
how to draw text which prompt the user in CGContext
I want to draw text in CGContext. I draw text when I write it from string. But I want to prompt the user this text. How can I do?

mkaracan
- 3
- 3