Image describes a two dimensional array of pixels to draw. The pixels may be decoded in a Raster_Bitmap, encoded in a Picture or compressed data stream, or located in GPU memory as a GPU_Texture.
Image cannot be modified after it is created. Image may allocate additional storage as needed; for instance, an encoded Image may decode when drawn.
Image width and height are greater than zero. Creating an Image with zero width or height returns Image equal to nullptr.
Image may be created from Bitmap, 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.
Raster_Image pixels are decoded in a Raster_Bitmap. These pixels may be read directly and in most cases written to, although edited pixels may not be drawn if Image has been copied internally.
Texture_Image are located on GPU and pixels are not accessible. Texture_Image are allocated optimally for best performance. Raster_Image may be drawn to GPU_Surface, but pixels are uploaded from CPU to GPU downgrading performance.
Lazy_Image defer allocating buffer for Image pixels and decoding stream until Image is drawn. Lazy_Image caches result if possible to speed up repeated drawing.
Creates SkImage from SkPixmap and copy of pixels. Since pixels are copied, SkPixmap pixels may be modified or deleted without affecting SkImage.
SkImage is returned if SkPixmap is valid. Valid SkPixmap parameters include: dimensions are greater than zero; each dimension fits in 29 bits; SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; row bytes are large enough to hold one row of pixels; pixel address is not nullptr.
copy of SkPixmap pixels, or nullptr
MakeRasterData MakeFromGenerator
Creates SkImage from SkImageInfo, sharing pixels.
SkImage is returned if SkImageInfo is valid. Valid SkImageInfo parameters include: dimensions are greater than zero; each dimension fits in 29 bits; SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; rowBytes are large enough to hold one row of pixels; pixels is not nullptr, and contains enough data for SkImage.
SkImage sharing pixels, or nullptr
MakeRasterCopy MakeFromGenerator
Caller data passed to RasterReleaseProc; may be nullptr.
MakeFromRaster RasterReleaseProc
Function called when Image no longer shares pixels. ReleaseContext is provided by caller when Image is created, and may be nullptr.
ReleaseContext MakeFromRaster
Creates SkImage from pixmap, sharing SkPixmap pixels. Pixels must remain valid and unchanged until rasterReleaseProc is called. rasterReleaseProc is passed releaseContext when SkImage is deleted or no longer refers to pixmap pixels.
Pass nullptr for rasterReleaseProc to share SkPixmap without requiring a callback when SkImage is released. Pass nullptr for releaseContext if rasterReleaseProc does not require state.
SkImage is returned if pixmap is valid. Valid SkPixmap parameters include: dimensions are greater than zero; each dimension fits in 29 bits; SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; row bytes are large enough to hold one row of pixels; pixel address is not nullptr.
SkImage sharing pixmap
before reset: 0 after reset: 1
MakeRasterCopy MakeRasterData MakeFromGenerator RasterReleaseProc ReleaseContext
Creates SkImage from bitmap, sharing or copying bitmap pixels. If the bitmap is marked immutable, and its pixel memory is shareable, it may be shared instead of copied.
SkImage is returned if bitmap is valid. Valid SkBitmap parameters include: dimensions are greater than zero; each dimension fits in 29 bits; SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; row bytes are large enough to hold one row of pixels; pixel address is not nullptr.
created SkImage, or nullptr
MakeFromRaster MakeRasterCopy MakeFromGenerator MakeRasterData
Creates SkImage from data returned by imageGenerator. Generated data is owned by SkImage and may not be shared or accessed.
subset allows selecting a portion of the full image. Pass nullptr to select the entire image; otherwise, subset must be contained by image bounds.
SkImage is returned if generator data is valid. Valid data parameters vary by type of data and platform.
imageGenerator may wrap SkPicture data, codec data, or custom data.
created SkImage, or nullptr
MakeFromEncoded
Creates SkImage from encoded data. subset allows selecting a portion of the full image. Pass nullptr to select the entire image; otherwise, subset must be contained by image bounds.
SkImage is returned if format of the encoded data is recognized and supported. Recognized formats vary by platform.
created SkImage, or nullptr
MakeFromGenerator
User function called when supplied texture may be deleted.
MakeFromTexture
Creates SkImage from GPU texture associated with context. Caller is responsible for managing the lifetime of GPU texture.
SkImage is returned if format of backendTexture is recognized and supported. Recognized formats vary by GPU back-end.
kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType, kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType
kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType
created SkImage, or nullptr
MakeFromAdoptedTexture SkSurface::MakeFromBackendTexture
Creates SkImage from GPU texture associated with context. GPU texture must stay valid and unchanged until textureReleaseProc is called. textureReleaseProc is passed releaseContext when SkImage is deleted or no longer refers to texture.
SkImage is returned if format of backendTexture is recognized and supported. Recognized formats vary by GPU back-end.
kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType, kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType
kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType
created SkImage, or nullptr
MakeFromAdoptedTexture SkSurface::MakeFromBackendTexture
Creates SkImage from encoded data. SkImage is uploaded to GPU back-end using context.
Created SkImage is available to other GPU contexts, and is available across thread boundaries. All contexts must be in the same GPU share group, or otherwise share resources.
When SkImage is no longer referenced, context releases texture memory asynchronously.
GrBackendTexture decoded from data is uploaded to match SkSurface created with dstColorSpace. SkColorSpace of SkImage is determined by encoded data.
SkImage is returned if format of data is recognized and supported, and if context supports moving resources. Recognized formats vary by platform and GPU back-end.
SkImage is returned using MakeFromEncoded() if context is nullptr or does not support moving resources between contexts.
created SkImage, or nullptr
MakeCrossContextFromPixmap
Creates SkImage from pixmap. SkImage is uploaded to GPU back-end using context.
Created SkImage is available to other GPU contexts, and is available across thread boundaries. All contexts must be in the same GPU share group, or otherwise share resources.
When SkImage is no longer referenced, context releases texture memory asynchronously.
GrBackendTexture created from pixmap is uploaded to match SkSurface created with dstColorSpace. SkColorSpace of SkImage is determined by pixmap.colorSpace().
SkImage is returned referring to GPU back-end if context is not nullptr, format of data is recognized and supported, and if context supports moving resources between contexts. Otherwise, pixmap pixel data is copied and SkImage as returned in raster format if possible; nullptr may be returned. Recognized GPU formats vary by platform and GPU back-end.
created SkImage, or nullptr
MakeCrossContextFromEncoded
Creates SkImage from backendTexture associated with context. backendTexture and returned SkImage are managed internally, and are released when no longer needed.
SkImage is returned if format of backendTexture is recognized and supported. Recognized formats vary by GPU back-end.
kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType, kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType
kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType
created SkImage, or nullptr
MakeFromTexture MakeFromYUVTexturesCopy
Creates an SkImage by flattening the specified YUVA planes into a single, interleaved RGBA image.
kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace, kRec709_SkYUVColorSpace
possibly interleaved, YUVA planes
in that texture, maps to each component of YUVA.
kTopLeft_GrSurfaceOrigin
created SkImage, or nullptr
MakeFromYUVATexturesCopyWithExternalBackend MakeFromYUVATextures
Creates an SkImage by storing the specified YUVA planes into an image, to be rendered via multitexturing.
kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace, kRec709_SkYUVColorSpace
possibly interleaved, YUVA planes
in that texture, maps to each component of YUVA.
kTopLeft_GrSurfaceOrigin
created SkImage, or nullptr
MakeFromYUVATexturesCopy MakeFromYUVATexturesCopyWithExternalBackend
Creates SkImage from pixmap array representing YUVA data. SkImage is uploaded to GPU back-end using context.
Each GrBackendTexture created from yuvaPixmaps array is uploaded to match SkSurface using SkColorSpace of SkPixmap. SkColorSpace of SkImage is determined by imageColorSpace.
SkImage is returned referring to GPU back-end if context is not nullptr and format of data is recognized and supported. Otherwise, nullptr is returned. Recognized GPU formats vary by platform and GPU back-end.
kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace, kRec709_SkYUVColorSpace
possibly interleaved, YUVA planes
in that pixmap, maps to each component of YUVA.
kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
created SkImage, or nullptr
MakeFromYUVATextures
Creates an SkImage by flattening the specified YUVA planes into a single, interleaved RGBA image. ‘backendTexture’ is used to store the result of the flattening.
kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace, kRec709_SkYUVColorSpace
possibly interleaved, YUVA planes
in that texture, maps to each component of YUVA.
kTopLeft_GrSurfaceOrigin
created SkImage, or nullptr
MakeFromYUVATexturesCopy MakeFromYUVATextures
To be deprecated.
MakeFromYUVTexturesCopyWithExternalBackend MakeFromNV12TexturesCopy MakeFromYUVATexturesCopy
To be deprecated.
MakeFromYUVTexturesCopy MakeFromNV12TexturesCopy MakeFromYUVATexturesCopyWithExternalBackend
Creates SkImage from copy of nv12Textures, an array of textures on GPU. nv12Textures[0] contains pixels for YUV component y plane. nv12Textures[1] contains pixels for YUV component u plane, followed by pixels for YUV component v plane. Returned SkImage has the dimensions nv12Textures[2]. yuvColorSpace describes how YUV colors convert to RGB colors.
kRec709_SkYUVColorSpace
created SkImage, or nullptr
MakeFromNV12TexturesCopyWithExternalBackend MakeFromYUVTexturesCopy MakeFromYUVATexturesCopy
Creates SkImage from copy of nv12Textures, an array of textures on GPU. nv12Textures[0] contains pixels for YUV component y plane. nv12Textures[1] contains pixels for YUV component u plane, followed by pixels for YUV component v plane. Returned SkImage has the dimensions nv12Textures[2] and stores pixels in backendTexture. yuvColorSpace describes how YUV colors convert to RGB colors.
kRec709_SkYUVColorSpace
created SkImage, or nullptr
MakeFromNV12TexturesCopy MakeFromYUVTexturesCopy MakeFromYUVATexturesCopyWithExternalBackend
MakeFromPicture
Creates SkImage from picture. Returned SkImage width and height are set by dimensions. SkImage draws picture with matrix and paint, set to bitDepth and colorSpace.
If matrix is nullptr, draws with identity SkMatrix. If paint is nullptr, draws with default SkPaint. colorSpace may be nullptr.
created SkImage, or nullptr
SkCanvas::drawPicture
(See Skia bug 7447) Creates SkImage from Android hardware buffer. Returned SkImage takes a reference on the buffer.
Only available on Android, when ANDROID_API is defined to be 26 or greater.
kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType
created SkImage, or nullptr
MakeFromRaster
Returns pixel count in each row.
pixel width in SkImage
dimensions() height()
Returns pixel row count.
pixel height in SkImage
dimensions() width()
Returns SkISize { width(), height() }.
integral size of width() and height()
dimensionsAsBounds == bounds
height() width() bounds()
Returns SkIRect { 0, 0, width(), height() }.
integral rectangle from origin to width() and height()
dimensions()
Returns value unique to image. SkImage contents cannot change after SkImage is created. Any operation to create a new SkImage will receive generate a new unique number.
unique identifier
isLazyGenerated
Returns Alpha_Type, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType .
Alpha_Type returned was a parameter to an Image constructor, or was parsed from encoded data.
Alpha_Type in Image
SkImageInfo::alphaType
Returns SkColorType if known; otherwise, returns kUnknown_SkColorType.
SkColorType of SkImage
SkImageInfo::colorType
Returns SkColorSpace, the range of colors, associated with SkImage. The reference count of SkColorSpace is unchanged. The returned SkColorSpace is immutable.
SkColorSpace returned was passed to an SkImage constructor, or was parsed from encoded data. SkColorSpace returned may be ignored when SkImage is drawn, depending on the capabilities of the SkSurface receiving the drawing.
SkColorSpace in SkImage, or nullptr
refColorSpace makeColorSpace
Returns a smart pointer to SkColorSpace, the range of colors, associated with SkImage. The smart pointer tracks the number of objects sharing this SkColorSpace reference so the memory is released when the owners destruct.
The returned SkColorSpace is immutable.
SkColorSpace returned was passed to an SkImage constructor, or was parsed from encoded data. SkColorSpace returned may be ignored when SkImage is drawn, depending on the capabilities of the SkSurface receiving the drawing.
SkColorSpace in SkImage, or nullptr, wrapped in a smart pointer
colorSpace makeColorSpace
Returns true if SkImage pixels represent transparency only. If true, each pixel is packed in 8 bits as defined by kAlpha_8_SkColorType.
true if pixels represent a transparency mask
alphaOnly = true
alphaType isOpaque
Returns true if pixels ignore their alpha value and are treated as fully opaque.
true if SkAlphaType is kOpaque_SkAlphaType
isOpaque = false isOpaque = true
alphaType isAlphaOnly
Creates SkShader from SkImage. SkShader dimensions are taken from SkImage. SkShader uses SkShader::TileMode rules to fill drawn area outside SkImage. localMatrix permits transforming SkImage before SkCanvas matrix is applied.
SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode
SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode
SkShader containing SkImage
scalePixels
Creates SkShader from SkImage. SkShader dimensions are taken from SkImage. SkShader uses SkShader::kClamp_TileMode to fill drawn area outside SkImage. localMatrix permits transforming SkImage before SkCanvas matrix is applied.
SkShader containing SkImage
scalePixels
Copies SkImage pixel address, row bytes, and SkImageInfo to pixmap, if address is available, and returns true. If pixel address is not available, return false and leave pixmap unchanged.
true if SkImage has direct access to pixels
------------ --xx----x--- -x--x--x---- -x--x--x---- -x--x-x----- --xx-xx-xx-- -----x-x--x- ----x--x--x- ----x--x--x- ---x----xx-- ------------
readPixels
Returns true the contents of SkImage was created on or uploaded to GPU memory, and is available as a GPU texture.
true if SkImage is a GPU texture
MakeFromTexture isValid
Returns true if SkImage can be drawn on either raster surface or GPU surface. If context is nullptr, tests if SkImage draws on raster surface; otherwise, tests if SkImage draws on GPU surface associated with context.
SkImage backed by GPU texture may become invalid if associated GrContext is invalid. lazy image may be invalid and may not draw to raster surface or GPU surface or both.
true if SkImage can be drawn
isTextureBacked isLazyGenerated
Retrieves the back-end texture. If SkImage has no back-end texture, an invalid object is returned. Call GrBackendTexture::isValid to determine if the result is valid.
If flushPendingGrContextIO is true, completes deferred I/O operations.
If origin in not nullptr, copies location of content drawn into SkImage.
kBottomLeft_GrSurfaceOrigin; or nullptr
back-end API texture handle; invalid on failure
MakeFromTexture isTextureBacked
CachingHint selects whether Skia may internally cache Bitmaps generated by decoding Image, or by copying Image from GPU to CPU. The default behavior allows caching Bitmaps.
Choose kDisallow_CachingHint if Image pixels are to be used only once, or if Image pixels reside in a cache outside of Skia, or to reduce memory pressure.
Choosing kAllow_CachingHint does not ensure that pixels will be cached. Image pixels may not be cached if memory requirements are too large or pixels are not accessible.
readPixels scalePixels
Copies Rect of pixels from Image to dstPixels. Copy starts at offset (srcX, srcY), and does not exceed Image (width(), height()).
dstInfo specifies width, height, Color_Type, Alpha_Type, and Color_Space of destination. dstRowBytes specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if:
Pixels are copied only if pixel conversion is possible. If Image Color_Type is kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. If Image Color_Type is kGray_8_SkColorType, dstInfo.colorSpace() must match. If Image Alpha_Type is kOpaque_SkAlphaType, dstInfo.alphaType() must match. If Image Color_Space is nullptr, dstInfo.colorSpace() must match. Returns false if pixel conversion is not possible.
srcX and srcY may be negative to copy only top or left of source. Returns false if width() or height() is zero or negative. Returns false if abs(srcX) >= Image width(), or if abs(srcY) >= Image height().
If cachingHint is kAllow_CachingHint, pixels may be retained locally. If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache.
true if pixels are copied to dstPixels
scalePixels SkBitmap::readPixels SkPixmap::readPixels SkCanvas::readPixels SkSurface::readPixels
Copies a Rect of pixels from Image to dst. Copy starts at (srcX, srcY), and does not exceed Image (width(), height()).
dst specifies width, height, Color_Type, Alpha_Type, Color_Space, pixel storage, and row bytes of destination. dst.rowBytes() specifics the gap from one destination row to the next. Returns true if pixels are copied. Returns false if:
Pixels are copied only if pixel conversion is possible. If Image Color_Type is kGray_8_SkColorType, or kAlpha_8_SkColorType; dst.colorType() must match. If Image Color_Type is kGray_8_SkColorType, dst.colorSpace() must match. If Image Alpha_Type is kOpaque_SkAlphaType, dst.alphaType() must match. If Image Color_Space is nullptr, dst.colorSpace() must match. Returns false if pixel conversion is not possible.
srcX and srcY may be negative to copy only top or left of source. Returns false if width() or height() is zero or negative. Returns false if abs(srcX) >= Image width(), or if abs(srcY) >= Image height().
If cachingHint is kAllow_CachingHint, pixels may be retained locally. If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache.
true if pixels are copied to dst
scalePixels SkBitmap::readPixels SkPixmap::readPixels SkCanvas::readPixels SkSurface::readPixels
Copies SkImage to dst, scaling pixels to fit dst.width() and dst.height(), and converting pixels to match dst.colorType() and dst.alphaType(). Returns true if pixels are copied. Returns false if dst.addr() is nullptr, or dst.rowBytes() is less than dst SkImageInfo::minRowBytes.
Pixels are copied only if pixel conversion is possible. If SkImage SkColorType is kGray_8_SkColorType, or kAlpha_8_SkColorType; dst.colorType() must match. If SkImage SkColorType is kGray_8_SkColorType, dst.colorSpace() must match. If SkImage SkAlphaType is kOpaque_SkAlphaType, dst.alphaType() must match. If SkImage SkColorSpace is nullptr, dst.colorSpace() must match. Returns false if pixel conversion is not possible.
Scales the image, with filterQuality, to match dst.width() and dst.height(). filterQuality kNone_SkFilterQuality is fastest, typically implemented with nearest neighbor filter. kLow_SkFilterQuality is typically implemented with bilerp filter. kMedium_SkFilterQuality is typically implemented with bilerp filter, and mip-map filter when size is reduced. kHigh_SkFilterQuality is slowest, typically implemented with bicubic filter.
If cachingHint is kAllow_CachingHint, pixels may be retained locally. If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache.
kMedium_SkFilterQuality, kHigh_SkFilterQuality
true if pixels are scaled to fit dst
SkCanvas::drawImage readPixels SkPixmap::scalePixels
Encodes SkImage pixels, returning result as SkData.
Returns nullptr if encoding fails, or if encodedImageFormat is not supported.
SkImage encoding in a format requires both building with one or more of: SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY; and platform support for the encoded format.
If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encodedImageFormat can additionally be one of: SkEncodedImageFormat::kICO, SkEncodedImageFormat::kBMP, SkEncodedImageFormat::kGIF.
quality is a platform and format specific metric trading off size and encoding error. When used, quality equaling 100 encodes with the least error. quality may be ignored by the encoder.
SkEncodedImageFormat::kWEBP
encoded SkImage, or nullptr
refEncodedData MakeFromEncoded
Encodes SkImage pixels, returning result as SkData. Returns existing encoded data if present; otherwise, SkImage is encoded with SkEncodedImageFormat::kPNG. Skia must be built with SK_HAS_PNG_LIBRARY to encode SkImage.
Returns nullptr if existing encoded data is missing or invalid, and encoding fails.
encoded SkImage, or nullptr
refEncodedData MakeFromEncoded
Returns encoded SkImage pixels as SkData, if SkImage was created from supported encoded stream format. Platform support for formats vary and may require building with one or more of: SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY.
Returns nullptr if SkImage contents are not encoded.
encoded SkImage, or nullptr
encodeToData MakeFromEncoded
Returns subset of SkImage. subset must be fully contained by SkImage dimensions(). The implementation may share pixels, or may copy them.
Returns nullptr if subset is empty, or subset is not contained by bounds, or pixels in SkImage could not be read or copied.
partial or full SkImage, or nullptr
MakeFromEncoded
Returns SkImage backed by GPU texture associated with context. Returned SkImage is compatible with SkSurface created with dstColorSpace. The returned SkImage respects mipMapped setting; if mipMapped equals GrMipMapped::kYes, the backing texture allocates mip map levels. Returns original SkImage if context and dstColorSpace match and mipMapped is compatible with backing GPU texture.
Returns nullptr if context is nullptr, or if SkImage was created with another GrContext.
created SkImage, or nullptr
MakeFromTexture
Returns raster image or lazy image. Copies SkImage backed by GPU texture into CPU memory if needed. Returns original SkImage if decoded in raster bitmap, or if encoded in a stream.
Returns nullptr if backed by GPU texture and copy fails.
raster image, lazy image, or nullptr
makeTextureImage makeRasterImage MakeBackendTextureFromSkImage
Returns raster image. Copies SkImage backed by GPU texture into CPU memory, or decodes SkImage from lazy image. Returns original SkImage if decoded in raster bitmap.
Returns nullptr if copy, decode, or pixel read fails.
raster image, or nullptr
isTextureBacked isLazyGenerated MakeFromRaster
Creates filtered SkImage. filter processes original SkImage, potentially changing color, position, and size. subset is the bounds of original SkImage processed by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset is required storage for the actual bounds of the filtered SkImage. offset is required storage for translation of returned SkImage.
Returns nullptr if SkImage could not be created. If nullptr is returned, outSubset and offset are undefined.
Useful for animation of SkImageFilter that varies size from frame to frame. Returned SkImage is created larger than required by filter so that GPU texture can be reused with different sized effects. outSubset describes the valid bounds of GPU texture returned. offset translates the returned SkImage to keep subsequent animation frames aligned with respect to each other.
filtered SkImage, or nullptr
makeShader SkPaint::setImageFilter
BackendTextureReleaseProc
Defines a callback function, taking one parameter of type GrBackendTexture with no return value. Function is called when back-end texture is to be released.
Creates a GrBackendTexture from the provided SkImage. Returns true and stores result in backendTexture and backendTextureReleaseProc if texture is created; otherwise, returns false and leaves backendTexture and backendTextureReleaseProc unmodified.
Call backendTextureReleaseProc after deleting backendTexture. backendTextureReleaseProc cleans up auxiliary data related to returned backendTexture. The caller must delete returned backendTexture after use.
If SkImage is both texture backed and singly referenced, image is returned in backendTexture without conversion or making a copy. SkImage is singly referenced if its was transferred solely using std::move().
If SkImage is not texture backed, returns texture with SkImage contents.
true if back-end texture was created
MakeFromTexture makeTextureImage
Returns true if SkImage is backed by an image-generator or other service that creates and caches its pixels or texture on-demand.
true if SkImage is created as needed
isTextureBacked makeNonTextureImage
Creates SkImage in target SkColorSpace. Returns nullptr if SkImage could not be created.
Returns original SkImage if it is in target SkColorSpace. Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace. If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB.
created SkImage in target SkColorSpace
MakeFromPicture MakeFromTexture