Giter Site home page Giter Site logo

Screenshot API about essentials HOT 11 CLOSED

xamarin avatar xamarin commented on May 22, 2024 7
Screenshot API

from essentials.

Comments (11)

Redth avatar Redth commented on May 22, 2024 2

Yeah I think this is the general idea. We are planning on working on the Photo Picker as one of the next features, so I'd like to see how that one gets spec'd out before we settle on a spec for this in case we can reuse the struct from it (like a common MediaFile struct).

from essentials.

mzhukovs avatar mzhukovs commented on May 22, 2024 2

This would be an awesome, very useful, addition. Question - the UWP implementation would just capture the application window, not the entire desktop, right?

from essentials.

pictos avatar pictos commented on May 22, 2024

I would like to implement this API. Can you assign this to me?

from essentials.

Redth avatar Redth commented on May 22, 2024

This one needs some more discussion and specifications before it can be implemented.

  1. What is the native API like in Android, iOS, and UWP ?
  2. Do we need to make the method async?
  3. What should this return? byte[] or the filename?
  4. What format of image can this be which all platforms support?

from essentials.

pictos avatar pictos commented on May 22, 2024

In the past I did a PR for this API. Using this as a reference....

1. What is the native API like in Android, iOS, and UWP ?

When I implemented I did not make use of the native APIs, to ensure that the implementation was similar on all platforms.

2. Do we need to make the method async?

Yes, because in all 3 platforms we use async methods. To get the byte[] or to save the sreenshot image.

3. What should this return? byte[] or the filename?
The both. Like this:

 public static Task<string> CaptureAsync(ScreenOutputType type = ScreenOutputType.PNG, string fileName = null) =>
            PlataformCaptureAsync(type, fileName);
         public static Task<byte[]> GetImageBytesAsync(ScreenOutputType type = ScreenOutputType.PNG) =>
            PlataformGetImageBytesAsync(type);

The developer can use the byte[] when he wants to do some other image processing, such as sending to a service. And we go back the path, when developer just wants to save the image on the device.

  1. What format of image can this be which all platforms support?
    On all 3 platforms, we can convert the image to .png or .jpg .

from essentials.

Redth avatar Redth commented on May 22, 2024

I think if we can reasonably get a PNG back on each platform, we should just use that and not have an option for JPG (unless there's a compelling reason for needing both).

I also don't think we should have two methods returning different results. If anything we maybe need to return a ScreenshotFile type or something similar and provide the filename and helper ReadStreamAsync and ReadBytesAsync type methods. It might be worth considering if we can use the same return type we will eventually be using for the photo picker.

from essentials.

pictos avatar pictos commented on May 22, 2024

First, I have 2 questions:

  1. How Photo Picker works?
  2. Will the screen capture API be in which folder?

How about we return a struct containing the information of the media types, can be used in Photo Picker and other APIs that handle media files. Like that:

Task<MediaFile> CaptureAsync(string fileName)
Task<Stream>  ReadStreamAsync(MediaFile file)
Task<byte[]> ReadBytesAsync(MediaFile file)
struct  MediaFile
{
   string FileName;
   string Path;
//Add other stuffs if necessary
}

from essentials.

jrahma avatar jrahma commented on May 22, 2024

Saving Screenshot should be an option, develop should have both option:

  1. View the screenshot on image control
  2. Save the screenshot

Sometimes you don't want to save the screenshot but just share it then why you need to save it

from essentials.

jrahma avatar jrahma commented on May 22, 2024

If you use Google Analytics app, you'll see that screenshot for some screen is not just the screenshot but the whole page shot which means the image will be vertically saving the whole page even the place which is not shown on the screen size.

It will be great if you add this so Xamarin Essentials will have a boolean value like this:

CaptureAsync(string filename, bool fullpage)

fullpage default is false

from essentials.

Mrnikbobjeff avatar Mrnikbobjeff commented on May 22, 2024

Can be closed

from essentials.

mattleibow avatar mattleibow commented on May 22, 2024

Thanks!

from essentials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.