My application “Acana Date Calculator” is on the AppStore since many years. Yesterday I made a new release and today it was rejected by the App Store review team, because it makes a screenshot of itself.
It is not appropriate for the app to request Screen Recording access for the functionality of taking a screenshot of the apps UI.
We look forward to reviewing your revised binary.
No, the reviewer and I are in agreement. Screen recording is not the same thing as capturing the content of an app’s own windows. ScreenshotRectMBS uses screen recording facilities under the hood.
My application now use the “CGWindowMBS” to create a screenshot and no longer use “ScreenshotMBS”. The build-in “Window.DrawInto” makes ugly screenshots and it doesn’t make a HiDPI picture.
My application wa now release in MAS this morning.
It does make a HiDPI Picture. At least, if you’re creating a HiDPI Picture. But of course you can also (by mistake/accident) create a Picture with ScaleFactor 1, and that will of course result in a “blurry result” since .DrawInto then needs to scale the “Retina display” contents down to the low-res Picture.
By “not useable” you probably mean that the “Background” is Transparent?
I can’t say if that’s “by design” or not…
…but you could just fill the Background first, and then use .DrawInto:
Dim oWindowScreenShot As Picture = self.TrueWindow.BitmapForCaching(self.TrueWindow.Width, self.TrueWindow.Height)
oWindowScreenShot.Graphics.ForeColor = FillColor
oWindowScreenShot.Graphics.FillRect(0, 0, oWindowScreenShot.Graphics.Width, oWindowScreenShot.Graphics.Height)
self.TrueWindow.DrawInto(oWindowScreenShot.Graphics, 0, 0)
oWindowScreenShot.Save(SpecialFolder.Desktop.Child("WindowScreenShot.png"), Picture.SaveAsPNG, Picture.QualityMax)
While you have your solution using MBS, maybe this still helps others that need a way with Xojo-built-in functions.
Thanks for the code Jürg, but there seems to be one limitation/bug.
FillColor seems to keep the value of when the Window was opened. Switching from Light to Dark modes and taking a new screenshot will result on white text for labels on a light background.
Ah right - thanks for the reminder That’s <https://xojo.com/issue/54786>.
That’s what happens if everyone needs to implement workarounds in own projects… I’ve forgotten to add this to a “new/simple example project / code snipplet”
What you need to additionally do: Manually cache the “current ‘real’ FillColor”. As an example:
Add a Property to Window1 (or a global Module): MyCurrentFillColor As Color
Implement Window1.Paint Event, and just add: MyCurentFillColor = FillColor(since FillColor is called from within a Paint-Event, it will have the desired/real/actual Color *)
in the Window .DrawInto code snipplet (see above), change FillColor to MyCurrentFillColor
I think that’s the best you can currently get with current Xojo built-in functions… *) it is still a bit off in DarkMode… that’s why I’ve written: the best you can currently get without Plugins/Declares