rimapshapeslib
This library comes from Reflective Images’ map editor. It turns Blitz shapes into map shapes: a map shape describes the planes of a shape as a system bitmap, so the graphics library can blit it into the RastPort of a window. A map shape uses the data of its shape and copies nothing, so the shape must stay in memory as long as the map shape is used.
Map shapes are numbered from 0, but they are no Blitz objects: call
SetNumMapShapes first, which allocates room for them; before it, the
map shape commands do nothing. With runtime error checking, a number
beyond that room is a runtime error. The commands that blit work on a
window of the windows library and draw through the graphics library.
BlitMapShape and BlitMapShapeSize are as fast as the original’s,
and the library runs also on Kickstart 1.3, where the original could
not start.
A group collects map shapes at offsets measured in blocks, to draw
them in one go with BlitGroup. ResetGroup starts a group and sets
the block size, AddGroupMember adds to it. A group has room for 63
members.
Two shapes as map shapes, drawn into window 0:
SetNumMapShapes 2
ShapeToMapShape 0,0
ShapeToMapShape 1,1
BlitMapShape 0,0,10,10
BlitMapShape 0,1,42,10Library number 6.
Commands
AddGroupMember
Adds a map shape to the group, dx blocks to the right and dy blocks down, with the block size of the last ResetGroup.
Statement. Help text: shape#,dx,dy
Arguments: .w, .w, .w
The first number is a map shape number, although the help names it
shape#.
A group holds at most 63 members; further ones are ignored, and with runtime error checking they are a runtime error.
BlitGroup
Copies every map shape of the group into the RastPort of a window, each at x,y plus its offset. Empty map shapes are skipped.
Statement. Help text: window#,x,y
Arguments: .w, .w, .w
BlitMapShape
Copies a whole map shape into the RastPort of a window, with its top left corner at x,y. An empty map shape draws nothing.
Statement. Help text: window#,mapshape#,x,y
Arguments: .w, .w, .w, .w
BlitMapShapeSize
Like BlitMapShape, but copies only width by height pixels from the top left corner of the map shape. The height is limited to that of the map shape; a larger width is a runtime error with runtime error checking.
Statement. Help text: window#,mapshape#,x,y,width,height
Arguments: .w, .w, .w, .w, .w, .w
FreeMapShapes
Makes the map shapes from first to last empty. Nothing happens if last is below first.
Statement. Help text: first,last
Arguments: .w, .w
The room of the map shapes stays allocated; the Blitz shapes they used are not freed.
MapShapeAddr
The address of a map shape in memory, 64 bytes, a width word followed by a system bitmap structure.
Function, result .l. Help text: mapshape#
Arguments: .w
RemapMapShape
Does nothing; the command was left unfinished in the original.
Statement. Help text: mapshape#,botcol,topcol
Arguments: .w, .w, .w
ResetGroup
Empties the group and sets the block size, in pixels, for the offsets of AddGroupMember. As a function it returns the address of the group, or 0 if the program got no memory for it.
Statement or function, result .l. Help text: blockwidth,blockheight
Arguments: .w, .w
The group is a list of 8-byte members (map shape address, x offset and y offset in pixels), ended by an address of 0.
SetNumMapShapes
Makes room for num map shapes, numbered from 0, all empty. Map shapes made before are lost.
Statement. Help text: num
Arguments: .w
If there is no memory, or num is 0, there are no map shapes: the
commands that use them do nothing, and MapShapeAddr returns 0.
With runtime error checking, a map shape number not below num is
a runtime error for every command that takes one.
ShapeToMapShape
Makes a map shape from a Blitz shape, with its width, height and depth. The map shape uses the planes of the shape; nothing is copied.
Statement. Help text: source shape,dest Mapshape
Arguments: .w, .w
The shape must have 1 to 8 planes. With runtime error checking, another depth is the error “Illegal Shape Depth”; without it, the depth is not checked.