Editar

Compartilhar via


SKImage Class

Definition

An abstraction for drawing a rectangle of pixels.

public class SKImage : SkiaSharp.SKObject
Inheritance

Remarks

An image is an abstraction of pixels, though the particular type of image could be actually storing its data on the GPU, or as drawing commands (picture or PDF or otherwise), ready to be played back into another canvas.

The content of an image is always immutable, though the actual storage may change, if for example that image can be recreated via encoded data or other means.

An image always has a non-zero dimensions. If there is a request to create a new image, either directly or via a surface, and either of the requested dimensions are zero, then null will be returned.

Properties

AlphaType

Gets the configured SKAlphaType for the bitmap.

ColorSpace

Gets the image color space.

ColorType

Gets the image color type.

EncodedData

Gets the encoded image pixels as a SKData, if the image was created from supported encoded stream format.

Handle

Gets or sets the handle to the underlying native object.

(Inherited from SKObject)
Height

Gets the image height.

IgnorePublicDispose

Gets or sets a value indicating whether the call the public Dispose() should be no-op.

(Inherited from SKNativeObject)
Info
IsAlphaOnly

Gets a value indicating whether the image will be drawn as a mask, with no intrinsic color of its own

IsDisposed

Gets or sets a value indicating whether the object has already been disposed.

(Inherited from SKNativeObject)
IsLazyGenerated

Gets a value indicating whether the image is backed by an image-generator or other source that creates (and caches) its pixels / texture on-demand.

IsTextureBacked

Gets a value indicating whether the image is texture backed.

OwnsHandle

Gets a value indicating whether this object should destroy the underlying native object.

(Inherited from SKObject)
UniqueId

Gets the unique ID associated with the image.

Width

Gets the image width.

Methods

ApplyImageFilter(GRContext, SKImageFilter, SKRectI, SKRectI, SKRectI, SKPointI)
ApplyImageFilter(GRRecordingContext, SKImageFilter, SKRectI, SKRectI, SKRectI, SKPointI)
ApplyImageFilter(SKImageFilter, SKRectI, SKRectI, SKRectI, SKPoint)

Applies a given image filter to this image, and return the filtered result.

ApplyImageFilter(SKImageFilter, SKRectI, SKRectI, SKRectI, SKPointI)

Applies a given image filter to this image, and return the filtered result.

Create(SKImageInfo)

Creates a new raster-based SKImage using the specified information.

Dispose()

Releases all resources used by this SKNativeObject.

(Inherited from SKNativeObject)
Dispose(Boolean)

Releases the unmanaged resources used by the SKImage and optionally releases the managed resources.

DisposeInternal()

Triggers a dispose, ignoring the value of IgnorePublicDispose.

(Inherited from SKNativeObject)
DisposeManaged()

Implemented by derived SKObject types to destroy any managed objects.

(Inherited from SKObject)
DisposeNative()

Implemented by derived SKObject types to destroy any native objects.

(Inherited from SKObject)
DisposeUnownedManaged() (Inherited from SKObject)
Encode()

Encodes the image using the SkiaSharp.SKImageEncodeFormat.Png format.

Encode(SKEncodedImageFormat, Int32)

Encodes the image using the specified format.

Encode(SKPixelSerializer)
Obsolete.

Encodes the image using the specified serializer.

FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace)

Creates a new image from the specified texture.

FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType)

Creates a new image from the specified texture.

FromAdoptedTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType)

Creates a new image from the specified texture.

FromAdoptedTexture(GRContext, GRBackendTexture, SKColorType)

Creates a new image from the specified texture.

FromAdoptedTexture(GRContext, GRBackendTextureDesc, SKAlphaType)
Obsolete.

Creates a new image from the specified texture descriptor.

FromAdoptedTexture(GRContext, GRBackendTextureDesc)
Obsolete.

Creates a new image from the specified texture descriptor.

FromAdoptedTexture(GRContext, GRGlBackendTextureDesc, SKAlphaType)
Obsolete.

Creates a new image from the specified OpenGL texture descriptor.

FromAdoptedTexture(GRContext, GRGlBackendTextureDesc)
Obsolete.

Creates a new image from the specified OpenGL texture descriptor.

FromAdoptedTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace)
FromAdoptedTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType)
FromAdoptedTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType)
FromAdoptedTexture(GRRecordingContext, GRBackendTexture, SKColorType)
FromBitmap(SKBitmap)

Creates a new image from the provided SKBitmap.

FromEncodedData(Byte[])

Creates a new image from an encoded image buffer.

FromEncodedData(ReadOnlySpan<Byte>)

Creates a new image from an encoded image buffer.

FromEncodedData(SKData, SKRectI)

Creates a new image from an encoded image wrapped by the data.

FromEncodedData(SKData)

Creates a new image from an encoded image wrapped by the data.

FromEncodedData(SKStream)

Creates a new image from an encoded image stream.

FromEncodedData(Stream)

Creates a new image from an encoded image stream.

FromEncodedData(String)

Creates a new image from an encoded image file.

FromPicture(SKPicture, SKSizeI, SKMatrix, SKPaint)

Creates a new image from the provided SKPicture.

FromPicture(SKPicture, SKSizeI, SKMatrix)

Creates a new image from the provided SKPicture.

FromPicture(SKPicture, SKSizeI, SKPaint)

Creates a new image from the provided SKPicture.

FromPicture(SKPicture, SKSizeI)

Creates a new image from the provided SKPicture.

FromPixelCopy(SKImageInfo, Byte[], Int32)

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, Byte[])

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, IntPtr, Int32, SKColorTable)
Obsolete.

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, IntPtr, Int32)

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, IntPtr)

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, ReadOnlySpan<Byte>, Int32)

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, ReadOnlySpan<Byte>)

Creates a new image from a copy of an in-memory buffer.

FromPixelCopy(SKImageInfo, SKStream, Int32)

Creates a new image from a copy of the stream data.

FromPixelCopy(SKImageInfo, SKStream)

Creates a new image from a copy of the stream data.

FromPixelCopy(SKImageInfo, Stream, Int32)

Creates a new image from a copy of the stream data.

FromPixelCopy(SKImageInfo, Stream)

Creates a new image from a copy of the stream data.

FromPixelCopy(SKPixmap)

Creates a new image from a copy of an in-memory buffer.

FromPixelData(SKImageInfo, SKData, Int32)
Obsolete.

Creates a new image from an in-memory buffer.

FromPixels(SKImageInfo, IntPtr, Int32)

Creates a new image from an in-memory buffer.

FromPixels(SKImageInfo, IntPtr)

Creates a new image from an in-memory buffer.

FromPixels(SKImageInfo, SKData, Int32)

Creates a new image from an in-memory buffer.

FromPixels(SKImageInfo, SKData)
FromPixels(SKPixmap, SKImageRasterReleaseDelegate, Object)

Creates a new image from an in-memory buffer.

FromPixels(SKPixmap, SKImageRasterReleaseDelegate)

Creates a new image from an in-memory buffer.

FromPixels(SKPixmap)

Creates a new image from an in-memory buffer.

FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate, Object)

Creates a new image from the specified texture.

FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate)

Creates a new image from the specified texture.

FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace)

Creates a new image from the specified texture.

FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType)

Creates a new image from the specified texture.

FromTexture(GRContext, GRBackendTexture, GRSurfaceOrigin, SKColorType)

Creates a new image from the specified texture.

FromTexture(GRContext, GRBackendTexture, SKColorType)

Creates a new image from the specified texture.

FromTexture(GRContext, GRBackendTextureDesc, SKAlphaType, SKImageTextureReleaseDelegate, Object)
Obsolete.

Creates a new image from the specified texture descriptor.

FromTexture(GRContext, GRBackendTextureDesc, SKAlphaType, SKImageTextureReleaseDelegate)
Obsolete.

Creates a new image from the specified texture descriptor.

FromTexture(GRContext, GRBackendTextureDesc, SKAlphaType)
Obsolete.

Creates a new image from the specified texture descriptor.

FromTexture(GRContext, GRBackendTextureDesc)
Obsolete.

Creates a new image from the specified texture descriptor.

FromTexture(GRContext, GRGlBackendTextureDesc, SKAlphaType, SKImageTextureReleaseDelegate, Object)
Obsolete.

Creates a new image from the specified OpenGL texture descriptor.

FromTexture(GRContext, GRGlBackendTextureDesc, SKAlphaType, SKImageTextureReleaseDelegate)
Obsolete.

Creates a new image from the specified OpenGL texture descriptor.

FromTexture(GRContext, GRGlBackendTextureDesc, SKAlphaType)
Obsolete.

Creates a new image from the specified OpenGL texture descriptor.

FromTexture(GRContext, GRGlBackendTextureDesc)
Obsolete.

Creates a new image from the specified OpenGL texture descriptor.

FromTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate, Object)
FromTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace, SKImageTextureReleaseDelegate)
FromTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType, SKColorSpace)
FromTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType, SKAlphaType)
FromTexture(GRRecordingContext, GRBackendTexture, GRSurfaceOrigin, SKColorType)
FromTexture(GRRecordingContext, GRBackendTexture, SKColorType)
IsValid(GRContext)
IsValid(GRRecordingContext)
PeekPixels()

Returns the pixmap if the image is raster-based.

PeekPixels(SKPixmap)

Returns the pixmap if the image is raster-based.

ReadPixels(SKImageInfo, IntPtr, Int32, Int32, Int32, SKImageCachingHint)

Copies the pixels from the image into the specified buffer.

ReadPixels(SKImageInfo, IntPtr, Int32, Int32, Int32)

Copies the pixels from the image into the specified buffer.

ReadPixels(SKImageInfo, IntPtr, Int32)
ReadPixels(SKImageInfo, IntPtr)
ReadPixels(SKPixmap, Int32, Int32, SKImageCachingHint)

Copies the pixels from the image into the specified buffer.

ReadPixels(SKPixmap, Int32, Int32)

Copies the pixels from the image into the specified buffer.

ReadPixels(SKPixmap)
ScalePixels(SKPixmap, SKFilterQuality, SKImageCachingHint)

Copies the pixels from this image into the destination pixmap, scaling the image if the dimensions differ.

ScalePixels(SKPixmap, SKFilterQuality)

Copies the pixels from this image into the destination pixmap, scaling the image if the dimensions differ.

Subset(SKRectI)

Returns a new image that is a subset of this image.

ToRasterImage()

Returns a raster-based image of the current image.

ToRasterImage(Boolean)
ToShader()
ToShader(SKShaderTileMode, SKShaderTileMode, SKMatrix)

Creates a new bitmap shader from the current image.

ToShader(SKShaderTileMode, SKShaderTileMode)

Creates a new bitmap shader from the current image.

ToTextureImage(GRContext, Boolean)
ToTextureImage(GRContext, SKColorSpace)
ToTextureImage(GRContext)

Applies to