|
@@ -216,22 +216,42 @@ Interface
|
|
grInvalidVersion = -18;
|
|
grInvalidVersion = -18;
|
|
|
|
|
|
|
|
|
|
- black = 0;
|
|
|
|
- blue = 1;
|
|
|
|
- green = 2;
|
|
|
|
- cyan = 3;
|
|
|
|
- red = 4;
|
|
|
|
- magenta = 5;
|
|
|
|
- brown = 6;
|
|
|
|
|
|
+ { Color constants for setpalette }
|
|
|
|
+ black = 0;
|
|
|
|
+ blue = 1;
|
|
|
|
+ green = 2;
|
|
|
|
+ cyan = 3;
|
|
|
|
+ red = 4;
|
|
|
|
+ magenta = 5;
|
|
|
|
+ brown = 6;
|
|
lightgray = 7;
|
|
lightgray = 7;
|
|
- darkgray = 8;
|
|
|
|
|
|
+ darkgray = 8;
|
|
lightblue = 9;
|
|
lightblue = 9;
|
|
lightgreen = 10;
|
|
lightgreen = 10;
|
|
lightcyan = 11;
|
|
lightcyan = 11;
|
|
- lightred = 12;
|
|
|
|
|
|
+ lightred = 12;
|
|
lightmagenta = 13;
|
|
lightmagenta = 13;
|
|
- yellow = 14;
|
|
|
|
- white = 15;
|
|
|
|
|
|
+ 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 }
|
|
{ Line styles for GetLineStyle/SetLineStyle }
|
|
SolidLn = 0;
|
|
SolidLn = 0;
|
|
@@ -320,18 +340,28 @@ Interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ MaxColors = 65535; { Maximum possible colors using a palette }
|
|
|
|
+ { otherwise, direct color encoding }
|
|
|
|
|
|
|
|
|
|
type
|
|
type
|
|
- RGBColor = record
|
|
|
|
- r,g,b,i : byte;
|
|
|
|
|
|
+ RGBRec = packed record
|
|
|
|
+ Red: integer;
|
|
|
|
+ Green: integer;
|
|
|
|
+ Blue : integer;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{$ifndef FPC}
|
|
|
|
+ PaletteType = record
|
|
|
|
+ Size : longint;
|
|
|
|
+ Colors : array[0..255] of RGBRec;
|
|
|
|
+ end;
|
|
|
|
+{$else}
|
|
PaletteType = record
|
|
PaletteType = record
|
|
- Size : integer;
|
|
|
|
- Colors : array[0..767]of Byte;
|
|
|
|
|
|
+ Size : longint;
|
|
|
|
+ Colors : array[0..MaxColors] of RGBRec;
|
|
end;
|
|
end;
|
|
|
|
+{$endif}
|
|
|
|
|
|
LineSettingsType = record
|
|
LineSettingsType = record
|
|
linestyle : word;
|
|
linestyle : word;
|
|
@@ -355,7 +385,7 @@ Interface
|
|
FillPatternType = array[1..8] of byte;
|
|
FillPatternType = array[1..8] of byte;
|
|
|
|
|
|
PointType = record
|
|
PointType = record
|
|
- x,y : integer;
|
|
|
|
|
|
+ x,y : integer;
|
|
end;
|
|
end;
|
|
|
|
|
|
ViewPortType = record
|
|
ViewPortType = record
|
|
@@ -460,6 +490,14 @@ TYPE
|
|
{ this routine is called in closegraph to cleanup... }
|
|
{ this routine is called in closegraph to cleanup... }
|
|
restorestateproc = procedure;
|
|
restorestateproc = procedure;
|
|
|
|
|
|
|
|
+ { This routine is a hook for SetRGBPalette }
|
|
|
|
+ setrgbpaletteproc =
|
|
|
|
+ procedure(ColorNum, RedValue, GreenValue, BlueValue: Integer);
|
|
|
|
+
|
|
|
|
+ { This routine is a hook for GetRGBPalette }
|
|
|
|
+ getrgbpaletteproc =
|
|
|
|
+ procedure(ColorNum, RedValue, GreenValue, BlueValue: Integer);
|
|
|
|
+
|
|
TYPE
|
|
TYPE
|
|
{-----------------------------------}
|
|
{-----------------------------------}
|
|
{ Linked list for mode information }
|
|
{ Linked list for mode information }
|
|
@@ -477,6 +515,7 @@ TYPE
|
|
DriverNumber: Integer;
|
|
DriverNumber: Integer;
|
|
ModeNumber: Integer;
|
|
ModeNumber: Integer;
|
|
MaxColor: Longint;
|
|
MaxColor: Longint;
|
|
|
|
+ PaletteSize : Longint;
|
|
XAspect : Integer;
|
|
XAspect : Integer;
|
|
YAspect : Integer;
|
|
YAspect : Integer;
|
|
MaxX: Integer;
|
|
MaxX: Integer;
|
|
@@ -486,6 +525,8 @@ TYPE
|
|
DirectPutPixel : DefPixelProc;
|
|
DirectPutPixel : DefPixelProc;
|
|
GetPixel : GetPixelProc;
|
|
GetPixel : GetPixelProc;
|
|
PutPixel : PutPixelProc;
|
|
PutPixel : PutPixelProc;
|
|
|
|
+ SetRGBPalette : SetRGBPaletteProc;
|
|
|
|
+ GetRGBPalette : GetRGBPaletteProc;
|
|
{ defaults possible ... }
|
|
{ defaults possible ... }
|
|
SetVisualPage : SetVisualPageProc;
|
|
SetVisualPage : SetVisualPageProc;
|
|
SetActivePage : SetActivePageProc;
|
|
SetActivePage : SetActivePageProc;
|
|
@@ -515,6 +556,8 @@ VAR
|
|
GetPixel : GetPixelProc;
|
|
GetPixel : GetPixelProc;
|
|
SetVisualPage : SetVisualPageProc;
|
|
SetVisualPage : SetVisualPageProc;
|
|
SetActivePage : SetActivePageProc;
|
|
SetActivePage : SetActivePageProc;
|
|
|
|
+ SetRGBPalette : SetRGBPaletteProc;
|
|
|
|
+ GetRGBPalette : GetRGBPaletteProc;
|
|
|
|
|
|
GraphFreeMemPtr: graphfreememprc;
|
|
GraphFreeMemPtr: graphfreememprc;
|
|
GraphGetMemPtr : graphgetmemprc;
|
|
GraphGetMemPtr : graphgetmemprc;
|
|
@@ -651,6 +694,7 @@ const
|
|
{$i fontdata.inc}
|
|
{$i fontdata.inc}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
var
|
|
var
|
|
CurrentColor: Word;
|
|
CurrentColor: Word;
|
|
CurrentBkColor: Word;
|
|
CurrentBkColor: Word;
|
|
@@ -699,7 +743,8 @@ var
|
|
MaxX : Integer; { Maximum resolution - ABSOLUTE }
|
|
MaxX : Integer; { Maximum resolution - ABSOLUTE }
|
|
MaxY : Integer; { Maximum resolution - ABSOLUTE }
|
|
MaxY : Integer; { Maximum resolution - ABSOLUTE }
|
|
MaxColor : Longint;
|
|
MaxColor : Longint;
|
|
-
|
|
|
|
|
|
+ PaletteSize : longint; { Maximum palette entry we can set, usually equal}
|
|
|
|
+ { maxcolor. }
|
|
DriverName: String;
|
|
DriverName: String;
|
|
ModeList : PModeInfo;
|
|
ModeList : PModeInfo;
|
|
|
|
|
|
@@ -734,9 +779,9 @@ var
|
|
Y := Y + StartYViewPort;
|
|
Y := Y + StartYViewPort;
|
|
if ClipPixels then
|
|
if ClipPixels then
|
|
Begin
|
|
Begin
|
|
- if LineClipped(x,y,x2,y,StartXViewPort,StartYViewPort,
|
|
|
|
- StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
- exit;
|
|
|
|
|
|
+ if LineClipped(x,y,x2,y,StartXViewPort,StartYViewPort,
|
|
|
|
+ StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
+ exit;
|
|
end;
|
|
end;
|
|
for x:= x to x2 do
|
|
for x:= x to x2 do
|
|
DirectPutPixel(X,Y);
|
|
DirectPutPixel(X,Y);
|
|
@@ -762,9 +807,9 @@ var
|
|
Y := Y + StartYViewPort;
|
|
Y := Y + StartYViewPort;
|
|
if ClipPixels then
|
|
if ClipPixels then
|
|
Begin
|
|
Begin
|
|
- if LineClipped(x,y,x,y2,StartXViewPort,StartYViewPort,
|
|
|
|
- StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
- exit;
|
|
|
|
|
|
+ if LineClipped(x,y,x,y2,StartXViewPort,StartYViewPort,
|
|
|
|
+ StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
+ exit;
|
|
end;
|
|
end;
|
|
for y := y to y2 do Directputpixel(x,y)
|
|
for y := y to y2 do Directputpixel(x,y)
|
|
End;
|
|
End;
|
|
@@ -837,8 +882,8 @@ var
|
|
if ClipPixels then
|
|
if ClipPixels then
|
|
begin
|
|
begin
|
|
if LineClipped(x1,y1,x2,y2,StartXViewPort, StartYViewPort,
|
|
if LineClipped(x1,y1,x2,y2,StartXViewPort, StartYViewPort,
|
|
- StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
- exit;
|
|
|
|
|
|
+ StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
+ exit;
|
|
end;
|
|
end;
|
|
{******************************************}
|
|
{******************************************}
|
|
{ SLOPED SOLID LINES }
|
|
{ SLOPED SOLID LINES }
|
|
@@ -969,8 +1014,8 @@ var
|
|
if ClipPixels then
|
|
if ClipPixels then
|
|
begin
|
|
begin
|
|
if LineClipped(x1,y1,x2,y2,StartXViewPort, StartYViewPort,
|
|
if LineClipped(x1,y1,x2,y2,StartXViewPort, StartYViewPort,
|
|
- StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
- exit;
|
|
|
|
|
|
+ StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
+ exit;
|
|
end;
|
|
end;
|
|
|
|
|
|
OldCurrentColor := CurrentColor;
|
|
OldCurrentColor := CurrentColor;
|
|
@@ -978,19 +1023,19 @@ var
|
|
if y1 = y2 then
|
|
if y1 = y2 then
|
|
Begin
|
|
Begin
|
|
{ Check if we must swap }
|
|
{ Check if we must swap }
|
|
- if x1 >= x2 then
|
|
|
|
|
|
+ if x1 >= x2 then
|
|
Begin
|
|
Begin
|
|
- swtmp := x1;
|
|
|
|
- x1 := x2;
|
|
|
|
- x2 := swtmp;
|
|
|
|
|
|
+ swtmp := x1;
|
|
|
|
+ x1 := x2;
|
|
|
|
+ x2 := swtmp;
|
|
end;
|
|
end;
|
|
- if LineInfo.Thickness = NormWidth then
|
|
|
|
|
|
+ if LineInfo.Thickness = NormWidth then
|
|
Begin
|
|
Begin
|
|
for PixelCount:=x1 to x2 do
|
|
for PixelCount:=x1 to x2 do
|
|
{ optimization: PixelCount mod 16 }
|
|
{ optimization: PixelCount mod 16 }
|
|
- if LinePatterns[PixelCount and 15] = TRUE then
|
|
|
|
|
|
+ if LinePatterns[PixelCount and 15] = TRUE then
|
|
begin
|
|
begin
|
|
- DirectPutPixel(PixelCount,y2);
|
|
|
|
|
|
+ DirectPutPixel(PixelCount,y2);
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
@@ -998,45 +1043,45 @@ var
|
|
for i:=-1 to 1 do
|
|
for i:=-1 to 1 do
|
|
Begin
|
|
Begin
|
|
for PixelCount:=x1 to x2 do
|
|
for PixelCount:=x1 to x2 do
|
|
- { Optimization from Thomas - mod 16 = and 15 }
|
|
|
|
- if LinePatterns[PixelCount and 15] = TRUE then
|
|
|
|
- begin
|
|
|
|
- DirectPutPixel(PixelCount,y2+i);
|
|
|
|
- end;
|
|
|
|
|
|
+ { Optimization from Thomas - mod 16 = and 15 }
|
|
|
|
+ if LinePatterns[PixelCount and 15] = TRUE then
|
|
|
|
+ begin
|
|
|
|
+ DirectPutPixel(PixelCount,y2+i);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
- end
|
|
|
|
|
|
+ end
|
|
else
|
|
else
|
|
if x1 = x2 then
|
|
if x1 = x2 then
|
|
Begin
|
|
Begin
|
|
{ Check if we must swap }
|
|
{ Check if we must swap }
|
|
if y1 >= y2 then
|
|
if y1 >= y2 then
|
|
Begin
|
|
Begin
|
|
- swtmp := y1;
|
|
|
|
- y1 := y2;
|
|
|
|
- y2 := swtmp;
|
|
|
|
|
|
+ swtmp := y1;
|
|
|
|
+ y1 := y2;
|
|
|
|
+ y2 := swtmp;
|
|
end;
|
|
end;
|
|
if LineInfo.Thickness = NormWidth then
|
|
if LineInfo.Thickness = NormWidth then
|
|
Begin
|
|
Begin
|
|
- for PixelCount:=y1 to y2 do
|
|
|
|
|
|
+ for PixelCount:=y1 to y2 do
|
|
{ compare if we should plot a pixel here , compare }
|
|
{ compare if we should plot a pixel here , compare }
|
|
{ with predefined line patterns... }
|
|
{ with predefined line patterns... }
|
|
if LinePatterns[PixelCount and 15] = TRUE then
|
|
if LinePatterns[PixelCount and 15] = TRUE then
|
|
begin
|
|
begin
|
|
- DirectPutPixel(x1,PixelCount);
|
|
|
|
|
|
+ DirectPutPixel(x1,PixelCount);
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Begin
|
|
Begin
|
|
- for i:=-1 to 1 do
|
|
|
|
|
|
+ for i:=-1 to 1 do
|
|
Begin
|
|
Begin
|
|
for PixelCount:=y1 to y2 do
|
|
for PixelCount:=y1 to y2 do
|
|
{ compare if we should plot a pixel here , compare }
|
|
{ compare if we should plot a pixel here , compare }
|
|
{ with predefined line patterns... }
|
|
{ with predefined line patterns... }
|
|
- if LinePatterns[PixelCount and 15] = TRUE then
|
|
|
|
- begin
|
|
|
|
- DirectPutPixel(x1+i,PixelCount);
|
|
|
|
- end;
|
|
|
|
|
|
+ if LinePatterns[PixelCount and 15] = TRUE then
|
|
|
|
+ begin
|
|
|
|
+ DirectPutPixel(x1+i,PixelCount);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
@@ -1051,42 +1096,42 @@ var
|
|
if deltax >= deltay then
|
|
if deltax >= deltay then
|
|
begin
|
|
begin
|
|
|
|
|
|
- Flag := FALSE;
|
|
|
|
- { x is independent variable }
|
|
|
|
- numpixels := deltax + 1;
|
|
|
|
- d := (2 * deltay) - deltax;
|
|
|
|
- dinc1 := deltay Shl 1;
|
|
|
|
- dinc2 := (deltay - deltax) shl 1;
|
|
|
|
- xinc1 := 1;
|
|
|
|
- xinc2 := 1;
|
|
|
|
- yinc1 := 0;
|
|
|
|
- yinc2 := 1;
|
|
|
|
|
|
+ Flag := FALSE;
|
|
|
|
+ { x is independent variable }
|
|
|
|
+ numpixels := deltax + 1;
|
|
|
|
+ d := (2 * deltay) - deltax;
|
|
|
|
+ dinc1 := deltay Shl 1;
|
|
|
|
+ dinc2 := (deltay - deltax) shl 1;
|
|
|
|
+ xinc1 := 1;
|
|
|
|
+ xinc2 := 1;
|
|
|
|
+ yinc1 := 0;
|
|
|
|
+ yinc2 := 1;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
|
|
|
|
- Flag := TRUE;
|
|
|
|
- { y is independent variable }
|
|
|
|
- numpixels := deltay + 1;
|
|
|
|
- d := (2 * deltax) - deltay;
|
|
|
|
- dinc1 := deltax Shl 1;
|
|
|
|
- dinc2 := (deltax - deltay) shl 1;
|
|
|
|
- xinc1 := 0;
|
|
|
|
- xinc2 := 1;
|
|
|
|
- yinc1 := 1;
|
|
|
|
- yinc2 := 1;
|
|
|
|
|
|
+ Flag := TRUE;
|
|
|
|
+ { y is independent variable }
|
|
|
|
+ numpixels := deltay + 1;
|
|
|
|
+ d := (2 * deltax) - deltay;
|
|
|
|
+ dinc1 := deltax Shl 1;
|
|
|
|
+ dinc2 := (deltax - deltay) shl 1;
|
|
|
|
+ xinc1 := 0;
|
|
|
|
+ xinc2 := 1;
|
|
|
|
+ yinc1 := 1;
|
|
|
|
+ yinc2 := 1;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ Make sure x and y move in the right directions }
|
|
{ Make sure x and y move in the right directions }
|
|
if x1 > x2 then
|
|
if x1 > x2 then
|
|
begin
|
|
begin
|
|
- xinc1 := - xinc1;
|
|
|
|
- xinc2 := - xinc2;
|
|
|
|
|
|
+ xinc1 := - xinc1;
|
|
|
|
+ xinc2 := - xinc2;
|
|
end;
|
|
end;
|
|
if y1 > y2 then
|
|
if y1 > y2 then
|
|
begin
|
|
begin
|
|
- yinc1 := - yinc1;
|
|
|
|
- yinc2 := - yinc2;
|
|
|
|
|
|
+ yinc1 := - yinc1;
|
|
|
|
+ yinc2 := - yinc2;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ Start drawing at <x1, y1> }
|
|
{ Start drawing at <x1, y1> }
|
|
@@ -1099,44 +1144,44 @@ var
|
|
TmpNumPixels := NumPixels-1;
|
|
TmpNumPixels := NumPixels-1;
|
|
{ Draw the pixels }
|
|
{ Draw the pixels }
|
|
for i := 0 to TmpNumPixels do
|
|
for i := 0 to TmpNumPixels do
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
{ all depending on the slope, we can determine }
|
|
{ all depending on the slope, we can determine }
|
|
{ in what direction the extra width pixels will be put }
|
|
{ in what direction the extra width pixels will be put }
|
|
If Flag then
|
|
If Flag then
|
|
- Begin
|
|
|
|
- { compare if we should plot a pixel here , compare }
|
|
|
|
- { with predefined line patterns... }
|
|
|
|
- if LinePatterns[i and 15] = TRUE then
|
|
|
|
- begin
|
|
|
|
- DirectPutPixel(x-1,y);
|
|
|
|
- DirectPutPixel(x,y);
|
|
|
|
- DirectPutPixel(x+1,y);
|
|
|
|
- end;
|
|
|
|
- end
|
|
|
|
|
|
+ Begin
|
|
|
|
+ { compare if we should plot a pixel here , compare }
|
|
|
|
+ { with predefined line patterns... }
|
|
|
|
+ if LinePatterns[i and 15] = TRUE then
|
|
|
|
+ begin
|
|
|
|
+ DirectPutPixel(x-1,y);
|
|
|
|
+ DirectPutPixel(x,y);
|
|
|
|
+ DirectPutPixel(x+1,y);
|
|
|
|
+ end;
|
|
|
|
+ end
|
|
else
|
|
else
|
|
- Begin
|
|
|
|
- { compare if we should plot a pixel here , compare }
|
|
|
|
- { with predefined line patterns... }
|
|
|
|
- if LinePatterns[i and 15] = TRUE then
|
|
|
|
- begin
|
|
|
|
- DirectPutPixel(x,y-1);
|
|
|
|
- DirectPutPixel(x,y);
|
|
|
|
- DirectPutPixel(x,y+1);
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- if d < 0 then
|
|
|
|
- begin
|
|
|
|
- d := d + dinc1;
|
|
|
|
- x := x + xinc1;
|
|
|
|
- y := y + yinc1;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- d := d + dinc2;
|
|
|
|
- x := x + xinc2;
|
|
|
|
- y := y + yinc2;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
|
|
+ Begin
|
|
|
|
+ { compare if we should plot a pixel here , compare }
|
|
|
|
+ { with predefined line patterns... }
|
|
|
|
+ if LinePatterns[i and 15] = TRUE then
|
|
|
|
+ begin
|
|
|
|
+ DirectPutPixel(x,y-1);
|
|
|
|
+ DirectPutPixel(x,y);
|
|
|
|
+ DirectPutPixel(x,y+1);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ if d < 0 then
|
|
|
|
+ begin
|
|
|
|
+ d := d + dinc1;
|
|
|
|
+ x := x + xinc1;
|
|
|
|
+ y := y + yinc1;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ d := d + dinc2;
|
|
|
|
+ x := x + xinc2;
|
|
|
|
+ y := y + yinc2;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Begin
|
|
Begin
|
|
@@ -1242,7 +1287,7 @@ var
|
|
TempTerm := j*ConvFac;
|
|
TempTerm := j*ConvFac;
|
|
{ Calculate points }
|
|
{ Calculate points }
|
|
xpt^[i]:=round(XRadius*Cos(TempTerm));
|
|
xpt^[i]:=round(XRadius*Cos(TempTerm));
|
|
- { calculate the value of y }
|
|
|
|
|
|
+ { calculate the value of y }
|
|
ypt^[i]:=round(YRadius*Sin(TempTerm+Pi));
|
|
ypt^[i]:=round(YRadius*Sin(TempTerm+Pi));
|
|
j:=j+Delta;
|
|
j:=j+Delta;
|
|
inc(i);
|
|
inc(i);
|
|
@@ -1354,32 +1399,32 @@ Begin
|
|
if LineInfo.Thickness = Normwidth then
|
|
if LineInfo.Thickness = Normwidth then
|
|
Begin
|
|
Begin
|
|
If (Alpha>=StAngle) And (Alpha<=EndAngle) then
|
|
If (Alpha>=StAngle) And (Alpha<=EndAngle) then
|
|
- PutPixel (xm,ym, CurrentColor);
|
|
|
|
|
|
+ PutPixel (xm,ym, CurrentColor);
|
|
If (180-Alpha>=StAngle) And (180-Alpha<=EndAngle) then
|
|
If (180-Alpha>=StAngle) And (180-Alpha<=EndAngle) then
|
|
- PutPixel (xm,yp, CurrentColor);
|
|
|
|
|
|
+ PutPixel (xm,yp, CurrentColor);
|
|
If (180+Alpha>=StAngle) And (180+Alpha<=EndAngle) then
|
|
If (180+Alpha>=StAngle) And (180+Alpha<=EndAngle) then
|
|
- PutPixel (xp,yp, CurrentColor);
|
|
|
|
|
|
+ PutPixel (xp,yp, CurrentColor);
|
|
If (360-Alpha>=StAngle) And (360-Alpha<=EndAngle) then
|
|
If (360-Alpha>=StAngle) And (360-Alpha<=EndAngle) then
|
|
- PutPixel (xp,ym, CurrentColor);
|
|
|
|
|
|
+ PutPixel (xp,ym, CurrentColor);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Begin
|
|
Begin
|
|
If (Alpha>=StAngle) And (Alpha<=EndAngle) then
|
|
If (Alpha>=StAngle) And (Alpha<=EndAngle) then
|
|
- for i:=-1 to 1 do
|
|
|
|
- for j:=-1 to 1 do
|
|
|
|
- PutPixel (xm+i,ym+j, CurrentColor);
|
|
|
|
|
|
+ for i:=-1 to 1 do
|
|
|
|
+ for j:=-1 to 1 do
|
|
|
|
+ PutPixel (xm+i,ym+j, CurrentColor);
|
|
If (180-Alpha>=StAngle) And (180-Alpha<=EndAngle) then
|
|
If (180-Alpha>=StAngle) And (180-Alpha<=EndAngle) then
|
|
- for i:=-1 to 1 do
|
|
|
|
- for j:=-1 to 1 do
|
|
|
|
- PutPixel (xm+i,yp+j, CurrentColor);
|
|
|
|
|
|
+ for i:=-1 to 1 do
|
|
|
|
+ for j:=-1 to 1 do
|
|
|
|
+ PutPixel (xm+i,yp+j, CurrentColor);
|
|
If (180+Alpha>=StAngle) And (180+Alpha<=EndAngle) then
|
|
If (180+Alpha>=StAngle) And (180+Alpha<=EndAngle) then
|
|
- for i:=-1 to 1 do
|
|
|
|
- for j:=-1 to 1 do
|
|
|
|
- PutPixel (xp+i,yp+j, CurrentColor);
|
|
|
|
|
|
+ for i:=-1 to 1 do
|
|
|
|
+ for j:=-1 to 1 do
|
|
|
|
+ PutPixel (xp+i,yp+j, CurrentColor);
|
|
If (360-Alpha>=StAngle) And (360-Alpha<=EndAngle) then
|
|
If (360-Alpha>=StAngle) And (360-Alpha<=EndAngle) then
|
|
- for i:=-1 to 1 do
|
|
|
|
- for j:=-1 to 1 do
|
|
|
|
- PutPixel (xp+i,ym+j, CurrentColor);
|
|
|
|
|
|
+ for i:=-1 to 1 do
|
|
|
|
+ for j:=-1 to 1 do
|
|
|
|
+ PutPixel (xp+i,ym+j, CurrentColor);
|
|
end;
|
|
end;
|
|
End;
|
|
End;
|
|
|
|
|
|
@@ -1458,8 +1503,8 @@ End;
|
|
y := y + StartYViewPort;
|
|
y := y + StartYViewPort;
|
|
{ if line was fully clipped then exit...}
|
|
{ if line was fully clipped then exit...}
|
|
if LineClipped(x1,y,x2,y,StartXViewPort,StartYViewPort,
|
|
if LineClipped(x1,y,x2,y,StartXViewPort,StartYViewPort,
|
|
- StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
- exit;
|
|
|
|
|
|
+ StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
|
|
|
+ exit;
|
|
|
|
|
|
OldWriteMode := CurrentWriteMode;
|
|
OldWriteMode := CurrentWriteMode;
|
|
CurrentWriteMode := NormalPut;
|
|
CurrentWriteMode := NormalPut;
|
|
@@ -1476,44 +1521,44 @@ End;
|
|
|
|
|
|
if FillSettings.Pattern = EmptyFill then
|
|
if FillSettings.Pattern = EmptyFill then
|
|
begin
|
|
begin
|
|
- OldCurrentColor := CurrentColor;
|
|
|
|
- CurrentColor := CurrentBkColor;
|
|
|
|
- HLine(x1,x2,y);
|
|
|
|
- CurrentColor := OldCurrentColor;
|
|
|
|
|
|
+ OldCurrentColor := CurrentColor;
|
|
|
|
+ CurrentColor := CurrentBkColor;
|
|
|
|
+ HLine(x1,x2,y);
|
|
|
|
+ CurrentColor := OldCurrentColor;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
if FillSettings.Pattern = SolidFill then
|
|
if FillSettings.Pattern = SolidFill then
|
|
begin
|
|
begin
|
|
- HLine(x1,x2,y);
|
|
|
|
|
|
+ HLine(x1,x2,y);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- For i:= 0 to NrIterations do
|
|
|
|
- Begin
|
|
|
|
- for j:=0 to 7 do
|
|
|
|
- Begin
|
|
|
|
|
|
+ For i:= 0 to NrIterations do
|
|
|
|
+ Begin
|
|
|
|
+ for j:=0 to 7 do
|
|
|
|
+ Begin
|
|
{ x1 mod 8 }
|
|
{ x1 mod 8 }
|
|
- if RevBitArray[x1 and 7] and TmpFillPattern <> 0 then
|
|
|
|
- DirectPutpixel(x1,y)
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- { According to the TP graph manual, we overwrite everything }
|
|
|
|
- { which is filled up - checked against VGA and CGA drivers }
|
|
|
|
- { of TP. }
|
|
|
|
- OldCurrentColor := CurrentColor;
|
|
|
|
- CurrentColor := CurrentBkColor;
|
|
|
|
- DirectPutPixel(x1,y);
|
|
|
|
- CurrentColor := OldCurrentColor;
|
|
|
|
- end;
|
|
|
|
- Inc(x1);
|
|
|
|
- if x1 > x2 then
|
|
|
|
- begin
|
|
|
|
- CurrentWriteMode := OldWriteMode;
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
|
|
+ if RevBitArray[x1 and 7] and TmpFillPattern <> 0 then
|
|
|
|
+ DirectPutpixel(x1,y)
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ { According to the TP graph manual, we overwrite everything }
|
|
|
|
+ { which is filled up - checked against VGA and CGA drivers }
|
|
|
|
+ { of TP. }
|
|
|
|
+ OldCurrentColor := CurrentColor;
|
|
|
|
+ CurrentColor := CurrentBkColor;
|
|
|
|
+ DirectPutPixel(x1,y);
|
|
|
|
+ CurrentColor := OldCurrentColor;
|
|
|
|
+ end;
|
|
|
|
+ Inc(x1);
|
|
|
|
+ if x1 > x2 then
|
|
|
|
+ begin
|
|
|
|
+ CurrentWriteMode := OldWriteMode;
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
CurrentWriteMode := OldWriteMode;
|
|
CurrentWriteMode := OldWriteMode;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1745,13 +1790,13 @@ Begin
|
|
begin
|
|
begin
|
|
case BitBlt of
|
|
case BitBlt of
|
|
{$R-}
|
|
{$R-}
|
|
- CopyPut: color:= pt(Bitmap)[k]; { also = normalput }
|
|
|
|
|
|
+ CopyPut: color:= pt(Bitmap)[k]; { also = normalput }
|
|
XORPut: color:= pt(Bitmap)[k] XOR GetPixel(i,j);
|
|
XORPut: color:= pt(Bitmap)[k] XOR GetPixel(i,j);
|
|
OrPut: color:= pt(Bitmap)[k] OR GetPixel(i,j);
|
|
OrPut: color:= pt(Bitmap)[k] OR GetPixel(i,j);
|
|
AndPut: color:= pt(Bitmap)[k] AND GetPixel(i,j);
|
|
AndPut: color:= pt(Bitmap)[k] AND GetPixel(i,j);
|
|
NotPut: color:= not pt(Bitmap)[k];
|
|
NotPut: color:= not pt(Bitmap)[k];
|
|
{$R+}
|
|
{$R+}
|
|
- end;
|
|
|
|
|
|
+ end;
|
|
putpixel(i,j,color);
|
|
putpixel(i,j,color);
|
|
Inc(k);
|
|
Inc(k);
|
|
end;
|
|
end;
|
|
@@ -1824,6 +1869,8 @@ end;
|
|
DirectPutPixel := nil;
|
|
DirectPutPixel := nil;
|
|
PutPixel := nil;
|
|
PutPixel := nil;
|
|
GetPixel := nil;
|
|
GetPixel := nil;
|
|
|
|
+ SetRGBPalette := nil;
|
|
|
|
+ GetRGBPalette := nil;
|
|
|
|
|
|
{ optional...}
|
|
{ optional...}
|
|
SetActivePage := SetActivePageDefault;
|
|
SetActivePage := SetActivePageDefault;
|
|
@@ -1872,6 +1919,7 @@ end;
|
|
MaxX := 0;
|
|
MaxX := 0;
|
|
MaxY := 0;
|
|
MaxY := 0;
|
|
MaxColor := 0;
|
|
MaxColor := 0;
|
|
|
|
+ PaletteSize := 0;
|
|
DefaultHooks;
|
|
DefaultHooks;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1910,9 +1958,9 @@ end;
|
|
|
|
|
|
if (Radius = 1) then
|
|
if (Radius = 1) then
|
|
begin
|
|
begin
|
|
- { must use clipping ... }
|
|
|
|
- { don't need to explicitly set NormalPut mode }
|
|
|
|
- { because PutPixel only supports normal put }
|
|
|
|
|
|
+ { must use clipping ... }
|
|
|
|
+ { don't need to explicitly set NormalPut mode }
|
|
|
|
+ { because PutPixel only supports normal put }
|
|
PutPixel(X, Y,CurrentColor);
|
|
PutPixel(X, Y,CurrentColor);
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
@@ -2103,22 +2151,22 @@ end;
|
|
|
|
|
|
case Fillsettings.pattern of
|
|
case Fillsettings.pattern of
|
|
EmptyFill :
|
|
EmptyFill :
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
Currentcolor:=CurrentBkColor;
|
|
Currentcolor:=CurrentBkColor;
|
|
for y:=y1 to y2 do
|
|
for y:=y1 to y2 do
|
|
Hline(x1,x2,y);
|
|
Hline(x1,x2,y);
|
|
end;
|
|
end;
|
|
SolidFill :
|
|
SolidFill :
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
CurrentColor:=FillSettings.color;
|
|
CurrentColor:=FillSettings.color;
|
|
for y:=y1 to y2 do
|
|
for y:=y1 to y2 do
|
|
Hline(x1,x2,y);
|
|
Hline(x1,x2,y);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
Begin
|
|
Begin
|
|
- CurrentColor:=FillSettings.color;
|
|
|
|
- for y:=y1 to y2 do
|
|
|
|
- patternline(x1,x2,y);
|
|
|
|
|
|
+ CurrentColor:=FillSettings.color;
|
|
|
|
+ for y:=y1 to y2 do
|
|
|
|
+ patternline(x1,x2,y);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
CurrentColor:= Origcolor;
|
|
CurrentColor:= Origcolor;
|
|
@@ -2171,6 +2219,9 @@ end;
|
|
{ }
|
|
{ }
|
|
{--------------------------------------------------------------------------}
|
|
{--------------------------------------------------------------------------}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ {$i palette.inc}
|
|
|
|
+
|
|
procedure SetColor(Color: Word);
|
|
procedure SetColor(Color: Word);
|
|
|
|
|
|
Begin
|
|
Begin
|
|
@@ -2306,7 +2357,7 @@ end;
|
|
{ between. }
|
|
{ between. }
|
|
var
|
|
var
|
|
i: integer;
|
|
i: integer;
|
|
- begin
|
|
|
|
|
|
+ begin
|
|
lineinfo.linestyle:=solidln;
|
|
lineinfo.linestyle:=solidln;
|
|
lineinfo.thickness:=normwidth;
|
|
lineinfo.thickness:=normwidth;
|
|
{ reset line style pattern }
|
|
{ reset line style pattern }
|
|
@@ -2325,7 +2376,7 @@ end;
|
|
|
|
|
|
|
|
|
|
CurrentColor:=white;
|
|
CurrentColor:=white;
|
|
- SetBkColor(Blue);
|
|
|
|
|
|
+ SetBkColor(Black);
|
|
|
|
|
|
|
|
|
|
ClipPixels := TRUE;
|
|
ClipPixels := TRUE;
|
|
@@ -2349,7 +2400,7 @@ end;
|
|
CurrentTextInfo.vert:=TopText;
|
|
CurrentTextInfo.vert:=TopText;
|
|
|
|
|
|
XAspect:=10000; YAspect:=10000;
|
|
XAspect:=10000; YAspect:=10000;
|
|
- end;
|
|
|
|
|
|
+ end;
|
|
|
|
|
|
|
|
|
|
procedure GetAspectRatio(var Xasp,Yasp : word);
|
|
procedure GetAspectRatio(var Xasp,Yasp : word);
|
|
@@ -2392,7 +2443,7 @@ end;
|
|
|
|
|
|
type
|
|
type
|
|
ppointtype = ^pointtype;
|
|
ppointtype = ^pointtype;
|
|
- pt = array[0..16000] of pointtype;
|
|
|
|
|
|
+ pt = array[0..16000] of pointtype;
|
|
|
|
|
|
var
|
|
var
|
|
i : longint;
|
|
i : longint;
|
|
@@ -2466,46 +2517,46 @@ end;
|
|
|
|
|
|
if (Graphdriver=Detect) then
|
|
if (Graphdriver=Detect) then
|
|
begin
|
|
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;
|
|
|
|
- { Actually set the graph mode...}
|
|
|
|
- SetGraphMode(CpyMode);
|
|
|
|
|
|
+ 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;
|
|
|
|
+ { Actually set the graph mode...}
|
|
|
|
+ SetGraphMode(CpyMode);
|
|
end
|
|
end
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- { Search if that graphics modec actually exists...}
|
|
|
|
- if SearchMode(GraphDriver,GraphMode) = nil then
|
|
|
|
- begin
|
|
|
|
- _GraphResult := grInvalidMode;
|
|
|
|
- exit;
|
|
|
|
- end
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- IntCurrentDriver := GraphDriver;
|
|
|
|
- SetGraphMode(GraphMode);
|
|
|
|
- end;
|
|
|
|
|
|
+ { Search if that graphics modec actually exists...}
|
|
|
|
+ if SearchMode(GraphDriver,GraphMode) = nil then
|
|
|
|
+ begin
|
|
|
|
+ _GraphResult := grInvalidMode;
|
|
|
|
+ exit;
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ IntCurrentDriver := GraphDriver;
|
|
|
|
+ SetGraphMode(GraphMode);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2526,26 +2577,13 @@ begin
|
|
end.
|
|
end.
|
|
|
|
|
|
|
|
|
|
-GetDefaultPalette
|
|
|
|
-GetPalette
|
|
|
|
-GetPaletteSize
|
|
|
|
PieSlice
|
|
PieSlice
|
|
Sector
|
|
Sector
|
|
-SetActivePage
|
|
|
|
-SetAllPalette
|
|
|
|
SetGraphBufSize
|
|
SetGraphBufSize
|
|
SetBkColor
|
|
SetBkColor
|
|
-SetPalette
|
|
|
|
-SetRGBPalette
|
|
|
|
-SetVisualPage
|
|
|
|
DetectGraph
|
|
DetectGraph
|
|
|
|
|
|
{ DetectGraph() }
|
|
{ DetectGraph() }
|
|
-{ GetPalette() }
|
|
|
|
-{ SetAllPalette() }
|
|
|
|
-{ SetPalette() }
|
|
|
|
-{ SetVisualPage() }
|
|
|
|
-{ SetActivePage() }
|
|
|
|
{ SetBkColor() }
|
|
{ SetBkColor() }
|
|
|
|
|
|
|
|
|