Virtual Buffer Scrolling

Another useful effect is scrolling, and Fastgraph provides a function that performs vertical scrolling within a given region of the active virtual buffer. The fg_scroll() function scrolls a region defined in screen space. It can scroll up or down and offers two types of scrolling: circular and end-off. In circular scrolling, rows that scroll off one edge of the defined region appear at its opposite edge. In end-off scrolling, such rows simply wind up above or below the scrolling area. The following diagram illustrates the two types of scrolling:

before after

The unshaded area represents the scrolling region, as specified in the call to fg_scroll(), and the scrolling direction is assumed to be down (that is, toward the bottom of the virtual buffer). The scrolling region moves from the unshaded position in the "before" diagram to the unshaded position in the "after" diagram. For end-off scrolling, the shaded area in the "before" diagram is replaced as the scrolling region moves down. The shaded area at the top of the "after" diagram is filled with pixels of the current color. For circular scrolling, the shaded area at the bottom of the "before" diagram moves to the top of the "after" diagram.

The fg_scroll() function takes six parameters. The first four define the scrolling region in the order minimum x coordinate, maximum x coordinate, minimum y coordinate, and maximum y coordinate. The fifth parameter is the scrolling increment. It specifies the number of rows to scroll. If it is positive, the scrolling direction is toward the bottom of the virtual buffer; if it is negative, the scrolling direction is toward the top of the virtual buffer. The sixth and final parameter specifies the scroll type. If this value is zero, the scroll will be circular; if it is any other value, the scroll will be end-off. If the scroll type is circular, fg_scroll() will use the background virtual buffer defined by fg_sethpage() as a workspace (more specifically, the area bounded by the scrolling region extremes in the background virtual buffer will be used).

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.