cgcontext Questions

1

Solved

According to this answer by ldoogy, setting the drawsAsynchronously property of CALayer to true enables a Metal based renderer vastly improving performance. This webpage affirms Idoogy's claim. How...
Crosscountry asked 14/1 at 6:57

18

Looking to create a view that has a transparent frame inside of it so that the views behind the view can be seen through this transparent frame, but areas outside of this will not show through. So ...
Averil asked 14/3, 2012 at 22:26

2

The simple UIView below draws a rounded rectangle. When I pass a corner radius of 65 or below it rounds correctly, but 66 and above and it generates a perfect circle! What is going on here? It shou...
Intenerate asked 24/7, 2014 at 14:7

3

Solved

Given an image, when I want to convert to standard sRGB, I can CGContext to help draw it as below. Given the original image When I use the CGContext directly, it redraws correctly extension UIImag...
Everglades asked 26/10, 2020 at 12:10

8

Solved

I try to make a 20x20 UIImage with a simple blue circle. I try with this function, but the result is a blue circle in a black square. How do I remove the black square around the circle? Function: ...
Hagbut asked 21/11, 2013 at 9:4

3

Solved

I can achieve an alternating stripe pattern fill using an image with UIColor(patternImage: UIImage(named: "pattern.png")). However, how can I achieve an alternating stripe pattern fill drawing it ...
Uda asked 27/8, 2016 at 14:8

4

Solved

I am looking to draw a UILabel (preferable through subclassing) as a transparent label, but with solid background. I draw up an quick example (sorry, it's ugly, but it gets the points across :)). ...
Rusel asked 4/1, 2012 at 1:38

4

Solved

Given: a CGContextRef (ctx) with frame {0,0,100,100} and a rect (r), with frame {25,25,50,50} It's easy to clip the context to that rect: CGContextClipToRect(ctx, r); to mask out the red ar...
Olympiaolympiad asked 3/1, 2013 at 19:19

4

Solved

I use the following method to get a decompressed uiimage from file system. However the UIImageView is colored as red when I turn on the color blended layer, even though the UIImageView is set to Op...
Unwieldy asked 28/1, 2014 at 20:40

3

PROBLEM: After I take screenshot the image is blurry when check by zooming. The text inside image seems to be blurred when zoomed. I know this question have been raised many a times but none of the...
Spousal asked 21/12, 2020 at 12:14

1

Solved

I have a Canvas view as below class Canvas: UIView { override func draw(_ rect: CGRect){ super.draw(rect) guard let context = UIGraphicsGetCurrentContext() else { return } paths.forEach {...
Dive asked 31/10, 2020 at 11:2

2

Solved

I am trying to draw a string in the overriden draw method of CALayer (I'm programming for iOS). override func draw(in ctx: CGContext) { let font = UIFont.systemFont(ofSize: 30) let string = NSAt...
Faculty asked 18/10, 2018 at 11:58

8

Solved

I've taken a look at this question: UIImage Shadow Trouble But the accepted answer didn't work for me. What I'm trying to do is take a UIImage and add a shadow to it, then return a whole new UIIm...
Lutestring asked 29/5, 2010 at 20:10

3

Solved

I'm trying to do a simple drawing app for the iPad where you can draw on a picture, and I'm using CGContext stuff to do it but the way I originally planned on handling erasing was to just draw over...
Skiffle asked 9/5, 2011 at 15:31

13

Solved

I'm trying to change color of UIImage. My code: -(UIImage *)coloredImage:(UIImage *)firstImage withColor:(UIColor *)color { UIGraphicsBeginImageContext(firstImage.size); CGContextRef context = ...
Telophase asked 13/10, 2012 at 11:31

8

I want to create different shapes. Below image is the one of example. Will you suggest me how to different shapes?
Aggrandize asked 24/3, 2015 at 8:24

6

I'm trying to create previews images of pages in a PDF but I have some problems with the release of memory. I wrote a simple test algorithm that cycles on the problem, the app crashes near the 40t...
Immune asked 25/2, 2011 at 18:28

8

Solved

I am trying to create a CGContext in swift. It compiles but throws an error at runtime. let colorSpace:CGColorSpace = CGColorSpaceCreateDeviceRGB() let context:CGContext = CGBitmapContextCreate(ni...
Natascha asked 8/6, 2014 at 18:0

3

Solved

Setup: Xcode 6.1 OS X 10.9.5 Swift Mac Document-based Application target Question: I am using Swift to make a Cocoa Mac app (NOT iOS!). I have a custom NSView subclass. I'd like to override -dra...
Mush asked 19/3, 2015 at 23:23

2

I am performing some CG drawing operations into a CGContext that I created for an MKMapOverlayView. After drawing into my context, I create an image and paste it into the context that MapKit provid...
Fley asked 5/8, 2011 at 15:41

4

I am using the framework of route-me for working with locations. In this code the path between two markers(points) will be drawn as a line. My Question: "What code should I add if I want to add an...
Chemotropism asked 23/3, 2010 at 13:26

2

Solved

I am using a UIPrintPageRenderer together with a UIMarkupTextPrintFormatter to print an html page which is rendered in a UIWebView. I am trying to achieve the following: I want to render the html c...
Macropterous asked 3/10, 2017 at 14:15

2

Solved

I am working to add support for wide color photos in iOS 10. When the user takes a photo from the camera, I need to use the new API that supports the new color space to save the photo data - UIGrap...
Overglaze asked 15/1, 2017 at 20:58

3

Solved

I'm drawing to a CGContext and using a CGImageRef-based mask: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextClipToMask(context, rect, _firstMaskImageRef); CGContextSetFillColorWi...
Hoofer asked 6/9, 2013 at 1:46

2

Solved

I'm trying to replicate a function of Instagram where you have your picture and you can add stickers (others images) and then save it. So on the UIImageView that holds my picture, I add the sticke...
Freedafreedman asked 11/12, 2017 at 5:2

© 2022 - 2024 — McMap. All rights reserved.