[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kcanvas
From:       Rob Buis <rwlbuis () xs4all ! nl>
Date:       2005-04-19 20:14:47
Message-ID: 20050419201447.649C73C8 () office ! kde ! org
[Download RAW message or body]

CVS commit by buis: 


Updating some sections.


  M +36 -1     DESIGN   1.6


--- kdenonbeta/kcanvas/DESIGN  #1.5:1.6
@@ -119,12 +119,47 @@
 http://www.w3.org/TR/SVG11/pservers.html
 
+- KCanvasResource
+
+Most paintservers are KCanvasResources. This class makes sure any change on
+the paint server invalidates every item using the paint server.
+For example, when a gradient resource changes a color stop, all items using
+said gradient will be invalidated and redrawn on the next update(). Since
+not every change on a parameter of a paintserver should trigger a redraw
+(for instance you don't want this while initializing the canvas) an
+explicit call named invalidate() has to be done on the KCanvasResource.
+
 - KRenderingStyle
 - KCanvasCreator
 
+Currently the following canvas items can be created using the
+KCanvasCreator singleton:
+
+- lines
+- rectangles (possibly rounded)
+- circles
+- ellipses
+- paths
+- containers
+
+Items are inserted into the canvas. Later additions are drawn above items
+added before, ie. the zIndex increases on every item insertion.
+Here is a code snippet of the creation of a canvas item, in this case a rounded \
rect: +
 <code-snippet>
         canvas->insertItem(KCanvasCreator::self()->createRoundedRectangle(canvas, \
rectStyle, 120, 100, 140, 160, 5, 10));  </code-snippet>
 
-One needs to understand that line after reading this section...
+Note that for manipulating individual canvas items at a later time it is
+convenient to keep a pointer to the canvas item:
+
+<code-snippet>
+        KCanvasItem *item = KCanvasCreator::self()->createRoundedRectangle(canvas, \
rectStyle, 120, 100, 140, 160, 5, 10); +</code-snippet>
+
+Do not worry about it being a pointer, the canvas keeps track of the item
+and will delete it when it is itself shutting down.
+Now that we have a pointer to the item, we can do things like lower()/raise(),
+get the bbox() of the item and hit detection using fillContains()/strokeContains().
+Have a look at KCanvasItem.h for what you can do with KCanvasItems.
 
 5. Writing rendering targets [TODO]


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic