Re: CALayer maybe silly question

2010-01-28 Thread David Duncan
On Jan 28, 2010, at 12:48 PM, vincent habchi wrote: > Of course. But then, admitting I do indeed draw offscreen and then load > contents in the CALayer, on what object shall I draw? A CGLayer? Something > else? There are only 2 types of context you can create (bitmap & pdf) and only one that c

Re: CALayer maybe silly question

2010-01-28 Thread vincent habchi
Le 28 janv. 2010 à 21:37, David Duncan a écrit : > On Jan 28, 2010, at 12:29 PM, vincent habchi wrote: > >> You're right. Up to that point, I'm quite satisfied with generating the >> contents directly out of the delegate, but, in a sense, your approach is >> more unified, since the same layer c

Re: CALayer maybe silly question

2010-01-28 Thread David Duncan
On Jan 28, 2010, at 12:29 PM, vincent habchi wrote: > You're right. Up to that point, I'm quite satisfied with generating the > contents directly out of the delegate, but, in a sense, your approach is more > unified, since the same layer could then display either vector (drawn out of > the data

Re: CALayer maybe silly question

2010-01-28 Thread vincent habchi
David, > You can create the images on a secondary thread, then pass them back to the > main thread for assignment. The heavy operation is the drawing, not the > uploading of drawn content. You may also want to consider culling some of > that data before you draw it. You're right. Up to that po

Re: CALayer maybe silly question

2010-01-28 Thread David Duncan
On Jan 27, 2010, at 9:52 PM, vincent habchi wrote: >> But at the same time, you could probably simplify this a lot by creating >> CGImages with your content and then assign those images as the contents of >> your layers from the main thread. This is almost certainly likely to be >> simpler and

Re: CALayer maybe silly question

2010-01-27 Thread vincent habchi
David, Le 28 janv. 2010 à 00:09, David Duncan a écrit : > Are you calling -drawLayer:inContext: yourself? if you are, don't do that - > just call -setNeedsDisplay on the layer, it will do the right thing. Yes, that exactly what I do: I have set up a custom loop event, that I trigger each time

Re: CALayer maybe silly question

2010-01-27 Thread David Duncan
On Jan 27, 2010, at 7:27 AM, vincent habchi wrote: > Let's say I have a ScrollLayer with 9 underlying tiles (CALayer). Each tile > has a delegate to provide contents via DrawLayer:inContext:. At init time, > these delegates create a linked object that spawns a thread that runs its run > loop (I

Re: CALayer maybe silly question

2010-01-27 Thread vincent habchi
David, Le 25 janv. 2010 à 21:39, David Duncan a écrit : > If you want to draw to a layer on a separate thread, you need to run the > runloop on that thread, as Core Animation is pretty highly dependent on the > run loop operating. If you call -setNeedsDisplay on a thread where you never > run

Re: CALayer maybe silly question

2010-01-25 Thread vincent habchi
David, Le 25 janv. 2010 à 21:39, David Duncan a écrit : > If you want to draw to a layer on a separate thread, you need to run the > runloop on that thread, as Core Animation is pretty highly dependent on the > run loop operating. If you call -setNeedsDisplay on a thread where you never > run

Re: CALayer maybe silly question

2010-01-25 Thread David Duncan
On Jan 25, 2010, at 12:02 PM, vincent habchi wrote: > the silly question is this: is it possible to redraw a CALayer in background? > > More specifically, I've written a delegate method drawLayer:inContext: that > creates a thread that does the drawing then returns. If you want to draw to a l