home *** CD-ROM | disk | FTP | other *** search
-
- program Target3;
- uses
- Dos, Crt, Graph;
- const
- SolidFill : FillPatternType = ($ff,$ff,$ff,$ff,
- $ff,$ff,$ff,$ff);
- var
- GraphDriver, GraphMode, ErrorCode : integer;
- Radius, CenterLine : integer;
- Repeat1, Repeat2, Repeat3, NewColor : integer;
- Year, Month, Day, DayOfWeek : word;
- ThisYear, ThisMonth, ThisDate, Today : string[9];
-
- (* This procedure puts a cross-hatch on the screen for linearity testing *)
- procedure CrossHatch;
- var
- HorizPos : integer;
- VertiPos : integer;
- begin
- SetColor(8);
- HorizPos := 1;
- VertiPos := GetMaxY div 29;
- repeat
- MoveTo(HorizPos, VertiPos);
- LineTo(GetMaxX - 1, VertiPos);
- inc(VertiPos, GetMaxY div 29);
- until VertiPos >= GetMaxY;
- HorizPos := GetMaxX div 39;
- VertiPos := 1;
- repeat
- MoveTo(HorizPos, VertiPos);
- LineTo(HorizPos, GetMaxY - 1);
- inc(HorizPos, GetMaxX div 39);
- until HorizPos >= GetMaxX;
- end; (* CrossHatch *)
-
- (* This procedure draws pie slices on demand *)
- procedure NextPie(X, Y, CenterLine : integer; Radius : word);
- begin
- PieSlice(X, Y, CenterLine -4, CenterLine +4, Radius);
- end; (* NextPie *)
-
- (* This procedure gets today's date *)
- procedure newdate;
- begin
- GetDate(Year, Month, Day, DayOfWeek );
- case DayOfWeek of
- 0 : Today := 'Sunday';
- 1 : Today := 'Monday';
- 2 : Today := 'Tuesday';
- 3 : Today := 'Wednesday';
- 4 : Today := 'Thursday';
- 5 : Today := 'Friday';
- 6 : Today := 'Saturday';
- end;
- case Month of
- 1 : ThisMonth := 'January';
- 2 : ThisMonth := 'February';
- 3 : ThisMonth := 'March';
- 4 : ThisMonth := 'April';
- 5 : ThisMonth := 'May';
- 6 : ThisMonth := 'June';
- 7 : ThisMonth := 'July';
- 8 : ThisMonth := 'August';
- 9 : ThisMonth := 'September';
- 10 : ThisMonth := 'October';
- 11 : ThisMonth := 'November';
- 12 : ThisMonth := 'December';
- end;
- str(Year, ThisYear);
- str(Day , ThisDate);
- end; (* NewDate *)
-
- (* Main program begins with the test of graphics call up *)
- begin
- GraphDriver := Detect;
- InitGraph(GraphDriver, GraphMode, 'D:\Turbo4\Drivers');
- ErrorCode := GraphResult;
- if ErrorCode <> grOk then
- begin
- Writeln('Graphics error : ');
- Writeln('Program Aborted ...');
- end;
-
- (* Set graphic driver to highest VGA mode *)
- SetGraphMode(2);
-
- (* Draw the largest rectangle for the systems graphics board *)
- SetBkColor(0);
- Rectangle(0, 0, GetMaxX, GetMaxY);
- CrossHatch;
-
- (* Draw a large circle for checking linearity in both axis *)
- SetColor(5);
- Radius := (GetMaxY div 20)*10;
- Circle(GetMaxX div 2, GetMaxY div 2, Radius);
-
- (* Set up to draw a peacock of 15 colors *)
- SetColor(15);
- CenterLine := 20;
- Repeat1 := 1;
- Repeat2 := 9;
- Repeat3 := 1;
-
- (* Draw the peacock *)
- repeat
- if odd(Repeat1) then
- begin
- Radius := (GetMaxY div 16) * 9;
- NewColor := Repeat3;
- inc(Repeat3);
- end
- else
- begin
- Radius := (GetMaxY div 16) * 11;
- NewColor := Repeat2;
- inc(Repeat2);
- end;
-
- SetFillPattern(SolidFill, NewColor);
- NextPie(GetMaxX div 2, GetMaxY - (GetMaxY div 5), CenterLine, Radius);
- Repeat1 := Repeat1 + 1;
- CenterLine := CenterLine + 10;
- until Repeat1 = 16;
-
- (* Now for some test circles *)
- Repeat1 := 10;
- repeat
- SetColor(4);
- Radius := GetMaxY div Repeat1;
- Circle(GetMaxX div 8, GetMaxY div 6, Radius);
- SetColor(1);
- Circle((GetMaxX div 8)*7, GetMaxY div 6, Radius);
- SetColor(2);
- Circle((GetMaxX div 8)*7, (GetMaxy div 6)*5, Radius);
- SetColor(14);
- Circle(GetMaxX div 8, (GetMaxY div 6)*5, Radius);
- inc(Repeat1);
- until Repeat1 > 150;
-
- (* Provide a title *)
- SetColor(9);
- SetTextJustify(CenterText, CenterText);
- SetTextStyle(DefaultFont, Horizdir, 2);
- OutTextXY(GetMaxX Div 2, (GetMaxY div 30)*3,
- 'TARGET3');
- SetTextStyle(DefaultFont, Horizdir, 1);
- OutTextXY(GetMaxX Div 2, (GetMaxY div 30)*27,
- 'EGA/VGA Monitor');
- OutTextXY(GetMaxX div 2, (GetMaxY div 30)*28,
- 'Test Pattern Generator');
- NewDate;
- OutTextXY(GetMaxX div 2, (GetMaxY div 30)*29,
- Today + ' ' + ThisDate + ' ' + ThisMonth +
- ' ' + ThisYear);
-
- (* The drawing is complete ... waiting for release *)
- Readln;
- if KeyPressed then
- ClearDevice;
- CloseGraph;
- end. (Target3.pas)