Layers

Let the developers know what you think of the software and what can be done to either improve the CFDG language or the Context Free program.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
vapocalypse
Posts: 7
Joined: Tue Jul 19, 2005 8:41 am
Location: Amsterdam

Layers

Post by vapocalypse »

What about a layer control, detemining if a given rule overlaps (the way it is today, with drawing priority, where the most recent rule draws over the previously drawn), is above or below another.

The layer could be accumulated or a specific and immutable value:

layer =1 // would draw always in the layer number 1

layer 1 // would add a level to the current layer; and

layer -1 // would subtract a level

This would require more memory and more processing. Each layer must be an image and, at the end of rendering, the images would be overlapped.

To keep things simple, it could have a limit in the number of layers, like 10 or 20.

What do you think?

--
Apoc

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

This is a lot like the depth-based color blending model that I have been knocking about in my head. I had originally thought that it would be implemented using a depth buffer like it is done in 3D hardware. But then I realized that the alpha channel forces me to draw the shapes from back to front. Once you are sorting the shapes by depth you don't need a depth buffer anymore, which is good because it would have been hard to do in AGG (the graphics library we use).

Keeping the finished shapes sorted in depth order is not that big a deal until we have to spill finished shapes to a temp file. When reading back the temp files we would have to open all of them at once and do a merge sort.

Having a small number of layers and using a bitmap buffer to accumulate shapes in each one would use a lot of memory. Especially when rendering large images. I think that sorting the shapes before drawing them into one bitmap buffer is the way to go. Plus it lets us have lots of layers.

Post Reply