Repository navigation
Feat: screenshots - #670
Conversation
|
We can also replace this sample then: |
5ebbaa9 to
780126f
Compare
|
Out of curiosity, does this feature works with UWP? I recall on Xamarin that when I tried to take a screenshot it usually freezes the app on UWP so I just disabled it on that platform 😅 |
Replace by what though? I'd actually remove that. |
While UWP isn't officially supported (a.k.a tested), the screenshot attachment seems to work fine: {"type":"attachment","length":100262,"filename":"screenshot.jpg","attachment_type":"event.attachment","content_type":"image/jpeg"}Though I can't verify if the actual screenshot looks reasonable because there are HTTP Request errors despite enabling some internet-related permissions in the player settings: |
| [field: SerializeField] public int ScreenshotMaxWidth { get; set; } | ||
| [field: SerializeField] public int ScreenshotMaxHeight { get; set; } |
There was a problem hiding this comment.
I'm not sure about dealing with absolute pixel sizes here. It does not take into account devices with different aspect ratios or switching from portrait to landscape.
Maybe we should start with a ratio instead e.g. "half the original resolution".
There was a problem hiding this comment.
I'd use a single parameter for Width/Height that gets applied to the highest value and if the image is bigger than the given maximum value, resize it while keeping the aspect ratio.
Sample code that I used to use for getting a new size for the image
private static SKImageInfo GetResizedMeasure(int width, int height, int newMax)
{
double ratio;
if (width > newMax)
{
ratio = (double)newMax / width;
height = (int)(height * ratio);
width = (int)(width * ratio);
}
if (height > newMax)
{
ratio = (double)newMax / height;
width = (int)(width * ratio);
height = (int)(height * ratio);
}
return new SKImageInfo(width, height, SKColorType.Rgb565);
}There was a problem hiding this comment.
We've discussed in the call to align across other SDKs. @bitsandfoxes is going to gather inputs
Co-authored-by: Bruno Garcia <[email protected]>
Co-authored-by: Bruno Garcia <[email protected]>
|
I've disabled for WebGL where the screenshots consistently don't work (they're black), and updated the tooltip with more information. If you think that's OK for now, please merge @bitsandfoxes or @bruno-garcia |
Closes #284
TODO: