- 4.37.2.106. -
Table of Contents
4. Standard Units
4.37. Graph - Graph unit
4.37.2. Graph Unit Procedures and Functions
4.37.2.106. SetLogicalPage procedure
4.37.2.106. SetLogicalPage procedure
Targets: MS-DOS, Win32
Graph Unit
Sets the logical page size. The SX and SY
values are the new logical size.
Declaraton:
procedure SetLogicalPage(SX, SY: Word);
Remarks:
Many SVGA adapters support logical pages.
A logical page can exceed the size of the physical screen.
For instance, it is possible to install a logical page 1280 x 480
with a screen of physical resolution 640x480. In this case only half the
logical page will be seen on the screen. Logical pages are used for hardware
scrolling. The maximum size logical pages depend on the SVGA adapter and
the size of the video memory. Use the function
GetLogicalPage
to get the current logical page size.
Remember that the number of available graphic pages depends
on the logical page size. Thus SetLogicalPage
influences the number of available graphic pages and resets viewport to
the whole logical page size. Keep in mind, that SX
and SY can't be less than the physical screen
size. Here is an example of use of the logical page:
// This example sets a logical page 1280x600
// and performs hardware scrolling
// VESA-compatible SVGA card with 1Mb required
//
uses Graph,Crt;
var
ErrorCode,i: Longint;
SX, SY: Word;
begin
// setup SVGA mode 640x480x256
SetSVGAMode(640, 480, 8, LfbOrBanked);
ClearDevice;
if GraphResult <> 0 then begin
ErrorCode:=GraphResult;
CloseGraph;
Writeln(GraphErrorMsg(ErrorCode));
end;
// setup logical page 1280x600
SetLogicalPage(1280, 600);
// check logical page size
GetLogicalPage(SX, SY);
if (SX = 640) and (SY = 480) then begin
CloseGraph;
Writeln(' Logical pages not supported...');
end;
// draw on logical page
SetLineStyle(SolidLn, 0, ThickWidth);
SetColor(clRed);
Line(0, 0, GetMaxX, GetMaxY);
Line(GetMaxX, 0, 0, GetMaxY);
SetColor(clWhite);
Rectangle(0, 0, GetMaxX, GetMaxY);
// scroll the screen left
for i := 0 to (SX - 640) div 4 do
SetScreenStart(i * 4, 0, True);
// scroll the screen up
for i := 0 to (SY - 480) div 4 do
SetScreenStart(SX - 640, i * 4, True);
// scroll the screen right
for i := (SX - 640) div 4 downto 0 do
SetScreenStart(i * 4, SY - 480, True);
// scroll the screen down
for i := (SY - 480) div 4 downto 0 do
SetScreenStart(0, i * 4, True);
// Wait a key
ReadKey;
// Close Graph and restore old video mode
CloseGraph;
end.
- 4.37.2.106. -