QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: jamesmustain on February 05, 2021, 11:26:55 pm

Title: How can I copy a part of screen ?
Post by: jamesmustain on February 05, 2021, 11:26:55 pm
Hi guys,
How to use _COPYIMAGE(0) to capture only a part of screen ?
The copied  area wil be further placed in the screen with _PUTIMAGE. Many Thanks!
Title: Re: How can I copy a part of screen ?
Post by: bplus on February 05, 2021, 11:31:44 pm
Read _PutImage carefully, there are arguments for both controlling the screen section to copy and controlling where in screen or another image you want to put that image. https://www.qb64.org/wiki/PUTIMAGE

Welcome to forum!

_PutImage is like a copy / paste in one step but pretty hairy looking when you first encounter it.
Title: Re: How can I copy a part of screen ?
Post by: SMcNeill on February 05, 2021, 11:52:08 pm
Easy wayis with _NEWIMAGE and _PUTIMAGE.

Say my main screen is 1024x720 in size.

I want to copy from (200,200)-(400,400)

That’s a 200x200 area of the screen, so I’d:

my_copy = _NEWIMAGE(200, 200, 32)
_PUTIMAGE (0,0), 0, my_copy, (200,200)-(400,400)

Now I have a new image with the partial part which I wanted to do whatever with.
Title: Re: How can I copy a part of screen ?
Post by: Pete on February 06, 2021, 06:14:08 am
That's a nice building block, but I'll be darned if I can figure out what it would be useful for.

Pete