[CREATE] Multiple viewports (for MyPaint, but Gimp/Krita/whoever too?)

Andrew Chadwick a.t.chadwick at gmail.com
Wed Jul 20 07:52:10 PDT 2011


I'm twiddling away on an unofficial branch of MyPaint which splits the
view of the single working document into multiple viewports, in a
split-screen manner:

-
http://gitorious.org/~achadwick/mypaint/achadwick-mypaint/commits/split-view
- http://en.wikipedia.org/wiki/Split_screen_%28computer_graphics%29

Each split has its own translation, zoom, rotation and mirroring. This
can be used to provide something of a poor man's overview widget, or a
usable mixer palette in a corner of the painting which can be picked
from when working in the opposite corner, or just a pair of zoomed in
and zoomed out views.

The imagined use case for this is that users like to continue work
immediately where they left off when re-opening a saved work on a later
date, and they won't generally want to have to faff around with windows
and controls each time to get it "right". Therefore, save the division
of space in the split windows and where each viewport points, and
recreate the structure when reloading the document.

The branch above uses an ugly mypaint-specific bodge to demonstrate one
approach to this. However I'd like to implement this in as
cross-OpenRaster-consumer a fashion as possible and in a way that can be
preserved by other editors even if they choose not to permit the use
case identified above in their UI. Even if their notion of viewport
splitting is radically different from ours, I'd like to share concepts
as much as humanly possible. So can we come up with some common ground
and agree on a common way of storing the data? I'd really likely to boil
things down to their essence before moving this forward for us.



I can think of some places where MyPaint does things strangely in
general, in all branches:

- View rotation is a number of radians ranging from 0 to 2*pi. It might
be better to express as degrees or a float from 0 to 1.

- View mirroring is a concept which may not be used in all other editors.


Both of these affect the notion of what a view of the document is, but
the split-screen implementation on my branch is somewhat funky too:

 - It's structured as a binary tree dividing space, which is horrible
for other programs which might want to do this as multiple windows but
fast to dump and recreate in terms of two-panel HPaneds and VPaneds.
Leaf nodes are the views themselves. There's no reason this can't be
made into a flat list that's more convenient for other ORA-consumers
though, provided we can store the tree path to each viewport in a path
or name field.

 - Each split is saved along with the position of the divider, expressed
as a proportion of the total width (or height) of the screen. This gains
us some window size-independence. Other implementations may want to save
the sizes of their windows, or even their positions.

 - I use an enforced maximum number of viewports right now. Likely
that's a fairly irrelevant implementation detail.

The nasty JSON dump inside the .ora will *almost certainly* go away as a
result of this discussion; that's just a stopgap implementation and I
don't intend to integrate it into the MyPaint master :)


-- 
Andrew Chadwick


More information about the CREATE mailing list