mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 10:49:07 +02:00
+ detectgraph
* small change to internalellipsedefault so less pixels are calculated twice * some small corrections to graph.tex
This commit is contained in:
parent
5f0cf70477
commit
bd4d132c5b
@ -1300,8 +1300,8 @@ var
|
||||
{ pl: procedure which either draws a patternline (for }
|
||||
{ FillEllipse) or does nothing (arc etc) }
|
||||
{--------------------------------------------------------}
|
||||
{ NOTE: - uses the current write mode. }
|
||||
{ - Angles must both be between 0 and 360 }
|
||||
{ NOTE: - }
|
||||
{ - }
|
||||
{********************************************************}
|
||||
|
||||
Procedure InternalEllipseDefault(X,Y: Integer;XRadius: word;
|
||||
@ -1369,7 +1369,7 @@ var
|
||||
{ equation of an ellipse. }
|
||||
{ In the worst case, we have to calculate everything from the }
|
||||
{ quadrant, so divide the circumference value by 4 (JM) }
|
||||
NumOfPixels:=Round(2.5*sqrt((sqr(XRadius)+sqr(YRadius)) div 2));
|
||||
NumOfPixels:=Round(Sqrt(3)*sqrt(sqr(XRadius)+sqr(YRadius)));
|
||||
{ Calculate the angle precision required }
|
||||
Delta := 90.0 / (NumOfPixels);
|
||||
{ Adjust for screen aspect ratio }
|
||||
@ -1440,7 +1440,7 @@ var
|
||||
PutPixel(xp,ym,CurrentColor);
|
||||
end;
|
||||
If (ynext <> ytemp) and
|
||||
(xp-xm >2) then
|
||||
(xp <> xm) then
|
||||
begin
|
||||
CurrentColor := FillSettings.Color;
|
||||
pl(plxmyp+1,plxpyp-1,yp);
|
||||
@ -1886,19 +1886,19 @@ Begin
|
||||
Begin
|
||||
for i:=X to X1 do
|
||||
begin
|
||||
case BitBlt of
|
||||
case BitBlt of
|
||||
{$R-}
|
||||
CopyPut: color:= pt(Bitmap)[k]; { also = normalput }
|
||||
XORPut: color:= pt(Bitmap)[k] XOR GetPixel(i,j);
|
||||
OrPut: color:= pt(Bitmap)[k] OR GetPixel(i,j);
|
||||
AndPut: color:= pt(Bitmap)[k] AND GetPixel(i,j);
|
||||
NotPut: color:= not pt(Bitmap)[k];
|
||||
CopyPut: color:= pt(Bitmap)[k]; { also = normalput }
|
||||
XORPut: color:= pt(Bitmap)[k] XOR GetPixel(i,j);
|
||||
OrPut: color:= pt(Bitmap)[k] OR GetPixel(i,j);
|
||||
AndPut: color:= pt(Bitmap)[k] AND GetPixel(i,j);
|
||||
NotPut: color:= not pt(Bitmap)[k];
|
||||
{$ifdef debug}
|
||||
{$R+}
|
||||
{$endif debug}
|
||||
end;
|
||||
putpixel(i,j,color);
|
||||
Inc(k);
|
||||
end;
|
||||
putpixel(i,j,color);
|
||||
Inc(k);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -2100,14 +2100,6 @@ end;
|
||||
{ and XRadius and YRadius as the horizontal and vertical }
|
||||
{ axes. The ellipse is filled with the current fill color}
|
||||
{ and fill style, and is bordered with the current color.}
|
||||
{--------------------------------------------------------}
|
||||
{ Important notes: }
|
||||
{ - CONTRRARY to VGA BGI - SetWriteMode DOES not }
|
||||
{ affect the contour of the ellipses. BGI mode }
|
||||
{ supports XORPut but the FloodFill() is still bounded}
|
||||
{ by the ellipse. In OUR case, XOR Mode is simply }
|
||||
{ not supported. }
|
||||
{ - update: other write modes are now supported (JM }
|
||||
{********************************************************}
|
||||
begin
|
||||
InternalEllipse(X,Y,XRadius,YRadius,0,360,PatternLine)
|
||||
@ -2312,7 +2304,7 @@ end;
|
||||
close(t);
|
||||
{$endif sectorpldebug}
|
||||
End;
|
||||
If plx2 - plx1 > 2 then
|
||||
If plx2 > plx1 then
|
||||
Begin
|
||||
{$ifdef sectorpldebug}
|
||||
append(t);
|
||||
@ -2334,34 +2326,6 @@ end;
|
||||
{$endif fpc}
|
||||
Line(ArcCall.XStart, ArcCall.YStart, x,y);
|
||||
Line(x,y,ArcCall.Xend,ArcCall.YEnd);
|
||||
|
||||
(*
|
||||
Ellipse(x,y,stAngle,endAngle,XRadius,YRadius);
|
||||
{ As in the TP graph unit - the line settings are used to }
|
||||
{ define the outline of the sector. }
|
||||
writemode:=Currentwritemode;
|
||||
Currentwritemode:=normalput;
|
||||
Line(ArcCall.XStart, ArcCall.YStart, x,y);
|
||||
Line(x,y,ArcCall.Xend,ArcCall.YEnd);
|
||||
{ we must take care of clipping so we call PutPixel instead }
|
||||
{ of DirectPutPixel... }
|
||||
PutPixel(ArcCall.xstart,ArcCall.ystart,CurrentColor);
|
||||
PutPixel(x,y,CurrentColor);
|
||||
PutPixel(ArcCall.xend,ArcCall.yend,CurrentColor);
|
||||
stangle:=Stangle mod 360; EndAngle:=Endangle mod 360;
|
||||
{ if stAngle<=Endangle then}
|
||||
Angle:=(stAngle+EndAngle) div 2
|
||||
{ else
|
||||
angle:=(stAngle-360+EndAngle) div 2};
|
||||
{ fill from the point in the middle of the slice }
|
||||
XRadius:=(longint(XRadius)*10000) div XAspect;
|
||||
YRadius:=(longint(YRadius)*10000) div YAspect;
|
||||
{ avoid rounding errors }
|
||||
if (abs(ArcCall.xstart-ArcCall.xend)
|
||||
+abs(ArcCall.ystart-ArcCall.yend)>2) then
|
||||
FloodFill(x+round(sin((angle+90)*Pi/180)*XRadius/2),
|
||||
y+round(cos((angle+90)*Pi/180)*YRadius/2),CurrentColor);
|
||||
CurrentWriteMode := writemode;*)
|
||||
end;
|
||||
|
||||
|
||||
@ -2629,8 +2593,6 @@ end;
|
||||
end;
|
||||
|
||||
Function GetDriverName: string;
|
||||
var
|
||||
mode: PModeInfo;
|
||||
begin
|
||||
GetDriverName:=DriverName;
|
||||
end;
|
||||
@ -2703,10 +2665,12 @@ end;
|
||||
|
||||
|
||||
procedure SetWriteMode(WriteMode : integer);
|
||||
{ TP sets the writemodes according to the following scheme (JM) }
|
||||
begin
|
||||
if (writemode<>xorput) and (writemode<>CopyPut) then
|
||||
exit;
|
||||
CurrentWriteMode := WriteMode;
|
||||
Case writemode of
|
||||
xorput, andput: CurrentWriteMode := XorPut;
|
||||
notput, orput, copyput: CurrentWriteMode := CopyPut;
|
||||
End;
|
||||
end;
|
||||
|
||||
|
||||
@ -2757,20 +2721,46 @@ end;
|
||||
{$i gtext.inc}
|
||||
|
||||
|
||||
procedure DetectGraph(var GraphDriver:Integer;var GraphMode:Integer);
|
||||
var LoMode, HiMode: Integer;
|
||||
CpyMode: Integer;
|
||||
CpyDriver: Integer;
|
||||
begin
|
||||
HiMode := -1;
|
||||
LoMode := -1;
|
||||
{ We start at VGA }
|
||||
GraphDriver := VGA;
|
||||
CpyMode := 0;
|
||||
{ search all possible graphic drivers in ascending order...}
|
||||
{ usually the new driver numbers indicate newest hardware...}
|
||||
{ Internal driver numbers start at VGA=9 }
|
||||
repeat
|
||||
GetModeRange(GraphDriver,LoMode,HiMode);
|
||||
{ save the highest mode possible...}
|
||||
if HiMode = -1 then break;
|
||||
CpyMode:=HiMode;
|
||||
CpyDriver:=GraphDriver;
|
||||
{ go to next driver if it exists...}
|
||||
Inc(GraphDriver);
|
||||
until (CpyMode=-1);
|
||||
{ If this is equal to -1 then no graph mode possible...}
|
||||
if CpyMode = -1 then
|
||||
begin
|
||||
_GraphResult := grNotDetected;
|
||||
exit;
|
||||
end;
|
||||
GraphDriver := CpyDriver;
|
||||
GraphMode := CpyMode;
|
||||
end;
|
||||
|
||||
procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;
|
||||
const PathToDriver:String);
|
||||
var i,index:Integer;
|
||||
LoMode, HiMode: Integer;
|
||||
CpyMode: Integer;
|
||||
CpyDriver: Integer;
|
||||
begin
|
||||
{ path to the fonts (where they will be searched)...}
|
||||
bgipath:=PathToDriver;
|
||||
if bgipath[length(bgipath)]<>'\' then
|
||||
bgipath:=bgipath+'\';
|
||||
|
||||
{ make sure our driver list is setup...}
|
||||
{ QueryAdapterInfo;}
|
||||
if not assigned(SaveVideoState) then
|
||||
RunError(216);
|
||||
{$ifdef logging}
|
||||
@ -2782,32 +2772,11 @@ end;
|
||||
|
||||
if (Graphdriver=Detect) then
|
||||
begin
|
||||
HiMode := -1;
|
||||
LoMode := -1;
|
||||
{ We start at VGA-1 }
|
||||
GraphDriver := VGA;
|
||||
CpyMode := 0;
|
||||
{ search all possible graphic drivers in ascending order...}
|
||||
{ usually the new driver numbers indicate newest hardware...}
|
||||
{ Internal driver numbers start at VGA=9 }
|
||||
repeat
|
||||
GetModeRange(GraphDriver,LoMode,HiMode);
|
||||
{ save the highest mode possible...}
|
||||
if HiMode = -1 then break;
|
||||
CpyMode:=HiMode;
|
||||
CpyDriver:=GraphDriver;
|
||||
{ go to next driver if it exists...}
|
||||
Inc(GraphDriver);
|
||||
until (CpyMode=-1);
|
||||
IntCurrentDriver := CpyDriver;
|
||||
{ If this is equal to -1 then no graph mode possible...}
|
||||
if CpyMode = -1 then
|
||||
begin
|
||||
_GraphResult := grNotDetected;
|
||||
exit;
|
||||
end;
|
||||
DetectGraph(GraphDriver,GraphMode);
|
||||
If _GraphResult = grNotDetected then Exit;
|
||||
IntCurrentDriver := GraphDriver;
|
||||
{ Actually set the graph mode...}
|
||||
SetGraphMode(CpyMode);
|
||||
SetGraphMode(GraphMode);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -2880,7 +2849,13 @@ DetectGraph
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.27 1999-09-24 22:52:38 jonas
|
||||
Revision 1.28 1999-09-25 11:48:43 jonas
|
||||
+ detectgraph
|
||||
* small change to internalellipsedefault so less pixels are
|
||||
calculated twice
|
||||
* some small corrections to graph.tex
|
||||
|
||||
Revision 1.27 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
|
||||
|
@ -81,7 +81,6 @@ below:
|
||||
return errors, as they are not directly supported.
|
||||
\item \textit{DrawPoly} XORPut write mode does not have the same behaviour
|
||||
as the one in the Turbo Pascal graph unit.
|
||||
\item XORPut write mode is not supported by \textit{FillEllipse}.
|
||||
\item XORPut write mode is not supported by \textit{Bar3d}.
|
||||
\item Passing invalid parameters to \textit{SetTextStyle} will not
|
||||
result in the same visual appearance. Make sure your input is valid.
|
||||
@ -156,8 +155,8 @@ others don't :
|
||||
\item \textit{Bar} --- ok
|
||||
\item \textit{Bar3D} --- ok
|
||||
\item \textit{ClearViewPort}
|
||||
\item \textit{CloseGraph}
|
||||
\item \textit{DetectGraph}
|
||||
\item \textit{CloseGraph} --- ok
|
||||
\item \textit{DetectGraph} --- ok
|
||||
\item \textit{DrawPoly} --- ok
|
||||
\item \textit{FillPoly} --- ok
|
||||
\item \textit{FloodFill} --- ok
|
||||
@ -196,6 +195,7 @@ The following routines support XORPut write modes (all routines support
|
||||
CopyPut modes):
|
||||
|
||||
\begin{itemize}
|
||||
\item \textit{FillEllipse}
|
||||
\item \textit{FillPoly}
|
||||
\item \textit{Arc} with ThickWidth line styles only
|
||||
\item \textit{Circle} with ThickWidth line styles only
|
||||
@ -271,7 +271,8 @@ This routine is one of the most important callback routines with
|
||||
PutPixel, it is called by most of the routines in the graph unit. It
|
||||
is about the same as PutPixel except that the coordinates passed to
|
||||
it are already in global (screen) coordinates, and that clipping has
|
||||
already been performed.
|
||||
already been performed. Note that the current WriteMode has to be taken
|
||||
into account in this procedure.
|
||||
|
||||
\var{InitMode}
|
||||
|
||||
@ -294,7 +295,7 @@ SaveVideoState was called.
|
||||
\var{QueryAdapterInfo}
|
||||
|
||||
This routine might be called by the user BEFORE we are in graphics
|
||||
mode. In all cases it is called by DetectGraph and InitGraph. It
|
||||
mode. It is called by the initialization code of the graph unit. It
|
||||
creates a linked list of video capabilities and procedural hooks for
|
||||
all supported video modes on the platform. Look at the DOS version,
|
||||
to see how it works. This linked list can be read by the user before a
|
||||
@ -327,7 +328,7 @@ empty string and sets GraphResult to grInvalidMode.
|
||||
\Declaration
|
||||
Procedure SetAllPalette(var Palette: PaletteType) ;
|
||||
\Description
|
||||
\var{Palette} is of type PaletteType. Thie first field in Palette
|
||||
\var{Palette} is of type PaletteType. The first field in Palette
|
||||
contains the length of the palette. The next \textit{n} fields of
|
||||
type \var{RGBRec} contains the Red-Green-Blue components to replace
|
||||
that specific color with. A value of -1 will not change the previous
|
||||
@ -460,7 +461,7 @@ access the video memory.
|
||||
|
||||
The behaviour of this routine depends on the platform, and is required
|
||||
for example to use the graph unit under older multitaskers such as
|
||||
Desqview (DOS platform). Certain modes simply are simply not supported
|
||||
Desqview (DOS platform). Certain modes re simply not supported
|
||||
via Operating system calls, while others are only supported by the
|
||||
operating system. In those cases this routine is simply ignored.
|
||||
|
||||
@ -1820,7 +1821,7 @@ If there is an error when using this routine, \var{GraphResult} might return
|
||||
\Errors
|
||||
None.
|
||||
\SeeAlso
|
||||
\seep{GetTextSettings}
|
||||
\seep{GetTextSettings}
|
||||
\end{procedure}
|
||||
\begin{procedure}{SetUserCharSize}
|
||||
\Declaration
|
||||
@ -1854,7 +1855,7 @@ None.
|
||||
Procedure SetVisualPage (Page : Word);
|
||||
|
||||
\Description
|
||||
\var{SetVisualPage} sets the video page to page number \var{Page}.
|
||||
\var{SetVisualPage} sets the video page to page number \var{Page}.
|
||||
\Errors
|
||||
None
|
||||
\SeeAlso
|
||||
@ -1872,6 +1873,14 @@ be one of the following pre-defined constants:
|
||||
\item CopyPut=0;
|
||||
\item XORPut=1;
|
||||
\end{itemize}
|
||||
|
||||
If you specify another mode, it is mapped to one of the above acoording to
|
||||
the following table (for TP compatibility, may be changed in the future):
|
||||
\begin{itemize}
|
||||
\item Notput, Orput: CopyPut
|
||||
\item AndPut: XorPut
|
||||
\end{itemize}
|
||||
|
||||
\Errors
|
||||
None.
|
||||
\SeeAlso
|
||||
@ -1903,4 +1912,5 @@ None.
|
||||
\SeeAlso
|
||||
\seef{TextHeight}
|
||||
\end{function}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user