cglayer

How to use a CGLayer to draw multiple images offscreen

Ultimately I'm working on a box blur function for use on iPhone. That function would take a UIImage and draw transparent copies, first to the sides, then take that image and draw transparent copies above and below, returning a nicely blurred image. Reading the Drawing with Quartz 2D Programming Guide, it recommends using CGLayers for ...

Computing a UIImage to be saved to the photo album

I basically want to automatically create a tiled image from a bunch of source images, and then save that to the user's photo album. I'm not having any success drawing a bunch of small UIImage's into one big UIImage. What's the best way to accomplish this? Currently I'm using UIGraphicsBeginImageContext() and [UIImage drawAtPoint], etc. A...

Is CGLayer a good solution?

Hi guys, I want to add a bit of functionality to my App, and I think that using a CGLayer is the best way of doing it, but have never done any Quartz drawing before (other than some basic tutorials). My intention is to show a full view of an image that my App will draw (basic geometric shapes based on parameters) in the top half of a v...

The antialias of rotated CGImage/CGlayer seems jaggy, UIImageView's is not

I need to mask a "texture" image with a rotated greyscale image. I found out, that I have to do it with CGImages or CGlayers (if there is a simplier way using UIImageViews only, please let me know about it). My problem is simple: The antialias of any rotation-transformed CG stuff is quiet jaggy... ... but the antialias of a r...

Set "opacity" of a CGLayer before draw?

I have UIView subclass - actually a puzzle piece - with 2 different CGLayer initialized at initWithFrame. In drawRect I have to blend this two layer, and the uppermost should have variable alpha depending on game-logic. What is the best (most performance optimized) way to do this? Is there any CGLayer, or CGContext function that sets s...

Drawing a CGLayer outside the method drawRect: faster?

I'm not really sure, what am I asking... ...but if make layer composites in separate methods, and draw them to the view also outside of the drawRect: method... ...then could my app performance get raised? I'm actually subclassed a puzzlePiece:UIView class, where the puzzlepiece gets rendered, but the redraw invoked now with setNeedsDis...

Using CGLayer to Cache Cells in a UITableView

I am trying to improve the performance of scrolling in our app. I have followed all of the generally accepted advice (draw it yourself with CG, the cell is opaque, no subviews, etc.) but it still stutters sometimes when we have background CPU and network activity. One solution stated here: http://www.fieryrobot.com/blog/2008/10/08/mor...

iPhone: Crash While Drawing CGLayers Stored in Array

I'm trying to build a drawing app with redo and undo functionality. My idea is to draw lines in a layer in "touchMoved", then saving the layer in "touchEnded". I'm not shure that I am drawing to the layer correct, everything works fine though, until I clear the image I'm drawing in on and try to redraw the layers in the array. - (void)...

How do I create a CGlayer that has an image drawn to it?

I just need to know hot to create a CGLayer that has an image drawn to it. I am not completely understanding the documentation entirely. Thanks ...

Creating a custom animation with CGLayers?

Basically, I want to animate a shrinking circle. I've already done this by drawing progressively smaller circles onto CGLayer's, and then using if(index < 30){ [self performSelector:@selector(showNextLayer) withObject:nil afterDelay:(NSTimeInterval)0.02]; index++; } in my showNextLayer method. This works for my simple goal, but in ge...

Quartz drawing help - CGLayer, UIGraphicsBeginImageContext, UIGraphicsGetCurrentContext

I'm trying to put together a simple example of using some of the quartz api. specifically i'm working on trying to draw an image to a CGLayer to cache it. Then draw that layer to another graphics context more frequently. Here's some source code for the example: header: http://pastebin.com/1qKnexDt class: http://pastebin.com/60FRj5dZ T...

CGLayer from an IUView

Hi On iPhone or iPad someone know how we can get a CGLayer (not a CALayer) from an UIView? Regards ...

How to cache lines to a CGLayer? iPhone Programming

Hello there, I'm having performance issues when drawing with CoreGraphics in my iPhone application, the Idea is to draw a line with the finger. Every suggestion I could find on the internet targeting this problem was: "cache the lines to a CGLayer, so that the application doesn't have to redraw all those lines over and over again". No...

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 into performance issues at fairly low numbers of lines (they are transparent, though), s...

Optimize Core Graphics animated drawing (iPhone)

I have a loop that fires a function 30 times per second. The function changes the position of a couple of points that I use to animate. I draw lines through all the points, meaning that the lines will change 30 times per second. I draw these lines to a CGLayer, which then is drawn to a UIView in the drawRect: method. I do this because I...

How to append drawings to existing CGLayer effectively

Hi, I'm working on a drawing app. Currently all the user's drawings are drawn into separate CALayers. To improve the responsiveness of freehand drawing when the CALayer's path gets large, I am caching parts of the path at regular intervals in a CGLayer. The following code shows how I have implemented this within the CALayer's drawInCont...

CGLayer Performance Issues, what do i wrong?

Hey people, i got a real performance issue on my app after adding a new class. this class extends UIButton. In the initWithFrame: method im setting some parameters like: [self.layer setBorderColor:[[UIColor lightGrayColor] CGColor]]; [self.layer setCornerRadius:5.0]; [self.layer setBorderWidth:1.0]; After that i add some gradient ...

Mixing CGLayers and CALayers

Here's the setup: I have a NSView which is a CALayer-backed view, and contains many CALayers. I have a CALayer for the 'background' of the view, and many small CALayers which are sublayers. Sometimes this view can be very big (as large as 2560x1400), and when it does there is a very noticeable lag in the CALayers. My guess is that Core ...