home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
- DefInt A-Z
-
- Sub ColorTrackingPattern ()
-
- 'BoxNum is box number, G is value of red, green, and
- ' blue components of gray color
- Dim BoxNum As Long, BoxWidth As Long, G As Long
- Screen.MousePointer = 11
- BoxWidth = PatternForm.ScaleWidth / NumberOfGrays
-
- 'Draw the filled rectangles
- If NumberOfGrays = 4 Then
- PatternForm.Line (0, 1)-(BoxWidth, PatternForm.ScaleHeight), RGB(0, 0, 0), BF
- PatternForm.Line (BoxWidth, 1)-(2 * BoxWidth, PatternForm.ScaleHeight), RGB(112, 112, 112), BF
- PatternForm.Line (2 * BoxWidth, 1)-(3 * BoxWidth, PatternForm.ScaleHeight), RGB(192, 192, 192), BF
- PatternForm.Line (3 * BoxWidth, 1)-(4 * BoxWidth, PatternForm.ScaleHeight), RGB(255, 255, 255), BF
- Else
- For BoxNum = 1 To NumberOfGrays
- G = (BoxNum - 1) * 255 / (NumberOfGrays - 1)
- PatternForm.Line ((BoxNum - 1) * BoxWidth, 1)-(BoxNum * BoxWidth, PatternForm.ScaleHeight), RGB(G, G, G), BF
- Next
- End If
- Screen.MousePointer = 0
-
- End Sub
-
- Sub DrawGrid (NumRows, NumColumns)
- 'This routine draws a grid with the given number of
- 'rows and columns.
-
- Dim n
- Dim x As Single, y As Single 'width & length of rectangles
- x = PatternForm.ScaleWidth / (NumColumns + .0055 * NumColumns)
- y = PatternForm.ScaleHeight / (NumRows + .0055 * NumColumns)
-
- 'draw horizontal lines
- PatternForm.Line (1, 1)-(PatternForm.ScaleWidth, 1)
- For n = 1 To NumRows
- PatternForm.Line (1, 2 + n * y)-(PatternForm.ScaleWidth, 2 + n * y)
- Next
- 'draw vertical lines
- PatternForm.Line (1, 1)-(1, PatternForm.ScaleHeight)
- For n = 1 To NumColumns
- PatternForm.Line (2 + n * x, 1)-(2 + n * x, PatternForm.ScaleHeight)
- Next
-
- End Sub
-
- Sub FocusPattern ()
- 'This routine displays text of the given font and
- 'font size on the pattern form.
- Dim FocusText$
- Dim n, m 'counters
- PatternForm.Cls
- Screen.MousePointer = 11
-
- 'Print entire screen with "EM" in current font
- For n = 1 To PatternForm.ScaleHeight / PatternForm.TextHeight("EM")
- For m = 1 To PatternForm.ScaleWidth / PatternForm.TextWidth("EM") - 1
- PatternForm.Print "EM";
- Next m
- PatternForm.Print "EM"
- Next n
-
- 'Display name and size of font in centered label
- PatternForm.PatternLabel.FontName = FocusFont$
- PatternForm.PatternLabel.Caption = PatternForm.FontName & " " & PatternForm.FontSize & " points"
- 'center the font name and size label
- PatternForm.PatternLabel.Move (PatternForm.ScaleWidth - PatternForm.PatternLabel.Width) \ 2, (PatternForm.ScaleHeight - PatternForm.PatternLabel.Height) \ 2
- PatternForm.PatternLabel.Visible = True
- Screen.MousePointer = 0
-
- End Sub
-
- Sub GeometryPattern ()
- 'This routine displays a white grid on a black background,
- 'by calling DrawGrid, draws diagonal lines from corner
- 'to corner, then draws 5 red circles, one in the center
- 'and one in each corner.
-
- Dim r As Single
- Dim Wide As Single, High As Single, Radius As Single
- PatternForm.Cls
- Screen.MousePointer = 11
-
- ' Draw the grid
- DrawGrid NumCols * 3 / 4, NumCols
-
- ' Draw circles in center and in each corner
- PatternForm.ForeColor = RED
- Wide = PatternForm.ScaleWidth - 5
- High = PatternForm.ScaleHeight - 5
- Radius = High / 8
- r = Radius
- ' To make the circles thicker, two circles are drawn,
- ' one just inside the other.
- PatternForm.Circle (r + 1, r + 1), Radius
- PatternForm.Circle (r + 1, r + 1), Radius - 1
- PatternForm.Circle (Wide + 1 - r, r + 1), Radius
- PatternForm.Circle (Wide + 1 - r, r + 1), Radius - 1
- PatternForm.Circle (1 + Wide / 2, 1 + High / 2), Radius
- PatternForm.Circle (1 + Wide / 2, 1 + High / 2), Radius - 1
- PatternForm.Circle (r + 2, 1 + High - r), Radius
- PatternForm.Circle (r + 2, 1 + High - r), Radius - 1
- PatternForm.Circle (Wide + 2 - r, High - r), Radius
- PatternForm.Circle (Wide + 2 - r, High - r), Radius - 1
-
- ' Draw diagonal lines:
- PatternForm.ForeColor = WHITE
- PatternForm.Line (1, 1)-(PatternForm.ScaleWidth, PatternForm.ScaleHeight)
- PatternForm.Line (1, PatternForm.ScaleHeight - 2)-(PatternForm.ScaleWidth - 2, 1)
- Screen.MousePointer = 0
-
- End Sub
-
- Sub HConvPattern ()
-
- 'This routine draws horizontal convergence test lines.
- 'Each line has 6 segments. Half of each segment is
- 'green and half is either red or blue. The colors
- 'switch after the time specified by Timer1.Interval.
- Dim ColGap, RowSeg, ColSeg, SC, Num, m, n, x
- Static Flag 'tells Sub how to color line segments
- Num = 12 '6 sets of two-color segments
- ConvOrient = HORIZONTAL 'horizontal line segments
- Static SegColor(4) As Long 'color of line segments
-
- ' Toggle Flag
- If Flag = False Then
- Flag = True
- Else
- Flag = False
- End If
-
- ' Set line segment colors
- If Flag = True Then
- SegColor(1) = GREEN
- SegColor(2) = RED
- SegColor(3) = GREEN
- SegColor(4) = BLUE
- Else
- SegColor(1) = RED
- SegColor(2) = GREEN
- SegColor(3) = BLUE
- SegColor(4) = GREEN
- End If
-
- SC = 1 'Segment Color (see below)
- 'length of row segment
- RowSeg = PatternForm.ScaleHeight / 4
- 'length of gap between horizontal segments
- ColGap = PatternForm.ScaleWidth / 32
- 'length of horizontal segments
- ColSeg = (PatternForm.ScaleWidth / Num) - ColGap / (Num * 3 / 16)
-
- 'draw horizontal lines segments
- x = 1
- For n = 0 To 3
- 'this alternates color pairs from row to row
- If SC = 1 Then
- SC = 3
- Else
- SC = 1
- End If
- PatternForm.Line (1, x)-(ColSeg, x), SegColor(SC)
- For m = 1 To Num
- SC = SC + 1
- If SC > 4 Then SC = 1
- PatternForm.Line -Step(ColSeg, 0), SegColor(SC)
- PatternForm.Line -Step(ColGap * (m Mod 2), 0), BLACK
- Next
- x = x + RowSeg
- Next
-
- 'draw the last horizontal line
- If SC = 1 Then 'this alternates color pairs row to row
- SC = 3
- Else
- SC = 1
- End If
- PatternForm.Line (1, PatternForm.ScaleHeight - 4)-(ColSeg, PatternForm.ScaleHeight - 4), SegColor(SC)
- For m = 1 To Num
- SC = SC + 1
- If SC > 4 Then SC = 1
- PatternForm.Line -Step(ColSeg, 0), SegColor(SC)
- PatternForm.Line -Step(ColGap * (m Mod 2), 0), BLACK
- Next
-
- End Sub
-
- Sub PurityPattern ()
-
- 'This displays a plain white screen
- PatternForm.Cls
-
- End Sub
-
- Sub VConvPattern ()
-
- 'See HVonvPattern for comments.
- Dim RowSeg, ColSeg, RowGap, SC, Num, m, n, x
- Static Flag
- Num = 8
- FirstConvTest = False
- ConvOrient = VERTICAL
- If Flag = False Then
- Flag = True
- Else
- Flag = False
- End If
- Static SegColor(4) As Long
- If Flag = True Then
- SegColor(1) = GREEN
- SegColor(2) = RED
- SegColor(3) = GREEN
- SegColor(4) = BLUE
- Else
- SegColor(1) = RED
- SegColor(2) = GREEN
- SegColor(3) = BLUE
- SegColor(4) = GREEN
- End If
- SC = 1
- ColSeg = PatternForm.ScaleWidth / 5
- RowGap = PatternForm.ScaleHeight / 32
- RowSeg = (PatternForm.ScaleHeight / Num) - RowGap / (Num * 5 / 16)
- PatternForm.BackColor = BLACK
-
- 'draw vertical line segments
- x = 1
- For n = 0 To 4
- If SC = 1 Then
- SC = 3
- Else
- SC = 1
- End If
- PatternForm.Line (x, 1)-(x, RowSeg), SegColor(SC)
- For m = 1 To Num
- SC = SC + 1
- If SC > 4 Then SC = 1
- PatternForm.Line -Step(0, RowSeg), SegColor(SC)
- PatternForm.Line -Step(0, RowGap * (m Mod 2)), BLACK
- Next
- x = x + ColSeg
- Next
-
- ' Draw right-most vertical line segments
- If SC = 1 Then
- SC = 3
- Else
- SC = 1
- End If
- PatternForm.Line (PatternForm.ScaleWidth - 4, 1)-(PatternForm.ScaleWidth - 4, RowSeg), SegColor(SC)
- For m = 1 To Num
- SC = SC + 1
- If SC > 4 Then SC = 1
- PatternForm.Line -Step(0, RowSeg), SegColor(SC)
- PatternForm.Line -Step(0, RowGap * (m Mod 2)), BLACK
- Next
-
- End Sub
-
-