On Mon, Jun 30, 2008 at 9:42 PM, Felipe Sanches <felipe.sanches@...400...> wrote:
definetly I do! What can you tell me about that? What are the basic principels for putting stuff on inkscape canvas?
Since this thing is helper display, i.e. not an object in a document, you create a CanvasItem for it. There are several kinds of them, what you need for this is CtrlRect in display/sodipodi-ctrlrect.cpp. It is used for example for the rubberband and selection rectangle. You can set the fill color and opacity level for such a rect. You can't make a hole in it, though, so you probably need to manage 4 such rects to surround the letter box; it may be a good idea to create a new kind of canvasitem for such "mask with hole". Alternatively, you can use display/canvas-bpath.cpp, which can display any path, then you can just make the hole as a subpath, same as in SVG. However the bpath may be slower to render because it uses cairo, whereas ctrlrect just bit-flips the rectangle. I'm not sure the difference would be noticeable, though.
See e.g. rubberband.cpp for a life cycle of a canvas item - it creates a box (for regular drag selection) or a path (for touch selection), sets their properties, updates coords, then deletes them when no longer needed. Copy code from there.
In addition to that, you will probably need to lock all objects other that the glyph you're editing. Since the glyph will be in defs, you just need to temporarily lock all regular layers. This is easy to do with item->setLocked, but the problem is that this must not be permanent locking that gets written to SVG - when you quit and reload the file, it must have its layers in the original locked/unlocked state. Mental, can you suggest a solution to this?