Author Topic: How can I copy a part of screen ?  (Read 2625 times)

0 Members and 1 Guest are viewing this topic.

Offline jamesmustain

  • Newbie
  • Posts: 1
    • View Profile
How can I copy a part of screen ?
« 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!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: How can I copy a part of screen ?
« Reply #1 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.
« Last Edit: February 05, 2021, 11:35:35 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: How can I copy a part of screen ?
« Reply #2 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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: How can I copy a part of screen ?
« Reply #3 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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/