Requirements

Name

Requirements -- Requirements for the preview.

Introduction

This is the list of requirements for a preview. This list was the result of a discussion on the Gimp-developer list.

Requirements for a GIMP plug-in preview widget V1.1
===================================================

INTRODUCTION

This document gives a possible list of requirements for a preview
widget that can be used by GIMP plug-ins.  

This document was written by Maurits Rijk <lpeek.mrijk@consunet.nl>
and Ernst Lippe <ernstl@planet.nl>.

HISTORY

This version reflects the results of the discussion on the
Gimp-developer mailing list in February 2003.

All requirements about signals, that should be emitted when the user
when the user scrolls or zooms with the GUI, have been dropped for the
moment.


REQUIREMENTS

REQUIREMENT 1: A plug-in author must be able to write a single version
of the rendering function that can both be used for rendering to the
plug-in and for rendering to the final drawable.

Far too many plug-ins that have a preview contain two different
versions of the rendering algorithm: one for the preview and another
one for the final result.  For plug-ins that don't have a preview yet
it is very desirable that the interface for generating a rendered
image for the preview is very similar to the interface for generating
the final results.


REQUIREMENT 2: The preview must support a GUI for scrolling through
the image.

There are two possible GUI styles: dragging in the preview and using
scrollbars.  These can also be combined.


REQUIREMENT 3: When dragging can be used to scroll the preview it
should show a "move" cursor in the preview image.

This gives visual feedback to the user that the image can be scrolled.


REQUIREMENT 4: During scrolling the preview should optionally show a
(possibly scaled) version of the original image.

In many cases rendering algorithms are too slow to support real-time
scrolling.  It must be possible to turn this feature off.  This would
be better when the rendering algorithm is fast and when the rendered
result bears little resemblance to the original image.


REQUIREMENT 5: The preview must support zooming.

Viewing a rendered image at different scales is very useful for a wide
range of plug-ins.


REQUIREMENT 6: The preview must contain an optional GUI for zooming.

A standard GUI for zooming the preview increases the uniformity of
plug-ins and makes life easier for plug-in writers.  It must be
possible to hide the zooming GUI for previews that either don't
support zooming or use a different interface.


REQUIREMENT 7: The preview must be able to handle both scaled and
unscaled rendered data.

In some cases the rendering algorithm may be able to produce a scaled
version of its outputs.  In many cases the rendering algorithm cannot
easily produce scaled data and then the preview should do the scaling.


REQUIREMENT 8: The scaling algorithm must be stable under scrolling.

The user must have the impression of scrolling through a fixed scaled
version of the image.  When the scaling algorithm is not stable, the
preview will flicker during the scroll, which is highly annoying.  In
most cases this is caused by rounding errors.  It is surprisingly
difficult to write a good scaling algorithm due to these numerical
problems.


REQUIREMENT 9: During zooming the preview should attempt to keep the
center of the previewed image at the same position.

This is similar to the visual behaviour of zooming with a camera.


REQUIREMENT 10: The preview must support an API to scroll the preview
and change the magnification.

This functionality is needed to synchronize multiple previews.


REQUIREMENT 11: The preview must be able to halt the rendering
algorithm.

Frequently, the user will perform actions like scrolling or zooming
that makes the image, that is being rendered by the rendering
function, obsolete. There must be some way for the preview to inform
the rendering function that it can stop.


REQUIREMENT 12: The user must be able to continue scrolling and
zooming even when the rendering function is still rendering a new
image.

With slow rendering algorithms it is intolerable when the widget
"locks up" during rendering.  When the user scrolls or zooms the
preview, the image that is currently being rendered becomes obsolete.


REQUIREMENT 13: The preview must supply a mechanism that prevents
showing obsolete rendered images.

It is possible that the rendering function will attempt to display
image data in the preview that already has been obsoleted because the
preview was scrolled or zoomed. The preview should ignore such
obsolete drawing requests.


REQUIREMENT 14: The preview must have an optional progress bar to
indicate the progress of the rendering function.

With slow rendering functions it is not obvious to the user when the
rendering function has updated the display.  It must be possible to
hide the progress bar.


REQUIREMENT 15: The preview must be resizable at run-time.

In some cases users would like to enlarge the preview to get a better
overview of the results.  On the other hand large previews take more
time to render and may clutter up the display. A resizable preview
allows the user to select an optimal size.  This requirement does not
imply that the preview should offer a GUI for resizing, but only that
it should respond when Gtk has allocated a new size for the preview.


REQUIREMENT 16: The preview must handle alpha by showing a
checkerboard pattern.

The GIMP GUI always handles alpha in this way.


LOW PRIORITY REQUIREMENTS

The following point is not a formal requirement.

NICE TO HAVE 1: The preview must support incremental updates of
rendered image data.

With slow rendering algorithms it may be desirable to update the
preview as soon as new parts of the image have been rendered.

This requirement comes from the GIMP TODO list. It is not clear how
this should be implemented.


NON-REQUIREMENTS

The following points have been mentioned in discussions about the
preview widget. They are listed here because we explicitely don't want
to support them.

NON-REQUIREMENT 1: Preview the rendered results in the original image
window.

The rendered image should be shown in the original image window.

Comment: This is one of the suggestions from the GUAD3C meeting.  It
does not seem relevant for the preview widget.


NON-REQUIREMENT 2: Split preview window with before and after version
of the image.

The user must be able to split the preview into two parts, one part
showing the original image and the other part showing the rendered
image.

Open issue: How should the preview be split? Suggestions have been
left/right, top/bottom and even diagonally.

Comment: This is one of the suggestions from the GUAD3C meeting.  It
is not clear what the GUI for splitting/unsplitting should be.  Also
it seems much more useful to show before/after versions of the same
area and not only for adjoining areas (which was the proposal, if I
understood it correctly).  Another disadvantage is that it makes the
preview-code more complicated.  When you really want to show both
before and after it seems much easier to have two different previews
that are synchronized with each other.