FROM : Jens Alfke
DATE : Thu Mar 06 22:16:28 2008
On 6 Mar '08, at 2:43 AM, Half Activist wrote:
> As I'm investigating on which drawing techniques to use for a
> software I'm planing to create,
> imagine a kind of vector drawing program (that's not really that
> but a somewhat similar).
> In its actual version, all drawing relies on NSBezierPath/Quartz
> primitives and is really fast.
> Now, I'd like to use CALayers and CoreAnimation extensively
I've used CA but am not an expert on its implementation. Here's my
take. Large numbers of layers aren't a problem. Large numbers of
layers *with custom drawing* would be a problem. That's because such a
layer will have a pixmap backing it, and CA will try to keep the
layers' pixmaps in the graphics coprocessor's memory, which is rather
limited.
Bezier paths don't seem like a good candidate for representing via
individual CA layers. A large but simple path can be represented as a
few dozen bytes of memory in an NSBezierPath object, but would require
megabytes of memory for a pixmap. Drawing the pixmap will also require
processing a lot more pixels than drawing the path; if the path is
unfilled, it might be hundreds of times as many.
(On the other hand, layers consisting of solid colors, borders, round
corners and/or text are very cheap, because they're drawn using OpenGL
primitives and don't need a pixmap.)
—Jens
DATE : Thu Mar 06 22:16:28 2008
On 6 Mar '08, at 2:43 AM, Half Activist wrote:
> As I'm investigating on which drawing techniques to use for a
> software I'm planing to create,
> imagine a kind of vector drawing program (that's not really that
> but a somewhat similar).
> In its actual version, all drawing relies on NSBezierPath/Quartz
> primitives and is really fast.
> Now, I'd like to use CALayers and CoreAnimation extensively
I've used CA but am not an expert on its implementation. Here's my
take. Large numbers of layers aren't a problem. Large numbers of
layers *with custom drawing* would be a problem. That's because such a
layer will have a pixmap backing it, and CA will try to keep the
layers' pixmaps in the graphics coprocessor's memory, which is rather
limited.
Bezier paths don't seem like a good candidate for representing via
individual CA layers. A large but simple path can be represented as a
few dozen bytes of memory in an NSBezierPath object, but would require
megabytes of memory for a pixmap. Drawing the pixmap will also require
processing a lot more pixels than drawing the path; if the path is
unfilled, it might be hundreds of times as many.
(On the other hand, layers consisting of solid colors, borders, round
corners and/or text are very cheap, because they're drawn using OpenGL
primitives and don't need a pixmap.)
—Jens
| Related mails | Author | Date |
|---|---|---|
| Half Activist | Mar 6, 11:43 | |
| Chris Ryland | Mar 6, 18:35 | |
| Jens Alfke | Mar 6, 22:16 |






Cocoa mail archive

