Monday, May 02, 2005

Update - CoreLayer

OK, So I am coding today CoreLayer. CoreLayer is quite a big component compared to the other components I have been coding in the last two weeks. It deals with the actual layer objects, updating and drawing the layers to the display. CoreLayer is quite a good design since it allows transparency with ease with only one offscreen buffer. Layers are like markup and store the points, actions and commands that layers use to draw like 'draw rectangle at position 0,0 and finish at position 0,0'. When a layer wants to be updated to the display it calls CoreLayerUpdate which adds the layer to the update layer region. It basicly enlarges the region to be big enough to hold all update locations. So if I only update layers in a certain area of the display, only that area is refreshed. CoreLayerDraw does the actual drawing of layers clipped to the update region. When it draws layers, it draws them one on top of each other on the offscreen buffer. It of course uses clipping to increase performance to not draw uneeded parts of the layer. It also only draws from the first base layer and on top. The base layer is found as the first layer on-screen which covers the entire update area and that is not transparent. This basicly will allow me to easily get transparency effects without having to use a mask. It acts more like a pile of papers where it draws the lowest paper and draws each paper on top untill it draws the top paper. While the CoreLayer will only draw basic primatives like lines, rectangles, round rectangles, frames, pixels and other PalmOS drawing primatives, it will expand to support much more complex types in the future.

No comments: