Function texture_from_image
pub fn texture_from_image(
direct_context: &mut RCHandle<GrDirectContext>,
image: &RCHandle<SkImage>,
mipmapped: skgpu_Mipmapped,
budgeted: Budgeted,
) -> Option<RCHandle<SkImage>>
Expand description
Returns Image
backed by GPU texture associated with context. Returned Image
is
compatible with Surface
created with dst_color_space
. The returned Image
respects
mipmapped setting; if mipmapped equals Mipmapped::Yes
, the backing texture
allocates mip map levels.
The mipmapped parameter is effectively treated as No
if MIP maps are not supported by the
GPU.
Returns original Image
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.
Returns None
if context is None
, or if Image
was created with another
DirectContext
.
direct_context
- theDirectContext
in play, if it existsimage
- a non-null pointer to anImage
.mipmapped
- Whether createdImage
texture must allocate mip map levels. Defaults toNo
.budgeted
- Whether to count a newly created texture for the returned image counts against the context’s budget. Defaults toYes
.
Returns: created Image
, or None