This is release 45.27 of the layers.library. One minor bug was
fixed, see the release notes for details, and the code got cleaned
up. Otherwise, no changes.
The NOTES directory contains additional information on the internal
workings of layers V45.
..with special thanks for the permission to redistribute to Ben Hermans.
What is this:
This archive contains the V45.24 of the layers.library. The layers library
is the part of the operating system that performs the "slice and dice"
operations when windows partially overlap, it prepares all the information
on the clipping regions that are used by the graphics.library to draw lines,
rectangles or text. It is also responsible for saving back graphics if
windows get occluded, and restore their content as soon as they are moved
back to front.
How official is this?
This publication has been agreed upon by Hyperion; it is free for owners
of the classic AmigaOs and released here hoping that it may be useful for
at least some. Since the source code of this library version formed the
basis of the Os 4.x layers.library, users of newer versions will get the
benefit of this software anyhow, and owners of the classic system at least
some of the benefits of the new layers in Os 4. I just considered it fair
to release what I still have (with permission) for the classic Amigas.
Why a new release:
Essentially, the V40 layers.library that is in the Os ROM is in quite
a bad shape. At first, it does not behave well with graphics cards,
which is why P96 and Cybergraphics patch it heavily. The graphics swap
logic that exchanges the background with the foreground uses a double-
XOR trick that works nice with the blitter, but not with rtg graphics.
Second, V40 layers is highly inefficient. If the window order is re-
organized on a screen with many overlapping windows, the amount of
swaps required for a single window arrangement grows linear in the
number of windows, even though it could be constant.
Third, V40 layers is the number one reason why memory fragments. It
allocates a lot of tiny structures, but does not attempt to pool them,
throwing a fragmentation bomb on the memory manager if many windows
Fourth, V40 layers contains a couple of bugs that break window arrange-
ment in low memory situations. It does not attempt to fail properly if
it runs out of memory, and then leaves the window order in a desolate
How was it made:
V45 layers was created as a contribution to AmigaOs 4.0, but since my
Amiga failed back then, it never became part of the Os, and not of the
classic system by any means. Layers V45 is based on the V40 ROM version
of layers, but with many bug fixes. Many parts of the code have been
re-written to compile and built with the latest version of SAS/C.
How to install it:
1) Copy Workbench/LIBS/layers.library to the LIBS: directory.
2) If you are not already using "LoadModule":
Copy Workbench/LIBS/C/LoadModule to C:
Edit the Startup-Sequence to include the following line
3) If you are already using LoadModule, edit the startup sequence
such that LIBS:layers.library is included, i.e. add the single
argument "LIBS:layers.library". On my system, the line reads as
LoadModule LIBS:icon.library LIBS:workbench.library DEVS:console.device
L:Ram-Handler L:FastFileSystem L:Shell-Seg LIBS:layers.library DEVS:audio.device
4) If you are using Picasso96, go into the directory "LIBS:Picasso96"
It should contain a file named "newlayers.library" (or similar). Rename
or delete this file. This library is no longer required.
4.1) I do not know what to do with cybergraphics. I do not use it. If
you use version 4 of CGfx, rumors say that it is enough if
ENVARC:CyberGraphX/SUPERLAYERS is *not* set. Delete this file if
it exists. Or maybe not, who knows. In case of doubt, copy the
file "LayersAntiHack" from Workbench/C to C:, and insert it into the
Startup-Sequence. This file will prevent patches into layers.library.
5) Reboot the system.
6) If you want to, try the "Examples". Probably "AmiSnap", see below.
How stable is it:
Well, this is actually beta software. But, given that it was installed on my
Amiga for 12 years now, and even though I only use the Amiga occasionally
(whenever the hardware is in the right mood), it seems to work pretty well.
I did not notice any negative side effects, except better speed.
What is new:
Despite the code cleanup, you mean? Well, layers is more lean and clean
than before, uses less memory and is hopefully more tolerant in low-memory
Yes, a couple of functions in layers.
First, Layers V45 includes a function to test whether a layer is partially
occluded. This is important for picture-in-picture functions (nowadays
called "video overlays") offered by some graphics functions.
Second, V45 layers allows programs to hide layers completely. Hidden layers
can still be drawn into, but nothing appears on the screen. The AmiSnap
utility demonstrates this by implementing a "Window Iconification"
Third, V45 layers implements layer_info clipping of layers. Together with a
new revision of intuition, this feature would allow users to drag windows
partially off the screen. "Clippy" demonstrates this feature (though without
Is in the NDK directory. It contains the includes and autodocs for V45
layers, including the new functions.
To demonstrate the V45 layers, this archive contains two example programs.
These are *NOT* in production quality, but are rather "tech demos". Since the
examples come completely with source code, you are invited to enhance them and
complete them, problably make them full programs.
"AmiSnap" is a window-iconifying program. Press Left-Alt and click on *any*
window, and it will turn the window into an icon on the workbench. Double-click
on the icon, and the window will re-appear. While this program demonstrates V45
layers and is in this respect os-friendly, grabbing the window without locking
intuition properly is *not* good practise and should be avoided. I said it is a
"tech demo" and not a good program, didn't I? It has known bugs. For example, it
does not handle the situation correctly in case an iconified window is closed
under its feet. Enjoy, but do not use.
"Clippy" installs a clip rect onto the workbench screen. Another new feature
of V45 layers. Which means that anything outside this cliprect will not be
updated. Means, your workbench will behaive weird as it will only update
content in the middle of the screen. This is intentional.
What is the future of this code?
Probably none. I will likely not have the time to keep it updated. Bug reports
welcome, of course, but without promise that I will provide fixes. If you find
problems, you are on your own. De-install by removing layers.library from LIBS:
and remove the corresponding argument from LoadModule, you should be fine again.
Thomas Richter, December 2014