Package org.mozilla.geckoview
Class GeckoDisplay.ScreenshotBuilder
Object
org.mozilla.geckoview.GeckoDisplay.ScreenshotBuilder
- Enclosing class:
- GeckoDisplay
Builder to construct screenshot requests.
-
Method Summary
Modifier and TypeMethodDescriptionaspectPreservingSize(int width) The width of the bitmap to create when taking the screenshot.Instead of creating a new Bitmap for the result, the builder will use the passed Bitmap.capture()Request aBitmapof the requested portion of the web page currently being rendered using any parameters specified with the builder.Request aBitmapof the full web page currently being rendered using any parameters specified with the builder.scale(float scale) The scale of the bitmap relative to the source.size(int width, int height) Size of the bitmap to create when taking the screenshot.source(int x, int y, int width, int height) The screenshot will be of a region instead of the entire screen / web pageThe screenshot will be of a region instead of the entire screen / web page
-
Method Details
-
source
@AnyThread @NonNull public GeckoDisplay.ScreenshotBuilder source(int x, int y, int width, int height) The screenshot will be of a region instead of the entire screen / web page- Parameters:
x- Left most pixel of the source region (in screen pixels).y- Top most pixel of the source region (in screen pixels).width- Width of the source region in screen pixelsheight- Height of the source region in screen pixels- Returns:
- The builder
-
source
The screenshot will be of a region instead of the entire screen / web page- Parameters:
source- Region of the screen to capture in screen pixels- Returns:
- The builder
-
aspectPreservingSize
The width of the bitmap to create when taking the screenshot. The height will be calculated to match the aspect ratio of the source as closely as possible. The source screenshot will be scaled into the resulting Bitmap.- Parameters:
width- of the result Bitmap in screen pixels.- Returns:
- The builder
- Throws:
IllegalStateException- if the size has already been set in some other way.
-
scale
The scale of the bitmap relative to the source. The height and width of the output bitmap will be within one pixel of this multiple of the source dimensions. The source screenshot will be scaled into the resulting Bitmap.- Parameters:
scale- of the result Bitmap relative to the source.- Returns:
- The builder
- Throws:
IllegalStateException- if the size has already been set in some other way.
-
size
Size of the bitmap to create when taking the screenshot. The source screenshot will be scaled into the resulting Bitmap- Parameters:
width- of the result Bitmap in screen pixels.height- of the result Bitmap in screen pixels.- Returns:
- The builder
- Throws:
IllegalStateException- if the size has already been set in some other way.
-
bitmap
Instead of creating a new Bitmap for the result, the builder will use the passed Bitmap.- Parameters:
bitmap- The Bitmap to use in the result.- Returns:
- The builder.
- Throws:
IllegalStateException- if the size has already been set in some other way.
-
capture
Request aBitmapof the requested portion of the web page currently being rendered using any parameters specified with the builder.This function must be called on the UI thread.
- Returns:
- A
GeckoResultthat completes with aBitmapcontaining the pixels and size information of the requested portion of the visible web page, or returns a failureGeckoResultincluding the reason why in anException
-
captureFullPage
Request aBitmapof the full web page currently being rendered using any parameters specified with the builder.This function must be called on the UI thread.
- Returns:
- A
GeckoResultthat completes with aBitmapcontaining the pixels and size information of the full web page, or returns a failureGeckoResultincluding the reason why in anException
-