Skip to content

scrolllib

These commands work on the used bitmap, in both modes. Plot and Point set and read single pixels; Cls fills the whole bitmap with one colour; Scroll and BlockScroll copy a rectangle to another place of the bitmap, or from another bitmap, with the blitter. Moving a part of a bitmap this way is how many games scroll the playfield.

BitMap 0,320,200,2
Cls 0
Plot 10,10,1
Scroll 0,0,320,192,0,8

Plot and Point count positions from the bitmap’s origin. With runtime error checking, a bitmap that has not been made is the error “Uninitialized BitMap”, and an area of Scroll or BlockScroll outside a bitmap is “Illegal Scroll Area”.

A bitmap with no bitplanes makes these commands run very long. In the style of Blitz Basic 2, only runtime error checking prevents it: BitMap and CludgeBitMap then refuse a depth of 0.

Based on the scrolllib guide by Acid Software.

Library number 100.

Commands

BlockScroll

As Scroll, but faster, for areas whose X1, X2 and Width are multiples of 8; the positions are rounded down to whole bytes.

Statement. Help text: X1,Y1,Width,Height,X2,Y2[,BitMap#]
2 forms:

  • .w, .w, .w, .w, .w, .w
  • .w, .w, .w, .w, .w, .w, .w

It helps with block scrolling: draw the new blocks on one side of the bitmap only and copy them to the other side with BlockScroll. Unlike Scroll, it always copies from the top down, so a destination below an overlapping source is not right.

Cls

Fills the whole used bitmap with Colour, or with colour 0 without it.

Statement. Help text: [Colour]
2 forms:

  • no arguments
  • .w

Plot

Sets the pixel at X,Y of the used bitmap to Colour; a negative colour, such as -1, inverts the pixel instead. A pixel outside the bitmap is left alone.

Statement. Help text: X,Y,Colour
Arguments: .w, .w, .w

Point

The colour of the pixel at X,Y of the used bitmap, or 0 for a point outside it.

Function, result .w. Help text: X,Y,Colour
Arguments: .w, .w

Scroll

Copies the rectangle of Width by Height pixels at X1,Y1 to X2,Y2 of the used bitmap. With BitMap#, the rectangle comes from that bitmap instead.

Statement. Help text: X1,Y1,Width,Height,X2,Y2[,BitMap#]
2 forms:

  • .w, .w, .w, .w, .w, .w
  • .w, .w, .w, .w, .w, .w, .w

The rectangles may overlap. Only as many bitplanes are copied as the shallower of the two bitmaps has. With runtime error checking, a height above 1024 is the error “Scroll area to large”.