Available on crate feature
engine only.Modules§
- color_
filters - Factory functions for creating
crate::ColorFilters, e.g. from a color matrix, acrate::BlendMode, or acrate::ColorTable. - gpu
- GPU support for Skia: the Ganesh (
crate::gpu::ganesh) and Graphite backends, their backend-specific APIs (D3D, GL, Metal, Vulkan), and the backend-agnostic GPU types shared between them. - gradient
- Gradient specifications and shader factory functions for linear, radial, and two-point conical gradients.
- image_
filters - Factory functions for creating
crate::ImageFilters. For filters that take an input filter,Nonemeans the dynamic source image is used. - images
- Factory functions for creating
crate::Images, e.g. from acrate::Bitmap, compressed data, or acrate::Picture. - shaders
- Shader factory functions and
Shaderconvenience constructors, re-exported fromcrate::shader::shaders. - svg
- SVG (Scalable Vector Graphics) support: an SVG
Canvasand the SVG DOM types for rendering SVG documents. - vk
vulkan - Vulkan types and helpers shared by the Ganesh and Graphite backends, plus the
Vulkan
BackendContextused to create a Ganeshcrate::gpu::DirectContext.
Structs§
- Borrows
- Budgeted
- Indicates whether an allocation should count against a cache budget.
- Canvas
Canvasprovides an interface for drawing, and how the drawing is clipped and transformed.Canvascontains a stack ofMatrixand clip values.- Color
- 32-bit ARGB color value, unpremultiplied. Color components are always in a known order. This is
different from
SkPMColor, which has its bytes in a configuration dependent order, to match the format of BGRA 8888 color type bitmaps.Coloris the type used to specify colors incrate::Paintand in gradients. - Color4f
- Colors
- Specification for the colors in a gradient.
- Cubic
Resampler - Specify
bandc(each between 0…1) to create a shader that applies the corresponding cubic reconstruction filter to the image. - Decoration
- Font
Arguments - Represents a set of actual arguments for a font.
- Font
Style - Framebuffer
Info - Glyph
Cluster Info - Gradient
- Gradient specification combining colors and interpolation settings.
- HSV
- IPoint
- IRect
- ISize
- Interpolation
- Gradient interpolation settings.
- Line
Metrics - Local
Resource Provider - A resource provider that loads only local / inline base64 resources.
- M44
- 4x4 matrix used by
crate::Canvasand other parts of Skia. - Matrix
- Pixmap
- Placeholder
Style - Point
- Position
With Affinity - RGB
- RRect
- Rect
- Sampling
Options - Save
Layer Rec SaveLayerReccontains the state used to create the layer.- Size
- SkColor
- 32-bit ARGB color value, unpremultiplied. Color components are always in a known order. This is
different from
SkPMColor, which has its bytes in a configuration dependent order, to match the format of BGRA 8888 color type bitmaps.Coloris the type used to specify colors incrate::Paintand in gradients. - SkColor4f
- SkHSV
- SkMatrix
- SkPoint
- SkRGB
- SkRRect
- SkRect
- SkText
Decoration - Multiple decorations can be applied at once. Ex: Underline and overline is (0x1 | 0x2)
- SkText
Shadow - Surface
Props - Describes properties and constraints of a given surface. The rendering engine can parse these during drawing, and can sometimes optimize its performance (e.g. disabling an expensive feature).
- Surface
Props Flags - TextBox
- Text
Decoration - Multiple decorations can be applied at once. Ex: Underline and overline is (0x1 | 0x2)
- Text
Shadow - V3
- Variation
Coordinate - A single axis/value pair in a
crate::font_arguments::VariationPosition. - Variation
Position - Represents a position in the variation design space.
- Weight
- Wrapper type of a font weight.
- Width
- Wrapper type for the width of a font.
Enums§
- Alpha
Type - Blend
Mode - Blur
Style - ClipOp
- Color
Type - Describes how pixel bits encode color. A pixel may be an alpha mask, a grayscale, RGB, or ARGB.
- Corner
- Encoded
Image Format - Filter
Mode - Format
- Glyph
Positions - Used to pass either a slice of
PointorRSXformtoCanvas::draw_glyphs_at. - Mipmap
Mode - Paint
Cap - Paint
Join - Paint
Style - Pixel
Geometry - Description of how the LCD strips are arranged for each pixel. If this is unknown, or the
pixels are meant to be “portable” and/or transformed before showing (e.g. rotated, scaled)
then use
PixelGeometry::Unknown. - Placeholder
Alignment - Where to vertically align the placeholder relative to the surrounding text.
- Rect
Height Style - Rect
Width Style - SkBlur
Style - SkCorner
- SkText
Align - SkText
Height Behavior - Slant
- Surface
Origin - Text
Align - Text
Baseline - Text
Decoration Style - Text
Direction - Text
Height Behavior - Tile
Mode
Traits§
- Pointer
Wrapper - This trait supports the conversion of a wrapper into it’s wrapped C/C++ pointer and back.
Functions§
- blur
- Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode is used when the blur kernel goes outside the input image.
- raster_
from_ data - Creates CPU-backed
Imagefrom pixel data described by info. The pixels data will not be copied. - raster_
n32_ premul - Allocates raster
Surface.crate::Canvasreturned bySurfacedraws directly into pixels. Allocates and zeroes pixel memory. Pixel memory size is height times width times four. Pixel memory is deleted whenSurfaceis deleted. - register_
font_ typeface - Registers a typeface and its available weight instances.
- render_
target - Returns
Surfaceon GPU indicated by context. Allocates memory for pixels, based on the width, height, andcrate::ColorTypeinImageInfo. budgeted selects whether allocation for pixels is tracked by context.image_infodescribes the pixel format incrate::ColorType, and transparency incrate::AlphaType, and color matching incrate::ColorSpace. - set_
resource_ cache_ single_ allocation_ byte_ limit - When the cacheable entry is very large, adding it to the cache can cause most or all of the existing entries to be purged. To avoid this, set a limit for a single allocation. If a cacheable entry would have been cached, but its size exceeds this limit, then it is not cached at all.
- set_
resource_ cache_ total_ bytes_ limit - Set the memory usage limit for the resource cache, used for temporary bitmaps and other resources. Entries are purged from the cache when the memory usage exceeds this limit.
- wrap_
backend_ render_ target - Wraps a GPU-backed buffer into
Surface. Caller must ensurebackend_render_targetis valid for the lifetime of returnedSurface. - wrap_
pixels - Allocates raster
Surface.crate::Canvasreturned bySurfacedraws directly into pixels.
Type Aliases§
- ArcSize
- Backend
Render Target - Describes a render target on a specific GPU backend.
- Bitmap
Bitmapdescribes a two-dimensional raster pixel array.Bitmapis built onImageInfo, containing integer width and height,ColorTypeandAlphaTypedescribing the pixel format, andColorSpacedescribing the range of colors.Bitmappoints toPixelRef, which describes the physical array of pixels.ImageInfobounds may be located anywhere fully insidePixelRefbounds.- Color
Space - Data
- Direct
Context - Font
Fontcontrols options applied when drawing and measuring text.- Font
Collection - Font
Edging - Whether edge pixels draw opaque or with partial transparency.
- Font
Feature - Font
Hinting - FontMgr
- GlyphId
- Image
Imagedescribes a two dimensional array of pixels to draw. The pixels may be decoded in a raster bitmap, encoded in aPictureor compressed data stream, or located in GPU memory as a GPU texture.- Image
Filter - Image
Info - Describes pixel dimensions and encoding.
crate::Bitmap,crate::Image,crate::Pixmap, andcrate::Surfacecan be created fromImageInfo.ImageInfocan be retrieved fromcrate::Bitmapandcrate::Pixmap, but not fromcrate::Imageandcrate::Surface. For example,crate::Imageandcrate::Surfaceimplementations may defer pixel depth, so may not completely specifyImageInfo. - Interface
crate::gpu::ganesh::DirectContextuses the following interface to make all calls into OpenGL. When acrate::gpu::ganesh::DirectContextis created it is given aSelf. The interface’s function pointers must be valid for the OpenGL context associated with thecrate::gpu::ganesh::DirectContext. On some platforms, such as Windows, function pointers for OpenGL extensions may vary between OpenGL contexts. So the caller must be careful to use aSelfinitialized for the correct context. All functions that should be available based on the OpenGL’s version and extension string must be non-NULL orcrate::gpu::ganesh::DirectContextcreation will fail. This can be tested with theSelf::validate()method when the OpenGL context has been made current.- Mask
Filter - MaskFilter is the base class for object that perform transformations on the mask before drawing it. An example subclass is Blur.
- Paint
Paintcontrols options applied when drawing.- Paragraph
- Paragraph
Builder - Paragraph
Style - Path
Pathcontain geometry.Pathmay be empty, or contain one or more verbs that outline a figure.Pathalways starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves. Adding a close verb makes the geometry into a continuous loop, a closed contour.Pathmay contain any number of contours, each beginning with a move verb.- Path
Builder - Path
Direction - Path
Effect - Path
Fill Type - Picture
- Picture
Recorder - Recording
Context - Runtime
Effect RuntimeEffectsupports creating customShaderandColorFilterobjects using Skia’s SkSL shading language.- Shader
- SkData
- SkImage
Imagedescribes a two dimensional array of pixels to draw. The pixels may be decoded in a raster bitmap, encoded in aPictureor compressed data stream, or located in GPU memory as a GPU texture.- SkMask
Filter - MaskFilter is the base class for object that perform transformations on the mask before drawing it. An example subclass is Blur.
- SkParagraph
- SkPath
Pathcontain geometry.Pathmay be empty, or contain one or more verbs that outline a figure.Pathalways starts with a move verb to a Cartesian coordinate, and may be followed by additional verbs that add lines or curves. Adding a close verb makes the geometry into a continuous loop, a closed contour.Pathmay contain any number of contours, each beginning with a move verb.- SkPath
Fill Type - SkSurface
Surfaceis responsible for managing the pixels that a canvas draws into. The pixels can be allocated either in CPU memory (a raster surface) or on the GPU (aRenderTargetsurface).Surfacetakes care of allocating aCanvasthat will draw into the surface. CallSurface::canvas()to use that canvas (but don’t delete it, it is owned by the surface).Surfacealways has non-zero dimensions. If there is a request for a new surface, and either of the requested dimensions are zero, thenNonewill be returned.- Strut
Style - Surface
Surfaceis responsible for managing the pixels that a canvas draws into. The pixels can be allocated either in CPU memory (a raster surface) or on the GPU (aRenderTargetsurface).Surfacetakes care of allocating aCanvasthat will draw into the surface. CallSurface::canvas()to use that canvas (but don’t delete it, it is owned by the surface).Surfacealways has non-zero dimensions. If there is a request for a new surface, and either of the requested dimensions are zero, thenNonewill be returned.- Text
Blob - Text
Index - Text
Range - Text
Style - Typeface
- Typeface
Font Provider - Uniform
- Reflected description of a uniform variable in the effect’s SkSL.