Interface IGraphicsModule
interface IGraphicsModule
Extends com.amazon.apmf.IStandard
UI graphics module
This interface acts as an entry point factory for graphics rendering.
Methods
makeFontStyle()
This function creates a new font style object with the specified weight, width, and slant.IFontStyle*makeFontStyle(FontWeightweight,FontWidthwidth,FontSlantslant)
Parameters
weight
FontWeight — Required
The weight of the font (e.g., Normal, Bold, etc.).
width
FontWidth — Required
The width of the font (e.g., Normal, Condensed, etc.).
slant
FontSlant — Required
The slant of the font (e.g. Italic, Oblique etc.).
Returns
IFontStyle*
the newly created font style object.
makeTextStyleBuilder()
This function creates and returns a new instance of an ITextStyleBuilder, which can be used to build and customize text styles for rendering text.ITextStyleBuilder*makeTextStyleBuilder()
Returns
ITextStyleBuilder*
An ITextStyleBuilder object.
makeAttributedText()
This function takes a plain text string and an array of ISpan objects to create an attributed text object. Each span represents a range of the text with specific attributes such as formatting or styling.IAttributedText*makeAttributedText(stringtext,ISpan*[]spans)
Parameters
text
string — Required
The plain text content for the attributed text.
spans
ISpan*[] — Required
An array of ISpan objects representing the text spans with attributes.
Returns
IAttributedText*
An IAttributedText instance representing the attributed text.
makeTextLayoutBuilder()
This function creates and returns an ITextLayoutBuilder, which is a tool for constructing text layouts with specific attributes and formatting. You can use the builder to define various text properties and then generate a finalized ITextLayout.ITextLayoutBuilder*makeTextLayoutBuilder(floatwidth,IAttributedText*text)
Parameters
width
float — Required
Maximum width for the text layout.
text
IAttributedText* — Required
Attributed text for the text layout.
Returns
ITextLayoutBuilder*
An ITextLayoutBuilder instance for constructing text layouts.
Throws
InvalidArgumentError— If a negative or zero width is passed.
makeParagraphStyleBuilder()
This function creates and returns a new instance of an IParagraphStyleBuilder, which can be used to build and customize paragraph styles for rendering text.IParagraphStyleBuilder*makeParagraphStyleBuilder()
Returns
IParagraphStyleBuilder*
an IParagraphStyleBuilder object.
makeLineBreakLayoutSpan()
This function creates a layout span that specifies a line break at the specified character index. When applied, this span will cause a line break in the rendered text at the specified index.ILayoutSpan*makeLineBreakLayoutSpan(i32index)
Parameters
index
i32 — Required
The character index at which the line break should occur.
Returns
ILayoutSpan*
A newly created layout span object.
Throws
InvalidArgumentError— If a negative index value is passed.
makeNoLineBreakLayoutSpan()
This function creates a layout span that represents a continuous span of content without any line breaks within the specified range.ILayoutSpan*makeNoLineBreakLayoutSpan(i32start,i32end)
Parameters
start
i32 — Required
The starting index of the text range (inclusive).
end
i32 — Required
The ending index of the text range (inclusive).
Returns
ILayoutSpan*
A newly created layout span object.
Note: The indices specified by start and end are inclusive, meaning that
the characters at both indices are included in the layout span.
Throws
InvalidArgumentError— If a negative start or end value is passed.
makeTextStyleSpan()
The makeTextStyleSpan method creates a text style span, which represents a portion of text with a specific style, within the given character range.ITextStyleSpan*makeTextStyleSpan(i32start,i32end,ITextStyle*style)
Parameters
start
i32 — Required
The starting index of the text span (inclusive).
end
i32 — Required
The ending index of the text span (inclusive).
style
ITextStyle* — Required
The text styling to be applied to the span.
Returns
ITextStyleSpan*
A newly created text style span object.
Note: The character indices are inclusive, meaning that the text span includes characters
at both the start and end indices.
Throws
InvalidArgumentError— If a negative start or end value is passed.
makeOffsetLayer()
Make a offset layer with offset valueIOffsetLayer*makeOffsetLayer(Pointoffset)
Parameters
offset
Point — Required
offset specified
Returns
IOffsetLayer*
offset layer
makeTransformLayer()
Make a transform layerITransformLayer*makeTransformLayer(AffineMatrix*matrix)
Parameters
matrix
AffineMatrix* — Required
transform matrix
Returns
ITransformLayer*
TransformLayer
makeDrawableLayer()
Return drawable layer which draws on canvasIDrawableLayer*makeDrawableLayer(IDrawableLayerDelegate*t)
Parameters
t
IDrawableLayerDelegate* — Required
Custom callback to draw on canvas
Returns
IDrawableLayer*
DrawableLayer
Note: The delegate can be retrieved later using IDrawableLayer2::getDelegate.
makeClipRRectLayer()
Make ClipRRectLayer which clips canvas intersecting with RRect with antialiased enabled by default.IClipRRectLayer*makeClipRRectLayer(RRect*rRect)
Parameters
rRect
RRect* — Required
clipping RRect
Returns
IClipRRectLayer*
ClipRRectLayer
makeClipRectLayer()
Make ClipRectLayer which clips canvas intersecting with Rect with antialiased enabled by default.IClipRectLayer*makeClipRectLayer(Rect*rect)
Parameters
rect
Rect* — Required
clipping Rect
Returns
IClipRectLayer*
ClipRectLayer
makeOpacityLayer()
Make opacity layerIOpacityLayer*makeOpacityLayer(floatopacity)
Parameters
opacity
float — Required
set opacity value
Returns
IOpacityLayer*
OpacityLayer
makePlaceholderLayer()
This method creates a new instance ofIPlaceholderLayer*makePlaceholderLayer()
IPlaceholderLayer, which is a ILayer subclass that does not affect the drawing
but provides notifications for its size, position, and invalidation status.
Returns
IPlaceholderLayer*
IPlaceholderLayer The newly created IPlaceholderLayer instance.
makeShadowBuilder()
Creates a new IShadowBuilder object. This function creates and returns a new instance of an IShadowBuilder, which can be used to build and customize shadows of the view.IShadowBuilder*makeShadowBuilder()
Returns
IShadowBuilder*
An IShadowBuilder object.
tryGetUIRunLoop()
This function is used to retrieve theIRunLoop?tryGetUIRunLoop()
IRunLoop associated with the UI/main thread.
Returns
IRunLoop?
The return value is optional and might be absent.
The IRunLoop instance associated with the UI/main thread. NULL may be
returned if an IRunLoop has not yet been initialized for the UI/main thread.
makePathBuilder()
This method creates and returns a new instance of anIPathBuilder*makePathBuilder()
IPathBuilder which can be used to
build and customize Path object for drawing.
Returns
IPathBuilder*
An IPathBuilder object.
makePaint()
This method creates and returns a new instance of anIPaint*makePaint()
IPaint,
which can be used for drawing.
Returns
IPaint*
An IPaint object.
makeBlendModeColorFilter()
Create aIColorFilter*makeBlendModeColorFilter(Color*color,BlendModeblendMode)
IColorFilter with given Color and BlendMode
Parameters
color
Color* — Required
Color value of the color filter
blendMode
BlendMode — Required
BlendMode of the color filter
Returns
IColorFilter*
IColorFilter blend mode color filter instance
makeColorMatrixColorFilter()
This function creates an instance of aIColorFilter*makeColorMatrixColorFilter(ColorMatrix*colorMatrix)
IColorFilter with given 4x5 ColorMatrix
Parameters
colorMatrix
ColorMatrix* — Required
to 4x5 ColorMatrix
Returns
IColorFilter*
Newly created IColorFilter instance
makeBlurMaskFilter()
This function creates an instance of aIMaskFilter*makeBlurMaskFilter(floatraidus,BlurStylestyle)
IMaskFilter that applies a blur effect
to masks with the given radius and BlurStyle.
Parameters
raidus
float — Required
The radius of the blur effect. Larger values produce a more pronounced blur.
style
BlurStyle — Required
The style of the blur effect, defining its appearance.
Returns
IMaskFilter*
Newly created IMaskFilter.
makeDashPathEffect()
This method creates a new instance ofIPathEffect*makeDashPathEffect(float[]intervals,floatphase)
IPathEffect with the specified dash intervals and phase.
Parameters
intervals
float[] — Required
An array of floating-point values representing the intervals of the dash pattern.
phase
float — Required
The phase offset of the dash pattern.
Returns
IPathEffect*
Newly created IPathEffect instance.
makeLinearGradientShader()
Creates a new instance ofIShader*makeLinearGradientShader(Pointstart,Pointend,Color[]colors,TileModetileMode,float[]?positions,AffineMatrix?matrix)
IShader with the specified parameters.
This function creates a new instance of IShader, which represents a linear gradient shader,
with the provided start and end points, array of colors, and tile mode.
Parameters
start
Point — Required
The starting point of the linear gradient.
end
Point — Required
The ending point of the linear gradient.
colors
Color[] — Required
An array of colors defining the gradient’s color stops.
tileMode
TileMode — Required
The tile mode to be used for the gradient (e.g., clamp, repeat, mirror).
positions
float[]? — Optional
The relative positions {0..1} of each corresponding color in the colors array.
If this is null, the the colors are distributed evenly along the gradient line.
matrix
AffineMatrix? — Optional
set the matrix object for the shader
Returns
IShader*
A pointer to the newly created IShader instance.
makeRadialGradientShader()
Creates a new instance ofIShader*makeRadialGradientShader(Pointcenter,floatradius,Color[]colors,TileModetileMode,float[]?positions,AffineMatrix?matrix)
IShader with the specified parameters.
This function creates a new instance of IShader, which represents a radial gradient shader,
with the provided start and end points, array of colors, positions of each corresponding color and tile mode.
Parameters
center
Point — Required
The center of the circle for this gradient.
radius
float — Required
The radius of the circle for this gradient.
colors
Color[] — Required
Holds memory for colors of size count distributed between the center and edge of the circle.
tileMode
TileMode — Required
The tile mode to be used for the gradient (e.g., clamp, repeat, mirror).
positions
float[]? — Optional
The values must begin with 0, end with 1.0, and intermediate values must be strictly increasing.
matrix
AffineMatrix? — Optional
set the matrix object for the shader
Returns
IShader*
A pointer to the newly created IShader instance.
getMemoryCacheManager()
Gets the instance ofIMemoryCacheManager*getMemoryCacheManager()
IMemoryCacheManager
Returns
IMemoryCacheManager*
pointer to IMemoryCacheManager
makeTypefaceFromFile()
This method creates anITypeface*makeTypefaceFromFile(stringfilePath)
ITypeface instance from a font file.
The client is responsible for ensuring that the specified path is accessible
by the platform. For example, on Android, necessary permissions should be added
in AndroidManifest.xml to access the storage directory.
Parameters
filePath
string — Required
The absolute path to the font file.
Returns
ITypeface*
An ITypeface instance representing the created typeface.
Throws
InvalidArgumentError— If there is an issue accessing the specified font file (e.g., file not found, insufficient permissions, or invalid path)
makeTypefaceFromAssets()
This method creates anITypeface*makeTypefaceFromAssets(stringassetPath)
ITypeface instance from a path of the asset relative to the application assets directory.
Parameters
assetPath
string — Required
The path to the font asset relative to the application assets directory.
Returns
ITypeface*
An ITypeface instance representing the created typeface.
Throws
InvalidArgumentError— If there is an issue accessing the specified font file (e.g., file not found, insufficient permissions, or invalid path)
makeTypefaceFromName()
This method creates anITypeface*makeTypefaceFromName(stringfamilyName,IFontStyle*fontStyle)
ITypeface instance that most closely matches the requested familyName and fontStyle. It it fails to create a typeface with the given family name and styling, it will fallback to default system typeface.
Parameters
familyName
string — Required
The name of the font family.
fontStyle
IFontStyle* — Required
An IFontStyle object representing the desired font style.
Returns
ITypeface*
An ITypeface object.
makeFont()
This method creates anIFont*makeFont(ITypeface*typeface,floatsize)
IFont instance with the specified ITypeface instance and size.
Parameters
typeface
ITypeface* — Required
An ITypeface object representing the ITypeface.
size
float — Required
The desired size of the font.
Returns
IFont*
An IFont object representing the created font.
Throws
InvalidArgumentError— if negative or zero size is passed.

