QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: acjacques on October 30, 2019, 02:33:43 pm

Title: How copy a part of screen ?
Post by: acjacques on October 30, 2019, 02:33:43 pm
Friends;

How use _COPYIMAGE(0) to capture only a part of screen ?

The copied  area wil be further placed in the screen with _PUTIMAGE

Sorry for such so beginners question...

Thanks
Title: Re: How copy a part of screen ?
Post by: Petr on October 30, 2019, 03:55:29 pm
Why not use PUTIMAGE directly?

Code: QB64: [Select]
  1. 'program copy 320x240 screen part (yellow rectangle) to next screen:
  2.  
  3. SCREEN _NEWIMAGE(1980, 1050, 32)
  4. CLS , &HFFFF0000
  5. LINE (0, 0)-(320, 240), &HFFFFFF00, BF
  6.  
  7. ScreenPart& = _NEWIMAGE(320, 240, 32)
  8.  
  9. _PUTIMAGE , 0, ScreenPart&, (0, 0)-(320, 240) 'copy current (0) screen from area 0,0 to 320, 240 full to new screen named ScreenPart&
  10. PRINT "Press key to view screen ScreenPart:"
  11. SCREEN ScreenPart& 'or use _putimage (destinationX, destionationY) - (destinationX2, destionationY2), destination, source, (sourceX1, sourceY1) - (sourceX2, sourceY2)
  12.