Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Screen copy of an area outside of a window.  (Read 1126 times)

0 Members and 1 Guest are viewing this topic.

bbel91

  • Newbie
  • *
  • Posts: 2
    • View Profile
Screen copy of an area outside of a window.
« on: August 24, 2018, 10:53:48 am »
Hello,
I'm trying to make a copy of an area of the screen under Visual C ++ and with SFML.
The result must be in the form of a memory zone or an array in BMP format.
Do you have links or post to give me, please?
Thank you.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Screen copy of an area outside of a window.
« Reply #1 on: August 24, 2018, 11:22:50 am »
You can for example:
  • Update a texture from a window
  • CopyToImage the texture to an image
  • Create a new image with the size of the area you want to copy
  • Copy the are from one to the other image
  • Then you can either saveToFile as BMP
  • or getPixelPtr and have access to the data in memory
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/