Module images
Functions§
- Creates GPU-backed
Image
from the provided GPU texture associated with context. GPU texture must stay valid and unchanged untiltexture_release_proc
is called by Skia. Skia will calltexture_release_proc
with the passed-inrelease_context
whenImage
is deleted or no longer refers to the texture. A non-nullImage
is returned if format ofbackend_texture
is recognized and supported. Recognized formats vary by GPU backend. Note: When using a DDL recording context,texture_release_proc
will be called on the GPU thread after the DDL is played back on the direct context. - Creates a GPU-backed
Image
from pixmap. It is uploaded to GPU backend using context. CreatedImage
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. WhenImage
is no longer referenced, context releases texture memory asynchronously.ColorSpace
ofImage
is determined bypixmap.color_space()
.Image
is returned referring to GPU backend if context is notNone
, format of data is recognized and supported, and if context supports moving resources between contexts. Otherwise, pixmap pixel data is copied andImage
as returned in raster format if possible;None
may be returned. Recognized GPU formats vary by platform and GPU backend. - Retrieves the existing backend texture. If
Image
is not a Ganesh-backend texture image or otherwise does not have such a texture,false
is returned. Otherwise, returned will be set to the image’s texture. - Returns subset of this image as a texture-backed image.
- Creates a GPU-backed
Image
from compressed data. This method will return anImage
representing the compressed data. If the GPU doesn’t support the specified compression method, the data will be decompressed and then wrapped in a GPU-backed image. Note: one can query the supported compression formats viaRecordingContext::compressed_backend_format
. - Returns
Image
backed by GPU texture associated with context. ReturnedImage
is compatible withSurface
created withdst_color_space
. The returnedImage
respects mipmapped setting; if mipmapped equalsMipmapped::Yes
, the backing texture allocates mip map levels. The mipmapped parameter is effectively treated asNo
if MIP maps are not supported by the GPU. Returns originalImage
if the image is already texture-backed, the context matches, and mipmapped is compatible with the backing GPU texture. skgpu::Budgeted is ignored in this case. ReturnsNone
if context isNone
, or ifImage
was created with anotherDirectContext
. - Creates a GPU-backed
Image
fromYUVAPixmaps
. The image will remain planar with each plane converted to a texture using the passedRecordingContext
.YUVAPixmaps
has aYUVAInfo
which specifies the transformation from YUV to RGB. TheColorSpace
of the resulting RGB values is specified byimage_color_space
. This will be theColorSpace
reported by the image and when drawn the RGB values will be converted from this space into the destination space (if the destination is tagged). Currently, this is only supported using the GPU backend and will fail if context isNone
.YUVAPixmaps
does not need to remain valid after this returns. - Creates a GPU-backed
Image
fromYUV[A]
planar textures. This requires that the textures stay valid for the lifetime of the image. The ReleaseContext can be used to know when it is safe to either delete or overwrite the textures. If ReleaseProc is provided it is also called before return on failure.