Classes
The following classes are available globally.
-
Bitmap describes a two-dimensional raster pixel array. Bitmap is built on ImageInfo, containing integer width and height, ColorType and AlphaType describing the pixel format, and ColorSpace describing the range of colors. Bitmap points to PixelRef, which describes the physical array of pixels. ImageInfo bounds may be located anywhere fully inside PixelRef bounds.
Bitmap can be drawn using Canvas. Bitmap can be a drawing destination for Canvas draw member functions. Bitmap flexibility as a pixel container limits some optimizations available to the target platform.
If pixel array is primarily read-only, use Image for better performance. If pixel array is primarily written to, use Surface for better performance.
Bitmap is not thread safe. Each thread must have its own copy of Bitmap fields, although threads may share the underlying pixel array.
See moreDeclaration
Swift
public final class Bitmap
-
Canvasprovides an interface for drawing, and how the drawing is clipped and transformed.Canvascontains a stack ofMatrixand clip values.CanvasandPainttogether provide the state to draw intoSurfaceorBaseDevice. EachCanvasdraw call transforms the geometry of the object by the concatenation of allMatrixvalues in the stack. The transformed geometry is clipped by the intersection of all of clip values in the stack. TheCanvasdraw calls usePaintto supply drawing state such as color,Typeface, text size, stroke width,Shaderand so on.To draw to a pixel-based destination, create raster surface or GPU surface. Request
CanvasfromSurfaceto obtain the interface to draw.Canvasgenerated by raster surface draws to memory visible to the CPU.Canvasgenerated by GPU surface uses Vulkan or OpenGL to draw to the GPU.To draw to a document, obtain
Canvasfrom SVG canvas, document PDF, orPictureRecorder.DocumentbasedCanvasand otherCanvassubclasses referenceBaseDevicedescribing the destination.Typically you create the Canvas from a bitmap, but an empty canvas can be created with the some fo the static
makemethods, and serve special purposes:makeEmpty(width:height)- creates an empty canvas that ignores all drawing commandsmakeOverdraw(canvas:)- A canvas that captures all drawing commands, and rather than draw the actual content, it increments the alpha channel of each pixel every time it would have been touched by a draw call.makeNway(width:height:)- will create a passthrough n-way canvas. Once created you can add canvas withaddCanvas, and remove them withremoveCanvas
Declaration
Swift
public final class Canvas
-
Undocumented
Declaration
Swift
public final class ColorFilter
-
Undocumented
See moreDeclaration
Swift
public final class ColorSpace
-
See moreSKDataholds an immutable data buffer. Not only is the data immutable, but the actual ptr that is returned (bydata)) is guaranteed to always be the same for the life of this instance.Declaration
Swift
public final class SKData
-
Skia’s FontManager The default font manager can be accessed via the
See moredefaultstatic property ofFontManager.Declaration
Swift
public final class FontManager
-
Represents a particular style (bold, italic, condensed) of a typeface.
See moreDeclaration
Swift
public final class FontStyle
-
Represets the set of styles for a particular font family.
See moreDeclaration
Swift
public final class FontStyleSet
-
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.Imagecannot be modified after it is created.Imagemay allocate additional storage as needed; for instance, an encodedImagemay decode when drawn.Imagewidth and height are greater than zero. Creating anImagewith zero width or height returnsImageequal tonil.
See moreImagemay be created fromBitmap,Pixmap,Surface,Picture, encoded streams, GPU texture, YUV_ColorSpace data, or hardware buffer. Encoded streams supported include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details vary with platform.Declaration
Swift
public final class Image
-
Undocumented
Declaration
Swift
public final class ImageFilter
-
Undocumented
Declaration
Swift
public final class MaskFilter
-
See morePaintcontrols options applied when drawing.Paintcollects all options outside of theCanvasclip andCanvasmatrix. Various options apply to strokes and fills, and images.Paintcollects effects and filters that describe single-pass and multiple-pass algorithms that alter the drawing geometry, color, and transparency. For instance,Paintdoes not directly implement dashing or blur, but contains the objects that do so.Declaration
Swift
public final class Paint
-
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.Pathcontours may contain only a move verb, or may also contain lines, quadratic beziers, conics, and cubic beziers.Pathcontours may be open or closed.When used to draw a filled area,
Pathdescribes whether the fill is inside or outside the geometry.Pathalso describes the winding rule used to fill overlapping contours.The various commands that add to the path provide a fluid interface, meaning that calling the methods return the instance on which it was invoked, easily allowing the drawing operations to be concatenated.
See moreDeclaration
Swift
public final class Path
-
Undocumented
See moreDeclaration
Swift
public final class Picture
-
The picture recorder is used to record drawing operations made to a SKCanvas and stored in a SKPicture. call the
See morebeginRecordingmethod to start, issue your commands into the returnedCanvasand then call theendRecordingmethod to get thePicturethat has the recording on it.Declaration
Swift
public final class PictureRecorder
-
Undocumented
See moreDeclaration
Swift
public final class Pixmap
-
See moreRegiondescribes the set of pixels used to clipCanvas.Regionis compact, efficiently storing a single integer rectangle, or a run length encoded array of rectangles.Regionmay reduce the currentCanvasclip, or may be drawn as one or more integer rectangles.Regioniterator returns the scan lines or rectangles contained by it, optionally intersecting a bounding rectangle.Declaration
Swift
public final class Region
-
Undocumented
See moreDeclaration
Swift
public final class RoundRect
-
Undocumented
Declaration
Swift
public class SKObject
-
bstraction for a source of bytes. Subclasses can be backed by memory, or a file, or something else.
Classic
streams
APIs are sort of async, in that on a request for N bytes, they may return fewer than N bytes on a given call, in which case the caller cantry again
to get more bytes, eventually (modulo an error) receiving their total N bytes.Skia streams behave differently. They are effectively synchronous, and will always return all N bytes of the request if possible. If they return fewer (the
See morereadcall returns the number of bytes read) then that means there is no more data (at EOF or hit an error). The caller should not call again in hopes of fulfilling more of the request.Declaration
Swift
public class SKStream -
A reading stream that wraps a native file. To write use
See moreSKFileWStreamDeclaration
Swift
public final class SKFileStream : SKStream -
Undocumented
See moreDeclaration
Swift
public class SKWStream -
Opens a write-only stream to the specified file. To read use
See moreSKFileStreamDeclaration
Swift
public final class SKFileWStream : SKWStream
-
Shaders specify the source color(s) for what is being drawn. If a paint has no shader, then the paint’s color is used. If the paint has a shader, then the shader’s color(s) are use instead, but they are modulated by the paint’s alpha. This makes it easy to create a shader once (e.g. bitmap tiling or gradient) and then change its transparency w/o having to modify the original shader… only the paint’s alpha needs to be modified.
Use any of the various static
See moremakemethods to create the shaderDeclaration
Swift
public final class Shader
-
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 (a GrRenderTarget surface).Surfacetakes care of allocating aCanvasthat will draw into the surface. Call surface->getCanvas() 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, thennilwill be returned.Use one of the static
See moremakemethods to create instances ofSurfaceDeclaration
Swift
public final class Surface
-
Declaration
Swift
public final class TextBlobBuilder
-
The
Typefaceclass specifies the typeface and intrinsic style of a font. This is used in the paint, along with optionally algorithmic settings like textSize, textskewX, textScaleX, FakeBoldText_Mask, to specify how text appears when drawn (and measured).Typeface objects are immutable, and so they can be shared between threads.
See moreDeclaration
Swift
public final class Typeface
-
Undocumented
See moreDeclaration
Swift
public class SkiaLayer : CALayer
-
SkiaViewis a UIView that you can add to your programs that can render some Skia content for you. To do this, create an instance of this class, and then set thedrawingCallbackproperty to point to a function that takes aSurfaceand anImageInfoas parameter, and this will be called when the view needs to render itself.You can set the
See moreignorePixelScalingto ignore the built-in scaling that uses theUIView‘scontentScaleFactorDeclaration
Swift
public class SkiaView : UIView
View on GitHub
Install in Dash
Classes Reference