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> putpic put graphics image pp 174</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 PUTPIC                      Put Graphics Image                       pp 174

 Syntax:  PutPic (Buffer,X1,Y1) ;

 Type:    N/A

 Form:    Extended Graphics Procedure

 Purpose: Copy image buffer to rectangular screen area.

 Notes:   Requires {$I Graph.P} include file in the source file.
          The rectangular area defined by lower left coordinates X1,Y1
          is written to from a user defined buffer.


 ----------------------------------------------------------------------------




 Usage:
          {$I Graph.P}                     { Extended graphics support }
       CONST
          X1     : Integer = 0         ;   { Upper left screen corner }
          Y1     : Integer = 0         ;
          X2     : Integer = 319       ;   { Lower right screen corner }
          Y2     : Integer = 199       ;

       VAR
          Width  : Integer             ;   { Buffer width }                  }
          Height : Integer             ;   { Buffer height }                 }
          BfrCnt : Integer             ;   { Buffer size in bytes }          }
          BfrPtr :^Integer             ;   { Define a pointer to heap buffer }

       BEGIN
          Width  := Abs(X1-X2) + 1     ;   { Calculate width                 }
          Height := Abs(1-Y2) + 1      ;   { Calculate height                }
          BfrCnt := Width * Height     ;   { Calculate buffer size in bytes  }
          GraphColorMode               ;   { Set 320x200 mode                }
          GetMem  (BfrPtr,BfrCnt)      ;   { Allocate HeapSpace buffer       }
          GetPic  (BfrPtr,X1,Y1,X2,Y2) ;   { Fill buffer with screen image   }
          PutPic  (BfrPtr,X1,Y2)       ;   { Lower left corner of screen     }
          FreeMem (BfrPtr,BfrCnt)      ;   { Release HeapSpace buffer            }
       END.

See Also: ColorTable FreeMem GetMem GetPic Pointer

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