UNISPEC v. 1.11 UPDATE
This addendum describes the new features of v. 1.11 (compared
to v. 1.0). Except for one small addition to the 16-color
converter, all these new features have to do with making
512-color delta animations. Also, with this Unispec release
we included a utility program which converts Spectrum picture
files into 256-color GIF files (you'll find it in the GIF
folder). GIF (Graphics Interchange Format) was developed by
Compuserve to allow exchange of computer images between
different systems. GIF is supported by Macintosh, Amiga and
IBM.
First, the 16-color converter addition: now when you save
16-color pictures to disk you can choose either Degas
low-resolution format (.PI1) or NEOchrome format (.NEO).
Press "P" to save as .PI1 or "S" (Save) for .NEO. If you
press "P", the picture is automatically saved under the name
UNISPEC.PI1 ("S" saves as UNISPEC.NEO). If you use UNISPEC's
Picture Ram disk, keep in mind that it has room for only one
picture; so, if you've used .NEO and then switch to .PI1
during the same session, you must first drag UNISPEC.NEO to
the trash can to make room for UNISPEC.PI1.
512-Color Delta Animation
UNISPEC 1.11 allows you to save the difference between any
two 512-color pictures to disk ("delta file"). Deltas are
very useful for animation: typically, you want your animation
to move smoothly, and that means changing your image only a
little bit with each step. If you save each frame of your
animation as a separate picture file, they still take a lot
of disk space (up to 50K each), no matter how little you
change them. With delta files it's a different story: the
smaller the change the smaller the file size. It can be as
small as a few bytes, but most often it's between hundreds of
bytes and several K.
UNISPEC 1.11 creates deltas by comparing any full screen
image in the picture buffer with the image on the main
screen. The differences between these two images (or
"Frames") are determined, and saved as a Delta file on disk.
Let's see how it works. Load any picture to UNISPEC's main
screen (or draw something) and copy the whole picture to the
buffer (select BLOCK PIC-BUF and double-click anywhere, use
the COPY mode so that a copy of your picture remains on the
main screen). Now change your picture a little - for
instance, draw a short line with DRAW. What you have on the
screen now is the 'current frame' of your animation; the
original that you copied to the buffer is the 'previous
frame'. Press the function key F10 to take a look at the
previous frame, just to make sure it's there (F10 always
exchanges the last full screen in the buffer with the main
screen). Press F10 again to put it back.
To create a delta between your two frames press CONTROL-F10.
The standard file selector will appear, with the preset
filename extension .SPD (for SPectrum Delta). Type a filename
and click Ok (you don't need to type the extension, it will
be added automatically).
Note that you can set the pathname (disk and folders) for
saving deltas separately from the one used for pictures, and
it will be remembered when you save your next delta. The
same is true for the load delta pathname (see below).
You can exit to the desktop and take a look at the delta file
you just created. It should be pretty small. That's all
there is to saving deltas. Deltas are always created between
the picture on the main screen and any full-screen picture in
the buffer (partial blocks in the buffer are ignored). If
you have several full-screen pictures in the buffer you can
specify any of them by pressing CONTROL and the appropriate
function key - the same function key that brings that picture
to the main screen when you press it without CONTROL. We
used F10 in the above example for convenience. F10 always
indicates the last picture in the buffer, no matter how many
are there. Notice also, that CONTROL-Fn does not exchange
the screen in the buffer with the main screen. Your 'current
frame' is still displayed.
We'll guide you through the procedure of creating a series of
deltas that form an animation in a moment. First let's try
loading deltas from disk into UNISPEC using the delta we just
created. Bring your original picture (the 'previous frame')
to the main screen. (Pressing F10 should do it, if it's
still in the buffer). Press the INSERT key. The file
selector will come up. Select the delta file you created a
moment ago, and click Ok. The delta file will be loaded and
immediately applied to the picture on the main screen,
transforming it into the second picture (the one we called
'current frame' when creating our delta). This is what
deltas do: a delta between two pictures -- we'll call them
picture #1, picture #2 -- transforms one into the other. The
delta itself is not a picture, you can't see it. It's just
data that performs that transformation.
Deltas are symmetrical: if you apply the same delta to
picture #2 (by loading that delta while picture #2 is on the
main screen), you get picture #1. Try it now, by pressing
INSERT and selecting our delta file in the file selector.
Likewise, when you create a delta it doesn't matter which of
the two pictures is on the main screen and which is in the
buffer - the result is the same. Load delta operation cannot
be UNDOne, but don't worry: since deltas are symmetrical,
loading the same delta again will restore the original
picture.
To create a long animation you simply save many consecutive
deltas. Since deltas are not pictures themselves, they must
have a starting point, an initial picture that deltas are
applied to. In the case of Spectrum deltas this is any
regular UNISPEC screen that represents the first frame of the
animation. This 'initial frame' is saved to disk (as a
regular picture file) along with its associated deltas.
Together they contain all of the information needed to
playback our animation in real time.
The basic procedure in UNISPEC goes like this: You draw
picture #1, save it to disk (the initial frame), then draw
picture #2, create a delta between #1 and #2, save it, and
store picture #2 in the buffer. Then you draw picture #3,
create a delta between #2 and #3, save it,and store #3 in the
buffer, and so on. In the end you'll have one picture (#1)
and many deltas.
Let's create a simple animation of an object moving across
the screen. First we'll create our initial frame and get set
up for delta creation.
Load any picture to the main screen. We'll use it as a
background (an empty screen is ok, too). Clear everything
from the buffer (select BLOCK BUF-PIC and Alt-left-click on
each block you have there). Copy your background picture to
the buffer (select BLOCK PIC-BUF and double-click on the
picture). We are going to use this background picture many
times, so it's handy to have it at the top of the buffer.
For the sake of simplicity our moving object will be one of
the Spectrum brushes. So, select any brush you like and stamp
it, let's say, near the upper left corner of the screen. We
just created our picture #1 (the initial frame). Before going
any further, SAVE it to disk. Remember, without this initial
frame all of our deltas will be useless. When saving use the
uncompressed format (you'll see why later). Finally, Copy the
whole picture #1 from the main screen to the buffer (while
you are at it, switch the BLOCK mode to OPAQUE, we'll need it
later). Now all preparations are finished. The background
picture is in buffer screen 1, the previous frame is in
buffer screen 2, and we're ready to proceed.
Operations in this paragraph can be repeated any number of
times. Select BLOCK BUF-PIC (you must be in the OPAQUE
mode), double-click on our background picture (screen 1) and
then left-click to copy it to the main screen. Select the
same brush you used before and stamp it somewhat to the right
of where it was on the previous picture. You can take a
quick look at the previous picture by pressing F2, just to
get an idea where to stamp this time (don't forget to put
everything back by pressing F2 again!). Now press CONTROL-F2
to save the delta between the current picture and the
previous one. Use a filename something like BRUSHAA (the next
time BRUSHAB, BRUSHAC and so on, changing the last two
letters in alphabetical order -- AA through ZZ). When the
delta is saved, press F2. The current picture moves to the
buffer screen 2 and becomes the previous picture. That
completes the cycle! Now you can go back to the start of
this paragraph to continue.
Please note that CONTROL-Function key combinations for
creating deltas work only in a normal drawing state: no menus
down, no color matrix, no block paste box. One reliable way
to get to a normal drawing state is to select DRAW in the
menu.
You can stop any time you like. Now that you saved your
deltas to disk you can examine the whole sequence. Load
picture #1 from disk (the uncompressed initial frame we saved
earlier) to the main screen, then press INSERT and select the
first delta (BRUSHAA.SPD in our example). When it loads
picture #1 will transform into picture #2. You could
continue in the same fashion (press INSERT and select
BRUSHAB.SPD), but there's a more convenient way: just press
the up cursor key (the up arrow). This increments the
filename automatically (in the alphabetical order) and loads
the next delta.
You can press the up cursor key repeatedly to walk through
your animation. Likewise, the down cursor key lets you go
backward (it decrements filenames). If you reach either end
UNISPEC simply displays "TOS error #33", which means "File
not found". That tells you that you're at the very start or
the very end. This cursor key feature depends on delta
filenames being in unbroken alphabetical order. You can use
filenames of any length from 1 to 8 letters. The last letter
is continuously incremented; when it reaches Z it goes back
to A and the previous letter is incremented, and so on. With
8 letters you can have billions of different filenames. Just
using the last two letters -- AA through ZZ yields 676
different names. Remember, before stepping through frames
with the cursor keys, you must start by selecting a delta
with the INSERT key. This is the only way UNISPEC will know
the delta filename to increment.
Note that each delta should only be applied to either of the
two pictures it was created with. If you load a delta when
the main screen contains some picture unrelated to this
delta, you simply get some colorful garbage. Keep this in
mind in case you decide to edit some picture in your
sequence. For instance, if you change picture #1 and try to
use the original deltas you'll get some unwanted changes on
all other pictures too. You can edit any picture in the
sequence, just remember that this requires modification of
both deltas, the preceding one and the following one.
Let's say you want to modify picture #10 in your sequence.
Using the cursor keys as described above, display pictures
#9, #10 and #11 and copy each of them to the buffer. Make any
changes you like to picture #10. Now create a delta between
the new picture #10 and the old picture #9. Save it under
the same filename you used for the old #9-to-#10 delta,
thereby replacing it. Do the same for the #10 - #11 pair,
and you're all done. If you want to modify picture #1, you
need to update only one delta, between #1 and #2. Store the
old picture #2 in the buffer, modify picture #1, then create
a delta between them. In this special case, don't forget to
re-save picture #1 itself!
Finally, there's a special Block paste feature in this
version of UNISPEC that makes possible a considerable
reduction in the sizes of delta files. Block paste is often
used when making animations. Yet if the normal Block paste
is used (for instance, replacing a simple brush in the
example above with some small block cut from another
picture), you'll soon discover that the deltas are much
larger than they were with the brush.
Even if you paste a very narrow block, the block paste
procedure must reprocess the entire width of the raster lines
affected by this block. Areas to the right and to the left
of the block look unchanged to your eye, but the way these
same dots and colors are represented digitally may change
completely (this is a necessary side effect of the 512-color
display). In this case the size of the delta is proportional
not to the area of the block itself (which is normally
small), but to the area of the horizontal slice of the screen
containing the block, which is considerably larger.
So, here's the remedy: When pasting blocks with UNISPEC 1.11,
you can specifically instruct the block paste procedure to
process colors in such a way that the change from the
previous frame will be as small as possible. How does it
know what the previous frame is? You tell it by using an
alternative method when performing the actual paste. This
alternative method involves using the Function keys, but
should not be confused with the use of those keys when
creating deltas as described above.
When using this method you do everything as you normally
would when pasting a block, up to the point where you would
normally Left-Click to complete the operation. With this
special block paste method, a Function key press -- instead
of the usual Left Click -- completes paste operation. By
pressing the appropriate function key -- the one
corresponding to the position of the previous frame in the
buffer (it has to be in the buffer, of course) -- you inform
UNISPEC that the picture indicated by that function key
should be used as a guide for color changes.
This may sound complex, but the method is simple: Grab the
block as usual, position the empty box where you want to
paste it, and then press the function key (instead of
clicking the left mouse button, which performs the normal
paste). You can use any pasting mode, flip, resize, etc.
When you use this feature the block paste procedure is not
free to choose the best possible colors, so you may notice
some deterioration of picture quality (often, though, it's
barely noticeable). But it can reduce delta sizes rather
dramatically (4, 5 or even 10 times), so it's worth it. To
accommodate all possible cases we provided an adjustable
parameter which controls the tradeoff between picture quality
and delta sizes. You can change it by pressing CONTROL-Q
while in any normal drawing state (like DRAW). It's called
'Delta color tolerance'. Initially it's set to 250, which is
a reasonable value for most cases. You can change it to
anything from 0 to 99999. The smaller it is, the better the
picture quality, the larger the delta sizes. Very high
settings produce smallest possible deltas, but colors may
become very different from the original ones. Note that using
this block paste feature doesn't produce any deltas by
itself. After pasting you have to exit the paste mode by
clicking the right button, then create a delta as usual, by
pressing CONTROL and the appropriate Function key. Also
remember that CONTROL-Function key combinations for creating
deltas work only in a normal drawing state: no menus down, no
color matrix, no block paste box.
Assembly and Playback
Open the ANIMATE folder on your UNISPEC disk. It contains
two small programs: DELTA6.PRG and ANISPEC.PRG. Once you
created your picture #1 and deltas with UNISPEC, you can
assemble all these separate files into one .SPS (SPectrum
Sequence) file with DELTA6.PRG and then play it back in real
time with ANISPEC.PRG.
Let's do it for our 'moving brush' animation. We'll need
DELTA6.PRG and also a special delta file FULLSCRN.SPD from
the ANIMATE folder. Double-click on DELTA6.PRG. When it
loads it immediately displays the file selector with
extension .SPU (Spectrum uncompressed format). At this
moment it expects picture #1 of your animation (that's why it
was necessary to save it using the uncompressed format). Load
the picture. After that you'll see a dialog box showing the
number of frames assembled so far (1), remaining free memory,
and three control buttons. You can choose to add many frames
at once, a single frame, or end the process by choosing
'none'. Select 'many'. The file selector comes up, showing
files with extension .SPD. Select the first delta of your
animation (BRUSHAA.SPD, or whatever other name you used). If
your delta filenames are in unbroken alphabetical order
DELTA6.PRG will load all of them one by one. If not, you'll
have to load them one at a time by clicking on 'one' in the
dialog box. It's just a matter of convenience. After
loading your last delta choose 'one' in the dialog box and
load FULLSCRN.SPD (we'll explain it later). After that
choose 'none'. Next it will ask you whether you want to add
a cycle delta. Choose 'no'. Finally, the file selector will
come up with extension .SPS . Type a filename and click Ok
to save the sequence file.
Now you can play it back. Double-click on ANISPEC.PRG,
choose 'Load sequence' and load your sequence file. Playback
starts as soon as it loads. You can adjust the speed by
pressing any of the Function keys. F1 is the slowest, 1
frame per second; F10 - the fastest, 60 frames per second.
You can freeze playback by pressing the Space bar, advance
frames manually with Return, exit to the title screen by
pressing Help, or to the desktop by pressing Undo. This
animation can only be played in ping-pong mode, because
there's no cycle delta in it (see below).
Now let's discuss various options in detail. As you can
imagine, 512-color animation places an extreme burden on ST's
main processor (but don't worry, it won't harm it in any
way!). It spends three quarters of its time just maintaining
512 colors on the screen, leaving only one quarter for
animation as such. It may still be enough if changes between
successive frames of your animation are small. But as they
grow larger the playback speed starts to slow down. If this
is unacceptable, you can increase the speed considerably by
reducing the 512-color display area to just a part of the
screen. It always has to be full-screen wide, and it has to
start at the very top, but you can end it at any raster line
before reaching the bottom. In fact, DELTA6.PRG
automatically cuts off the 512-color display area at a
certain line if your image doesn't change below that line
through the whole length of your animation. In other words,
it shows in 512 colors only what is moving (or changing in
other ways).
What if you do want to show some nice static 512-color
background in the lower portion of the screen where there's
no motion? Simple. You just make some insignificant change
in the lowermost line that you want to be shown in 512
colors. It's enough to do it on just one picture of your
animation, for instance, by putting a single dot anywhere on
that lowermost line in picture #2. That is exactly what our
special delta, FULLSCRN.SPD, does - it changes one pixel at
the very bottom of the screen. It was created between two
pictures: one was completely blank (black screen), another -
a singe dot of some dark color at the very bottom of the
screen. Any time you want to show the entire screen in 512
colors, you can just add FULLSCRN.SPD to your animation. Of
course, when extending the 512-color area you don't have to
do it all the way to the bottom. The height of the 512-color
area affects the animation speed considerably: just using 150
lines instead of 200 doubles the maximum speed; using 100
lines triples it.
Let's suppose now that speed is important to you and you
decided to show only a part of the screen in 512 colors. As
was mentioned above, DELTA6.PRG will cut off 512-color
display automatically starting with the first line with no
motion (or other changes) below it. What is going to be
displayed in that area not covered by 512 colors? You can
leave it completely blank if you like. In this case just
make sure that it's totally black when you are creating your
pictures with UNISPEC -- otherwise you'll see some randomly
colored lines there when playing back with ANISPEC.PRG. You
can also use that area below the 512-color display to show a
slice of any normal low-resolution 16-color picture. This
can be your animation's title or anything you like. You can
create this 16-color picture with NEOchrome, Degas, some
other 16-color program, or UNISPEC itself - by converting any
Spectrum picture to 16 colors. The picture has to be in
Degas low resolution format (.PI1). During assembly
DELTA6.PRG will ask you if you want to add '.PI1 title'.
Answer 'yes' and then select your .PI1 picture in the file
selector. This option is available only if there's some room
below the 512-color area, at least one line (that's why we
didn't see it when assembling our full-screen 512-color
'moving brush' animation). Of course, only the lower part of
your 16-color picture (whatever falls below the lowest
'active' 512 color line) will be included in the .SPS file.
It doesn't matter what is in the upper part, anything covered
by the 'active' 512 color area will not be included.
And finally, 'cycle delta'. ANISPEC.PRG can show any
animation in ping-pong mode -- going from start to end, then
back from end to start. To be able to use the cycle mode -
jumping immediately from end to start - requires special
'cycle' delta. It's just a normal delta created between the
first and the last pictures of your animation. You can make
it with UNISPEC any time: Load your picture #1, copy it to
the buffer, then 'walk' to the end of your animation by
loading the first delta with INSERT and the rest with the up
cursor key, then create a delta between the last picture on
the main screen and picture #1 in the buffer. When saving it
give it some distinct name, so that DELTA6.PRG will not
confuse it with regular (alphabetically named) deltas.
Remember, when you choose the 'many' option in DELTA6.PRG, it
loads as many files in unbroken alphabetical order as it can
find. The cycle delta has to be added separately, when
DELTA6.PRG asks you to do just that. When you play back an
.SPS file with a cycle delta in it, you can switch to the
cycle mode by pressing F. Note that if you want your cycle
animation to look "seamless" (to jump from the last frame to
the first one at exactly the same speed as anywhere in the
middle), your animation must contain an even number of
frames. If the number of frames is odd, there will be a
slight delay when it returns from the end to the start.
Note that you can play back very short sequences of frames at
high speed from inside Unispec itself, without going through
the assembly process described above. This method has nothing
to do with deltas, it works even with UNISPEC 1.0. You simply
put any sequence of full-screen pictures in the buffer in the
order you want to play them. Then set the SNAP grid to
exactly 25 pixels vertically (turn the magnifier on to be
able to see the mouse coordinate readout, press Right
Shift, move the mouse exactly 25 pixels down, release Right
Shift). Return to the buffer and start scrolling up and down.
With this SNAP setting the buffer scrolls exactly one screen
at a time, thus creating the animation effect. The length of
these sequences is very limited, of course, but they can be
useful if you just want to try something out quickly.
A couple of notes concerning memory and disk space
limitations. When you create an animation with UNISPEC,
there's no limit on its size: deltas are saved to disk one by
one, and if you run out of space on the first disk you can
continue with another. We noticed that TOS places some limit
on a number of files that can be saved on a floppy disk, even
if they are very small and their combined size is far below
the disk capacity (the limit seems to be just over a hundred
files). However, this is so only with the main directory: if
you save your files to a folder you can put there as many
files as you like. Also, the standard file selector starts to
skip some filenames when the number of files it has to show
in its window approaches 100 (if you know the file is present
on the disk, just type its filename and click Ok; it will
still be loaded).
You can run into memory problems when you start assembling
deltas with DELTA6.PRG. At this stage all of your deltas
have to fit in RAM. When using DELTA6.PRG to assemble a
large animation, run it without any desk accessories or
memory-resident programs. If you run out of memory during
assembly, DELTA6.PRG simply stops asking you for more deltas
and skips to the end of the assembly process. Adding .PI1
title never poses a problem, because this procedure only
replaces a portion of already assembled file. With or
without .PI1, you can then save your partially assembled file
to disk.
When saving .SPS files you can run out of disk space. If
DELTA6.PRG can't save an .SPS file in its entirety, it saves
as much of it as it can, then redisplays the file selector to
let you try saving it to another disk. It's a good idea to
have a blank formatted disk ready when working with
DELTA6.PRG . Of course, if your .SPS is larger than the
largest available disk, nothing more can be done. Partially
saved .SPS files can still be played back with ANISPEC.PRG,
but your animation, of course, becomes shorter.
Summary of the new keyboard commands.
(Fn means any of the function keys F1-F10)
Normal drawing state:
CONTROL-Fn Create a delta between the main screen
and the n-th full screen picture in the buffer
INSERT Load a delta (apply it to the picture on the
main screen)
UP CURSOR KEY Show next frame (delta filenames have
to be in the unbroken alphabetical order)
DOWN CURSOR KEY Show previous frame
CONTROL-Q Change Delta color tolerance
Block paste state:
Fn Paste with minimum difference from the n-th full
screen picture in the buffer
ST Control
UNISPEC 1.11 is not an animation program by itself - it
cannot create a series of frames in one operation. Making
very long animations one frame at a time is too tedious to be
practical. Trio Engineering now offers a new program
specifically designed to automate long sequences of
operations performed by any program, including UNISPEC. It's
called ST Control. ST Control is a universal script language
which controls the mouse and keyboard. It looks very much
like Basic - it has all the usual commands like GOTO,
FOR-NEXT, IF-THEN, etc. - except that its output consists of
mouse clicks and keypresses. This allows it to 'drive' any
program - select items in its menus, type text, cut and paste
blocks - anything that you can do with this program manually.
ST Control itself is a desk accessory, thus it can can run
simultaneously with any regular program (including non-GEM
programs - ST Control can be accessed from programs without
the menu bar!). ST Control scripts can be interactive - doing
different things depending on where you click the mouse or
which keys you press during the script execution. When used
with UNISPEC 1.11 ST Control will allow you, for instance, to
specify only the two end points of your object's motion path,
then watch as it pastes the object in any number of
intermediate positions (along a straight line or a curve),
creates deltas and saves them to disk. The real beauty of ST
Control is that it's fully programmable - you can always edit
your script to create a new tool by combining the basic
functions available in the controlled program.