Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> pattern define array for fillpattern pp 176</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 PATTERN                 Define Array for FillPattern                 pp 176

 Syntax:  Pattern (ByteArray) ;

 Type:    Array of Byte

 Form:    Extended Graphics Procedure

 Purpose: Define graphics pattern used by FillPattern.

 Notes:   Requires {$I Graph.P} include file in the source file.
          The pattern is an 8x8 matrix defined by ByteArray.  Each byte
          corresponds to a pixel.

          The following example shows a sample pattern.  The 0 and 1
          represent bits being set on or off.  When the pattern is used by
          FillPattern only the one bits will cause a dot to be written.
          To use the slanted line pattern the following typed constant is
          declared and passes as a paramter to Pattern.

 Usage:
          {$I Graph.P}                      { Extended graphics support     }
       CONST
          Color   : Integer =   1         ; { Use color 1                   }
          X1      : Integer =   0         ; { Upper left corner             }
          Y1      : Integer =   0         ;
          X2      : Integer = 319         ; { Lower right corner            }
          Y2      : Integer = 199         ;
          Lines   : Array [0..7] of Byte = ($44,$88,$11,$22,$44,$88,$11,$22);

       BEGIN
          GraphColorMode                  ;
          Pattern (Lines)                 ; { Define the pattern from Lines }
          FillPattern (X1,Y1,X2,Y2,Color) ; { Fill pattern in green         }
          ColorTable (3,2,1,0)            ; { Reverse table colors          }
          FillPattern (X1,Y1,X2,Y2,-1)    ; { Fill pattern in red           }
       END.

          $01  -  0 0 0 0  0 0 0 1         $44  -  0 1 0 0 0 1 0 0
          $23  -  0 0 1 0  0 0 1 1         $88  -  1 0 0 0 1 0 0 0
          $45  -  0 1 0 0  0 1 0 1         $11  -  0 0 0 1 0 0 0 1
          $67  -  0 1 1 0  0 1 1 1         $22  -  0 0 1 0 0 0 1 0
          $89  -  1 0 0 0  1 0 0 1         $44  -  0 1 0 0 0 1 0 0
          $AB  -  1 0 1 0  1 0 1 1         $88  -  1 0 0 0 1 0 0 0
          $CD  -  1 1 0 0  1 1 0 1         $11  -  0 0 0 1 0 0 0 1
          $EF  -  1 1 1 0  1 1 1 1         $22  -  0 0 1 0 0 0 1 0

See Also: FillPattern FillShape FillScreen Palette

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson