The Morphic Implementation


The BackgroundMorph class

A BackgroundMorph incorporates tiling and regular motion with the intent of supporting, eg, panning of endless (toroidal) backgrounds.
The idea is that embedded morphs get displayed at a moving offset relative to the backgrounds position. Moreover this display is tiled according to the bounding box of the submorphs (subBounds), as much as necesary to fill the rest of the backgrounds bounds.

Try to evaluate the following expression in an workspace

a := WorldMorph new.
a primaryHand attachMorph: (BackgroundMorph new addMorph: (ImageMorph new grabFromScreen)).
a openWithTitle: 'Scrolling image ....'

This will prompt you to select some part of the screen. When you're done selecting the image, you will have a small BackgroundMorph stuck to your "hand". Find some appropriate part of the screen an lay it down simply by clicking there. The BackgroundMorph has as its only job to will continually tile and scroll its content (think Sat morning cartoon background during a chase scene). Use command click to get a halo, and use the yellow handle to change its size (the clipping rectangle). This will give you some sense of the smooth scrolling performance available in morphic.

BackgroundMorph is a direct subclass of Morph.