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 IGraphicsSurface

interface IGraphicsSurface
Extends com.amazon.apmf.IStandard A rectangular region that can be rendered to

Methods

getWidth()

i32 getWidth()

Returns

i32 Width of this surface in pixels.

getHeight()

i32 getHeight()

Returns

i32 Height of this surface in pixels.

isCurrentSurface()

bool isCurrentSurface()

Returns

bool Whether this surface is current.

Throws

  • DeviceError — if IGraphicsSurface is not in valid state

prepareToDraw()

IFrameHint* prepareToDraw(RectI[] drawRects)
Clients are expected to call this before rendering to the surface for any given frame and perform the needed transformation. For example, if IFrameHint.getRotation() is other than ‘NONE’, client should perform necessary transformation while rendering accounting the needed rotation. The rectangles passed as part of drawRects should be specified relative to the bottom-left of the surface and the x and y components of each rectangle specify the bottom-left position of that rectangle. Note that rectangles passed should be those surface contents that changed since the last frame. The implementation will clear buffer contents marked by the rectangles in drawRects.

Parameters

drawRects
RectI[] — Required The rectangle area will use to draw

Returns

IFrameHint* Frame hint information. Client should use it while rendering.

Throws


endDraw()

void endDraw()
All needed rendering for this surface is complete for the current frame. The Surface will either use Flush, Finish or Fence based on platform capabilities to ensure rendering is done before surface is scanned out. The Surface needs to be current during this call.

Throws

  • DeviceError — if IGraphicsSurface is not in valid state

getSurfaceControl()

ISurfaceControl* getSurfaceControl()
get surface control associated to current rendering surface

Returns

ISurfaceControl* ISurfaceControl

Throws


presentBuffer()

PresentResult presentBuffer(RectI[] bufferDamage, u64 timeInNanoSecs, bool needToTransform)
For OnScreen Surfaces, the current back buffer will be presented to the display. For OffScreen Surfaces, any needed book-keeping for resources like FBO, Texture and reporting performance metrics will be completed.

Parameters

bufferDamage
RectI[] — Required The buffer area that was damaged
timeInNanoSecs
u64 — Required (no use for now, can be set to 0)
needToTransform
bool — Required if true, rendered content will be transformed as per the IFrameHint of the current frame. It is highly recommended that clients set this to ‘false’ and perform the required transformation indicated by IFrameHint (returned by prepareToDraw) during the draw call for performance reasons. If it is false, compositor will assume that content is already transformed.

Returns

PresentResult PresentResult.Submitted when success

Throws


addPresentListener()

com.amazon.apmf.ISubscription* addPresentListener(IPresentListener* listener)
Add present listener The listener will continue to receive events until ISubscription#unsubscribe() is called or until the event source is destroyed.

Parameters

listener
IPresentListener* — Required IPresentListener interface

Returns

com.amazon.apmf.ISubscription* ISubscription related to this listener interface

Throws


getNativeHandle()

com.amazon.apmf.NativePointer getNativeHandle()
Query the native handle of current surface based on platforms

Returns

com.amazon.apmf.NativePointer Native handle

Throws

  • DeviceError — if IGraphicsSurface is not in valid state

Last modified on October 29, 2026