Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IView8

interface IView8
Extends IView7 This interface extends IView7 with the ability to capture a snapshot of the view and its subtree as an image. Like its predecessors, all methods of this interface must be called from the UI thread.

Methods

captureSnapshot()

com.amazon.kepler.uitoolkit.graphics.IImage* captureSnapshot(ColorFormat colorFormat)
Captures a snapshot of this view and its entire subtree, returning the result as an image. The snapshot renders the view’s layer tree into an offscreen surface at the view’s current bounds in density-independent pixels or physical pixels depending on the configuration, using the software rendering pipeline, producing an immutable image. The caller can then encode the image using com.amazon.kepler.uitoolkit.graphics.IImage::encode to obtain PNG, JPEG, or WEBP bytes. The snapshot captures only the visible content within this view’s bounds; children drawing outside the view’s bounds are clipped by the surface dimensions. Note, this will use the software rendering pipeline to draw the view to the image. This may result with different drawing to what is rendered on a hardware accelerated canvas (such as the device screen).

Parameters

colorFormat
ColorFormat — Required The pixel format for the snapshot. Use ColorFormat::ARGB_8888 for full color with alpha, or ColorFormat::GRAY_8 for grayscale. Note: Currently only ColorFormat::ARGB_8888 is supported.

Returns

com.amazon.kepler.uitoolkit.graphics.IImage* A non-null com.amazon.kepler.uitoolkit.graphics.IImage containing the snapshot.

Throws

  • InvalidArgumentError — if this view has not been laid out (width or height is zero), or if the specified colorFormat is not supported.
  • InvalidOperationError — if the graphics system fails to create the offscreen surface, image encoding fails, or pixel data cannot be read back.

Last modified on October 29, 2026