mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 16:10:07 +02:00
* graph unit include is now independent and the dependent part
is now in graph.pp * ggigraph unit for linux added
This commit is contained in:
parent
98a50970e7
commit
2d6a92f17e
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Makefile generated by fpcmake v0.99.13 [2000/03/10]
|
# Makefile generated by fpcmake v0.99.13 [2000/02/24]
|
||||||
#
|
#
|
||||||
|
|
||||||
defaultrule: all
|
defaultrule: all
|
||||||
@ -146,7 +146,6 @@ endif
|
|||||||
ifdef NO_EXCEPTIONS_IN_SYSTEM
|
ifdef NO_EXCEPTIONS_IN_SYSTEM
|
||||||
override FPCOPT+=-dNO_EXCEPTIONS_IN_SYSTEM
|
override FPCOPT+=-dNO_EXCEPTIONS_IN_SYSTEM
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# FPCDIR Setting
|
# FPCDIR Setting
|
||||||
#####################################################################
|
#####################################################################
|
||||||
@ -232,7 +231,7 @@ endif
|
|||||||
|
|
||||||
# Info
|
# Info
|
||||||
|
|
||||||
INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall
|
INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# Post Settings
|
# Post Settings
|
||||||
@ -1201,9 +1200,9 @@ printer$(PPUEXT) : printer.pp $(SYSTEMPPU)
|
|||||||
include $(GRAPHDIR)/makefile.inc
|
include $(GRAPHDIR)/makefile.inc
|
||||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||||
|
|
||||||
graph$(PPUEXT) : $(GRAPHDIR)/graph.pp go32$(PPUEXT) ports$(PPUEXT) $(SYSTEMPPU) \
|
graph$(PPUEXT) : graph.pp go32$(PPUEXT) ports$(PPUEXT) $(SYSTEMPPU) \
|
||||||
$(GRAPHINCDEPS) graph.inc graphh.inc vesa.inc vesah.inc dpmi.inc
|
$(GRAPHINCDEPS) vesa.inc vesah.inc dpmi.inc
|
||||||
$(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
|
$(COMPILER) -I$(GRAPHDIR) graph.pp $(REDIR)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Delphi Compatible Units
|
# Delphi Compatible Units
|
||||||
@ -1239,4 +1238,4 @@ lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMPPU)
|
|||||||
# Other system-dependent RTL Units
|
# Other system-dependent RTL Units
|
||||||
#
|
#
|
||||||
|
|
||||||
msmouse$(PPUEXT) : msmouse.pp $(SYSTEMPPU)
|
msmouse$(PPUEXT) : msmouse.pp $(SYSTEMPPU)
|
||||||
|
@ -134,9 +134,9 @@ printer$(PPUEXT) : printer.pp $(SYSTEMPPU)
|
|||||||
include $(GRAPHDIR)/makefile.inc
|
include $(GRAPHDIR)/makefile.inc
|
||||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||||
|
|
||||||
graph$(PPUEXT) : $(GRAPHDIR)/graph.pp go32$(PPUEXT) ports$(PPUEXT) $(SYSTEMPPU) \
|
graph$(PPUEXT) : graph.pp go32$(PPUEXT) ports$(PPUEXT) $(SYSTEMPPU) \
|
||||||
$(GRAPHINCDEPS) graph.inc graphh.inc vesa.inc vesah.inc dpmi.inc
|
$(GRAPHINCDEPS) vesa.inc vesah.inc dpmi.inc
|
||||||
$(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
|
$(COMPILER) -I$(GRAPHDIR) graph.pp $(REDIR)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Delphi Compatible Units
|
# Delphi Compatible Units
|
||||||
|
@ -1,17 +1,75 @@
|
|||||||
{
|
{
|
||||||
$Id$
|
$Id$
|
||||||
}
|
This file is part of the Free Pascal run time library.
|
||||||
|
Copyright (c) 1999-2000 by Florian Klaempfl
|
||||||
|
|
||||||
{$ifdef DPMI}
|
This file implements the go32v2 support for the graph unit
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
unit Graph;
|
||||||
|
interface
|
||||||
|
|
||||||
|
{$i graphh.inc}
|
||||||
{$i vesah.inc}
|
{$i vesah.inc}
|
||||||
{$endif DPMI}
|
|
||||||
|
|
||||||
{$ifndef fpc}
|
CONST
|
||||||
{$i dpmi.inc}
|
m640x200x16 = VGALo;
|
||||||
{$else fpc}
|
m640x400x16 = VGAMed;
|
||||||
{$asmmode intel}
|
m640x480x16 = VGAHi;
|
||||||
{$endif fpc}
|
|
||||||
|
|
||||||
|
{ VESA Specific video modes. }
|
||||||
|
m320x200x32k = $10D;
|
||||||
|
m320x200x64k = $10E;
|
||||||
|
|
||||||
|
m640x400x256 = $100;
|
||||||
|
|
||||||
|
m640x480x256 = $101;
|
||||||
|
m640x480x32k = $110;
|
||||||
|
m640x480x64k = $111;
|
||||||
|
|
||||||
|
m800x600x16 = $102;
|
||||||
|
m800x600x256 = $103;
|
||||||
|
m800x600x32k = $113;
|
||||||
|
m800x600x64k = $114;
|
||||||
|
|
||||||
|
m1024x768x16 = $104;
|
||||||
|
m1024x768x256 = $105;
|
||||||
|
m1024x768x32k = $116;
|
||||||
|
m1024x768x64k = $117;
|
||||||
|
|
||||||
|
m1280x1024x16 = $106;
|
||||||
|
m1280x1024x256 = $107;
|
||||||
|
m1280x1024x32k = $119;
|
||||||
|
m1280x1024x64k = $11A;
|
||||||
|
|
||||||
|
const
|
||||||
|
UseLFB : boolean = false;
|
||||||
|
UseNoSelector : boolean = false;
|
||||||
|
LFBPointer : pointer = nil;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
go32,ports;
|
||||||
|
|
||||||
|
const
|
||||||
|
InternalDriverName = 'DOSGX';
|
||||||
|
|
||||||
|
{$i graph.inc}
|
||||||
|
|
||||||
|
|
||||||
|
Type
|
||||||
|
TDPMIRegisters = go32.registers;
|
||||||
|
|
||||||
|
{$asmmode intel}
|
||||||
|
|
||||||
{ How to access real mode memory }
|
{ How to access real mode memory }
|
||||||
{ using 32-bit DPMI memory }
|
{ using 32-bit DPMI memory }
|
||||||
@ -19,7 +77,6 @@
|
|||||||
{ 2. Set segment limit }
|
{ 2. Set segment limit }
|
||||||
{ 3. Set base linear address }
|
{ 3. Set base linear address }
|
||||||
const
|
const
|
||||||
InternalDriverName = 'DOSGX';
|
|
||||||
{$ifdef fpc}
|
{$ifdef fpc}
|
||||||
VideoOfs : DWord = 0; { Segment to draw to }
|
VideoOfs : DWord = 0; { Segment to draw to }
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
@ -2519,97 +2576,14 @@ const CrtAddress: word = 0;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
InitializeGraph;
|
||||||
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 2000-02-09 16:59:28 peter
|
Revision 1.8 2000-03-19 11:20:12 peter
|
||||||
* truncated log
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
Revision 1.12 2000/01/02 19:00:30 jonas
|
* ggigraph unit for linux added
|
||||||
* another small fix to getpixel320 and putpixel320 (when clip = off)
|
|
||||||
|
|
||||||
Revision 1.11 1999/12/29 16:43:44 jonas
|
|
||||||
* fixed put- and getpixel320 for fpc
|
|
||||||
|
|
||||||
Revision 1.10 1999/12/26 10:36:00 jonas
|
|
||||||
* finished patternlineVESA256 and enabled it
|
|
||||||
* folded (direct)put/getpixVESA32k and 64k into one procedure since
|
|
||||||
they were exactly the same code
|
|
||||||
|
|
||||||
Revision 1.9 1999/12/25 22:26:10 jonas
|
|
||||||
* vlinevesa256 wasn't used yet for 640x480x256
|
|
||||||
|
|
||||||
Revision 1.8 1999/12/25 08:25:20 jonas
|
|
||||||
* screen dimensions for g640x480x32k were set to 640x400, changed
|
|
||||||
|
|
||||||
Revision 1.7 1999/12/12 13:34:19 jonas
|
|
||||||
* putimage now performs the lipping itself and uses directputpixel
|
|
||||||
(note: this REQUIRES or/and/notput support in directputpixel,
|
|
||||||
this is not yet the case in the assembler versions!)
|
|
||||||
* YOffset addition moved in hlinevesa256 and vlinevesa256
|
|
||||||
because it uses still putpixel afterwards
|
|
||||||
|
|
||||||
Revision 1.6 1999/12/11 23:41:39 jonas
|
|
||||||
* changed definition of getscanlineproc to "getscanline(x1,x2,y:
|
|
||||||
integer; var data);" so it can be used by getimage too
|
|
||||||
* changed getimage so it uses getscanline
|
|
||||||
* changed floodfill, getscanline16 and definitions in Linux
|
|
||||||
include files so they use this new format
|
|
||||||
+ getscanlineVESA256 for 256 color VESA modes (banked)
|
|
||||||
|
|
||||||
Revision 1.5 1999/12/10 12:49:24 pierre
|
|
||||||
* avoid overflow on ProtW in PutPixel16
|
|
||||||
|
|
||||||
Revision 1.4 1999/11/29 07:32:53 jonas
|
|
||||||
* fixed setvgargbpalette (it's 6bit lsb, not msb values, so no shifts!)
|
|
||||||
|
|
||||||
Revision 1.3 1999/11/27 21:48:00 jonas
|
|
||||||
* fixed VlineVESA256 and re-enabled it in graph.inc
|
|
||||||
* added procedure detectgraph to interface of graph unit
|
|
||||||
|
|
||||||
Revision 1.2 1999/11/11 14:05:21 florian
|
|
||||||
+ support font loaded from BIOS
|
|
||||||
|
|
||||||
Revision 1.1 1999/11/08 11:15:21 peter
|
|
||||||
* move graph.inc to the target dir
|
|
||||||
|
|
||||||
Revision 1.26 1999/11/05 12:18:23 jonas
|
|
||||||
* fixed pascal version of (direct)putpixelx
|
|
||||||
|
|
||||||
Revision 1.25 1999/11/03 20:23:01 florian
|
|
||||||
+ first release of win32 gui support
|
|
||||||
|
|
||||||
Revision 1.24 1999/10/24 15:51:22 carl
|
|
||||||
* Bugfix of mode m800x600x64k - wrong vide mode would be used.
|
|
||||||
+ TP compilable.
|
|
||||||
|
|
||||||
Revision 1.23 1999/10/24 03:34:37 carl
|
|
||||||
- Removed some old french comments.
|
|
||||||
* Bugfix of problems with register access in noasmmoded
|
|
||||||
+ GetPixVESA16
|
|
||||||
|
|
||||||
Revision 1.22 1999/10/08 14:28:18 jonas
|
|
||||||
* fixed set/getvgargbpalette for VGA 16 color modes
|
|
||||||
|
|
||||||
Revision 1.21 1999/09/27 23:34:40 peter
|
|
||||||
* new graph unit is default for go32v2
|
|
||||||
* removed warnings/notes
|
|
||||||
|
|
||||||
Revision 1.20 1999/09/26 13:31:06 jonas
|
|
||||||
* changed name of modeinfo variable to vesamodeinfo and fixed
|
|
||||||
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
|
|
||||||
of sizeof(TVesamodeinfo) etc)
|
|
||||||
* changed several sizeof(type) to sizeof(varname) to avoid similar
|
|
||||||
errors in the future
|
|
||||||
|
|
||||||
Revision 1.19 1999/09/24 22:52:38 jonas
|
|
||||||
* optimized patternline a bit (always use hline when possible)
|
|
||||||
* isgraphmode stuff cleanup
|
|
||||||
* vesainfo.modelist now gets disposed in cleanmode instead of in
|
|
||||||
closegraph (required moving of some declarations from vesa.inc to
|
|
||||||
new vesah.inc)
|
|
||||||
* queryadapter gets no longer called from initgraph (is called from
|
|
||||||
initialization of graph unit)
|
|
||||||
* bugfix for notput in 32k and 64k vesa modes
|
|
||||||
* a div replaced by / in fillpoly
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,35 +0,0 @@
|
|||||||
CONST
|
|
||||||
|
|
||||||
m640x200x16 = VGALo;
|
|
||||||
m640x400x16 = VGAMed;
|
|
||||||
m640x480x16 = VGAHi;
|
|
||||||
|
|
||||||
{ VESA Specific video modes. }
|
|
||||||
m320x200x32k = $10D;
|
|
||||||
m320x200x64k = $10E;
|
|
||||||
|
|
||||||
m640x400x256 = $100;
|
|
||||||
|
|
||||||
m640x480x256 = $101;
|
|
||||||
m640x480x32k = $110;
|
|
||||||
m640x480x64k = $111;
|
|
||||||
|
|
||||||
m800x600x16 = $102;
|
|
||||||
m800x600x256 = $103;
|
|
||||||
m800x600x32k = $113;
|
|
||||||
m800x600x64k = $114;
|
|
||||||
|
|
||||||
m1024x768x16 = $104;
|
|
||||||
m1024x768x256 = $105;
|
|
||||||
m1024x768x32k = $116;
|
|
||||||
m1024x768x64k = $117;
|
|
||||||
|
|
||||||
m1280x1024x16 = $106;
|
|
||||||
m1280x1024x256 = $107;
|
|
||||||
m1280x1024x32k = $119;
|
|
||||||
m1280x1024x64k = $11A;
|
|
||||||
|
|
||||||
const
|
|
||||||
UseLFB : boolean = false;
|
|
||||||
UseNoSelector : boolean = false;
|
|
||||||
LFBPointer : pointer = nil;
|
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
This file is part of the Free Pascal run time library.
|
This file is part of the Free Pascal run time library.
|
||||||
Copyright (c) 1999-2000 by Carl Eric Codere
|
Copyright (c) 1999-2000 by Carl Eric Codere
|
||||||
@ -1834,8 +1833,6 @@ Const
|
|||||||
DsLimit : dword = 0;
|
DsLimit : dword = 0;
|
||||||
|
|
||||||
function NewHeapError(size : longint) : integer;
|
function NewHeapError(size : longint) : integer;
|
||||||
var
|
|
||||||
res : integer;
|
|
||||||
begin
|
begin
|
||||||
set_segment_limit(get_ds,DsLimit);
|
set_segment_limit(get_ds,DsLimit);
|
||||||
NewHeapError:=OldHeapError(size);
|
NewHeapError:=OldHeapError(size);
|
||||||
@ -2599,7 +2596,12 @@ Const
|
|||||||
|
|
||||||
(*
|
(*
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2000-03-12 22:32:22 pierre
|
Revision 1.22 2000-03-19 11:20:13 peter
|
||||||
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
|
* ggigraph unit for linux added
|
||||||
|
|
||||||
|
Revision 1.21 2000/03/12 22:32:22 pierre
|
||||||
+ UseLFB and UseNoSelector vars to force LinearFrameBuffer use
|
+ UseLFB and UseNoSelector vars to force LinearFrameBuffer use
|
||||||
with or without specific selector.
|
with or without specific selector.
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
This file is part of the Free Pascal run time library.
|
This file is part of the Free Pascal run time library.
|
||||||
Copyright (c) 1999-2000 by the Free Pascal development team
|
Copyright (c) 1999-2000 by the Free Pascal development team
|
||||||
|
|
||||||
|
Graph unit implementation part
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
|
|
||||||
@ -11,700 +13,6 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
Unit Graph;
|
|
||||||
{-------------------------------------------------------}
|
|
||||||
{ Differences with TP Graph unit: }
|
|
||||||
{ - default putimage and getimage only support a max. }
|
|
||||||
{ of 64K colors on screen, because all pixels are }
|
|
||||||
{ saved as words. }
|
|
||||||
{ - Set RGB Palette is not used, SetPalette must be }
|
|
||||||
{ used instead. }
|
|
||||||
{ - In the TP graph unit, Clipping is always performed }
|
|
||||||
{ on strings written with OutText, and this clipping }
|
|
||||||
{ is done on a character per character basis (for }
|
|
||||||
{ example, if ONE part of a character is outside the }
|
|
||||||
{ viewport , then that character is not written at }
|
|
||||||
{ all to the screen. In FPC Pascal, clipping is done }
|
|
||||||
{ on a PIXEL basis, not a character basis, so part of }
|
|
||||||
{ characters which are not entirely in the viewport }
|
|
||||||
{ may appear on the screen. }
|
|
||||||
{ - SetTextStyle only conforms to the TP version when }
|
|
||||||
{ the correct (and expected) values are used for }
|
|
||||||
{ CharSize for stroked fonts (4 = stroked fonts) }
|
|
||||||
{ - InstallUserDriver is not supported, so always }
|
|
||||||
{ returns an error. }
|
|
||||||
{ - RegisterBGIDriver is not supported, so always }
|
|
||||||
{ returns an error. }
|
|
||||||
{ - DrawPoly XORPut mode is not exactly the same as in }
|
|
||||||
{ the TP graph unit. }
|
|
||||||
{ - Imagesize returns a longint instead of a word }
|
|
||||||
{ - ImageSize cannot return an error value }
|
|
||||||
{-------------------------------------------------------}
|
|
||||||
{ AUTHORS: }
|
|
||||||
{ Gernot Tenchio - original version }
|
|
||||||
{ Florian Klaempfl - major updates }
|
|
||||||
{ Pierre Mueller - major bugfixes }
|
|
||||||
{ Carl Eric Codere - complete rewrite }
|
|
||||||
{ Thomas Schatzl - optimizations,routines and }
|
|
||||||
{ suggestions. }
|
|
||||||
{ Jonas Maebe - bugfixes and optimizations }
|
|
||||||
{ Credits (external): }
|
|
||||||
{ - Original FloodFill code by }
|
|
||||||
{ Menno Victor van der star }
|
|
||||||
{ (the code has been heavily modified) }
|
|
||||||
{-------------------------------------------------------}
|
|
||||||
{-------------------------------------------------------}
|
|
||||||
{ For significant speed improvements , is is recommended }
|
|
||||||
{ that these routines be hooked (otherwise the default, }
|
|
||||||
{ slower routines will be used) : }
|
|
||||||
{ HLine() }
|
|
||||||
{ VLine() }
|
|
||||||
{ PatternLine() }
|
|
||||||
{ ClearViewPort() }
|
|
||||||
{ PutImage() }
|
|
||||||
{ GetImage() - ImageSize() should also be changed }
|
|
||||||
{ InternalEllipse() }
|
|
||||||
{ Line() }
|
|
||||||
{ GetScanLine() }
|
|
||||||
{--------------------------------------------------------}
|
|
||||||
{ FPC unit requirements: }
|
|
||||||
{ All modes should at least have 1 graphics page to }
|
|
||||||
{ make it possible to create animation on all supported }
|
|
||||||
{ systems , this can be done either by double-buffering }
|
|
||||||
{ yourself in the heap if no hardware is available to do}
|
|
||||||
{ it. }
|
|
||||||
{--------------------------------------------------------}
|
|
||||||
{ COMPATIBILITY WARNING: Some of the compatibility tests }
|
|
||||||
{ were done using the CGA and other the VGA drivers. }
|
|
||||||
{ Within the BGI drivers themselves the BEHAVIOUR is not }
|
|
||||||
{ the same, so be warned!!! }
|
|
||||||
{--------------------------------------------------------}
|
|
||||||
{ History log: }
|
|
||||||
{ 15th February 1999: }
|
|
||||||
{ + Added support for system font in vertical mode }
|
|
||||||
{ + system font is now available for all platforms }
|
|
||||||
{ * font support routines now compile }
|
|
||||||
{ * textHeight would not return correct size for system }
|
|
||||||
{ font }
|
|
||||||
{ * Alignment of fonts partly fixed }
|
|
||||||
{ 17th Feb. 1999: }
|
|
||||||
{ + First support for stroked fonts }
|
|
||||||
{ 18th Feb. 1999: }
|
|
||||||
{ * bugfix of line drawing which fixes stroked font }
|
|
||||||
{ displays. }
|
|
||||||
{ 23rd Feb. 1999: }
|
|
||||||
{ + Applied Pierre's patches to font }
|
|
||||||
{ + Added scaling of bitmapped fonts }
|
|
||||||
{ + Vertical stroked fonts }
|
|
||||||
{ 24th Feb. 1999: }
|
|
||||||
{ * Scaling of stroked fonts must be done using FPs }
|
|
||||||
{ to be 100% compatible with turbo pascal }
|
|
||||||
{ + Sped up by 40% stroked font scaling calculations }
|
|
||||||
{ + RegisterBGIFont }
|
|
||||||
{ 9th march 1999: }
|
|
||||||
{ + Starting implementing Fillpoly() }
|
|
||||||
{ 15th march 1999: }
|
|
||||||
{ + SetFillStyle() }
|
|
||||||
{ + patternLine() }
|
|
||||||
{ + Bar() }
|
|
||||||
{ * GraphDefaults would not make the Default color }
|
|
||||||
{ of the fill pattern to the Max. Palette entry. }
|
|
||||||
{ + SetFillPattern() }
|
|
||||||
{ 20th march 1999: }
|
|
||||||
{ * GraphDefaults would not reset to the text system }
|
|
||||||
{ * DefaultFont would write one character too much to }
|
|
||||||
{ the screen }
|
|
||||||
{ + Sloped thick lines in Line() }
|
|
||||||
{ + Sloped patterned lines in Line() }
|
|
||||||
{ * GraphDefaults would not reset the User Fill pattern}
|
|
||||||
{ to $ff }
|
|
||||||
{ + DirectPutPixel takes care of XOR mode writes }
|
|
||||||
{ improves speed by about 30% over old method of }
|
|
||||||
{ GetPixel XOR CurrentColor }
|
|
||||||
{ * Dashed LineStyle exactly like BP version now }
|
|
||||||
{ + Center LineStyle (checked against CGA driver) }
|
|
||||||
{ * GraphDefaults() now resets linepattern array }
|
|
||||||
{ 1st april 1999: }
|
|
||||||
{ + First implementation of FillPoly (incomplete) }
|
|
||||||
{ 2nd april 1999: }
|
|
||||||
{ * FillPoly did not Reset PatternLine index }
|
|
||||||
{ * FillPoly did not use correct color }
|
|
||||||
{ * PatternLine was writing modes in reverse direction }
|
|
||||||
{ * PatternLine would not work with non-rectangular }
|
|
||||||
{ shapes. }
|
|
||||||
{ * PatternLine must fill up the ENTIRE pattern, }
|
|
||||||
{ with either the foreground or background color. }
|
|
||||||
{ * GraphDefaults() would not call SetBkColor() }
|
|
||||||
{ * Fixed some memory leaks in FillPoly() }
|
|
||||||
{ 11th April 1999: }
|
|
||||||
{ * PatternLine() was drawing one pixel less then }
|
|
||||||
{ requested }
|
|
||||||
{ 12th April 1999: }
|
|
||||||
{ + FloodFill - first working implementation }
|
|
||||||
{ Horrbly slow even on very fast cpu's }
|
|
||||||
{ + Some suggestions of Thomas implemented }
|
|
||||||
{ 13th April 1999: }
|
|
||||||
{ * FloodFill() vertical index was off by one pixel }
|
|
||||||
{ * FloodFill() would never draw the last line in the }
|
|
||||||
{ list }
|
|
||||||
{ - Removed ClearViewPort320 which was wrong anyways, }
|
|
||||||
{ will need to be implemented later. }
|
|
||||||
{ * PatternLine() would not always restore write mode }
|
|
||||||
{ + Circle() uses NormalPut always with NormWidth lines}
|
|
||||||
{ + FillEllipse() initial version }
|
|
||||||
{ * InternalEllipse() - 0 to 360 now supported as }
|
|
||||||
{ angles. }
|
|
||||||
{ 14th April 1999: }
|
|
||||||
{ * mod x = and (x-1)(from Thomas Schatzl) gives a }
|
|
||||||
{ significant speed improvement. }
|
|
||||||
{ 15th april 1999: }
|
|
||||||
{ + Arc() ok except for Aspect Ratio, which does not }
|
|
||||||
{ give us the correct ratio on a 320x200 screen. }
|
|
||||||
{ + Added FillPoly() from Thomas Schatzl }
|
|
||||||
{ + More hookable routines }
|
|
||||||
{ 16th april 1999: }
|
|
||||||
{ + Line() checked ok. }
|
|
||||||
{ 17th april 1999: }
|
|
||||||
{ * GraphDefaults() would not reset CP }
|
|
||||||
{ + GetX(), GetY(), MoveTo() checked for viewports }
|
|
||||||
{ * OutTextXY() should not update the CP }
|
|
||||||
{ * ClearViewPort() would not update the CP }
|
|
||||||
{ * ClearDevice() would not update the CP }
|
|
||||||
{ * Sector() would update the CP by calling LineTo }
|
|
||||||
{ * Bar3D() would update the CP }
|
|
||||||
{ * PieSlice() would update the CP }
|
|
||||||
{ 18th april 1999: }
|
|
||||||
{ + Clipping algorithm }
|
|
||||||
{ 19th april 1999: }
|
|
||||||
{ + Adapterinfo structure }
|
|
||||||
{ 20th april 1999: }
|
|
||||||
{ + GetModeName }
|
|
||||||
{ + GetGraphMode }
|
|
||||||
{ + GetModeRange }
|
|
||||||
{--------------------------------------------------------}
|
|
||||||
{ LEFT TO DO: }
|
|
||||||
{ - optimize scaling of stroked fonts }
|
|
||||||
{ - optimize InternalEllipse() }
|
|
||||||
{ using linear appx. of sine/cosine tables }
|
|
||||||
{ - justification for stroked fonts does not work }
|
|
||||||
{--------------------------------------------------------}
|
|
||||||
|
|
||||||
{ text.inc will crash on aligned requirement machines. }
|
|
||||||
{ (packed record for fontrec) }
|
|
||||||
{$ifndef fpc}
|
|
||||||
{$G+}
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
Interface
|
|
||||||
|
|
||||||
|
|
||||||
{$ifdef win32}
|
|
||||||
uses
|
|
||||||
windows;
|
|
||||||
{$endif win32}
|
|
||||||
|
|
||||||
type smallint = -32768..32767;
|
|
||||||
|
|
||||||
const
|
|
||||||
maxsmallint = high(smallint);
|
|
||||||
{ error codes }
|
|
||||||
grOk = 0;
|
|
||||||
grNoInitGraph = -1;
|
|
||||||
grNotDetected = -2;
|
|
||||||
grFileNotFound = -3;
|
|
||||||
grInvalidDriver = -4;
|
|
||||||
grNoLoadMem = -5;
|
|
||||||
grNoScanMem = -6;
|
|
||||||
grNoFloodMem = -7;
|
|
||||||
grFontNotFound = -8;
|
|
||||||
grNoFontMem = -9;
|
|
||||||
grInvalidMode = -10;
|
|
||||||
grError = -11;
|
|
||||||
grIOerror = -12;
|
|
||||||
grInvalidFont = -13;
|
|
||||||
grInvalidFontNum = -14;
|
|
||||||
grInvalidVersion = -18;
|
|
||||||
|
|
||||||
|
|
||||||
{ Color constants for setpalette }
|
|
||||||
black = 0;
|
|
||||||
blue = 1;
|
|
||||||
green = 2;
|
|
||||||
cyan = 3;
|
|
||||||
red = 4;
|
|
||||||
magenta = 5;
|
|
||||||
brown = 6;
|
|
||||||
lightgray = 7;
|
|
||||||
darkgray = 8;
|
|
||||||
lightblue = 9;
|
|
||||||
lightgreen = 10;
|
|
||||||
lightcyan = 11;
|
|
||||||
lightred = 12;
|
|
||||||
lightmagenta = 13;
|
|
||||||
yellow = 14;
|
|
||||||
white = 15;
|
|
||||||
|
|
||||||
EGABlack = 0;
|
|
||||||
EGABlue = 1;
|
|
||||||
EGAGreen = 2;
|
|
||||||
EGACyan = 3;
|
|
||||||
EGARed = 4;
|
|
||||||
EGAMagenta = 5;
|
|
||||||
EGALightgray= 7;
|
|
||||||
EGABrown = 20;
|
|
||||||
EGADarkgray = 56;
|
|
||||||
EGALightblue = 57;
|
|
||||||
EGALightgreen = 58;
|
|
||||||
EGALightcyan = 59;
|
|
||||||
EGALightred = 60;
|
|
||||||
EGALightmagenta=61;
|
|
||||||
EGAYellow = 62;
|
|
||||||
EGAWhite = 63;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ Line styles for GetLineStyle/SetLineStyle }
|
|
||||||
SolidLn = 0;
|
|
||||||
DottedLn = 1;
|
|
||||||
CenterLn = 2;
|
|
||||||
DashedLn = 3;
|
|
||||||
UserBitLn = 4;
|
|
||||||
|
|
||||||
NormWidth = 1;
|
|
||||||
ThickWidth = 3;
|
|
||||||
|
|
||||||
{ Set/GetTextStyle Konstanten: }
|
|
||||||
DefaultFont = 0;
|
|
||||||
TriplexFont = 1;
|
|
||||||
SmallFont = 2;
|
|
||||||
SansSerifFont = 3;
|
|
||||||
GothicFont = 4;
|
|
||||||
ScriptFont = 5;
|
|
||||||
SimpleFont = 6;
|
|
||||||
TSCRFont = 7;
|
|
||||||
LCOMFont = 8;
|
|
||||||
EuroFont = 9;
|
|
||||||
BoldFont = 10;
|
|
||||||
|
|
||||||
HorizDir = 0;
|
|
||||||
VertDir = 1;
|
|
||||||
|
|
||||||
UserCharSize = 0;
|
|
||||||
|
|
||||||
ClipOn = true;
|
|
||||||
ClipOff = false;
|
|
||||||
|
|
||||||
{ Bar3D constants }
|
|
||||||
TopOn = true;
|
|
||||||
TopOff = false;
|
|
||||||
|
|
||||||
{ fill pattern for Get/SetFillStyle: }
|
|
||||||
EmptyFill = 0;
|
|
||||||
SolidFill = 1;
|
|
||||||
LineFill = 2;
|
|
||||||
LtSlashFill = 3;
|
|
||||||
SlashFill = 4;
|
|
||||||
BkSlashFill = 5;
|
|
||||||
LtBkSlashFill = 6;
|
|
||||||
HatchFill = 7;
|
|
||||||
XHatchFill = 8;
|
|
||||||
InterleaveFill = 9;
|
|
||||||
WideDotFill = 10;
|
|
||||||
CloseDotFill = 11;
|
|
||||||
UserFill = 12;
|
|
||||||
|
|
||||||
{ bitblt operators }
|
|
||||||
NormalPut = 0;
|
|
||||||
CopyPut = 0;
|
|
||||||
XORPut = 1;
|
|
||||||
OrPut = 2;
|
|
||||||
AndPut = 3;
|
|
||||||
NotPut = 4;
|
|
||||||
|
|
||||||
{ SetTextJustify constants }
|
|
||||||
LeftText = 0;
|
|
||||||
CenterText = 1;
|
|
||||||
RightText = 2;
|
|
||||||
|
|
||||||
BottomText = 0;
|
|
||||||
TopText = 2;
|
|
||||||
|
|
||||||
{ graphic drivers }
|
|
||||||
CurrentDriver = -128;
|
|
||||||
Detect = 0;
|
|
||||||
LowRes = 1;
|
|
||||||
HercMono = 7;
|
|
||||||
VGA = 9;
|
|
||||||
VESA = 10;
|
|
||||||
|
|
||||||
{ graph modes }
|
|
||||||
Default = 0;
|
|
||||||
|
|
||||||
{ VGA Driver modes }
|
|
||||||
VGALo = 0;
|
|
||||||
VGAMed = 1;
|
|
||||||
VGAHi = 2;
|
|
||||||
|
|
||||||
{ Hercules mono card }
|
|
||||||
HercMonoHi = 0;
|
|
||||||
|
|
||||||
MaxColors = 255; { Maximum possible colors using a palette }
|
|
||||||
{ otherwise, direct color encoding }
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
RGBRec = packed record
|
|
||||||
Red: smallint;
|
|
||||||
Green: smallint;
|
|
||||||
Blue : smallint;
|
|
||||||
end;
|
|
||||||
|
|
||||||
PaletteType = record
|
|
||||||
Size : longint;
|
|
||||||
Colors : array[0..MaxColors] of RGBRec;
|
|
||||||
end;
|
|
||||||
|
|
||||||
LineSettingsType = record
|
|
||||||
linestyle : word;
|
|
||||||
pattern : word;
|
|
||||||
thickness : word;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TextSettingsType = record
|
|
||||||
font : word;
|
|
||||||
direction : word;
|
|
||||||
charsize : word;
|
|
||||||
horiz : word;
|
|
||||||
vert : word;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FillSettingsType = record
|
|
||||||
pattern : word;
|
|
||||||
color : word;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FillPatternType = array[1..8] of byte;
|
|
||||||
|
|
||||||
PointType = record
|
|
||||||
x,y : smallint;
|
|
||||||
end;
|
|
||||||
|
|
||||||
ViewPortType = record
|
|
||||||
x1,y1,x2,y2 : smallint;
|
|
||||||
Clip : boolean;
|
|
||||||
end;
|
|
||||||
|
|
||||||
ArcCoordsType = record
|
|
||||||
x,y : smallint;
|
|
||||||
xstart,ystart : smallint;
|
|
||||||
xend,yend : smallint;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$IFDEF FPC}
|
|
||||||
graph_int = longint; { platform specific smallint used for indexes;
|
|
||||||
should be 16 bits on TP/BP and 32 bits on every-
|
|
||||||
thing else for speed reasons }
|
|
||||||
graph_float = single; { the platform's preferred floating point size }
|
|
||||||
{$ELSE}
|
|
||||||
graph_int = smallint; { platform specific smallint used for indexes;
|
|
||||||
should be 16 bits on TP/BP and 32 bits on every-
|
|
||||||
thing else for speed reasons }
|
|
||||||
graph_float = real; { the platform's preferred floating point size }
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
const
|
|
||||||
fillpatternTable : array[0..12] of FillPatternType = (
|
|
||||||
($00,$00,$00,$00,$00,$00,$00,$00), { background color }
|
|
||||||
($ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff), { foreground color }
|
|
||||||
($ff,$ff,$00,$00,$ff,$ff,$00,$00), { horizontal lines }
|
|
||||||
($01,$02,$04,$08,$10,$20,$40,$80), { slashes }
|
|
||||||
($07,$0e,$1c,$38,$70,$e0,$c1,$83), { thick slashes }
|
|
||||||
($07,$83,$c1,$e0,$70,$38,$1c,$0e), { thick backslashes }
|
|
||||||
($5a,$2d,$96,$4b,$a5,$d2,$69,$b4), { backslashes }
|
|
||||||
($ff,$88,$88,$88,$ff,$88,$88,$88), { small boxes }
|
|
||||||
($18,$24,$42,$81,$81,$42,$24,$18), { rhombus }
|
|
||||||
($cc,$33,$cc,$33,$cc,$33,$cc,$33), { wall pattern }
|
|
||||||
($80,$00,$08,$00,$80,$00,$08,$00), { wide points }
|
|
||||||
($88,$00,$22,$00,$88,$00,$22,$00), { dense points }
|
|
||||||
(0,0,0,0,0,0,0,0) { user defined line style }
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{ ******************** PROCEDURAL VARIABLES ********************* }
|
|
||||||
{ * These are hooks which have device specific stuff in them, * }
|
|
||||||
{ * therefore to add new modes or to redirect these routines * }
|
|
||||||
{ * then declare variables of these types as shown below. * }
|
|
||||||
{-----------------------------------------------------------------}
|
|
||||||
|
|
||||||
TYPE
|
|
||||||
|
|
||||||
|
|
||||||
{ This is the standard putpixel routine used by all function }
|
|
||||||
{ drawing routines, it will use the viewport settings, as }
|
|
||||||
{ well as clip, and use the current foreground color to plot }
|
|
||||||
{ the desired pixel. }
|
|
||||||
defpixelproc = procedure(X,Y: smallint);
|
|
||||||
|
|
||||||
{ standard plot and get pixel }
|
|
||||||
getpixelproc = function(X,Y: smallint): word;
|
|
||||||
putpixelproc = procedure(X,Y: smallint; Color: Word);
|
|
||||||
|
|
||||||
{ clears the viewport, also used to clear the device }
|
|
||||||
clrviewproc = procedure;
|
|
||||||
|
|
||||||
{ putimage procedure, can be hooked to accomplish transparency }
|
|
||||||
putimageproc = procedure (X,Y: smallint; var Bitmap; BitBlt: Word);
|
|
||||||
getimageproc = procedure(X1,Y1,X2,Y2: smallint; Var Bitmap);
|
|
||||||
imagesizeproc= function (X1,Y1,X2,Y2: smallint): longint;
|
|
||||||
|
|
||||||
graphfreememprc = procedure (var P: Pointer; size: word);
|
|
||||||
graphgetmemprc = procedure (var P: pointer; size: word);
|
|
||||||
|
|
||||||
{ internal routines -- can be hooked for much faster drawing }
|
|
||||||
|
|
||||||
{ draw filled horizontal lines using current color }
|
|
||||||
{ on entry coordinates are already clipped. }
|
|
||||||
hlineproc = procedure (x, x2,y : smallint);
|
|
||||||
{ on entry coordinates are already clipped. }
|
|
||||||
{ draw filled vertical line using current color }
|
|
||||||
vlineproc = procedure (x,y,y2: smallint);
|
|
||||||
|
|
||||||
{ this routine is used to draw filled patterns for all routines }
|
|
||||||
{ that require it. (FillPoly, FloodFill, Sector, etc... }
|
|
||||||
{ clipping is verified, uses current Fill settings for drawing }
|
|
||||||
patternlineproc = procedure (x1,x2,y: smallint);
|
|
||||||
|
|
||||||
{ this routine is used to draw all circles/ellipses/sectors }
|
|
||||||
{ more info... on this later... }
|
|
||||||
ellipseproc = procedure (X,Y: smallint;XRadius: word;
|
|
||||||
YRadius:word; stAngle,EndAngle: word; fp: PatternLineProc);
|
|
||||||
|
|
||||||
{ Line routine - draws lines thick/norm widths with current }
|
|
||||||
{ color and line style - LINE must be clipped here. }
|
|
||||||
lineproc = procedure (X1, Y1, X2, Y2 : smallint);
|
|
||||||
|
|
||||||
{ this routine is used for FloodFill - it returns an entire }
|
|
||||||
{ screen scan line with a word for each pixel in the scanline. }
|
|
||||||
{ Also handy for GetImage, so I added x coords as well (JM) }
|
|
||||||
getscanlineproc = procedure (X1, X2, Y : smallint; var data);
|
|
||||||
|
|
||||||
{ changes the active display screen where we draw to... }
|
|
||||||
setactivepageproc = procedure (page: word);
|
|
||||||
|
|
||||||
{ changes the active display screen which we see ... }
|
|
||||||
setvisualpageproc = procedure (page: word);
|
|
||||||
|
|
||||||
{ this routine actually switches to the desired video mode. }
|
|
||||||
initmodeproc = procedure;
|
|
||||||
|
|
||||||
{ this routine is called to save the sate just before a mode set }
|
|
||||||
savestateproc = procedure;
|
|
||||||
{ this routine is called in closegraph to cleanup... }
|
|
||||||
restorestateproc = procedure;
|
|
||||||
|
|
||||||
{ This routine is a hook for SetRGBPalette }
|
|
||||||
setrgbpaletteproc =
|
|
||||||
procedure(ColorNum, RedValue, GreenValue, BlueValue: smallint);
|
|
||||||
|
|
||||||
{ This routine is a hook for GetRGBPalette }
|
|
||||||
getrgbpaletteproc =
|
|
||||||
procedure(ColorNum: smallint; var
|
|
||||||
RedValue, GreenValue, BlueValue: smallint);
|
|
||||||
|
|
||||||
|
|
||||||
TYPE
|
|
||||||
{-----------------------------------}
|
|
||||||
{ Linked list for mode information }
|
|
||||||
{ This list is set up by one of the }
|
|
||||||
{ following routines: }
|
|
||||||
{ It lists all available resolutions}
|
|
||||||
{ on this display adapter. }
|
|
||||||
{-----------------------------------}
|
|
||||||
{ QueryAdapter() }
|
|
||||||
{ DetectGraph() }
|
|
||||||
{ InitGraph() }
|
|
||||||
{-----------------------------------}
|
|
||||||
PModeInfo = ^TModeInfo;
|
|
||||||
TModeInfo = record
|
|
||||||
DriverNumber: smallint;
|
|
||||||
ModeNumber: smallint;
|
|
||||||
MaxColor: Longint; { Maximum colors on screen }
|
|
||||||
PaletteSize : Longint; { Maximum palette entry we can change }
|
|
||||||
XAspect : word; { XAspect ratio correction factor }
|
|
||||||
YAspect : word; { YAspect ratio correction factor }
|
|
||||||
MaxX: word; { Max-X row }
|
|
||||||
MaxY: word; { Max. column. }
|
|
||||||
DirectColor: boolean; { Is this a direct color mode?? }
|
|
||||||
Hardwarepages: byte; { total number of image pages - 1 }
|
|
||||||
ModeName: String[18];
|
|
||||||
{ necessary hooks ... }
|
|
||||||
DirectPutPixel : DefPixelProc;
|
|
||||||
GetPixel : GetPixelProc;
|
|
||||||
PutPixel : PutPixelProc;
|
|
||||||
SetRGBPalette : SetRGBPaletteProc;
|
|
||||||
GetRGBPalette : GetRGBPaletteProc;
|
|
||||||
{ defaults possible ... }
|
|
||||||
SetVisualPage : SetVisualPageProc;
|
|
||||||
SetActivePage : SetActivePageProc;
|
|
||||||
ClearViewPort : ClrViewProc;
|
|
||||||
PutImage : PutImageProc;
|
|
||||||
GetImage : GetImageProc;
|
|
||||||
ImageSize : ImageSizeProc;
|
|
||||||
GetScanLine : GetScanLineProc;
|
|
||||||
Line : LineProc;
|
|
||||||
InternalEllipse: EllipseProc;
|
|
||||||
PatternLine : PatternLineProc;
|
|
||||||
HLine : HLineProc;
|
|
||||||
VLine : VLineProc;
|
|
||||||
InitMode : InitModeProc;
|
|
||||||
next: PModeInfo;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VAR
|
|
||||||
DirectPutPixel : DefPixelProc;
|
|
||||||
ClearViewPort : ClrViewProc;
|
|
||||||
PutPixel : PutPixelProc;
|
|
||||||
PutImage : PutImageProc;
|
|
||||||
GetImage : GetImageProc;
|
|
||||||
ImageSize : ImageSizeProc;
|
|
||||||
GetPixel : GetPixelProc;
|
|
||||||
SetVisualPage : SetVisualPageProc;
|
|
||||||
SetActivePage : SetActivePageProc;
|
|
||||||
SetRGBPalette : SetRGBPaletteProc;
|
|
||||||
GetRGBPalette : GetRGBPaletteProc;
|
|
||||||
|
|
||||||
GraphFreeMemPtr: graphfreememprc;
|
|
||||||
GraphGetMemPtr : graphgetmemprc;
|
|
||||||
|
|
||||||
GetScanLine : GetScanLineProc;
|
|
||||||
Line : LineProc;
|
|
||||||
InternalEllipse: EllipseProc;
|
|
||||||
PatternLine : PatternLineProc;
|
|
||||||
HLine : HLineProc;
|
|
||||||
VLine : VLineProc;
|
|
||||||
|
|
||||||
SaveVideoState : SaveStateProc;
|
|
||||||
RestoreVideoState: RestoreStateProc;
|
|
||||||
ExitSave: pointer;
|
|
||||||
|
|
||||||
|
|
||||||
Procedure Closegraph;
|
|
||||||
procedure SetLineStyle(LineStyle: word; Pattern: word; Thickness: word);
|
|
||||||
function GraphErrorMsg(ErrorCode: smallint): string;
|
|
||||||
Function GetMaxX: smallint;
|
|
||||||
Function GetMaxY: smallint;
|
|
||||||
Procedure SetViewPort(X1, Y1, X2, Y2: smallint; Clip: Boolean);
|
|
||||||
Function GraphResult: smallint;
|
|
||||||
function GetModeName(ModeNumber: smallint): string;
|
|
||||||
procedure SetGraphMode(Mode: smallint);
|
|
||||||
function GetGraphMode: smallint;
|
|
||||||
function GetMaxMode: word;
|
|
||||||
procedure RestoreCrtMode;
|
|
||||||
procedure GetModeRange(GraphDriver: smallint; var LoMode, HiMode: smallint);
|
|
||||||
Function GetX: smallint;
|
|
||||||
Function GetY: smallint;
|
|
||||||
procedure GraphDefaults;
|
|
||||||
procedure ClearDevice;
|
|
||||||
procedure GetViewSettings(var viewport : ViewPortType);
|
|
||||||
procedure SetWriteMode(WriteMode : smallint);
|
|
||||||
procedure GetFillSettings(var Fillinfo:Fillsettingstype);
|
|
||||||
procedure GetFillPattern(var FillPattern:FillPatternType);
|
|
||||||
procedure GetLineSettings(var ActiveLineInfo : LineSettingsType);
|
|
||||||
procedure InitGraph(var GraphDriver:smallint;var GraphMode:smallint;const PathToDriver:String);
|
|
||||||
procedure DetectGraph(var GraphDriver:smallint;var GraphMode:smallint);
|
|
||||||
function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
|
|
||||||
function RegisterBGIDriver(driver: pointer): smallint;
|
|
||||||
procedure SetFillStyle(Pattern : word; Color: word);
|
|
||||||
procedure SetFillPattern(Pattern: FillPatternType; Color: word);
|
|
||||||
Function GetDriverName: string;
|
|
||||||
procedure MoveRel(Dx, Dy: smallint);
|
|
||||||
procedure MoveTo(X,Y: smallint);
|
|
||||||
|
|
||||||
procedure SetDirectVideo(DirectAccess: boolean);
|
|
||||||
function GetDirectVideo: boolean;
|
|
||||||
|
|
||||||
{ -------------------- Color/Palette ------------------------------- }
|
|
||||||
procedure SetBkColor(ColorNum: Word);
|
|
||||||
function GetColor: Word;
|
|
||||||
function GetBkColor: Word;
|
|
||||||
procedure SetColor(Color: Word);
|
|
||||||
function GetMaxColor: word;
|
|
||||||
|
|
||||||
procedure SetAllPalette(var Palette:PaletteType);
|
|
||||||
procedure SetPalette(ColorNum: word; Color: shortint);
|
|
||||||
procedure GetPalette(var Palette: PaletteType);
|
|
||||||
function GetPaletteSize: smallint;
|
|
||||||
procedure GetDefaultPalette(var Palette: PaletteType);
|
|
||||||
|
|
||||||
|
|
||||||
{ -------------------- Shapes/Lines -------------------------------- }
|
|
||||||
procedure Rectangle(x1,y1,x2,y2:smallint);
|
|
||||||
procedure Bar(x1,y1,x2,y2:smallint);
|
|
||||||
procedure Bar3D(x1, y1, x2, y2 : smallint;depth : word;top : boolean);
|
|
||||||
procedure FillPoly(NumPoints: word; Var PolyPoints);
|
|
||||||
procedure DrawPoly(NumPoints : word;var polypoints);
|
|
||||||
procedure LineRel(Dx, Dy: smallint);
|
|
||||||
procedure LineTo(X,Y : smallint);
|
|
||||||
procedure FloodFill(x : smallint; y : smallint; Border: word);
|
|
||||||
|
|
||||||
{ -------------------- Circle related routines --------------------- }
|
|
||||||
procedure GetAspectRatio(var Xasp,Yasp : word);
|
|
||||||
procedure SetAspectRatio(Xasp, Yasp : word);
|
|
||||||
procedure GetArcCoords(var ArcCoords: ArcCoordsType);
|
|
||||||
|
|
||||||
|
|
||||||
procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
|
|
||||||
procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: Word);
|
|
||||||
procedure FillEllipse(X, Y: smallint; XRadius, YRadius: Word);
|
|
||||||
procedure Circle(X, Y: smallint; Radius:Word);
|
|
||||||
procedure Sector(x, y: smallint; StAngle,EndAngle, XRadius, YRadius: Word);
|
|
||||||
procedure Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,
|
|
||||||
YRadius: word);
|
|
||||||
|
|
||||||
{ --------------------- Text related routines --------------------- }
|
|
||||||
function InstallUserFont(const FontFileName : string) : smallint;
|
|
||||||
function RegisterBGIfont(font : pointer) : smallint;
|
|
||||||
procedure GetTextSettings(var TextInfo : TextSettingsType);
|
|
||||||
function TextHeight(const TextString : string) : word;
|
|
||||||
function TextWidth(const TextString : string) : word;
|
|
||||||
procedure SetTextJustify(horiz,vert : word);
|
|
||||||
procedure SetTextStyle(font,direction : word;charsize : word);
|
|
||||||
procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
|
|
||||||
|
|
||||||
procedure OutTextXY(x,y : smallint;const TextString : string);
|
|
||||||
procedure OutText(const TextString : string);
|
|
||||||
|
|
||||||
{ Load extra graph additions per system like mode constants }
|
|
||||||
{$i graphh.inc}
|
|
||||||
|
|
||||||
|
|
||||||
Implementation
|
|
||||||
|
|
||||||
{ what a mess ... it would be much better if the graph unit }
|
|
||||||
{ would follow the structure of the FPC system unit: }
|
|
||||||
{ the main file is system depended and the system independend part }
|
|
||||||
{ is included (FK) }
|
|
||||||
{$ifdef fpc}
|
|
||||||
{$ifdef go32v2}
|
|
||||||
{$define dpmi}
|
|
||||||
uses go32,ports;
|
|
||||||
Type TDPMIRegisters = go32.registers;
|
|
||||||
{$endif go32v2}
|
|
||||||
{$ifdef win32}
|
|
||||||
uses
|
|
||||||
strings;
|
|
||||||
{$endif}
|
|
||||||
{$ifdef linux}
|
|
||||||
uses linux;
|
|
||||||
{$endif}
|
|
||||||
{$else fpc}
|
|
||||||
{$IFDEF DPMI}
|
|
||||||
uses WinAPI;
|
|
||||||
{$ENDIF}
|
|
||||||
{$endif fpc}
|
|
||||||
|
|
||||||
{$ifdef logging}
|
{$ifdef logging}
|
||||||
var debuglog: text;
|
var debuglog: text;
|
||||||
@ -2159,7 +1467,6 @@ end;
|
|||||||
|
|
||||||
{$i modes.inc}
|
{$i modes.inc}
|
||||||
{$i palette.inc}
|
{$i palette.inc}
|
||||||
{$i graph.inc}
|
|
||||||
|
|
||||||
function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
|
function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
|
||||||
begin
|
begin
|
||||||
@ -2960,6 +2267,7 @@ end;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure InitializeGraph;
|
||||||
begin
|
begin
|
||||||
{$ifdef logging}
|
{$ifdef logging}
|
||||||
assign(debuglog,'grlog.txt');
|
assign(debuglog,'grlog.txt');
|
||||||
@ -3003,10 +2311,15 @@ begin
|
|||||||
{$ifdef win32}
|
{$ifdef win32}
|
||||||
charmessagehandler:=nil;
|
charmessagehandler:=nil;
|
||||||
{$endif win32}
|
{$endif win32}
|
||||||
end.
|
end;
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.60 2000-03-18 10:45:07 sg
|
Revision 1.28 2000-03-19 11:20:13 peter
|
||||||
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
|
* ggigraph unit for linux added
|
||||||
|
|
||||||
|
Revision 1.60 2000/03/18 10:45:07 sg
|
||||||
* Fix for ClearViewportDefault: The width and the height of the rectangle
|
* Fix for ClearViewportDefault: The width and the height of the rectangle
|
||||||
it filled has been one pixel too high.
|
it filled has been one pixel too high.
|
||||||
|
|
682
rtl/inc/graph/graphh.inc
Normal file
682
rtl/inc/graph/graphh.inc
Normal file
@ -0,0 +1,682 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
This file is part of the Free Pascal run time library.
|
||||||
|
Copyright (c) 1999-2000 by the Free Pascal development team
|
||||||
|
|
||||||
|
Interface include file for graph unit
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
{-------------------------------------------------------}
|
||||||
|
{ Differences with TP Graph unit: }
|
||||||
|
{ - default putimage and getimage only support a max. }
|
||||||
|
{ of 64K colors on screen, because all pixels are }
|
||||||
|
{ saved as words. }
|
||||||
|
{ - Set RGB Palette is not used, SetPalette must be }
|
||||||
|
{ used instead. }
|
||||||
|
{ - In the TP graph unit, Clipping is always performed }
|
||||||
|
{ on strings written with OutText, and this clipping }
|
||||||
|
{ is done on a character per character basis (for }
|
||||||
|
{ example, if ONE part of a character is outside the }
|
||||||
|
{ viewport , then that character is not written at }
|
||||||
|
{ all to the screen. In FPC Pascal, clipping is done }
|
||||||
|
{ on a PIXEL basis, not a character basis, so part of }
|
||||||
|
{ characters which are not entirely in the viewport }
|
||||||
|
{ may appear on the screen. }
|
||||||
|
{ - SetTextStyle only conforms to the TP version when }
|
||||||
|
{ the correct (and expected) values are used for }
|
||||||
|
{ CharSize for stroked fonts (4 = stroked fonts) }
|
||||||
|
{ - InstallUserDriver is not supported, so always }
|
||||||
|
{ returns an error. }
|
||||||
|
{ - RegisterBGIDriver is not supported, so always }
|
||||||
|
{ returns an error. }
|
||||||
|
{ - DrawPoly XORPut mode is not exactly the same as in }
|
||||||
|
{ the TP graph unit. }
|
||||||
|
{ - Imagesize returns a longint instead of a word }
|
||||||
|
{ - ImageSize cannot return an error value }
|
||||||
|
{-------------------------------------------------------}
|
||||||
|
{ AUTHORS: }
|
||||||
|
{ Gernot Tenchio - original version }
|
||||||
|
{ Florian Klaempfl - major updates }
|
||||||
|
{ Pierre Mueller - major bugfixes }
|
||||||
|
{ Carl Eric Codere - complete rewrite }
|
||||||
|
{ Thomas Schatzl - optimizations,routines and }
|
||||||
|
{ suggestions. }
|
||||||
|
{ Jonas Maebe - bugfixes and optimizations }
|
||||||
|
{ Credits (external): }
|
||||||
|
{ - Original FloodFill code by }
|
||||||
|
{ Menno Victor van der star }
|
||||||
|
{ (the code has been heavily modified) }
|
||||||
|
{-------------------------------------------------------}
|
||||||
|
{-------------------------------------------------------}
|
||||||
|
{ For significant speed improvements , is is recommended }
|
||||||
|
{ that these routines be hooked (otherwise the default, }
|
||||||
|
{ slower routines will be used) : }
|
||||||
|
{ HLine() }
|
||||||
|
{ VLine() }
|
||||||
|
{ PatternLine() }
|
||||||
|
{ ClearViewPort() }
|
||||||
|
{ PutImage() }
|
||||||
|
{ GetImage() - ImageSize() should also be changed }
|
||||||
|
{ InternalEllipse() }
|
||||||
|
{ Line() }
|
||||||
|
{ GetScanLine() }
|
||||||
|
{--------------------------------------------------------}
|
||||||
|
{ FPC unit requirements: }
|
||||||
|
{ All modes should at least have 1 graphics page to }
|
||||||
|
{ make it possible to create animation on all supported }
|
||||||
|
{ systems , this can be done either by double-buffering }
|
||||||
|
{ yourself in the heap if no hardware is available to do}
|
||||||
|
{ it. }
|
||||||
|
{--------------------------------------------------------}
|
||||||
|
{ COMPATIBILITY WARNING: Some of the compatibility tests }
|
||||||
|
{ were done using the CGA and other the VGA drivers. }
|
||||||
|
{ Within the BGI drivers themselves the BEHAVIOUR is not }
|
||||||
|
{ the same, so be warned!!! }
|
||||||
|
{--------------------------------------------------------}
|
||||||
|
{ History log: }
|
||||||
|
{ 15th February 1999: }
|
||||||
|
{ + Added support for system font in vertical mode }
|
||||||
|
{ + system font is now available for all platforms }
|
||||||
|
{ * font support routines now compile }
|
||||||
|
{ * textHeight would not return correct size for system }
|
||||||
|
{ font }
|
||||||
|
{ * Alignment of fonts partly fixed }
|
||||||
|
{ 17th Feb. 1999: }
|
||||||
|
{ + First support for stroked fonts }
|
||||||
|
{ 18th Feb. 1999: }
|
||||||
|
{ * bugfix of line drawing which fixes stroked font }
|
||||||
|
{ displays. }
|
||||||
|
{ 23rd Feb. 1999: }
|
||||||
|
{ + Applied Pierre's patches to font }
|
||||||
|
{ + Added scaling of bitmapped fonts }
|
||||||
|
{ + Vertical stroked fonts }
|
||||||
|
{ 24th Feb. 1999: }
|
||||||
|
{ * Scaling of stroked fonts must be done using FPs }
|
||||||
|
{ to be 100% compatible with turbo pascal }
|
||||||
|
{ + Sped up by 40% stroked font scaling calculations }
|
||||||
|
{ + RegisterBGIFont }
|
||||||
|
{ 9th march 1999: }
|
||||||
|
{ + Starting implementing Fillpoly() }
|
||||||
|
{ 15th march 1999: }
|
||||||
|
{ + SetFillStyle() }
|
||||||
|
{ + patternLine() }
|
||||||
|
{ + Bar() }
|
||||||
|
{ * GraphDefaults would not make the Default color }
|
||||||
|
{ of the fill pattern to the Max. Palette entry. }
|
||||||
|
{ + SetFillPattern() }
|
||||||
|
{ 20th march 1999: }
|
||||||
|
{ * GraphDefaults would not reset to the text system }
|
||||||
|
{ * DefaultFont would write one character too much to }
|
||||||
|
{ the screen }
|
||||||
|
{ + Sloped thick lines in Line() }
|
||||||
|
{ + Sloped patterned lines in Line() }
|
||||||
|
{ * GraphDefaults would not reset the User Fill pattern}
|
||||||
|
{ to $ff }
|
||||||
|
{ + DirectPutPixel takes care of XOR mode writes }
|
||||||
|
{ improves speed by about 30% over old method of }
|
||||||
|
{ GetPixel XOR CurrentColor }
|
||||||
|
{ * Dashed LineStyle exactly like BP version now }
|
||||||
|
{ + Center LineStyle (checked against CGA driver) }
|
||||||
|
{ * GraphDefaults() now resets linepattern array }
|
||||||
|
{ 1st april 1999: }
|
||||||
|
{ + First implementation of FillPoly (incomplete) }
|
||||||
|
{ 2nd april 1999: }
|
||||||
|
{ * FillPoly did not Reset PatternLine index }
|
||||||
|
{ * FillPoly did not use correct color }
|
||||||
|
{ * PatternLine was writing modes in reverse direction }
|
||||||
|
{ * PatternLine would not work with non-rectangular }
|
||||||
|
{ shapes. }
|
||||||
|
{ * PatternLine must fill up the ENTIRE pattern, }
|
||||||
|
{ with either the foreground or background color. }
|
||||||
|
{ * GraphDefaults() would not call SetBkColor() }
|
||||||
|
{ * Fixed some memory leaks in FillPoly() }
|
||||||
|
{ 11th April 1999: }
|
||||||
|
{ * PatternLine() was drawing one pixel less then }
|
||||||
|
{ requested }
|
||||||
|
{ 12th April 1999: }
|
||||||
|
{ + FloodFill - first working implementation }
|
||||||
|
{ Horrbly slow even on very fast cpu's }
|
||||||
|
{ + Some suggestions of Thomas implemented }
|
||||||
|
{ 13th April 1999: }
|
||||||
|
{ * FloodFill() vertical index was off by one pixel }
|
||||||
|
{ * FloodFill() would never draw the last line in the }
|
||||||
|
{ list }
|
||||||
|
{ - Removed ClearViewPort320 which was wrong anyways, }
|
||||||
|
{ will need to be implemented later. }
|
||||||
|
{ * PatternLine() would not always restore write mode }
|
||||||
|
{ + Circle() uses NormalPut always with NormWidth lines}
|
||||||
|
{ + FillEllipse() initial version }
|
||||||
|
{ * InternalEllipse() - 0 to 360 now supported as }
|
||||||
|
{ angles. }
|
||||||
|
{ 14th April 1999: }
|
||||||
|
{ * mod x = and (x-1)(from Thomas Schatzl) gives a }
|
||||||
|
{ significant speed improvement. }
|
||||||
|
{ 15th april 1999: }
|
||||||
|
{ + Arc() ok except for Aspect Ratio, which does not }
|
||||||
|
{ give us the correct ratio on a 320x200 screen. }
|
||||||
|
{ + Added FillPoly() from Thomas Schatzl }
|
||||||
|
{ + More hookable routines }
|
||||||
|
{ 16th april 1999: }
|
||||||
|
{ + Line() checked ok. }
|
||||||
|
{ 17th april 1999: }
|
||||||
|
{ * GraphDefaults() would not reset CP }
|
||||||
|
{ + GetX(), GetY(), MoveTo() checked for viewports }
|
||||||
|
{ * OutTextXY() should not update the CP }
|
||||||
|
{ * ClearViewPort() would not update the CP }
|
||||||
|
{ * ClearDevice() would not update the CP }
|
||||||
|
{ * Sector() would update the CP by calling LineTo }
|
||||||
|
{ * Bar3D() would update the CP }
|
||||||
|
{ * PieSlice() would update the CP }
|
||||||
|
{ 18th april 1999: }
|
||||||
|
{ + Clipping algorithm }
|
||||||
|
{ 19th april 1999: }
|
||||||
|
{ + Adapterinfo structure }
|
||||||
|
{ 20th april 1999: }
|
||||||
|
{ + GetModeName }
|
||||||
|
{ + GetGraphMode }
|
||||||
|
{ + GetModeRange }
|
||||||
|
{--------------------------------------------------------}
|
||||||
|
{ LEFT TO DO: }
|
||||||
|
{ - optimize scaling of stroked fonts }
|
||||||
|
{ - optimize InternalEllipse() }
|
||||||
|
{ using linear appx. of sine/cosine tables }
|
||||||
|
{ - justification for stroked fonts does not work }
|
||||||
|
{--------------------------------------------------------}
|
||||||
|
|
||||||
|
{ text.inc will crash on aligned requirement machines. }
|
||||||
|
{ (packed record for fontrec) }
|
||||||
|
{$ifndef fpc}
|
||||||
|
{$G+}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
type smallint = -32768..32767;
|
||||||
|
|
||||||
|
const
|
||||||
|
maxsmallint = high(smallint);
|
||||||
|
{ error codes }
|
||||||
|
grOk = 0;
|
||||||
|
grNoInitGraph = -1;
|
||||||
|
grNotDetected = -2;
|
||||||
|
grFileNotFound = -3;
|
||||||
|
grInvalidDriver = -4;
|
||||||
|
grNoLoadMem = -5;
|
||||||
|
grNoScanMem = -6;
|
||||||
|
grNoFloodMem = -7;
|
||||||
|
grFontNotFound = -8;
|
||||||
|
grNoFontMem = -9;
|
||||||
|
grInvalidMode = -10;
|
||||||
|
grError = -11;
|
||||||
|
grIOerror = -12;
|
||||||
|
grInvalidFont = -13;
|
||||||
|
grInvalidFontNum = -14;
|
||||||
|
grInvalidVersion = -18;
|
||||||
|
|
||||||
|
|
||||||
|
{ Color constants for setpalette }
|
||||||
|
black = 0;
|
||||||
|
blue = 1;
|
||||||
|
green = 2;
|
||||||
|
cyan = 3;
|
||||||
|
red = 4;
|
||||||
|
magenta = 5;
|
||||||
|
brown = 6;
|
||||||
|
lightgray = 7;
|
||||||
|
darkgray = 8;
|
||||||
|
lightblue = 9;
|
||||||
|
lightgreen = 10;
|
||||||
|
lightcyan = 11;
|
||||||
|
lightred = 12;
|
||||||
|
lightmagenta = 13;
|
||||||
|
yellow = 14;
|
||||||
|
white = 15;
|
||||||
|
|
||||||
|
EGABlack = 0;
|
||||||
|
EGABlue = 1;
|
||||||
|
EGAGreen = 2;
|
||||||
|
EGACyan = 3;
|
||||||
|
EGARed = 4;
|
||||||
|
EGAMagenta = 5;
|
||||||
|
EGALightgray= 7;
|
||||||
|
EGABrown = 20;
|
||||||
|
EGADarkgray = 56;
|
||||||
|
EGALightblue = 57;
|
||||||
|
EGALightgreen = 58;
|
||||||
|
EGALightcyan = 59;
|
||||||
|
EGALightred = 60;
|
||||||
|
EGALightmagenta=61;
|
||||||
|
EGAYellow = 62;
|
||||||
|
EGAWhite = 63;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{ Line styles for GetLineStyle/SetLineStyle }
|
||||||
|
SolidLn = 0;
|
||||||
|
DottedLn = 1;
|
||||||
|
CenterLn = 2;
|
||||||
|
DashedLn = 3;
|
||||||
|
UserBitLn = 4;
|
||||||
|
|
||||||
|
NormWidth = 1;
|
||||||
|
ThickWidth = 3;
|
||||||
|
|
||||||
|
{ Set/GetTextStyle Konstanten: }
|
||||||
|
DefaultFont = 0;
|
||||||
|
TriplexFont = 1;
|
||||||
|
SmallFont = 2;
|
||||||
|
SansSerifFont = 3;
|
||||||
|
GothicFont = 4;
|
||||||
|
ScriptFont = 5;
|
||||||
|
SimpleFont = 6;
|
||||||
|
TSCRFont = 7;
|
||||||
|
LCOMFont = 8;
|
||||||
|
EuroFont = 9;
|
||||||
|
BoldFont = 10;
|
||||||
|
|
||||||
|
HorizDir = 0;
|
||||||
|
VertDir = 1;
|
||||||
|
|
||||||
|
UserCharSize = 0;
|
||||||
|
|
||||||
|
ClipOn = true;
|
||||||
|
ClipOff = false;
|
||||||
|
|
||||||
|
{ Bar3D constants }
|
||||||
|
TopOn = true;
|
||||||
|
TopOff = false;
|
||||||
|
|
||||||
|
{ fill pattern for Get/SetFillStyle: }
|
||||||
|
EmptyFill = 0;
|
||||||
|
SolidFill = 1;
|
||||||
|
LineFill = 2;
|
||||||
|
LtSlashFill = 3;
|
||||||
|
SlashFill = 4;
|
||||||
|
BkSlashFill = 5;
|
||||||
|
LtBkSlashFill = 6;
|
||||||
|
HatchFill = 7;
|
||||||
|
XHatchFill = 8;
|
||||||
|
InterleaveFill = 9;
|
||||||
|
WideDotFill = 10;
|
||||||
|
CloseDotFill = 11;
|
||||||
|
UserFill = 12;
|
||||||
|
|
||||||
|
{ bitblt operators }
|
||||||
|
NormalPut = 0;
|
||||||
|
CopyPut = 0;
|
||||||
|
XORPut = 1;
|
||||||
|
OrPut = 2;
|
||||||
|
AndPut = 3;
|
||||||
|
NotPut = 4;
|
||||||
|
|
||||||
|
{ SetTextJustify constants }
|
||||||
|
LeftText = 0;
|
||||||
|
CenterText = 1;
|
||||||
|
RightText = 2;
|
||||||
|
|
||||||
|
BottomText = 0;
|
||||||
|
TopText = 2;
|
||||||
|
|
||||||
|
{ graphic drivers }
|
||||||
|
CurrentDriver = -128;
|
||||||
|
Detect = 0;
|
||||||
|
LowRes = 1;
|
||||||
|
HercMono = 7;
|
||||||
|
VGA = 9;
|
||||||
|
VESA = 10;
|
||||||
|
|
||||||
|
{ graph modes }
|
||||||
|
Default = 0;
|
||||||
|
|
||||||
|
{ VGA Driver modes }
|
||||||
|
VGALo = 0;
|
||||||
|
VGAMed = 1;
|
||||||
|
VGAHi = 2;
|
||||||
|
|
||||||
|
{ Hercules mono card }
|
||||||
|
HercMonoHi = 0;
|
||||||
|
|
||||||
|
MaxColors = 255; { Maximum possible colors using a palette }
|
||||||
|
{ otherwise, direct color encoding }
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
RGBRec = packed record
|
||||||
|
Red: smallint;
|
||||||
|
Green: smallint;
|
||||||
|
Blue : smallint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
PaletteType = record
|
||||||
|
Size : longint;
|
||||||
|
Colors : array[0..MaxColors] of RGBRec;
|
||||||
|
end;
|
||||||
|
|
||||||
|
LineSettingsType = record
|
||||||
|
linestyle : word;
|
||||||
|
pattern : word;
|
||||||
|
thickness : word;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TextSettingsType = record
|
||||||
|
font : word;
|
||||||
|
direction : word;
|
||||||
|
charsize : word;
|
||||||
|
horiz : word;
|
||||||
|
vert : word;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FillSettingsType = record
|
||||||
|
pattern : word;
|
||||||
|
color : word;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FillPatternType = array[1..8] of byte;
|
||||||
|
|
||||||
|
PointType = record
|
||||||
|
x,y : smallint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
ViewPortType = record
|
||||||
|
x1,y1,x2,y2 : smallint;
|
||||||
|
Clip : boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
ArcCoordsType = record
|
||||||
|
x,y : smallint;
|
||||||
|
xstart,ystart : smallint;
|
||||||
|
xend,yend : smallint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
graph_int = longint; { platform specific smallint used for indexes;
|
||||||
|
should be 16 bits on TP/BP and 32 bits on every-
|
||||||
|
thing else for speed reasons }
|
||||||
|
graph_float = single; { the platform's preferred floating point size }
|
||||||
|
{$ELSE}
|
||||||
|
graph_int = smallint; { platform specific smallint used for indexes;
|
||||||
|
should be 16 bits on TP/BP and 32 bits on every-
|
||||||
|
thing else for speed reasons }
|
||||||
|
graph_float = real; { the platform's preferred floating point size }
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
const
|
||||||
|
fillpatternTable : array[0..12] of FillPatternType = (
|
||||||
|
($00,$00,$00,$00,$00,$00,$00,$00), { background color }
|
||||||
|
($ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff), { foreground color }
|
||||||
|
($ff,$ff,$00,$00,$ff,$ff,$00,$00), { horizontal lines }
|
||||||
|
($01,$02,$04,$08,$10,$20,$40,$80), { slashes }
|
||||||
|
($07,$0e,$1c,$38,$70,$e0,$c1,$83), { thick slashes }
|
||||||
|
($07,$83,$c1,$e0,$70,$38,$1c,$0e), { thick backslashes }
|
||||||
|
($5a,$2d,$96,$4b,$a5,$d2,$69,$b4), { backslashes }
|
||||||
|
($ff,$88,$88,$88,$ff,$88,$88,$88), { small boxes }
|
||||||
|
($18,$24,$42,$81,$81,$42,$24,$18), { rhombus }
|
||||||
|
($cc,$33,$cc,$33,$cc,$33,$cc,$33), { wall pattern }
|
||||||
|
($80,$00,$08,$00,$80,$00,$08,$00), { wide points }
|
||||||
|
($88,$00,$22,$00,$88,$00,$22,$00), { dense points }
|
||||||
|
(0,0,0,0,0,0,0,0) { user defined line style }
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{ ******************** PROCEDURAL VARIABLES ********************* }
|
||||||
|
{ * These are hooks which have device specific stuff in them, * }
|
||||||
|
{ * therefore to add new modes or to redirect these routines * }
|
||||||
|
{ * then declare variables of these types as shown below. * }
|
||||||
|
{-----------------------------------------------------------------}
|
||||||
|
|
||||||
|
TYPE
|
||||||
|
|
||||||
|
|
||||||
|
{ This is the standard putpixel routine used by all function }
|
||||||
|
{ drawing routines, it will use the viewport settings, as }
|
||||||
|
{ well as clip, and use the current foreground color to plot }
|
||||||
|
{ the desired pixel. }
|
||||||
|
defpixelproc = procedure(X,Y: smallint);
|
||||||
|
|
||||||
|
{ standard plot and get pixel }
|
||||||
|
getpixelproc = function(X,Y: smallint): word;
|
||||||
|
putpixelproc = procedure(X,Y: smallint; Color: Word);
|
||||||
|
|
||||||
|
{ clears the viewport, also used to clear the device }
|
||||||
|
clrviewproc = procedure;
|
||||||
|
|
||||||
|
{ putimage procedure, can be hooked to accomplish transparency }
|
||||||
|
putimageproc = procedure (X,Y: smallint; var Bitmap; BitBlt: Word);
|
||||||
|
getimageproc = procedure(X1,Y1,X2,Y2: smallint; Var Bitmap);
|
||||||
|
imagesizeproc= function (X1,Y1,X2,Y2: smallint): longint;
|
||||||
|
|
||||||
|
graphfreememprc = procedure (var P: Pointer; size: word);
|
||||||
|
graphgetmemprc = procedure (var P: pointer; size: word);
|
||||||
|
|
||||||
|
{ internal routines -- can be hooked for much faster drawing }
|
||||||
|
|
||||||
|
{ draw filled horizontal lines using current color }
|
||||||
|
{ on entry coordinates are already clipped. }
|
||||||
|
hlineproc = procedure (x, x2,y : smallint);
|
||||||
|
{ on entry coordinates are already clipped. }
|
||||||
|
{ draw filled vertical line using current color }
|
||||||
|
vlineproc = procedure (x,y,y2: smallint);
|
||||||
|
|
||||||
|
{ this routine is used to draw filled patterns for all routines }
|
||||||
|
{ that require it. (FillPoly, FloodFill, Sector, etc... }
|
||||||
|
{ clipping is verified, uses current Fill settings for drawing }
|
||||||
|
patternlineproc = procedure (x1,x2,y: smallint);
|
||||||
|
|
||||||
|
{ this routine is used to draw all circles/ellipses/sectors }
|
||||||
|
{ more info... on this later... }
|
||||||
|
ellipseproc = procedure (X,Y: smallint;XRadius: word;
|
||||||
|
YRadius:word; stAngle,EndAngle: word; fp: PatternLineProc);
|
||||||
|
|
||||||
|
{ Line routine - draws lines thick/norm widths with current }
|
||||||
|
{ color and line style - LINE must be clipped here. }
|
||||||
|
lineproc = procedure (X1, Y1, X2, Y2 : smallint);
|
||||||
|
|
||||||
|
{ this routine is used for FloodFill - it returns an entire }
|
||||||
|
{ screen scan line with a word for each pixel in the scanline. }
|
||||||
|
{ Also handy for GetImage, so I added x coords as well (JM) }
|
||||||
|
getscanlineproc = procedure (X1, X2, Y : smallint; var data);
|
||||||
|
|
||||||
|
{ changes the active display screen where we draw to... }
|
||||||
|
setactivepageproc = procedure (page: word);
|
||||||
|
|
||||||
|
{ changes the active display screen which we see ... }
|
||||||
|
setvisualpageproc = procedure (page: word);
|
||||||
|
|
||||||
|
{ this routine actually switches to the desired video mode. }
|
||||||
|
initmodeproc = procedure;
|
||||||
|
|
||||||
|
{ this routine is called to save the sate just before a mode set }
|
||||||
|
savestateproc = procedure;
|
||||||
|
{ this routine is called in closegraph to cleanup... }
|
||||||
|
restorestateproc = procedure;
|
||||||
|
|
||||||
|
{ This routine is a hook for SetRGBPalette }
|
||||||
|
setrgbpaletteproc =
|
||||||
|
procedure(ColorNum, RedValue, GreenValue, BlueValue: smallint);
|
||||||
|
|
||||||
|
{ This routine is a hook for GetRGBPalette }
|
||||||
|
getrgbpaletteproc =
|
||||||
|
procedure(ColorNum: smallint; var
|
||||||
|
RedValue, GreenValue, BlueValue: smallint);
|
||||||
|
|
||||||
|
|
||||||
|
TYPE
|
||||||
|
{-----------------------------------}
|
||||||
|
{ Linked list for mode information }
|
||||||
|
{ This list is set up by one of the }
|
||||||
|
{ following routines: }
|
||||||
|
{ It lists all available resolutions}
|
||||||
|
{ on this display adapter. }
|
||||||
|
{-----------------------------------}
|
||||||
|
{ QueryAdapter() }
|
||||||
|
{ DetectGraph() }
|
||||||
|
{ InitGraph() }
|
||||||
|
{-----------------------------------}
|
||||||
|
PModeInfo = ^TModeInfo;
|
||||||
|
TModeInfo = record
|
||||||
|
DriverNumber: smallint;
|
||||||
|
ModeNumber: smallint;
|
||||||
|
MaxColor: Longint; { Maximum colors on screen }
|
||||||
|
PaletteSize : Longint; { Maximum palette entry we can change }
|
||||||
|
XAspect : word; { XAspect ratio correction factor }
|
||||||
|
YAspect : word; { YAspect ratio correction factor }
|
||||||
|
MaxX: word; { Max-X row }
|
||||||
|
MaxY: word; { Max. column. }
|
||||||
|
DirectColor: boolean; { Is this a direct color mode?? }
|
||||||
|
Hardwarepages: byte; { total number of image pages - 1 }
|
||||||
|
ModeName: String[18];
|
||||||
|
{ necessary hooks ... }
|
||||||
|
DirectPutPixel : DefPixelProc;
|
||||||
|
GetPixel : GetPixelProc;
|
||||||
|
PutPixel : PutPixelProc;
|
||||||
|
SetRGBPalette : SetRGBPaletteProc;
|
||||||
|
GetRGBPalette : GetRGBPaletteProc;
|
||||||
|
{ defaults possible ... }
|
||||||
|
SetVisualPage : SetVisualPageProc;
|
||||||
|
SetActivePage : SetActivePageProc;
|
||||||
|
ClearViewPort : ClrViewProc;
|
||||||
|
PutImage : PutImageProc;
|
||||||
|
GetImage : GetImageProc;
|
||||||
|
ImageSize : ImageSizeProc;
|
||||||
|
GetScanLine : GetScanLineProc;
|
||||||
|
Line : LineProc;
|
||||||
|
InternalEllipse: EllipseProc;
|
||||||
|
PatternLine : PatternLineProc;
|
||||||
|
HLine : HLineProc;
|
||||||
|
VLine : VLineProc;
|
||||||
|
InitMode : InitModeProc;
|
||||||
|
next: PModeInfo;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
VAR
|
||||||
|
DirectPutPixel : DefPixelProc;
|
||||||
|
ClearViewPort : ClrViewProc;
|
||||||
|
PutPixel : PutPixelProc;
|
||||||
|
PutImage : PutImageProc;
|
||||||
|
GetImage : GetImageProc;
|
||||||
|
ImageSize : ImageSizeProc;
|
||||||
|
GetPixel : GetPixelProc;
|
||||||
|
SetVisualPage : SetVisualPageProc;
|
||||||
|
SetActivePage : SetActivePageProc;
|
||||||
|
SetRGBPalette : SetRGBPaletteProc;
|
||||||
|
GetRGBPalette : GetRGBPaletteProc;
|
||||||
|
|
||||||
|
GraphFreeMemPtr: graphfreememprc;
|
||||||
|
GraphGetMemPtr : graphgetmemprc;
|
||||||
|
|
||||||
|
GetScanLine : GetScanLineProc;
|
||||||
|
Line : LineProc;
|
||||||
|
InternalEllipse: EllipseProc;
|
||||||
|
PatternLine : PatternLineProc;
|
||||||
|
HLine : HLineProc;
|
||||||
|
VLine : VLineProc;
|
||||||
|
|
||||||
|
SaveVideoState : SaveStateProc;
|
||||||
|
RestoreVideoState: RestoreStateProc;
|
||||||
|
ExitSave: pointer;
|
||||||
|
|
||||||
|
function queryadapterinfo : pmodeinfo;
|
||||||
|
|
||||||
|
Procedure Closegraph;
|
||||||
|
procedure SetLineStyle(LineStyle: word; Pattern: word; Thickness: word);
|
||||||
|
function GraphErrorMsg(ErrorCode: smallint): string;
|
||||||
|
Function GetMaxX: smallint;
|
||||||
|
Function GetMaxY: smallint;
|
||||||
|
Procedure SetViewPort(X1, Y1, X2, Y2: smallint; Clip: Boolean);
|
||||||
|
Function GraphResult: smallint;
|
||||||
|
function GetModeName(ModeNumber: smallint): string;
|
||||||
|
procedure SetGraphMode(Mode: smallint);
|
||||||
|
function GetGraphMode: smallint;
|
||||||
|
function GetMaxMode: word;
|
||||||
|
procedure RestoreCrtMode;
|
||||||
|
procedure GetModeRange(GraphDriver: smallint; var LoMode, HiMode: smallint);
|
||||||
|
Function GetX: smallint;
|
||||||
|
Function GetY: smallint;
|
||||||
|
procedure GraphDefaults;
|
||||||
|
procedure ClearDevice;
|
||||||
|
procedure GetViewSettings(var viewport : ViewPortType);
|
||||||
|
procedure SetWriteMode(WriteMode : smallint);
|
||||||
|
procedure GetFillSettings(var Fillinfo:Fillsettingstype);
|
||||||
|
procedure GetFillPattern(var FillPattern:FillPatternType);
|
||||||
|
procedure GetLineSettings(var ActiveLineInfo : LineSettingsType);
|
||||||
|
procedure InitGraph(var GraphDriver:smallint;var GraphMode:smallint;const PathToDriver:String);
|
||||||
|
procedure DetectGraph(var GraphDriver:smallint;var GraphMode:smallint);
|
||||||
|
function InstallUserDriver(Name: string; AutoDetectPtr: Pointer): smallint;
|
||||||
|
function RegisterBGIDriver(driver: pointer): smallint;
|
||||||
|
procedure SetFillStyle(Pattern : word; Color: word);
|
||||||
|
procedure SetFillPattern(Pattern: FillPatternType; Color: word);
|
||||||
|
Function GetDriverName: string;
|
||||||
|
procedure MoveRel(Dx, Dy: smallint);
|
||||||
|
procedure MoveTo(X,Y: smallint);
|
||||||
|
|
||||||
|
procedure SetDirectVideo(DirectAccess: boolean);
|
||||||
|
function GetDirectVideo: boolean;
|
||||||
|
|
||||||
|
{ -------------------- Color/Palette ------------------------------- }
|
||||||
|
procedure SetBkColor(ColorNum: Word);
|
||||||
|
function GetColor: Word;
|
||||||
|
function GetBkColor: Word;
|
||||||
|
procedure SetColor(Color: Word);
|
||||||
|
function GetMaxColor: word;
|
||||||
|
|
||||||
|
procedure SetAllPalette(var Palette:PaletteType);
|
||||||
|
procedure SetPalette(ColorNum: word; Color: shortint);
|
||||||
|
procedure GetPalette(var Palette: PaletteType);
|
||||||
|
function GetPaletteSize: smallint;
|
||||||
|
procedure GetDefaultPalette(var Palette: PaletteType);
|
||||||
|
|
||||||
|
|
||||||
|
{ -------------------- Shapes/Lines -------------------------------- }
|
||||||
|
procedure Rectangle(x1,y1,x2,y2:smallint);
|
||||||
|
procedure Bar(x1,y1,x2,y2:smallint);
|
||||||
|
procedure Bar3D(x1, y1, x2, y2 : smallint;depth : word;top : boolean);
|
||||||
|
procedure FillPoly(NumPoints: word; Var PolyPoints);
|
||||||
|
procedure DrawPoly(NumPoints : word;var polypoints);
|
||||||
|
procedure LineRel(Dx, Dy: smallint);
|
||||||
|
procedure LineTo(X,Y : smallint);
|
||||||
|
procedure FloodFill(x : smallint; y : smallint; Border: word);
|
||||||
|
|
||||||
|
{ -------------------- Circle related routines --------------------- }
|
||||||
|
procedure GetAspectRatio(var Xasp,Yasp : word);
|
||||||
|
procedure SetAspectRatio(Xasp, Yasp : word);
|
||||||
|
procedure GetArcCoords(var ArcCoords: ArcCoordsType);
|
||||||
|
|
||||||
|
|
||||||
|
procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
|
||||||
|
procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: Word);
|
||||||
|
procedure FillEllipse(X, Y: smallint; XRadius, YRadius: Word);
|
||||||
|
procedure Circle(X, Y: smallint; Radius:Word);
|
||||||
|
procedure Sector(x, y: smallint; StAngle,EndAngle, XRadius, YRadius: Word);
|
||||||
|
procedure Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,
|
||||||
|
YRadius: word);
|
||||||
|
|
||||||
|
{ --------------------- Text related routines --------------------- }
|
||||||
|
function InstallUserFont(const FontFileName : string) : smallint;
|
||||||
|
function RegisterBGIfont(font : pointer) : smallint;
|
||||||
|
procedure GetTextSettings(var TextInfo : TextSettingsType);
|
||||||
|
function TextHeight(const TextString : string) : word;
|
||||||
|
function TextWidth(const TextString : string) : word;
|
||||||
|
procedure SetTextJustify(horiz,vert : word);
|
||||||
|
procedure SetTextStyle(font,direction : word;charsize : word);
|
||||||
|
procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
|
||||||
|
|
||||||
|
procedure OutTextXY(x,y : smallint;const TextString : string);
|
||||||
|
procedure OutText(const TextString : string);
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 2000-03-19 11:20:13 peter
|
||||||
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
|
* ggigraph unit for linux added
|
||||||
|
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
GRAPHINCNAMES=fontdata.inc clip.inc fills.inc gtext.inc palette.inc modes.inc
|
GRAPHINCNAMES=graph.inc graphh.inc fontdata.inc clip.inc fills.inc gtext.inc palette.inc modes.inc
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Makefile generated by fpcmake v0.99.13 [2000/02/09]
|
# Makefile generated by fpcmake v0.99.13 [2000/02/24]
|
||||||
#
|
#
|
||||||
|
|
||||||
defaultrule: all
|
defaultrule: all
|
||||||
@ -202,7 +202,7 @@ endif
|
|||||||
# Targets
|
# Targets
|
||||||
|
|
||||||
override LOADEROBJECTS+=prt0 cprt0 gprt0 cprt21 gprt21
|
override LOADEROBJECTS+=prt0 cprt0 gprt0 cprt21 gprt21
|
||||||
override UNITOBJECTS+=$(SYSTEMUNIT) objpas strings linux ports initc dos crt objects printer graph sysutils typinfo math cpu mmx getopts heaptrc lineinfo errors sockets gpm ipc
|
override UNITOBJECTS+=$(SYSTEMUNIT) objpas strings linux ports initc dos crt objects printer graph ggigraph sysutils typinfo math cpu mmx getopts heaptrc lineinfo errors sockets gpm ipc
|
||||||
|
|
||||||
# Clean
|
# Clean
|
||||||
|
|
||||||
@ -1202,14 +1202,14 @@ printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
|
|||||||
#
|
#
|
||||||
include $(GRAPHDIR)/makefile.inc
|
include $(GRAPHDIR)/makefile.inc
|
||||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||||
ifeq ($(USELIBGGI),YES)
|
|
||||||
GRAPHINCDEPS+=ggigraph.inc
|
graph$(PPUEXT) : graph.pp linux$(PPUEXT) $(SYSTEMPPU) \
|
||||||
override COMPILER+=-dUSEGGI -S2
|
$(GRAPHINCDEPS) vgagraph16.inc
|
||||||
else
|
$(COMPILER) -I$(GRAPHDIR) graph.pp $(REDIR)
|
||||||
GRAPHINCDEPS+=vgagraph.inc
|
|
||||||
endif
|
ggigraph$(PPUEXT) : ggigraph.pp linux$(PPUEXT) $(SYSTEMPPU) \
|
||||||
graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) $(GRAPHINCDEPS) graph.inc
|
$(GRAPHINCDEPS)
|
||||||
$(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
|
$(COMPILER) -I$(GRAPHDIR) ggigraph.pp $(REDIR)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Delphi Compatible Units
|
# Delphi Compatible Units
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
loaders=prt0 cprt0 gprt0 cprt21 gprt21
|
loaders=prt0 cprt0 gprt0 cprt21 gprt21
|
||||||
units=$(SYSTEMUNIT) objpas strings \
|
units=$(SYSTEMUNIT) objpas strings \
|
||||||
linux ports initc \
|
linux ports initc \
|
||||||
dos crt objects printer graph \
|
dos crt objects printer graph ggigraph \
|
||||||
sysutils typinfo math \
|
sysutils typinfo math \
|
||||||
cpu mmx getopts heaptrc lineinfo \
|
cpu mmx getopts heaptrc lineinfo \
|
||||||
errors sockets gpm ipc
|
errors sockets gpm ipc
|
||||||
@ -144,14 +144,14 @@ printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
|
|||||||
#
|
#
|
||||||
include $(GRAPHDIR)/makefile.inc
|
include $(GRAPHDIR)/makefile.inc
|
||||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||||
ifeq ($(USELIBGGI),YES)
|
|
||||||
GRAPHINCDEPS+=ggigraph.inc
|
graph$(PPUEXT) : graph.pp linux$(PPUEXT) $(SYSTEMPPU) \
|
||||||
override COMPILER+=-dUSEGGI -S2
|
$(GRAPHINCDEPS) vgagraph16.inc
|
||||||
else
|
$(COMPILER) -I$(GRAPHDIR) graph.pp $(REDIR)
|
||||||
GRAPHINCDEPS+=vgagraph.inc
|
|
||||||
endif
|
ggigraph$(PPUEXT) : ggigraph.pp linux$(PPUEXT) $(SYSTEMPPU) \
|
||||||
graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) $(GRAPHINCDEPS) graph.inc
|
$(GRAPHINCDEPS)
|
||||||
$(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
|
$(COMPILER) -I$(GRAPHDIR) ggigraph.pp $(REDIR)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Delphi Compatible Units
|
# Delphi Compatible Units
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
$Id$
|
$Id$
|
||||||
This file is part of the Free Pascal run time library.
|
This file is part of the Free Pascal run time library.
|
||||||
Copyright (c) 1999-2000 by the Free Pascal development team
|
Copyright (c) 1999-2000 by Florian Klaempfl
|
||||||
|
|
||||||
GGI implementation of graph unit.
|
This file implements the linux GGI support for the graph unit
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
@ -13,16 +13,94 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
unit GGIGraph;
|
||||||
|
interface
|
||||||
|
|
||||||
{$LINKLIB c}
|
{ objfpc is needed for array of const support }
|
||||||
{$PACKRECORDS C}
|
{$mode objfpc}
|
||||||
|
|
||||||
|
{$i graphh.inc}
|
||||||
|
|
||||||
|
Const
|
||||||
|
{ Supported modes }
|
||||||
|
{(sg) GTEXT deactivated because we need mode #0 as default mode}
|
||||||
|
{GTEXT = 0; Compatible with VGAlib v1.2 }
|
||||||
|
G320x200x16 = 1;
|
||||||
|
G640x200x16 = 2;
|
||||||
|
G640x350x16 = 3;
|
||||||
|
G640x480x16 = 4;
|
||||||
|
G320x200x256 = 5;
|
||||||
|
G320x240x256 = 6;
|
||||||
|
G320x400x256 = 7;
|
||||||
|
G360x480x256 = 8;
|
||||||
|
G640x480x2 = 9;
|
||||||
|
|
||||||
|
G640x480x256 = 10;
|
||||||
|
G800x600x256 = 11;
|
||||||
|
G1024x768x256 = 12;
|
||||||
|
|
||||||
|
G1280x1024x256 = 13; { Additional modes. }
|
||||||
|
|
||||||
|
G320x200x32K = 14;
|
||||||
|
G320x200x64K = 15;
|
||||||
|
G320x200x16M = 16;
|
||||||
|
G640x480x32K = 17;
|
||||||
|
G640x480x64K = 18;
|
||||||
|
G640x480x16M = 19;
|
||||||
|
G800x600x32K = 20;
|
||||||
|
G800x600x64K = 21;
|
||||||
|
G800x600x16M = 22;
|
||||||
|
G1024x768x32K = 23;
|
||||||
|
G1024x768x64K = 24;
|
||||||
|
G1024x768x16M = 25;
|
||||||
|
G1280x1024x32K = 26;
|
||||||
|
G1280x1024x64K = 27;
|
||||||
|
G1280x1024x16M = 28;
|
||||||
|
|
||||||
|
G800x600x16 = 29;
|
||||||
|
G1024x768x16 = 30;
|
||||||
|
G1280x1024x16 = 31;
|
||||||
|
|
||||||
|
G720x348x2 = 32; { Hercules emulation mode }
|
||||||
|
|
||||||
|
G320x200x16M32 = 33; { 32-bit per pixel modes. }
|
||||||
|
G640x480x16M32 = 34;
|
||||||
|
G800x600x16M32 = 35;
|
||||||
|
G1024x768x16M32 = 36;
|
||||||
|
G1280x1024x16M32 = 37;
|
||||||
|
|
||||||
|
{ additional resolutions }
|
||||||
|
G1152x864x16 = 38;
|
||||||
|
G1152x864x256 = 39;
|
||||||
|
G1152x864x32K = 40;
|
||||||
|
G1152x864x64K = 41;
|
||||||
|
G1152x864x16M = 42;
|
||||||
|
G1152x864x16M32 = 43;
|
||||||
|
|
||||||
|
G1600x1200x16 = 44;
|
||||||
|
G1600x1200x256 = 45;
|
||||||
|
G1600x1200x32K = 46;
|
||||||
|
G1600x1200x64K = 47;
|
||||||
|
G1600x1200x16M = 48;
|
||||||
|
G1600x1200x16M32 = 49;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
linux;
|
||||||
|
|
||||||
const
|
const
|
||||||
InternalDriverName = 'LinuxGGI';
|
InternalDriverName = 'LinuxGGI';
|
||||||
|
|
||||||
|
{$i graph.inc}
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
GGI bindings [(c) 1999 Sebastian Guenther]
|
GGI bindings [(c) 1999 Sebastian Guenther]
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
{$LINKLIB c}
|
||||||
|
{$PACKRECORDS C}
|
||||||
|
|
||||||
const
|
const
|
||||||
GLASTMODE = 49;
|
GLASTMODE = 49;
|
||||||
ModeNames: array[0..GLastMode] of PChar =
|
ModeNames: array[0..GLastMode] of PChar =
|
||||||
@ -430,43 +508,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
InitializeGraph;
|
||||||
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2000-02-27 14:41:25 peter
|
Revision 1.1 2000-03-19 11:20:14 peter
|
||||||
* removed warnings/notes
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
|
* ggigraph unit for linux added
|
||||||
|
|
||||||
Revision 1.8 2000/01/07 16:41:40 daniel
|
|
||||||
* copyright 2000
|
|
||||||
|
|
||||||
Revision 1.7 1999/12/20 11:22:38 peter
|
|
||||||
* modes moved to interface
|
|
||||||
* integer -> smallint
|
|
||||||
|
|
||||||
Revision 1.6 1999/12/11 23:41:39 jonas
|
|
||||||
* changed definition of getscanlineproc to "getscanline(x1,x2,y:
|
|
||||||
smallint; var data);" so it can be used by getimage too
|
|
||||||
* changed getimage so it uses getscanline
|
|
||||||
* changed floodfill, getscanline16 and definitions in Linux
|
|
||||||
include files so they use this new format
|
|
||||||
+ getscanlineVESA256 for 256 color VESA modes (banked)
|
|
||||||
|
|
||||||
Revision 1.5 1999/11/12 02:13:01 carl
|
|
||||||
* Bugfix if getimage / putimage, format was not standard with FPC
|
|
||||||
graph.
|
|
||||||
|
|
||||||
Revision 1.4 1999/11/10 10:54:24 sg
|
|
||||||
* Fixed a LOT of bugs:
|
|
||||||
* - Default mode should be determined by GGI now
|
|
||||||
* - Colors are working (only the 16 standard VGA colors, though)
|
|
||||||
|
|
||||||
Revision 1.3 1999/11/08 20:04:55 sg
|
|
||||||
* GGI programs must link to libc, or ggiOpen will fail!
|
|
||||||
* Changed max length of ModeNames string from 18 to 20 chars
|
|
||||||
|
|
||||||
Revision 1.2 1999/11/08 00:08:43 michael
|
|
||||||
* Fist working version of svgalib new graph unit
|
|
||||||
* Initial implementation of ggi new graph unit
|
|
||||||
|
|
||||||
Revision 1.1 1999/11/07 16:57:26 michael
|
|
||||||
+ Start of common graph implementation
|
|
||||||
}
|
}
|
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
$Id$
|
|
||||||
This file is part of the Free Pascal run time library.
|
|
||||||
Copyright (c) 1999-2000 by the Free Pascal development team
|
|
||||||
|
|
||||||
Graph include file for linux.
|
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
|
||||||
for details about the copyright.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
**********************************************************************}
|
|
||||||
|
|
||||||
{ decide what to load }
|
|
||||||
{$ifdef USEGGI}
|
|
||||||
{ use GGI libs }
|
|
||||||
{$i ggigraph.inc}
|
|
||||||
{$else}
|
|
||||||
{ use plain old vgalib }
|
|
||||||
{$i vgagraph.inc}
|
|
||||||
{$endif}
|
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
$Id$
|
$Id$
|
||||||
This file is part of the Free Pascal run time library.
|
This file is part of the Free Pascal run time library.
|
||||||
Copyright (c) 1999-2000 by the Free Pascal development team
|
Copyright (c) 1999-2000 by Florian Klaempfl
|
||||||
|
|
||||||
svgalib implementation of graph unit.
|
This file implements the linux GGI support for the graph unit
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
@ -13,10 +13,84 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
unit Graph;
|
||||||
|
interface
|
||||||
|
|
||||||
const
|
{$i graphh.inc}
|
||||||
InternalDriverName = 'LinuxVGA';
|
|
||||||
|
|
||||||
|
Const
|
||||||
|
{ Supported modes }
|
||||||
|
{(sg) GTEXT deactivated because we need mode #0 as default mode}
|
||||||
|
{GTEXT = 0; Compatible with VGAlib v1.2 }
|
||||||
|
G320x200x16 = 1;
|
||||||
|
G640x200x16 = 2;
|
||||||
|
G640x350x16 = 3;
|
||||||
|
G640x480x16 = 4;
|
||||||
|
G320x200x256 = 5;
|
||||||
|
G320x240x256 = 6;
|
||||||
|
G320x400x256 = 7;
|
||||||
|
G360x480x256 = 8;
|
||||||
|
G640x480x2 = 9;
|
||||||
|
|
||||||
|
G640x480x256 = 10;
|
||||||
|
G800x600x256 = 11;
|
||||||
|
G1024x768x256 = 12;
|
||||||
|
|
||||||
|
G1280x1024x256 = 13; { Additional modes. }
|
||||||
|
|
||||||
|
G320x200x32K = 14;
|
||||||
|
G320x200x64K = 15;
|
||||||
|
G320x200x16M = 16;
|
||||||
|
G640x480x32K = 17;
|
||||||
|
G640x480x64K = 18;
|
||||||
|
G640x480x16M = 19;
|
||||||
|
G800x600x32K = 20;
|
||||||
|
G800x600x64K = 21;
|
||||||
|
G800x600x16M = 22;
|
||||||
|
G1024x768x32K = 23;
|
||||||
|
G1024x768x64K = 24;
|
||||||
|
G1024x768x16M = 25;
|
||||||
|
G1280x1024x32K = 26;
|
||||||
|
G1280x1024x64K = 27;
|
||||||
|
G1280x1024x16M = 28;
|
||||||
|
|
||||||
|
G800x600x16 = 29;
|
||||||
|
G1024x768x16 = 30;
|
||||||
|
G1280x1024x16 = 31;
|
||||||
|
|
||||||
|
G720x348x2 = 32; { Hercules emulation mode }
|
||||||
|
|
||||||
|
G320x200x16M32 = 33; { 32-bit per pixel modes. }
|
||||||
|
G640x480x16M32 = 34;
|
||||||
|
G800x600x16M32 = 35;
|
||||||
|
G1024x768x16M32 = 36;
|
||||||
|
G1280x1024x16M32 = 37;
|
||||||
|
|
||||||
|
{ additional resolutions }
|
||||||
|
G1152x864x16 = 38;
|
||||||
|
G1152x864x256 = 39;
|
||||||
|
G1152x864x32K = 40;
|
||||||
|
G1152x864x64K = 41;
|
||||||
|
G1152x864x16M = 42;
|
||||||
|
G1152x864x16M32 = 43;
|
||||||
|
|
||||||
|
G1600x1200x16 = 44;
|
||||||
|
G1600x1200x256 = 45;
|
||||||
|
G1600x1200x32K = 46;
|
||||||
|
G1600x1200x64K = 47;
|
||||||
|
G1600x1200x16M = 48;
|
||||||
|
G1600x1200x16M32 = 49;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
linux;
|
||||||
|
|
||||||
|
const
|
||||||
|
InternalDriverName = 'LinuxVGA';
|
||||||
|
|
||||||
|
{$i graph.inc}
|
||||||
|
|
||||||
type
|
type
|
||||||
PByte = ^Byte;
|
PByte = ^Byte;
|
||||||
@ -169,10 +243,10 @@ var
|
|||||||
Required procedures
|
Required procedures
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
{$INCLUDE vgagraph16.inc} // Include graphic functions for 16 colours modes
|
{$INCLUDE vgagraph16.inc} // Include graphic functions for 16 colours modes
|
||||||
|
|
||||||
var
|
var
|
||||||
LastColor: Integer; {Cache the last set color to improve speed}
|
LastColor: Integer; {Cache the last set color to improve speed}
|
||||||
|
|
||||||
procedure SetEGAColor(color: Integer);
|
procedure SetEGAColor(color: Integer);
|
||||||
begin
|
begin
|
||||||
@ -444,24 +518,24 @@ end;
|
|||||||
PaletteSize := MaxColor;
|
PaletteSize := MaxColor;
|
||||||
HardwarePages := 0;
|
HardwarePages := 0;
|
||||||
// necessary hooks ...
|
// necessary hooks ...
|
||||||
if (MaxColor = 16) and (LongInt(MaxX) * LongInt(MaxY) < 65536*4*2) then
|
if (MaxColor = 16) and (LongInt(MaxX) * LongInt(MaxY) < 65536*4*2) then
|
||||||
begin
|
begin
|
||||||
// Use optimized graphics routines for 4 bit EGA/VGA modes
|
// Use optimized graphics routines for 4 bit EGA/VGA modes
|
||||||
ScrWidth := MaxX div 8;
|
ScrWidth := MaxX div 8;
|
||||||
DirectPutPixel := @DirectPutPixel16;
|
DirectPutPixel := @DirectPutPixel16;
|
||||||
PutPixel := @PutPixel16;
|
PutPixel := @PutPixel16;
|
||||||
GetPixel := @GetPixel16;
|
GetPixel := @GetPixel16;
|
||||||
HLine := @HLine16;
|
HLine := @HLine16;
|
||||||
VLine := @VLine16;
|
VLine := @VLine16;
|
||||||
GetScanLine := @GetScanLine16;
|
GetScanLine := @GetScanLine16;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
DirectPutPixel := @libvga_DirectPixelProc;
|
DirectPutPixel := @libvga_DirectPixelProc;
|
||||||
GetPixel := @libvga_GetPixelProc;
|
GetPixel := @libvga_GetPixelProc;
|
||||||
PutPixel := @libvga_PutPixelProc;
|
PutPixel := @libvga_PutPixelProc;
|
||||||
{ May be implemented later:
|
{ May be implemented later:
|
||||||
HLine := @libvga_HLineProc;
|
HLine := @libvga_HLineProc;
|
||||||
VLine := @libvga_VLineProc;
|
VLine := @libvga_VLineProc;
|
||||||
GetScanLine := @libvga_GetScanLineProc;}
|
GetScanLine := @libvga_GetScanLineProc;}
|
||||||
ClearViewPort := @libvga_ClrViewProc;
|
ClearViewPort := @libvga_ClrViewProc;
|
||||||
@ -469,7 +543,7 @@ end;
|
|||||||
SetRGBPalette := @libvga_SetRGBPaletteProc;
|
SetRGBPalette := @libvga_SetRGBPaletteProc;
|
||||||
GetRGBPalette := @libvga_GetRGBPaletteProc;
|
GetRGBPalette := @libvga_GetRGBPaletteProc;
|
||||||
{ These are not really implemented yet:
|
{ These are not really implemented yet:
|
||||||
PutImage := @libvga_PutImageProc;
|
PutImage := @libvga_PutImageProc;
|
||||||
GetImage := @libvga_GetImageProc;}
|
GetImage := @libvga_GetImageProc;}
|
||||||
ImageSize := @libvga_ImageSizeProc;
|
ImageSize := @libvga_ImageSizeProc;
|
||||||
{ Add later maybe ?
|
{ Add later maybe ?
|
||||||
@ -486,47 +560,14 @@ end;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
InitializeGraph;
|
||||||
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2000-03-18 10:46:16 sg
|
Revision 1.12 2000-03-19 11:20:14 peter
|
||||||
* Fixed ClearViewport for 4 bpp modes
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
|
* ggigraph unit for linux added
|
||||||
|
|
||||||
Revision 1.10 2000/03/17 13:30:35 sg
|
|
||||||
* Added accelerated drawing functions for modes with 4 bits per pixel
|
|
||||||
|
|
||||||
Revision 1.9 2000/02/27 14:41:25 peter
|
|
||||||
* removed warnings/notes
|
|
||||||
|
|
||||||
Revision 1.8 2000/02/06 11:26:45 sg
|
|
||||||
* Fixed SetRGBPalette and GetRGBPalette (hopefully; not tested)
|
|
||||||
|
|
||||||
Revision 1.7 2000/02/06 01:48:55 sg
|
|
||||||
* Fixed the default palette. libsvga works with a RGB range from 0-63, not
|
|
||||||
0-255!
|
|
||||||
* PutPixel fixed (pixels didn't get drawn before)
|
|
||||||
|
|
||||||
Revision 1.6 2000/02/03 20:39:58 michael
|
|
||||||
+ Version using only vgalib
|
|
||||||
|
|
||||||
Revision 1.5 2000/01/07 16:41:42 daniel
|
|
||||||
* copyright 2000
|
|
||||||
|
|
||||||
Revision 1.4 1999/12/20 11:22:38 peter
|
|
||||||
* modes moved to interface
|
|
||||||
* integer -> smallint
|
|
||||||
|
|
||||||
Revision 1.3 1999/12/11 23:41:39 jonas
|
|
||||||
* changed definition of getscanlineproc to "getscanline(x1,x2,y:
|
|
||||||
integer; var data);" so it can be used by getimage too
|
|
||||||
* changed getimage so it uses getscanline
|
|
||||||
* changed floodfill, getscanline16 and definitions in Linux
|
|
||||||
include files so they use this new format
|
|
||||||
+ getscanlineVESA256 for 256 color VESA modes (banked)
|
|
||||||
|
|
||||||
Revision 1.2 1999/11/08 00:08:43 michael
|
|
||||||
* Fist working version of svgalib new graph unit
|
|
||||||
* Initial implementation of ggi new graph unit
|
|
||||||
|
|
||||||
Revision 1.1 1999/11/07 16:57:26 michael
|
|
||||||
+ Start of common graph implementation
|
|
||||||
}
|
}
|
@ -1,94 +0,0 @@
|
|||||||
{
|
|
||||||
$Id$
|
|
||||||
This file is part of the Free Pascal run time library.
|
|
||||||
Copyright (c) 1999-2000 by Florian Klaempfl
|
|
||||||
|
|
||||||
Graph include file for linux.
|
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
|
||||||
for details about the copyright.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
**********************************************************************}
|
|
||||||
|
|
||||||
|
|
||||||
Const
|
|
||||||
{ Supported modes }
|
|
||||||
{(sg) GTEXT deactivated because we need mode #0 as default mode}
|
|
||||||
{GTEXT = 0; Compatible with VGAlib v1.2 }
|
|
||||||
G320x200x16 = 1;
|
|
||||||
G640x200x16 = 2;
|
|
||||||
G640x350x16 = 3;
|
|
||||||
G640x480x16 = 4;
|
|
||||||
G320x200x256 = 5;
|
|
||||||
G320x240x256 = 6;
|
|
||||||
G320x400x256 = 7;
|
|
||||||
G360x480x256 = 8;
|
|
||||||
G640x480x2 = 9;
|
|
||||||
|
|
||||||
G640x480x256 = 10;
|
|
||||||
G800x600x256 = 11;
|
|
||||||
G1024x768x256 = 12;
|
|
||||||
|
|
||||||
G1280x1024x256 = 13; { Additional modes. }
|
|
||||||
|
|
||||||
G320x200x32K = 14;
|
|
||||||
G320x200x64K = 15;
|
|
||||||
G320x200x16M = 16;
|
|
||||||
G640x480x32K = 17;
|
|
||||||
G640x480x64K = 18;
|
|
||||||
G640x480x16M = 19;
|
|
||||||
G800x600x32K = 20;
|
|
||||||
G800x600x64K = 21;
|
|
||||||
G800x600x16M = 22;
|
|
||||||
G1024x768x32K = 23;
|
|
||||||
G1024x768x64K = 24;
|
|
||||||
G1024x768x16M = 25;
|
|
||||||
G1280x1024x32K = 26;
|
|
||||||
G1280x1024x64K = 27;
|
|
||||||
G1280x1024x16M = 28;
|
|
||||||
|
|
||||||
G800x600x16 = 29;
|
|
||||||
G1024x768x16 = 30;
|
|
||||||
G1280x1024x16 = 31;
|
|
||||||
|
|
||||||
G720x348x2 = 32; { Hercules emulation mode }
|
|
||||||
|
|
||||||
G320x200x16M32 = 33; { 32-bit per pixel modes. }
|
|
||||||
G640x480x16M32 = 34;
|
|
||||||
G800x600x16M32 = 35;
|
|
||||||
G1024x768x16M32 = 36;
|
|
||||||
G1280x1024x16M32 = 37;
|
|
||||||
|
|
||||||
{ additional resolutions }
|
|
||||||
G1152x864x16 = 38;
|
|
||||||
G1152x864x256 = 39;
|
|
||||||
G1152x864x32K = 40;
|
|
||||||
G1152x864x64K = 41;
|
|
||||||
G1152x864x16M = 42;
|
|
||||||
G1152x864x16M32 = 43;
|
|
||||||
|
|
||||||
G1600x1200x16 = 44;
|
|
||||||
G1600x1200x256 = 45;
|
|
||||||
G1600x1200x32K = 46;
|
|
||||||
G1600x1200x64K = 47;
|
|
||||||
G1600x1200x16M = 48;
|
|
||||||
G1600x1200x16M32 = 49;
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
$Log$
|
|
||||||
Revision 1.3 2000-01-07 16:41:40 daniel
|
|
||||||
* copyright 2000
|
|
||||||
|
|
||||||
Revision 1.2 1999/12/20 11:22:38 peter
|
|
||||||
* modes moved to interface
|
|
||||||
* integer -> smallint
|
|
||||||
|
|
||||||
Revision 1.1 1999/11/08 15:06:17 peter
|
|
||||||
* needed
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Makefile generated by fpcmake v0.99.13 [2000/02/09]
|
# Makefile generated by fpcmake v0.99.13 [2000/02/24]
|
||||||
#
|
#
|
||||||
|
|
||||||
defaultrule: all
|
defaultrule: all
|
||||||
@ -1200,9 +1200,9 @@ objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
|
|||||||
include $(GRAPHDIR)/makefile.inc
|
include $(GRAPHDIR)/makefile.inc
|
||||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||||
|
|
||||||
graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) \
|
graph$(PPUEXT) : graph.pp strings$(PPUEXT) windows$(PPUEXT) $(SYSTEMPPU) \
|
||||||
$(GRAPHINCDEPS) graph.inc graphh.inc
|
$(GRAPHINCDEPS)
|
||||||
$(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
|
$(COMPILER) -I$(GRAPHDIR) graph.pp $(REDIR)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -135,9 +135,9 @@ objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
|
|||||||
include $(GRAPHDIR)/makefile.inc
|
include $(GRAPHDIR)/makefile.inc
|
||||||
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
|
||||||
|
|
||||||
graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) \
|
graph$(PPUEXT) : graph.pp strings$(PPUEXT) windows$(PPUEXT) $(SYSTEMPPU) \
|
||||||
$(GRAPHINCDEPS) graph.inc graphh.inc
|
$(GRAPHINCDEPS)
|
||||||
$(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
|
$(COMPILER) -I$(GRAPHDIR) graph.pp $(REDIR)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -13,7 +13,68 @@
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
unit Graph;
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
windows;
|
||||||
|
|
||||||
|
{$i graphh.inc}
|
||||||
|
|
||||||
|
var
|
||||||
|
{ this procedure allows to hook keyboard messages }
|
||||||
|
charmessagehandler : function(Window: hwnd; AMessage, WParam,
|
||||||
|
LParam: Longint): Longint;
|
||||||
|
{ this procedure allows to hook mouse messages }
|
||||||
|
mousemessagehandler : function(Window: hwnd; AMessage, WParam,
|
||||||
|
LParam: Longint): Longint;
|
||||||
|
mainwindow : HWnd;
|
||||||
|
|
||||||
|
const
|
||||||
|
{ predefined window style }
|
||||||
|
{ we shouldn't set CS_DBLCLKS here }
|
||||||
|
{ because most dos applications }
|
||||||
|
{ handle double clicks on it's own }
|
||||||
|
graphwindowstyle : DWord = cs_hRedraw or cs_vRedraw;
|
||||||
|
|
||||||
|
windowtitle : pchar = 'Graph window application';
|
||||||
|
|
||||||
|
CONST
|
||||||
|
|
||||||
|
m640x200x16 = VGALo;
|
||||||
|
m640x400x16 = VGAMed;
|
||||||
|
m640x480x16 = VGAHi;
|
||||||
|
|
||||||
|
{ VESA Specific video modes. }
|
||||||
|
m320x200x32k = $10D;
|
||||||
|
m320x200x64k = $10E;
|
||||||
|
|
||||||
|
m640x400x256 = $100;
|
||||||
|
|
||||||
|
m640x480x256 = $101;
|
||||||
|
m640x480x32k = $110;
|
||||||
|
m640x480x64k = $111;
|
||||||
|
|
||||||
|
m800x600x16 = $102;
|
||||||
|
m800x600x256 = $103;
|
||||||
|
m800x600x32k = $113;
|
||||||
|
m800x600x64k = $114;
|
||||||
|
|
||||||
|
m1024x768x16 = $104;
|
||||||
|
m1024x768x256 = $105;
|
||||||
|
m1024x768x32k = $116;
|
||||||
|
m1024x768x64k = $117;
|
||||||
|
|
||||||
|
m1280x1024x16 = $106;
|
||||||
|
m1280x1024x256 = $107;
|
||||||
|
m1280x1024x32k = $119;
|
||||||
|
m1280x1024x64k = $11A;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
strings;
|
||||||
|
|
||||||
{
|
{
|
||||||
Remarks:
|
Remarks:
|
||||||
@ -28,9 +89,13 @@
|
|||||||
must be used when doing xor/or/and operations
|
must be used when doing xor/or/and operations
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
InternalDriverName = 'WIN32GUI';
|
InternalDriverName = 'WIN32GUI';
|
||||||
|
|
||||||
|
{$i graph.inc}
|
||||||
|
|
||||||
|
|
||||||
{ used to create a file containing all calls to WM_PAINT
|
{ used to create a file containing all calls to WM_PAINT
|
||||||
WARNING this probably creates HUGE files PM }
|
WARNING this probably creates HUGE files PM }
|
||||||
{ $define DEBUG_WM_PAINT}
|
{ $define DEBUG_WM_PAINT}
|
||||||
@ -47,7 +112,7 @@ var
|
|||||||
bitmapdc : hdc;
|
bitmapdc : hdc;
|
||||||
oldbitmap : hgdiobj;
|
oldbitmap : hgdiobj;
|
||||||
pal : ^rgbrec;
|
pal : ^rgbrec;
|
||||||
SavePtr : pointer; { we don't use that pointer }
|
// SavePtr : pointer; { we don't use that pointer }
|
||||||
MessageThreadHandle : Handle;
|
MessageThreadHandle : Handle;
|
||||||
MessageThreadID : DWord;
|
MessageThreadID : DWord;
|
||||||
windc : hdc;
|
windc : hdc;
|
||||||
@ -729,9 +794,17 @@ function queryadapterinfo : pmodeinfo;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
InitializeGraph;
|
||||||
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2000-03-17 22:53:20 florian
|
Revision 1.1 2000-03-19 11:20:14 peter
|
||||||
|
* graph unit include is now independent and the dependent part
|
||||||
|
is now in graph.pp
|
||||||
|
* ggigraph unit for linux added
|
||||||
|
|
||||||
|
Revision 1.8 2000/03/17 22:53:20 florian
|
||||||
* window class is registered only once => multible init/closegraphs are possible
|
* window class is registered only once => multible init/closegraphs are possible
|
||||||
* calling cleardevice when creating the window
|
* calling cleardevice when creating the window
|
||||||
|
|
@ -1,84 +0,0 @@
|
|||||||
{
|
|
||||||
$Id$
|
|
||||||
This file is part of the Free Pascal run time library.
|
|
||||||
Copyright (c) 1999-2000 by Florian Klaempfl
|
|
||||||
|
|
||||||
This file implements the win32 gui support for the graph unit
|
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
|
||||||
for details about the copyright.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
**********************************************************************}
|
|
||||||
|
|
||||||
|
|
||||||
var
|
|
||||||
{ this procedure allows to hook keyboard messages }
|
|
||||||
charmessagehandler : function(Window: hwnd; AMessage, WParam,
|
|
||||||
LParam: Longint): Longint;
|
|
||||||
{ this procedure allows to hook mouse messages }
|
|
||||||
mousemessagehandler : function(Window: hwnd; AMessage, WParam,
|
|
||||||
LParam: Longint): Longint;
|
|
||||||
mainwindow : HWnd;
|
|
||||||
|
|
||||||
const
|
|
||||||
{ predefined window style }
|
|
||||||
{ we shouldn't set CS_DBLCLKS here }
|
|
||||||
{ because most dos applications }
|
|
||||||
{ handle double clicks on it's own }
|
|
||||||
graphwindowstyle : DWord = cs_hRedraw or cs_vRedraw;
|
|
||||||
|
|
||||||
windowtitle : pchar = 'Graph window application';
|
|
||||||
|
|
||||||
CONST
|
|
||||||
|
|
||||||
m640x200x16 = VGALo;
|
|
||||||
m640x400x16 = VGAMed;
|
|
||||||
m640x480x16 = VGAHi;
|
|
||||||
|
|
||||||
{ VESA Specific video modes. }
|
|
||||||
m320x200x32k = $10D;
|
|
||||||
m320x200x64k = $10E;
|
|
||||||
|
|
||||||
m640x400x256 = $100;
|
|
||||||
|
|
||||||
m640x480x256 = $101;
|
|
||||||
m640x480x32k = $110;
|
|
||||||
m640x480x64k = $111;
|
|
||||||
|
|
||||||
m800x600x16 = $102;
|
|
||||||
m800x600x256 = $103;
|
|
||||||
m800x600x32k = $113;
|
|
||||||
m800x600x64k = $114;
|
|
||||||
|
|
||||||
m1024x768x16 = $104;
|
|
||||||
m1024x768x256 = $105;
|
|
||||||
m1024x768x32k = $116;
|
|
||||||
m1024x768x64k = $117;
|
|
||||||
|
|
||||||
m1280x1024x16 = $106;
|
|
||||||
m1280x1024x256 = $107;
|
|
||||||
m1280x1024x32k = $119;
|
|
||||||
m1280x1024x64k = $11A;
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
$Log$
|
|
||||||
Revision 1.5 2000-03-05 13:07:04 florian
|
|
||||||
* the title can be user defined
|
|
||||||
|
|
||||||
Revision 1.4 2000/01/07 16:41:52 daniel
|
|
||||||
* copyright 2000
|
|
||||||
|
|
||||||
Revision 1.3 1999/12/08 09:09:34 pierre
|
|
||||||
+ add VESA compatible mode in 16 and 256 colors
|
|
||||||
|
|
||||||
Revision 1.2 1999/11/29 22:03:39 florian
|
|
||||||
* first implementation of winmouse unit
|
|
||||||
|
|
||||||
Revision 1.1 1999/11/08 15:01:39 peter
|
|
||||||
* fpcmake support
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user