Yesterday night I had a stimulating session with Thomas on the way forward for Krita and flake integration. Let's try to summarize...
Applications offer a user interface that is specialized for a type of document: think having pages or not and page structure are things defined by the application. The Flake library does not know the concept of pages.
We don't provide the complete user interface for the applications that are responsible for creating a flake shape, but just those parts that are most appropriate to be shared. That means, apps get basic selections, painting tools and layers tools for a krita shape, but not, for instance, the transform tools. Same with Karbon: an application that embeds a path shape can do basic manipulation on it, but for complicated work, Karbon needs to be opened.
That needs to happen in the same process of the original application, but in a different window, while sharing the tool manager. (Or could we use dbus to share the date among two processes?)
There are two ways to tackle this issue. If we want to keep the auto update we can either just use the same shape, or we can use the concepts of collaboration and send diffs between two processes. The second would be a better long term strategy, but is a long way out. (TZ)
We will need to determine along the way which tool belongs with flake (and thus is loaded for every koffice application) and which tool belongs to the specific application. We will also need to determine which bits of the menu associated with the native application for a flake shape to activate when that shape is selected. For instance, Krita's filters are a must-have for an embedded krita image, but the scripting not.
What I forgot to discuss with Thomas is that I would prefer the shape creation tool to be invisible... Just select shapes from the toolbar (for text, table, sheet, formula, image, rect, ecclipse, line and a few more) or from the shape selector (for shapes that look complex to the user, like star, predefined polygon shapes, kivio templates, clipart etc.) (We did discuss the difference between simple and complex shapes, though. Not sure if we reached a conclusion.)
The difference between simple and complex shapes was a bit strange as we had different definitions of what simple and what was complex. For clarity here is what is happening in the PathShape. We have a) Path shapes with all nodes visible and editable. b) special shapes like a star and a rounded-rect. c) Templated shapes. A collection of path-based shapes that can be inserted from a library like kivio's panel. (TZ)
What is complex and what is not complex depends on the app, too, a little: Kivio will need arrow connectors immediately available, while that's not important for Krita.
Krita's guided paint tools (rect, line, star etc) will appear only in Krita, not when a krita-based image shape is embedded in another application.
Three main sections in the toolbox, the second section is subdivided to classify the tools that belong to a shape:
+-------------------+ + manip | create? + +-------------------+ + + + sections for + + current shape + +-------------------+ + buttons for + particular + shapes + + callout or something + for complex shapes +
Look at how [Gobe Productive] solved our problem:
Krita will ship with two types of tools: tools loaded only with Krita and tools loaded by flake to enable working on the contents of a krita image shape. The difference is in the desktop file's service type. When a krita image shape is activated, the krita tools are shown (all tools if the application is krita, else a subset). We cannot currently subgroup tools that are activated for a shape: that is a TODO. (Proposed format for the tooltype: "shape/subgroup". Tools and shapes are linked through a common ID string.
I need to emit a signal indicating which cursor I want whenever a tool needs to change its cursor. I'm still not sure how to do the brush outline in brave new Qt land.
There are three possibilities of which two are compatible:
See this image for the proposed structure: File:Kritaflake.png
I want the last option implemented in Krita. This will give maximum flexibility and make life easier for users.
(Note: This model differs a lot, it seems, from Photoshop's model where vector shapes are not really in the layer hierarchy. I don't care about that: see my upcoming blog post on pleasing photoshop apologists. It would be cool though, if we could render a path shape more than once with different parameters in the layer stack. But that's something we also want to make possible with raster layers, for additional compatibility with OpenRaster and Pippin.)
A Krita image is a shape group with at least one layer shape child. (Krita layers also need to be shapes, but you cannot add a single krita layer as a shape outside a krita image shape. Do we already have a way to enforce such a constraint?)
Inside krita, we need to composite using our own projection rendering code since QPainter offers only 8 bit RGBA composition with only a few porter-duff operations. This is enough (for now) for the other applications like KWord it would be useful to, for instance, composite a text with an image using the screen composite op (which Qt doesn't support yet, only source, destination, over, in, out, atop, clear and xor)
Add a common foreground/background/pattern/gradient/opacity button to the bottom of KoToolBox and extend KoCanvasResourceProvider with convience methods to get at those settings for the tools.