Functions
- Creates GPU-backed
Imagefrom the provided GPU texture associated with context. GPU texture must stay valid and unchanged untiltexture_release_procis called by Skia. Skia will calltexture_release_procwith the passed-inrelease_contextwhenImageis deleted or no longer refers to the texture. A non-nullImageis returned if format ofbackend_textureis recognized and supported. Recognized formats vary by GPU backend. Note: When using a DDL recording context,texture_release_procwill be called on the GPU thread after the DDL is played back on the direct context. - Creates a GPU-backed
Imagefrom pixmap. It is uploaded to GPU backend using context. CreatedImageis 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. WhenImageis no longer referenced, context releases texture memory asynchronously.ColorSpaceofImageis determined bypixmap.color_space().Imageis 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 andImageas returned in raster format if possible;Nonemay be returned. Recognized GPU formats vary by platform and GPU backend. - Retrieves the existing backend texture. If
Imageis not a Ganesh-backend texture image or otherwise does not have such a texture,falseis 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
Imagefrom compressed data. This method will return anImagerepresenting 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
Imagebacked by GPU texture associated with context. ReturnedImageis compatible withSurfacecreated withdst_color_space. The returnedImagerespects mipmapped setting; if mipmapped equalsMipmapped::Yes, the backing texture allocates mip map levels. The mipmapped parameter is effectively treated asNoif MIP maps are not supported by the GPU. Returns originalImageif 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. ReturnsNoneif context isNone, or ifImagewas created with anotherDirectContext. - Creates a GPU-backed
ImagefromYUVAPixmaps. The image will remain planar with each plane converted to a texture using the passedRecordingContext.YUVAPixmapshas aYUVAInfowhich specifies the transformation from YUV to RGB. TheColorSpaceof the resulting RGB values is specified byimage_color_space. This will be theColorSpacereported 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.YUVAPixmapsdoes not need to remain valid after this returns. - Creates a GPU-backed
ImagefromYUV[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.