Questions tagged [uigraphicscontext]

The UIGraphicsContext is not a class as you might think, but a set of functions that allows access to functions of CGContext. UIGraphicsContext is often used to create images or PDFs from code.

The UIGraphicsContext is the programmatic interface to the graphics contexts.

Since iOS 10 and tvOS 10 UIGraphicsRenderer and its subclasses facilitates the creation of documents via UIGraphicsRendererContext, which are based on Objective-C / Swift classes. The creation process is quite similar to working with functions from UIGraphicsContext so that these functions become less and less important.

314 questions
0
votes
1 answer

Not Rendering properly "UIGraphicsBeginImageContextWithOptions"

I'm just taking a signature and saving with imageMask . Here actually the imageMask rendering properly but the main signature behaves abnormally like 2 lines of it. Here is my code . UIGraphicsBeginImageContextWithOptions(imageView.bounds.size,…
Kumar KL
  • 15,315
  • 9
  • 38
  • 60
0
votes
2 answers

Creating a UIImage from a UIImageView and a UITextView

I am using the following code from a previous answer to create a new UIImage from combining a UIImageView and a UITextView. UIView *parentView = [[UIView alloc] initWithFrame:CGRectZero]; [parentView addSubview:self.imagePreview]; [self.imagePreview…
ORStudios
  • 3,157
  • 9
  • 41
  • 69
0
votes
1 answer

iOS render image in context not working as expected in landscape orientation

The code below seems to work well to render an image from a view at retina resolution. The problem is it does not seem to work while my device is in landscape orientation. It returns an image rotated 90 degrees. Do I need to add options for image…
OWolf
  • 5,012
  • 15
  • 58
  • 93
0
votes
4 answers

Can I pass the CGContextRef to methods called from drawRect?

I found this in the Quartz 2D Programming Guide: To draw to the screen in an iOS application, you set up a UIView object and implement its drawRect: method to perform drawing. The view’s drawRect: method is called when the view is visible onscreen…
SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
0
votes
0 answers

Issue with drawing a point

In my app, I want to draw a dot on the screen (where the user touches). After adding it, I save the incrementalImage and the next point will be added to this image. The problem is, that the first point doesn't appear. What am I missing? …
Levi
  • 7,313
  • 2
  • 32
  • 44
0
votes
1 answer

UIImage Drawing with a color

I have two UIImageViews and I want to copy the image from one to the other and adjust the color but it's causing weird stretching. Here is the code that I use to make the copy: _selectedIcon.image = groupView.icon; [ViewUtils…
CaseyB
  • 24,780
  • 14
  • 77
  • 112
-1
votes
1 answer

How to apply scale when drawing and composing UIImage

I have the following functions. extension UIImage { var width: CGFloat { return size.width } var height: CGFloat { return size.height } private static func circularImage(diameter: CGFloat, color:…
meaning-matters
  • 21,929
  • 10
  • 82
  • 142
-1
votes
1 answer

how to undo last draw stroke in imageContext

I want my swift code to undo the last drawn stroke. I have seen something like the use of PopLast() but connecting that with image view pic does not work. To do the drawing I am using GetImageContext. Which i know has less options with drawing. But…
joe buck
  • 31
  • 1
  • 7
-1
votes
1 answer

Programmatically send image to new view controller when button is clicked

I am trying to make an app that loads a UIWebView in "WebController" and below the UIWebView is a button that takes a screenshot of the UIWebView and saves it to my PhotoLibrary. I want to send the photo that was just taken when the button is…
-1
votes
2 answers

Why do CGContextSetFillColorWithColor and CGContextFillRects both throw "invalid context 0x0" error?

This code: let rect = CGRectMake( 0.0, 0.0, 16.0, 16.0 ) let context = UIGraphicsGetCurrentContext() UIGraphicsBeginImageContext( rect.size ) CGContextSetFillColorWithColor( context, color.CGColor ) CGContextFillRect( context,…
Joseph Beuys' Mum
  • 2,395
  • 2
  • 24
  • 50
-1
votes
1 answer

Deep Copy UIImage with ARC

I have one UIImage which I want to deep copy to another (so that I may add it to an NSMUtableArray of images) I cannot get it to deep copy, I have looked at zones and such but this no luck. This is what I have trieD: _incrementalImage =…
ddoor
  • 5,819
  • 9
  • 34
  • 41
-1
votes
1 answer

Black border in bitmap image in iOS

I am using the following code to create a bitmap image. UIGraphicsBeginImageContextWithOptions(CGSizeMake(targetWidth, targetHeight), NO, 0.0); CGContextRef context = UIGraphicsGetCurrentContext(); …
XYZ
  • 597
  • 1
  • 7
  • 19
-2
votes
1 answer

How to delete around an image UIGraphicsGetCurrentContext instead of fill clear or change size of context - Swift 4

UIGraphicsBeginImageContextWithOptions(startingImageL.size, false, 0.0) let context = UIGraphicsGetCurrentContext()! startingImageL.draw(in: CGRect(origin: CGPoint.zero, size: startingImageL.size), blendMode: .copy, alpha: 1.0) …
devjme
  • 684
  • 6
  • 12
-2
votes
3 answers

How to clear UIView?

I am working on a drawing app where the user draws something on a view. On the same view controller I would like to create a button that would erase everything that was on the view and give it a blank slate. How would I do this? I added all of my…
user8105388
1 2 3
20
21