HeyM1ke / ValorantStreamOverlay

501 stars 64 forks source link

Feature request: Save screenshot of the form every time the data changes to avoid resource intensive window captures #174

Open YorVeX opened 3 years ago

YorVeX commented 3 years ago

In OBS (and I doubt that it's a lot different for other streaming programs) a window capture is a lot more resource intensive than reading and displaying an image in an image source. This might not matter much if this is the only window capture used on a beefy computer but becomes noticeable on a slower machine or if lots of window captures are used. On a busy scene configuration you can directly observe the frame render time go up as soon as window captures are added, which is bad. On the contrary if you add an image source you most probably won't notice any resource impact at all.

Hence I would appreciate if the tool could save its own window as a screenshot whenever it changes to a configurable image path (.png file), maybe with a default of "ValorantRank.png" in the current executable folder, which should already be suitable for most people.

I've done the same for my own C# streaming tools, it should be as simple as:

Bitmap bmp = new Bitmap(MainForm.Width, MainForm.Height);
MainForm.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save(@"path\from\settings\to\ValorantRank.png");

This will include the window border so it still has to be cropped, but that shouldn't be an issue. Or you could try to put all visible controls onto a panel and then use DrawToBitmap() on that panel (all objects derived from Control have the DrawToBitmap() method), it might also work but I haven't tried that myself yet.