Questions tagged [cglayer]

90 questions
1
vote
0 answers

How to Draw Different Types of Strokes Using CGLayer in Swift

I'm trying to draw different types of strokes using CGLayer in Swift, but I'm not sure how to do it. Can someone please guide me on how to achieve this? Here's the code I have so far: func drawStroke(_ rect: CGRect) { let context =…
1
vote
2 answers

CGL vs OpenGL on Mac

I am trying to figure out the relationship between CGL and OpenGL on Mac platform. More specifically about the context. Do they share context? If yes, how? Please give me a link to some related examples. If no, then are there two contexts working…
RLT
  • 4,219
  • 4
  • 37
  • 91
1
vote
0 answers

iPhone: Create CGLayer with gradient point and transparent background

I would like to create a CGLayer, contains a point with gradient in boundary. Because I will use this layer to draw multiple points on the main screen. This is my code: CGRect r = CGRectMake(0, 0, 64, 64); textureLayer =…
haisergeant
  • 1,111
  • 2
  • 13
  • 32
1
vote
2 answers

iPhone - pushing and pulling a value from a dictionary to a CGlayer

I have a finger painting view that I am implementing undo/redo. All the drawing occurs on a CGLayer called lineLayer. As soon as the user touches the screen but before any modification is done to the screen, I need to quickly grab the views content…
Duck
  • 34,902
  • 47
  • 248
  • 470
1
vote
1 answer

Ever increasing memory usage with bitmap CGContext drawing

I am trying to move a sub-area contents within a CGLayer. The main idea is that I first draw the source area (the part I want to move) into a newly created bitmap CGContext, then make a CGImage from it, and draw it back to the original layer at a…
Terry
  • 337
  • 2
  • 9
1
vote
0 answers

Duplicate sub-area within a CGLayer

I use Core Graphics to draw in an UIView, and cache the contents in a CGLayer. One of its functions needs to duplicate a sub-area of the CGLayer and move it to a new location within the same layer. As a traditional trick, I used to do this by…
Terry
  • 337
  • 2
  • 9
1
vote
1 answer

Save edited image to the iPhone gallery

am working on an app where i am loading one image from the bundle and with the help of quartz i am adding two red circles on that image, the image is loaded in the instance of the UIImageVIew class. I want to save the image with the red circle, so…
Radix
  • 3,639
  • 3
  • 31
  • 47
1
vote
1 answer

How do I autorelease a CGLayer?

I have CGLayers cached in an NSMutableDictionary where I use them as follows: - (CGLayerRef)getLayerForCacheKey:(CacheKey)cacheKey andProperty:(id)property { NSDictionary *cacheDict = [cacheArray objectAtIndex:cacheKey]; if (cacheDict) { …
Aldrich Co
  • 587
  • 6
  • 21
1
vote
1 answer

Unable to release a CGContextRef (context is from a CGLayer)

When you create a CGLayer like so, and then get the context...it appears to be impossible to release the CGContextRef? Releasing the CGLayerRef itself (apparently) works fine. You'd think you could release the CGContextRef just before releasing the…
Fattie
  • 27,874
  • 70
  • 431
  • 719
1
vote
1 answer

iOS: UIButton border color looks fuzzy/blurred only in iphone6(s)

I have been scratching my hair for this question for several days. Basically, the problem is: I have a square button(equal width and height), with an image placed in this UIButton's UIImageView. And I want to have a circular border for this button.…
Chenglu
  • 844
  • 1
  • 9
  • 17
1
vote
1 answer

Caching to CGLayer slower than redrawing on iPhone

I'm in the process of making a simple drawing program for the iPhone. At the moment, touch events add their location to a list which is connected with a bunch of CGContextAddLineToPoint calls which are redrawn in every call to drawRect. I'm running…
jonmorgan
  • 2,570
  • 2
  • 22
  • 27
1
vote
1 answer

Memory issues with CGlayer

I am working CGlayers for drawing. I have implemented the drawing part, the drawingView(canvas) where the user will draw is dynamic, what I mean by this is, user can increase/decrease height of the drawingView(Canvas) For example by default size -…
Ranjit
  • 4,576
  • 11
  • 62
  • 121
1
vote
1 answer

Memory management in Coregraphics (iOS)

I am working on a drawing application, I am using CGlayers for drawing, So I open my canvas for drawing on click of a button, I am using UIBezierPath and then converting it to CGPath in touchesMoved below and then using it to draw …
Ranjit
  • 4,576
  • 11
  • 62
  • 121
1
vote
1 answer

CGlayer drawing getting slow

I am working with CGlayer drawing, I am using 3 CGlayers for drawing, named as temporary, permanent and newLayer. 1) While drawing, I draw first into temporary Layer and on touchesEnded, I transfer data from temporary to permanent Layer and clear…
Ranjit
  • 4,576
  • 11
  • 62
  • 121
1
vote
0 answers

Draw one CGlayer into another CGlayer

I am using two CGlayers for drawing, Layer1 and Layer2, I draw into Layer1 and on touches end, I transfer the data into Layer2 and just clear Layer1, and in my drawRect, method, I draw both layers to context. On erase button clicked, I transfer the…
Ranjit
  • 4,576
  • 11
  • 62
  • 121