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 IGraphicsModule2

interface IGraphicsModule2
Extends IGraphicsModule Graphics Module v2 extends IGraphicsModule and defines new methods to create surface, additional layers, image filters, shader and decoded image.

Methods

makeSurface()

ISurface* makeSurface(SizeI size)
Creates a new drawing surface with the specified width and height. A surface provides a rectangular area for rendering content. The surface is initially filled with transparent black (all pixel components set to 0).

Parameters

size
SizeI — Required The SizeI (width and height) of the surface to be created.

Returns

ISurface* A new surface ISurface instance initialized to transparent black.

Throws


makeBlendLayer()

IBlendLayer* makeBlendLayer(BlendMode mode)
Creates a new blend layer that combines visual elements using the specified blend mode. A blend layer determines how content is combined with the content below it in the layer stack. The blend mode controls the mathematical operation used to combine pixel colors.

Parameters

mode
BlendMode — Required The blend mode BlendMode to use for this layer

Returns

IBlendLayer* A new blend layer IBlendLayer configured with the specified mode

makeImageFilterLayer()

IImageFilterLayer* makeImageFilterLayer(IImageFilter* imageFilter)
Creates a new layer that applies image filtering effects to its children. An image filter layer processes the content of all its child layers through the specified image filter before compositing with layers below it.

Parameters

imageFilter
IImageFilter* — Required The IImageFilter to apply to this layer’s children.

Returns

IImageFilterLayer* A new IImageFilterLayer configured with the specified filter.

makeImageFilter()

IImageFilter* makeImageFilter(IImage* image, ImageFilterQuality filterQuality)
Creates an image filter that renders a static image as part of a filter chain. This filter produces its source image as output, allowing it to be combined with other filters or used as a source in filter graphs. The source image must remain valid for the lifetime of the returned filter. The image is rendered with the specified sampling option as ImageFilterQuality.

Parameters

image
IImage* — Required The source IImage to render through this filter.
filterQuality
ImageFilterQuality — Required The sampling quality for transformed pixels

Returns

IImageFilter* A new filter IImageFilter that renders the specified image.

makeBlendImageFilter()

IImageFilter* makeBlendImageFilter(BlendMode mode, IImageFilter? background, IImageFilter? foreground)
Creates a filter that combines foreground and background image filters using a blend mode. When either input filter is null, the filter uses the source image from the filter chain instead. This allows for blending between filter results and the original content. When both filters are null, the operation blends the source content with itself. This can be useful with certain blend modes:
  • With MULTIPLY: Darkens the image
  • With SCREEN: Lightens the image
  • With OVERLAY: Increases contrast

Parameters

mode
BlendMode — Required The BlendMode to use for blending.
background
IImageFilter? — Optional Filter providing the bottom layer for blending, uses source content if null.
foreground
IImageFilter? — Optional Filter providing the top layer for blending, uses source content if null.

Returns

IImageFilter* A new filter IImageFilter that applies the specified blending operation.

makeBlurImageFilter()

IImageFilter* makeBlurImageFilter(float sigmaX, float sigmaY, TileMode tileMode, IImageFilter? imageFilter)
Creates a filter that applies a Gaussian blur effect. Performs a two-dimensional Gaussian blur with independent control over the blur radius in each direction. The sigma values determine the blur radius, with larger values creating a wider blur effect. A sigma of 0 means no blur in that direction. The tile mode determines how pixels outside the source image are sampled when the blur kernel extends beyond the image bounds.

Parameters

sigmaX
float — Required The Gaussian sigma value for blurring along the X axis.
sigmaY
float — Required The Gaussian sigma value for blurring along the Y axis.
tileMode
TileMode — Required The TileMode for sampling outside bounds.
imageFilter
IImageFilter? — Optional Input filter to blur, uses source content if null.

Returns

IImageFilter* A new IImageFilter that performs the specified blur operation.

makeDropShadowImageFilter()

IImageFilter* makeDropShadowImageFilter(Point offset, float radiusX, float radiusY, Color color, IImageFilter? imageFilter)
Creates a filter that applies a drop shadow effect. It generates the shadow by:
  • creating an alpha mask from the source content
  • blurring the mask using the specified X and Y radii
  • filling the result with the shadow color
  • offsetting the shadow by the specified amount
  • compositing the original content over the shadow
The offset is specified in the current coordinate system, with positive values moving the shadow right and down. The blur radii control the softness of the shadow edges independently in each direction.

Parameters

offset
Point — Required The distance to offset the shadow from its source
radiusX
float — Required Horizontal blur radius for the shadow
radiusY
float — Required Vertical blur radius for the shadow
color
Color — Required The color of the shadow
imageFilter
IImageFilter? — Optional Input filter to generate shadow from, uses source content if null

Returns

IImageFilter* A new IImageFilter that applies the specified drop shadow

makeShaderImageFilter()

IImageFilter* makeShaderImageFilter(IShader* shader)
Creates a filter that generates content by evaluating a shader program. This filter ignores its input and instead produces output by evaluating the provided shader at each pixel location. The shader’s coordinate space is relative to the destination where the filter is applied. This allows the shader to respond to the final transformed space of the content. The shader must remain valid for the lifetime of the returned filter. Multiple filters may share the same shader object.

Parameters

shader
IShader* — Required The shader program to evaluate for output pixels

Returns

IImageFilter* A new IImageFilter that renders using the specified shader

makeMatrixTransformImageFilter()

IImageFilter* makeMatrixTransformImageFilter(AffineMatrix matrix, ImageFilterQuality filterQuality, IImageFilter? imageFilter)
Creates a filter that transforms its input using an affine matrix. Applies affine transformation matrix to the input content. The matrix can represent any combination of translation, scale, rotation and skew. The filter quality parameter controls how pixels are sampled when the transformation requires interpolation.

Parameters

matrix
AffineMatrix — Required The affine matrix transformation to apply
filterQuality
ImageFilterQuality — Required The sampling quality for transformed pixels
imageFilter
IImageFilter? — Optional Input filter to transform, uses source content if null

Returns

IImageFilter* A new filter that applies the specified transformation

makeMatrixConvolutionImageFilter()

IImageFilter* makeMatrixConvolutionImageFilter(Size kernelSize, float[] kernel, Point kernelOffset, float gain, float bias, TileMode tileMode, bool convolveAlpha, IImageFilter? imageFilter)
Creates a filter that applies a custom convolution kernel to its input. Convolution is a fundamental image processing operation that computes each output pixel as a weighted sum of input pixels in a local neighborhood. The kernel defines the weights and size of this neighborhood. The kernel offset defines the center point of the convolution kernel, allowing for asymmetric filtering effects. This can be used to produce effects such as sharpening, blurring, edge detection, etc.

Parameters

kernelSize
Size — Required Dimensions of the convolution kernel
kernel
float[] — Required Array of weights in row-major order, must contain kernelSize.width * kernelSize.height elements
kernelOffset
Point — Required Origin point within the kernel
gain
float — Required Scale factor applied to convolution result
bias
float — Required Value added to scaled result
tileMode
TileMode — Required The TileMode for sampling outside bounds
convolveAlpha
bool — Required If true, the alpha channel is included in the convolution, else only RGB channel is included in convolution
imageFilter
IImageFilter? — Optional Input filter to process, uses source content if null

Returns

IImageFilter* A new filter that applies the specified convolution

Throws

  • InvalidArgumentError — if kernel array size doesn’t match kernelSize or if kernelOffset is outside kernel bounds

makeArithmeticImageFilter()

IImageFilter* makeArithmeticImageFilter(float k1, float k2, float k3, float k4, IImageFilter? background, IImageFilter? foreground)
Creates a filter that blends two input filters using an arithmetic expression. Computes output colors using the formula: result = clamp(k1 * src * dst + k2 * src + k3 * dst + k4) where:
  • src is the foreground color (0-1 per channel)
  • dst is the background color (0-1 per channel)
  • k1-k4 are coefficients controlling the blend
  • clamp ensures results stay in valid 0-1 range
This formula is applied independently to each color channel including alpha. When both background and foreground are null, the filter applies the arithmetic operation using the source content for both input filters. This is useful for effects like contrast adjustment that operate on a single image.

Parameters

k1
float — Required First arithmetic coefficient
k2
float — Required Second arithmetic coefficient
k3
float — Required Third arithmetic coefficient
k4
float — Required Fourth arithmetic coefficient
background
IImageFilter? — Optional Background input filter, uses source content if null
foreground
IImageFilter? — Optional Foreground input filter, uses source content if null

Returns

IImageFilter* A new filter that applies the arithmetic operation

makeColorFilterImageFilter()

IImageFilter* makeColorFilterImageFilter(IColorFilter* colorFilter, IImageFilter? imageFilter)
Creates a filter that applies the given color filter to the input. It applies a color transformation to each pixel of the input. The color filter must remain valid for the lifetime of the returned filter. Multiple filters may share the same color filter object. Common uses:
  • Adjusting brightness, contrast, or saturation
  • Applying color tints or photo filters
  • Converting to grayscale
  • Applying artistic color effects
  • Color space conversion and correction

Parameters

colorFilter
IColorFilter* — Required The IColorFilter to apply
imageFilter
IImageFilter? — Optional Input filter to transform, uses source content if null

Returns

IImageFilter* A new filter that applies the color filter

makeImageShader()

IShader* makeImageShader(IImage* image, TileMode tileX, TileMode tileY, AffineMatrix? matrix)
Creates a shader that fills an area by sampling from an image with tiling. The shader repeats or extends the source image based on the tile modes. The affine transformation matrix allows for:
  • Scaling the image pattern
  • Rotating the pattern
  • Skewing for perspective effects
  • Translating the pattern origin
The source image must remain valid for the lifetime of the returned shader. Multiple shaders may share the same source image object. Common uses:
  • Creating repeating background patterns
  • Filling shapes with image textures
  • Creating border patterns
  • Applying transformed image fills
  • Creating seamless texture tiles

Parameters

image
IImage* — Required The source IImage to use for the shader
tileX
TileMode — Required The TileMode for tiling in the horizontal direction
tileY
TileMode — Required The TileMode for tiling in the vertical direction
matrix
AffineMatrix? — Optional AffineMatrix to transform the image coordinates, if null, no transformation will be applied.

Returns

IShader* A new IShader that samples from the image using the specified tiling and transformation

makeDecodedImage()

IImage* makeDecodedImage(u8[] encodedData)

Parameters

encodedData
u8[] — Required

Returns

IImage*
Last modified on October 29, 2026