Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
MSGraph Unit Interface
◄Standard Units► ◄Contents► ◄Index► ◄Back►
{──────────────────────────────────────────────────────────────────────
MSGraph Unit Interface
Microsoft QuickPascal Version 1.00
Copyright (C) 1989, Microsoft Corporation
All Rights Reserved.
──────────────────────────────────────────────────────────────────────}
UNIT MSGraph;
INTERFACE
USES MSGrUtil;
CONST
{ arguments to _SetVideoMode }
_MaxResMode = -3; { highest resolution graphics mode }
_MaxColorMode = -2; { graphics mode with most colors }
_DefaultMode = -1; { restore screen to original mode }
_TextBW40 = 0; { 40-column text, 16 grey }
_TextC40 = 1; { 40-column text, 16/8 color }
_TextBW80 = 2; { 80-column text, 16 grey }
_TextC80 = 3; { 80-column text, 16/8 color }
_MRes4Color = 4; { 320 x 200, 4 color }
_MResNoColor = 5; { 320 x 200, 4 grey }
_HResBW = 6; { 640 x 200, BW }
_TextMono = 7; { 80-column text, BW }
_HercMono = 8; { 720 x 348, BW for HGC }
_MRes16Color = 13; { 320 x 200, 16 color }
_HRes16Color = 14; { 640 x 200, 16 color }
_EResNoColor = 15; { 640 x 350, BW }
_EResColor = 16; { 640 x 350, 4 or 16 color }
_VRes2Color = 17; { 640 x 480, BW }
_VRes16Color = 18; { 640 x 480, 16 color }
_MRes256Color = 19; { 320 x 200, 256 color }
_OResColor = 64; { 640 x 400, 1 of 16 colors(Olivetti)}
{ _VideoConfig adapter values }
_MDPA = $0001; { Monochrome Display Printer Adapter (MDPA) }
_CGA = $0002; { Color Graphics Adapter (CGA) }
_EGA = $0004; { Enhanced Graphics Adapter (EGA) }
_VGA = $0008; { Video Graphics Array (VGA) }
_MCGA = $0010; { MultiColor Graphics Array (MCGA) }
_HGC = $0020; { Hercules Graphics Card (HGC) }
_OCGA = $0042; { Olivetti Color Graphics Adapter (OCGA) }
_OEGA = $0044; { Olivetti Enhanced Graphics Adapter (OEGA) }
_OVGA = $0048; { Olivetti Video Graphics Array (OVGA) }
{ _VideoConfig monitor values }
_Mono = $0001; { Monochrome }
_Color = $0002; { Color or Enhanced emulating color }
_EnhColor = $0004; { Enhanced Color }
_AnalogMono = $0008; { Analog Monochrome only }
_AnalogColor = $0010; { Analog Color only }
_Analog = $0018; { Analog Monochrome and Color modes }
{ control parameters for _Rectangle, _Ellipse and _Pie }
_GBorder = 2; { draw outline only }
_GFillInterior = 3; { fill with current color, fill mask }
{ control parameters for _ClearScreen }
_GClearScreen = 0;
_GViewport = 1;
_GWindow = 2;
{ directions for _ScrollTextWindow }
_GScrollUp = 1;
_GScrollDown = -1;
{ max rows option for _SetTextRows and _SetVideoModeRows }
_MaxTextRows = -1;
{ "action verbs" for _PutImage and _SetWriteMode }
_GPSET = 3;
_GPRESET = 2;
_GAND = 1;
_GOR = 0;
_GXOR = 4;
{ universal color values }
_Black = $000000;
_Blue = $2a0000;
_Green = $002a00;
_Cyan = $2a2a00;
_Red = $00002a;
_Magenta = $2a002a;
_Brown = $00152a;
_White = $2a2a2a;
_Gray = $151515;
_LightBlue = $3F1515;
_LightGreen = $153f15;
_LightCyan = $3f3f15;
_LightRed = $15153f;
_LightMagenta = $3f153f;
_Yellow = $153f3f;
_BrightWhite = $3f3f3f;
{ _EResNoColor mode colors }
_ModeFOff = 0;
_ModeFOffToOn = 1;
_ModeFOffToHi = 2;
_ModeFOnToOff = 3;
_ModeFOn = 4;
_ModeFOnToHi = 5;
_ModeFHiToOff = 6;
_ModeFHiToOn = 7;
_ModeFHi = 8;
{ _TextMono mode colors }
_Mode7Off = 0;
_Mode7On = 1;
_Mode7Hi = 2;
{ return values for _GrStatus }
_GrOk = 0;
_GrError = -1;
_GrModeNotSupported = -2;
_GrNotInProperMode = -3;
_GrInvalidParameter = -4;
_GrFontFileNotFound = -5;
_GrInvalidFontFile = -6;
_GrCorruptedFontFile = -7;
_GrInsufficientMemory = -8;
_GrInvalidImageBuffer = -9;
_GrNoOutput = 1;
_GrClipped = 2;
_GrParameterAltered = 3;
TYPE
{ structure for _GetVideoConfig as visible to user }
_VideoConfig = RECORD
NumXPixels : Integer; { horizontal resolution }
NumYPixels : Integer; { vertical resolution }
NumTextCols : Integer; { text columns available }
NumTextRows : Integer; { text rows available }
NumColors : Integer; { number of colors available }
BitsPerPixel : Integer; { bits per pixel }
NumVideoPages : Integer; { available video pages }
Mode : Integer; { current video mode }
Adapter : Integer; { active adapter }
Monitor : Integer; { active monitor }
Memory : Integer; { video memory in K bytes }
END;
{ structure for specifying fill patterns }
_FillMask = ARRAY[0..7] OF Byte;
{ return value of _GetViewCoord, etc. }
_XYCoord = RECORD
xcoord : Integer;
ycoord : Integer;
END;
{ structure for window coordinate pair }
_WXYCoord = RECORD
wx : Double; { window x coordinate }
wy : Double; { window y coordinate }
END;
{ structure for _GetFontInfo }
_FontInfo = RECORD
FontType : Integer; { bit 0 set=vector, clear=bit map }
Ascent : Integer; { pixels from top to baseline }
PixWidth : Integer; { width in pixels, 0 = proportional }
PixHeight : Integer; { character height in pixels }
AvgWidth : Integer; { average character width in pixels }
FileName : CSTRING[80]; { file name including path }
FaceName : CSTRING[31]; { font name }
END;
{──────────────────────────────────────────────────────────────────
MSGraph Procedures and Functions
───────────────────────────────────────────────────────────────────}
{ setup and configuration }
FUNCTION _GrStatus : Integer;
FUNCTION _SetVideoMode( mode : Integer ) : Integer;
FUNCTION _SetVideoModeRows( mode, rows : Integer ) : Integer;
PROCEDURE _SetActivePage( page : Integer );
PROCEDURE _SetVisualPage( page : Integer );
FUNCTION _GetActivePage : Integer;
FUNCTION _GetVisualPage : Integer;
PROCEDURE _GetVideoConfig( VAR vc : _VideoConfig );
{ coordinate systems }
PROCEDURE _SetViewOrg( x, y : Integer; VAR org : _XYCoord );
PROCEDURE _SetViewport( x1, y1, x2, y2 : Integer );
PROCEDURE _SetClipRgn( x1, y1, x2, y2 : Integer );
PROCEDURE _SetWindow( FInvert : Boolean; x1, y1, x2, y2 : Double );
PROCEDURE _GetViewCoord( x, y : Integer; VAR xy : _XYCoord );
PROCEDURE _GetViewCoord_w( x, y : Double; VAR xy : _XYCoord );
PROCEDURE _GetViewCoord_wxy( VAR wxy : _WXYCoord; VAR xy : _XYCoord );
PROCEDURE _GetPhysCoord( x, y : Integer; VAR xy : _XYCoord );
PROCEDURE _GetWindowCoord( x, y : Integer; VAR wxy : _WXYCoord );
PROCEDURE _GetCurrentPosition( VAR xy : _XYCoord );
PROCEDURE _GetCurrentPosition_wxy( VAR wxy : _WXYCoord );
{ output routines }
PROCEDURE _ClearScreen( area : Integer );
PROCEDURE _MoveTo( x, y : Integer );
PROCEDURE _MoveTo_w( wx, wy : Double );
PROCEDURE _LineTo( x, y : Integer );
PROCEDURE _LineTo_w( wx, xy : Double );
PROCEDURE _Rectangle( control, x1, y1, x2, y2 : Integer );
PROCEDURE _Rectangle_w( control : Integer;
wx1, wy1, wx2, wy2 : Double );
PROCEDURE _Rectangle_wxy( control : Integer;
VAR wxy1, wxy2 : _WXYCoord );
PROCEDURE _Ellipse( control, x1, y1, x2, y2 : Integer );
PROCEDURE _Ellipse_w( control : Integer; wx1, wy1, wx2, wy2 : Double );
PROCEDURE _Ellipse_wxy( control : Integer; VAR wxy1, wxy2 : _WXYCoord );
PROCEDURE _Arc( x1, y1, x2, y2, x3, y3, x4, y4 : Integer );
PROCEDURE _Arc_wxy( VAR wxy1, wxy2, wxy3, wxy4 : _WXYCoord );
PROCEDURE _Pie( control, x1, y1, x2, y2, x3, y3, x4, y4 : Integer );
PROCEDURE _Pie_wxy( control : Integer;
VAR wxy1, wxy2, wxy3, wxy4 : _WXYCoord );
PROCEDURE _FloodFill( x, y, boundary : Integer );
PROCEDURE _FloodFill_w( wx, wy : Double; boundary : Integer );
{ information about most recent _Arc or _Pie }
FUNCTION _GetArcInfo( VAR StartPoint, EndPoint, FillPoint : _XYCoord
) : Boolean;
{ pixel color routines }
PROCEDURE _SetPixel( x, y : Integer );
PROCEDURE _SetPixel_w( wx, wy : Double );
FUNCTION _GetPixel( x, y : Integer ) : Integer;
FUNCTION _GetPixel_w( wx, wy : Double ) : Integer;
{ pen color, line style and fill pattern routines }
PROCEDURE _SetColor( color : Integer );
FUNCTION _GetColor : Integer;
PROCEDURE _SetLineStyle( style : Word );
FUNCTION _GetLineStyle : Word;
PROCEDURE _SetWriteMode( wmode : Integer );
FUNCTION _GetWriteMode : Integer;
PROCEDURE _SetFillMask( mask : _FillMask );
FUNCTION _GetFillMask( VAR mask : _FillMask ) : Boolean;
{ background color selection }
PROCEDURE _SetBkColor( color : LongInt );
FUNCTION _GetBkColor : LongInt;
{ routines for setting a color palette }
FUNCTION _RemapPalette( index : Integer; value : LongInt ) : LongInt;
PROCEDURE _RemapAllPalette( VAR newpalette );
FUNCTION _SelectPalette( number : Integer ) : Integer;
{ text functions }
FUNCTION _SetTextRows( rows : Integer ) : Integer;
PROCEDURE _SetTextWindow( r1, c1, r2, c2 : Integer );
PROCEDURE _GetTextWindow( VAR r1, c1, r2, c2 : Integer );
PROCEDURE _ScrollTextWindow( count : Integer );
PROCEDURE _OutMem( TextString : CSTRING; length : Integer );
PROCEDURE _OutText( TextString : CSTRING );
FUNCTION _WrapOn( option : Boolean ) : Boolean;
FUNCTION _DisplayCursor( toggle : Boolean ) : Boolean;
{ cursor attribute routines }
PROCEDURE _SetTextCursor( attr : Word );
FUNCTION _GetTextCursor : Word;
{ current text position routines }
PROCEDURE _SetTextPosition( r, c : Integer );
PROCEDURE _GetTextPosition( VAR r, c : Integer );
{ background color selection }
PROCEDURE _SetTextColor( color : Integer );
FUNCTION _GetTextColor : Integer;
{ screen images }
PROCEDURE _GetImage( x1, y1, x2, y2 : Integer; VAR image );
PROCEDURE _GetImage_w( wx1, wy1, wx2, wy2 : Double; VAR image );
PROCEDURE _GetImage_wxy( VAR wxy1, wxy2 : _WXYCoord; VAR image );
PROCEDURE _PutImage( x, y : Integer; VAR image ; action : Integer );
PROCEDURE _PutImage_w( wx, wy : Double; VAR image; action : Integer );
FUNCTION _ImageSize( x1, y1, x2, y2 : Integer ): LongInt;
FUNCTION _ImageSize_w( wx1, wy1, wx2, wy2 : Double ): LongInt;
FUNCTION _ImageSize_wxy( VAR wxy1, wxy2: _WXYCoord ) : LongInt;
{ font functions }
FUNCTION _RegisterFonts( pathname : CSTRING ) : Integer;
PROCEDURE _UnRegisterFonts;
FUNCTION _SetFont( options : CSTRING ) : Integer;
PROCEDURE _OutGText( TextString : CSTRING );
FUNCTION _GetGTextExtent( TextString : CSTRING ) : Integer;
FUNCTION _GetFontInfo( VAR FInfo : _FontInfo ) : Integer;
PROCEDURE _SetGTextVector( x , y : Integer);
PROCEDURE _GetGTextVector( VAR x , y : Integer);