pub type OrderedFontMgr = RCHandle<SkOrderedFontMgr>;Aliased Type§
pub struct OrderedFontMgr(/* private fields */);Implementations§
Methods from Deref<Target = FontMgr>§
Sourcepub fn to_a_color_mode(&self) -> Option<(Color, BlendMode)>
pub fn to_a_color_mode(&self) -> Option<(Color, BlendMode)>
If the filter can be represented by a source color plus Mode, this
returns the color and mode appropriately.
If not, this returns None and ignores the parameters.
Sourcepub fn to_a_color_matrix(&self) -> Option<[scalar; 20]>
pub fn to_a_color_matrix(&self) -> Option<[scalar; 20]>
If the filter can be represented by a 5x4 matrix, this
returns the matrix appropriately.
If not, this returns None and ignores the parameter.
Sourcepub fn is_alpha_unchanged(&self) -> bool
pub fn is_alpha_unchanged(&self) -> bool
Returns true if the filter is guaranteed to never change the alpha of a color it filters.
pub fn filter_color(&self, color: impl Into<Color>) -> Color
Sourcepub fn filter_color4f(
&self,
color: impl Into<Color4f>,
src_color_space: Option<&ColorSpace>,
dst_color_space: Option<&ColorSpace>,
) -> Color4f
pub fn filter_color4f( &self, color: impl Into<Color4f>, src_color_space: Option<&ColorSpace>, dst_color_space: Option<&ColorSpace>, ) -> Color4f
Converts the src color (in src colorspace), into the dst colorspace, then applies this filter to it, returning the filtered color in the dst colorspace.
Sourcepub fn composed(&self, inner: impl Into<ColorFilter>) -> Option<Self>
pub fn composed(&self, inner: impl Into<ColorFilter>) -> Option<Self>
Construct a color filter whose effect is to first apply the inner filter and then apply this filter, applied to the output of the inner filter.
result = this(inner(…))
Sourcepub fn with_working_color_space(
&self,
color_space: impl Into<ColorSpace>,
) -> Option<Self>
pub fn with_working_color_space( &self, color_space: impl Into<ColorSpace>, ) -> Option<Self>
Return a color filter that will compute this filter in a specific color space. By default all filters operate in the destination (surface) color space. This allows filters like Blend and Matrix, or runtime color filters to perform their math in a known space.
pub fn to_xyzd50_hash(&self) -> XYZD50Hash
pub fn with_linear_gamma(&self) -> Self
pub fn with_srgb_gamma(&self) -> Self
pub fn with_color_spin(&self) -> Self
pub fn is_srgb(&self) -> bool
pub fn serialize(&self) -> Data
pub fn transfer_fn(&self) -> ColorSpaceTransferFn
pub fn inv_transfer_fn(&self) -> ColorSpaceTransferFn
pub fn transfer_fn_hash(&self) -> u32
pub fn hash(&self) -> u64
pub fn alpha_table(&self) -> &[u8; 256]
pub fn red_table(&self) -> &[u8; 256]
pub fn green_table(&self) -> &[u8; 256]
pub fn blue_table(&self) -> &[u8; 256]
pub fn length(&self) -> scalar
pub fn pos_tan(&self, distance: scalar) -> Option<(Point, Vector)>
pub fn get_matrix( &self, distance: scalar, flags: impl Into<Option<MatrixFlags>>, ) -> Option<Matrix>
pub fn segment( &self, start_d: scalar, stop_d: scalar, path_builder: &mut PathBuilder, start_with_move_to: bool, ) -> bool
pub fn is_closed(&self) -> bool
pub fn verbs(&self) -> ForwardVerbIterator<'_> ⓘ
pub fn size(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn as_bytes(&self) -> &[u8] ⓘ
pub fn copy_range(&self, offset: usize, buffer: &mut [u8]) -> &Self
pub fn is_empty(&self) -> bool
pub fn count(&self) -> usize
pub fn at_size(&self, index: usize) -> usize
pub fn at(&self, index: usize) -> &[u8] ⓘ
pub unsafe fn at_t<T: Copy>(&self, index: usize) -> &[T]
pub fn at_str(&self, index: usize) -> &CStr
pub fn iter(&self) -> Iter<'_> ⓘ
pub fn count_families(&self) -> usize
pub fn family_name(&self, index: usize) -> String
pub fn family_names(&self) -> impl Iterator<Item = String> + use<'_>
pub fn new_styleset(&self, index: usize) -> FontStyleSet
pub fn new_style_set(&self, index: usize) -> FontStyleSet
pub fn match_family(&self, family_name: impl AsRef<str>) -> FontStyleSet
pub fn match_family_style( &self, family_name: impl AsRef<str>, style: FontStyle, ) -> Option<Typeface>
pub fn match_family_style_character( &self, family_name: impl AsRef<str>, style: FontStyle, bcp_47: &[&str], character: Unichar, ) -> Option<Typeface>
pub fn match_face_style( &self, _typeface: impl AsRef<Typeface>, _style: FontStyle, ) -> !
pub fn new_from_data( &self, bytes: &[u8], ttc_index: impl Into<Option<usize>>, ) -> Option<Typeface>
pub fn legacy_make_typeface<'a>( &self, family_name: impl Into<Option<&'a str>>, style: FontStyle, ) -> Option<Typeface>
Sourcepub fn image_info(&self) -> &ImageInfo
pub fn image_info(&self) -> &ImageInfo
Sourcepub fn dimensions(&self) -> ISize
pub fn dimensions(&self) -> ISize
Returns ISize { width(), height() }.
Returns: integral size of width() and height()
Sourcepub fn bounds(&self) -> IRect
pub fn bounds(&self) -> IRect
Returns IRect { 0, 0, width(), height() }.
Returns: integral rectangle from origin to width() and height()
Sourcepub fn alpha_type(&self) -> AlphaType
pub fn alpha_type(&self) -> AlphaType
Sourcepub fn color_type(&self) -> ColorType
pub fn color_type(&self) -> ColorType
Returns ColorType if known; otherwise, returns ColorType::Unknown.
Sourcepub fn color_space(&self) -> Option<ColorSpace>
pub fn color_space(&self) -> Option<ColorSpace>
Returns a smart pointer to ColorSpace, the range of colors, associated with
Image. The smart pointer tracks the number of objects sharing this
ColorSpace reference so the memory is released when the owners destruct.
The returned ColorSpace is immutable.
ColorSpace returned was passed to an Image constructor,
or was parsed from encoded data. ColorSpace returned may be ignored when Image
is drawn, depending on the capabilities of the crate::Surface receiving the drawing.
Returns: ColorSpace in Image, or None, wrapped in a smart pointer
Sourcepub fn is_alpha_only(&self) -> bool
pub fn is_alpha_only(&self) -> bool
Returns true if Image pixels represent transparency only. If true, each pixel
is packed in 8 bits as defined by ColorType::Alpha8.
Returns: true if pixels represent a transparency mask
Sourcepub fn is_opaque(&self) -> bool
pub fn is_opaque(&self) -> bool
Returns true if pixels ignore their alpha value and are treated as fully opaque.
Returns: true if AlphaType is AlphaType::Opaque
Sourcepub fn to_shader<'a>(
&self,
tile_modes: impl Into<Option<(TileMode, TileMode)>>,
sampling: impl Into<SamplingOptions>,
local_matrix: impl Into<Option<&'a Matrix>>,
) -> Option<Shader>
pub fn to_shader<'a>( &self, tile_modes: impl Into<Option<(TileMode, TileMode)>>, sampling: impl Into<SamplingOptions>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<Shader>
Make a shader with the specified tiling and mipmap sampling.
Sourcepub fn to_raw_shader<'a>(
&self,
tile_modes: impl Into<Option<(TileMode, TileMode)>>,
sampling: impl Into<SamplingOptions>,
local_matrix: impl Into<Option<&'a Matrix>>,
) -> Option<Shader>
pub fn to_raw_shader<'a>( &self, tile_modes: impl Into<Option<(TileMode, TileMode)>>, sampling: impl Into<SamplingOptions>, local_matrix: impl Into<Option<&'a Matrix>>, ) -> Option<Shader>
to_raw_shader functions like to_shader, but for images that contain non-color data.
This includes images encoding things like normals, material properties (eg, roughness),
heightmaps, or any other purely mathematical data that happens to be stored in an image.
These types of images are useful with some programmable shaders (see: crate::RuntimeEffect).
Raw image shaders work like regular image shaders (including filtering and tiling), with a few major differences:
- No color space transformation is ever applied (the color space of the image is ignored).
- Images with an alpha type of
Unpremulare not automatically premultiplied. - Bicubic filtering is not supported. If
SamplingOptions::use_cubicistrue, these factories will returnNone.
Sourcepub fn peek_pixels(&self) -> Option<Pixmap<'_>>
pub fn peek_pixels(&self) -> Option<Pixmap<'_>>
Copies Image pixel address, row bytes, and ImageInfo to pixmap, if address
is available, and returns true. If pixel address is not available, return
false and leave pixmap unchanged.
pixmapstorage for pixel state if pixels are readable; otherwise, ignored
Returns: true if Image has direct access to pixels
Sourcepub fn is_texture_backed(&self) -> bool
pub fn is_texture_backed(&self) -> bool
Sourcepub fn texture_size(&self) -> usize
pub fn texture_size(&self) -> usize
Returns an approximation of the amount of texture memory used by the image. Returns zero if the image is not texture backed or if the texture has an external format.
Sourcepub fn is_valid(&self, recorder: Option<&mut dyn Recorder>) -> bool
pub fn is_valid(&self, recorder: Option<&mut dyn Recorder>) -> bool
Returns true if Image can be drawn on either raster surface or GPU surface.
If recorder is None, tests if SkImage draws on raster surface;
otherwise, tests if SkImage draws on the associated GPU surface.
Image backed by GPU texture may become invalid if associated context is
invalid. lazy image may be invalid and may not draw to raster surface or
GPU surface or both.
contextGPU context
Returns: true if Image can be drawn
Sourcepub fn make_scaled(
&self,
info: &ImageInfo,
scaling: impl Into<SamplingOptions>,
) -> Option<Image>
pub fn make_scaled( &self, info: &ImageInfo, scaling: impl Into<SamplingOptions>, ) -> Option<Image>
Create a new image by copying this image and scaling to fit the ImageInfo’s dimensions
and converting the pixels into the ImageInfo’s crate::ColorInfo.
This is done retaining the domain (backend) of the image (e.g. gpu, raster).
Returns None if the requested crate::ColorInfo is not supported, its dimensions are out
of range.
Sourcepub fn flush<'a>(
&self,
context: &mut DirectContext,
flush_info: impl Into<Option<&'a FlushInfo>>,
) -> SemaphoresSubmitted
👎Deprecated since 0.63.0: use gpu::DirectContext::flush()
pub fn flush<'a>( &self, context: &mut DirectContext, flush_info: impl Into<Option<&'a FlushInfo>>, ) -> SemaphoresSubmitted
Sourcepub fn flush_with_info(
&self,
context: &mut DirectContext,
flush_info: &FlushInfo,
) -> SemaphoresSubmitted
👎Deprecated since 0.46.0: use gpu::DirectContext::flush()
pub fn flush_with_info( &self, context: &mut DirectContext, flush_info: &FlushInfo, ) -> SemaphoresSubmitted
Flushes any pending uses of texture-backed images in the GPU backend. If the image is not
texture-backed (including promise texture images) or if the gpu::DirectContext does not
have the same context ID as the context backing the image then this is a no-op.
If the image was not used in any non-culled draws in the current queue of work for the
passed gpu::DirectContext then this is a no-op unless the gpu::FlushInfo contains semaphores or
a finish proc. Those are respected even when the image has not been used.
contextthe context on which to flush pending usages of the image.infoflush options
Sourcepub fn flush_and_submit(&self, context: &mut DirectContext)
👎Deprecated since 0.63.0: use gpu::DirectContext::flush_and_submit()
pub fn flush_and_submit(&self, context: &mut DirectContext)
Version of flush() that uses a default gpu::FlushInfo. Also submits the flushed work to the
GPU.
Sourcepub fn backend_texture(
&self,
flush_pending_gr_context_io: bool,
) -> Option<(BackendTexture, SurfaceOrigin)>
👎Deprecated since 0.63.0: use gpu::images::get_backend_texture_from_image()
pub fn backend_texture( &self, flush_pending_gr_context_io: bool, ) -> Option<(BackendTexture, SurfaceOrigin)>
Retrieves the back-end texture. If Image has no back-end texture, Noneis returned.
If flush_pending_gr_context_io is true, completes deferred I/O operations.
If origin in not None, copies location of content drawn into Image.
flush_pending_gr_context_ioflag to flush outstanding requests
Returns: back-end API texture handle; invalid on failure
Sourcepub fn read_pixels_with_context<'a, P>(
&self,
context: impl Into<Option<&'a mut DirectContext>>,
dst_info: &ImageInfo,
pixels: &mut [P],
dst_row_bytes: usize,
src: impl Into<IPoint>,
caching_hint: CachingHint,
) -> bool
pub fn read_pixels_with_context<'a, P>( &self, context: impl Into<Option<&'a mut DirectContext>>, dst_info: &ImageInfo, pixels: &mut [P], dst_row_bytes: usize, src: impl Into<IPoint>, caching_hint: CachingHint, ) -> bool
Copies crate::Rect of pixels from Image to dst_pixels. Copy starts at offset (src_x, src_y),
and does not exceed Image (width(), height()).
Graphite has deprecated this API in favor of the equivalent asynchronous API on
skgpu::graphite::Context (with an optional explicit synchronization).
dst_info specifies width, height, ColorType, AlphaType, and ColorSpace of
destination. dst_row_bytes specifies the gap from one destination row to the next.
Returns true if pixels are copied. Returns false if:
dst_info.addr()equalsNonedst_row_bytesis less thandst_info.min_row_bytes()crate::PixelRefisNone
Pixels are copied only if pixel conversion is possible. If Image ColorType is
ColorType::Gray8, or ColorType::Alpha8; dst_info.color_type() must match.
If Image ColorType is ColorType::Gray8, dst_info.color_space() must match.
If Image AlphaType is AlphaType::Opaque, dst_info.alpha_type() must
match. If Image ColorSpace is None, dst_info.color_space() must match. Returns
false if pixel conversion is not possible.
src_x and src_y 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(src_x) >= Image width(), or if abs(src_y) >= Image height().
If caching_hint is CachingHint::Allow, pixels may be retained locally.
If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.
contextthegpu::DirectContextin play, if it existsdst_infodestination width, height,ColorType,AlphaType,ColorSpacedst_pixelsdestination pixel storagedst_row_bytesdestination row lengthsrc_xcolumn index whose absolute value is less thanwidth()src_yrow index whose absolute value is less thanheight()caching_hintwhether the pixels should be cached locally
Returns: true if pixels are copied to dst_pixels
Sourcepub fn read_pixels_to_pixmap_with_context<'a>(
&self,
context: impl Into<Option<&'a mut DirectContext>>,
dst: &Pixmap<'_>,
src: impl Into<IPoint>,
caching_hint: CachingHint,
) -> bool
pub fn read_pixels_to_pixmap_with_context<'a>( &self, context: impl Into<Option<&'a mut DirectContext>>, dst: &Pixmap<'_>, src: impl Into<IPoint>, caching_hint: CachingHint, ) -> bool
Copies a crate::Rect of pixels from Image to dst. Copy starts at (src_x, src_y), and
does not exceed Image (width(), height()).
Graphite has deprecated this API in favor of the equivalent asynchronous API on
skgpu::graphite::Context (with an optional explicit synchronization).
dst specifies width, height, ColorType, AlphaType, ColorSpace, pixel storage,
and row bytes of destination. dst.row_bytes() specifics the gap from one destination
row to the next. Returns true if pixels are copied. Returns false if:
- dst pixel storage equals
None - dst.
row_bytesis less thanImageInfo::min_row_bytes crate::PixelRefisNone
Pixels are copied only if pixel conversion is possible. If Image ColorType is
ColorType::Gray8, or ColorType::Alpha8; dst.color_type() must match.
If Image ColorType is ColorType::Gray8, dst.color_space() must match.
If Image AlphaType is AlphaType::Opaque, dst.alpha_type() must
match. If Image ColorSpace is None, dst.color_space() must match. Returns
false if pixel conversion is not possible.
src_x and src_y 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(src_x) >= Image width(), or if abs(src_y) >= Image height().
If caching_hint is CachingHint::Allow, pixels may be retained locally.
If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.
contextthegpu::DirectContextin play, if it existsdstdestinationPixmap:ImageInfo, pixels, row bytessrc_xcolumn index whose absolute value is less thanwidth()src_yrow index whose absolute value is less thanheight()caching_hintwhether the pixels should be cachedlocally_z
Returns: true if pixels are copied to dst
Sourcepub fn read_pixels<P>(
&self,
dst_info: &ImageInfo,
pixels: &mut [P],
dst_row_bytes: usize,
src: impl Into<IPoint>,
caching_hint: CachingHint,
) -> bool
pub fn read_pixels<P>( &self, dst_info: &ImageInfo, pixels: &mut [P], dst_row_bytes: usize, src: impl Into<IPoint>, caching_hint: CachingHint, ) -> bool
Sourcepub unsafe fn read_pixels_to_pixmap(
&self,
dst: &Pixmap<'_>,
src: impl Into<IPoint>,
caching_hint: CachingHint,
) -> bool
pub unsafe fn read_pixels_to_pixmap( &self, dst: &Pixmap<'_>, src: impl Into<IPoint>, caching_hint: CachingHint, ) -> bool
Sourcepub fn scale_pixels(
&self,
dst: &Pixmap<'_>,
sampling: impl Into<SamplingOptions>,
caching_hint: impl Into<Option<CachingHint>>,
) -> bool
pub fn scale_pixels( &self, dst: &Pixmap<'_>, sampling: impl Into<SamplingOptions>, caching_hint: impl Into<Option<CachingHint>>, ) -> bool
Copies Image to dst, scaling pixels to fit dst.width() and dst.height(), and
converting pixels to match dst.color_type() and dst.alpha_type(). Returns true if
pixels are copied. Returns false if dst.addr() is None, or dst.row_bytes() is
less than dst ImageInfo::min_row_bytes.
Pixels are copied only if pixel conversion is possible. If Image ColorType is
ColorType::Gray8, or ColorType::Alpha8; dst.color_type() must match.
If Image ColorType is ColorType::Gray8, dst.color_space() must match.
If Image AlphaType is AlphaType::Opaque, dst.alpha_type() must
match. If Image ColorSpace is None, dst.color_space() must match. Returns
false if pixel conversion is not possible.
If caching_hint is CachingHint::Allow, pixels may be retained locally.
If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.
Returns: true if pixels are scaled to fit dst
Sourcepub fn encode_to_data_with_context(
&self,
context: impl Into<Option<DirectContext>>,
image_format: EncodedImageFormat,
quality: impl Into<Option<u32>>,
) -> Option<Data>
👎Deprecated since 0.63.0: Use encode
pub fn encode_to_data_with_context( &self, context: impl Into<Option<DirectContext>>, image_format: EncodedImageFormat, quality: impl Into<Option<u32>>, ) -> Option<Data>
Encodes Image pixels, returning result as Data.
Returns None if encoding fails, or if encoded_image_format is not supported.
Image encoding in a format requires both building with one or more of:
SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP; and platform support
for the encoded format.
If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encoded_image_format can
additionally be one of: EncodedImageFormat::ICO, EncodedImageFormat::BMP,
EncodedImageFormat::GIF.
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.
context- thegpu::DirectContextin play, if it exists; can beNoneencoded_image_format- one of:EncodedImageFormat::JPEG,EncodedImageFormat::PNG,EncodedImageFormat::WEBPquality- encoder specific metric with 100 equaling best
Returns: encoded Image, or None
Sourcepub fn encode_to_data(&self, image_format: EncodedImageFormat) -> Option<Data>
👎Deprecated since 0.63.0: Support for encoding GPU backed images without a context was removed, use encode_to_data_with_context instead
pub fn encode_to_data(&self, image_format: EncodedImageFormat) -> Option<Data>
encode_to_data_with_context insteadSourcepub fn encode_to_data_with_quality(
&self,
image_format: EncodedImageFormat,
quality: u32,
) -> Option<Data>
👎Deprecated since 0.63.0: Support for encoding GPU backed images without a context was removed, use encode_to_data_with_context instead
pub fn encode_to_data_with_quality( &self, image_format: EncodedImageFormat, quality: u32, ) -> Option<Data>
encode_to_data_with_context insteadEncodes Image pixels, returning result as Data.
Returns None if encoding fails, or if encoded_image_format is not supported.
Image encoding in a format requires both building with one or more of:
SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP; and platform support
for the encoded format.
If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encoded_image_format can
additionally be one of: EncodedImageFormat::ICO, EncodedImageFormat::BMP,
EncodedImageFormat::GIF.
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.
encoded_image_formatone of:EncodedImageFormat::JPEG,EncodedImageFormat::PNG,EncodedImageFormat::WEBPqualityencoder specific metric with 100 equaling best
Returns: encoded Image, or None
Sourcepub fn encoded_data(&self) -> Option<Data>
pub fn encoded_data(&self) -> Option<Data>
Returns encoded Image pixels as Data, if Image was created from supported
encoded stream format. Platform support for formats vary and may require building
with one or more of: SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP.
Returns None if Image contents are not encoded.
Returns: encoded Image, or None
Sourcepub fn make_subset(
&self,
recorder: Option<&mut dyn Recorder>,
subset: impl AsRef<IRect>,
required_properties: RequiredProperties,
) -> Option<Image>
pub fn make_subset( &self, recorder: Option<&mut dyn Recorder>, subset: impl AsRef<IRect>, required_properties: RequiredProperties, ) -> Option<Image>
Returns subset of this image.
Returns None if any of the following are true:
- Subset is empty
- Subset is not contained inside the image’s bounds
- Pixels in the image could not be read or copied
- This image is texture-backed and the provided context is null or does not match the source image’s context.
If the source image was texture-backed, the resulting image will be texture-backed also. Otherwise, the returned image will be raster-backed.
recorder- the recorder of the source image (Noneis ok if the source image was texture-backed).subset- bounds of returnedImagerequired_properties- properties the returnedImagemust possess (e.g. mipmaps)
Returns: the subsetted image, or None
Sourcepub fn has_mipmaps(&self) -> bool
pub fn has_mipmaps(&self) -> bool
Returns true if the image has mipmap levels.
Sourcepub fn with_default_mipmaps(&self) -> Option<Image>
pub fn with_default_mipmaps(&self) -> Option<Image>
Returns an image with the same “base” pixels as the this image, but with mipmap levels automatically generated and attached.
Sourcepub fn new_texture_image(
&self,
context: &mut DirectContext,
mipmapped: Mipmapped,
) -> Option<Image>
pub fn new_texture_image( &self, context: &mut DirectContext, mipmapped: Mipmapped, ) -> Option<Image>
Sourcepub fn new_texture_image_budgeted(
&self,
direct_context: &mut DirectContext,
mipmapped: Mipmapped,
budgeted: Budgeted,
) -> Option<Image>
pub fn new_texture_image_budgeted( &self, direct_context: &mut DirectContext, mipmapped: Mipmapped, budgeted: Budgeted, ) -> Option<Image>
Returns Image backed by GPU texture associated with context. Returned Image is
compatible with crate::Surface created with dst_color_space. The returned Image respects
mipmapped setting; if mipmapped equals gpu::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. crate::Budgeted is ignored in this case.
Returns None if context is None, or if Image was created with another
gpu::DirectContext.
direct_contextthegpu::DirectContextin play, if it existsmipmappedwhether createdImagetexture must allocate mip map levelsbudgetedwhether to count a newly created texture for the returned image counts against the context’s budget.
Returns: created Image, or None
Sourcepub fn to_non_texture_image(&self) -> Option<Image>
👎Deprecated since 0.64.0: use make_non_texture_image()
pub fn to_non_texture_image(&self) -> Option<Image>
Returns raster image or lazy image. Copies Image backed by GPU texture into
CPU memory if needed. Returns original Image if decoded in raster bitmap,
or if encoded in a stream.
Returns None if backed by GPU texture and copy fails.
Returns: raster image, lazy image, or None
example: https://fiddle.skia.org/c/@Image_makeNonTextureImage
Sourcepub fn make_non_texture_image<'a>(
&self,
context: impl Into<Option<&'a mut DirectContext>>,
) -> Option<Image>
pub fn make_non_texture_image<'a>( &self, context: impl Into<Option<&'a mut DirectContext>>, ) -> Option<Image>
Returns raster image or lazy image. Copies Image backed by GPU texture into
CPU memory if needed. Returns original Image if decoded in raster bitmap,
or if encoded in a stream.
Returns None if backed by GPU texture and copy fails.
Returns: raster image, lazy image, or None
example: https://fiddle.skia.org/c/@Image_makeNonTextureImage
Sourcepub fn to_raster_image(
&self,
caching_hint: impl Into<Option<CachingHint>>,
) -> Option<Image>
👎Deprecated since 0.64.0: use make_raster_image()
pub fn to_raster_image( &self, caching_hint: impl Into<Option<CachingHint>>, ) -> Option<Image>
Returns raster image. Copies Image backed by GPU texture into CPU memory,
or decodes Image from lazy image. Returns original Image if decoded in
raster bitmap.
Returns None if copy, decode, or pixel read fails.
If caching_hint is CachingHint::Allow, pixels may be retained locally.
If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.
Returns: raster image, or None
Sourcepub fn make_raster_image<'a>(
&self,
context: impl Into<Option<&'a mut DirectContext>>,
caching_hint: impl Into<Option<CachingHint>>,
) -> Option<Image>
pub fn make_raster_image<'a>( &self, context: impl Into<Option<&'a mut DirectContext>>, caching_hint: impl Into<Option<CachingHint>>, ) -> Option<Image>
Returns raster image. Copies Image backed by GPU texture into CPU memory,
or decodes Image from lazy image. Returns original Image if decoded in
raster bitmap.
Returns None if copy, decode, or pixel read fails.
If caching_hint is CachingHint::Allow, pixels may be retained locally.
If caching_hint is CachingHint::Disallow, pixels are not added to the local cache.
Returns: raster image, or None
Sourcepub fn new_with_filter(
&self,
_context: Option<&mut RecordingContext>,
filter: &ImageFilter,
clip_bounds: impl Into<IRect>,
subset: impl Into<IRect>,
) -> Option<(Image, IRect, IPoint)>
👎Deprecated since 0.67.0: use images::make_with_filter()
pub fn new_with_filter( &self, _context: Option<&mut RecordingContext>, filter: &ImageFilter, clip_bounds: impl Into<IRect>, subset: impl Into<IRect>, ) -> Option<(Image, IRect, IPoint)>
Creates filtered Image. filter processes original Image, potentially changing
color, position, and size. subset is the bounds of original Image processed
by filter. clip_bounds is the expected bounds of the filtered Image. out_subset
is required storage for the actual bounds of the filtered Image. offset is
required storage for translation of returned Image.
Returns None if Image could not be created or if the recording context provided doesn’t
match the GPU context in which the image was created. If None is returned, out_subset
and offset are undefined.
Useful for animation of ImageFilter that varies size from frame to frame.
Returned Image is created larger than required by filter so that GPU texture
can be reused with different sized effects. out_subset describes the valid bounds
of GPU texture returned. offset translates the returned Image to keep subsequent
animation frames aligned with respect to each other.
contextthegpu::RecordingContextin play - if it existsfilterhowImageis sampled when transformedsubsetbounds ofImageprocessed by filterclip_boundsexpected bounds of filteredImageout_subsetstorage for returnedImageboundsoffsetstorage for returnedImagetranslation
Returns: filtered Image, or None
Sourcepub fn is_lazy_generated(&self) -> bool
pub fn is_lazy_generated(&self) -> bool
Returns true if Image is backed by an image-generator or other service that creates
and caches its pixels or texture on-demand.
Returns: true if Image is created as needed
example: https://fiddle.skia.org/c/@Image_isLazyGenerated_a example: https://fiddle.skia.org/c/@Image_isLazyGenerated_b
Sourcepub fn make_color_space(
&self,
recorder: Option<&mut dyn Recorder>,
color_space: impl Into<Option<ColorSpace>>,
required_properties: RequiredProperties,
) -> Option<Image>
pub fn make_color_space( &self, recorder: Option<&mut dyn Recorder>, color_space: impl Into<Option<ColorSpace>>, required_properties: RequiredProperties, ) -> Option<Image>
Creates Image in target ColorSpace.
Returns None if Image could not be created.
Returns original Image if it is in target ColorSpace.
Otherwise, converts pixels from Image ColorSpace to target ColorSpace.
If Image color_space() returns None, Image ColorSpace is assumed to be s_rgb.
If this image is graphite-backed, the recorder parameter is required.
target_color_space-ColorSpacedescribing color range of returnedImagerecorder- The Recorder in which to create the new imagerequired_properties- properties the returnedImagemust possess (e.g. mipmaps)
Returns: created Image in target ColorSpace
Sourcepub fn reinterpret_color_space(
&self,
new_color_space: impl Into<ColorSpace>,
) -> Option<Image>
pub fn reinterpret_color_space( &self, new_color_space: impl Into<ColorSpace>, ) -> Option<Image>
Creates a new Image identical to this one, but with a different ColorSpace.
This does not convert the underlying pixel data, so the resulting image will draw
differently.
pub fn filter_bounds<'a>( &self, src: impl AsRef<IRect>, ctm: &Matrix, map_direction: MapDirection, input_rect: impl Into<Option<&'a IRect>>, ) -> IRect
pub fn color_filter_node(&self) -> Option<ColorFilter>
pub fn to_a_color_filter(&self) -> Option<ColorFilter>
pub fn count_inputs(&self) -> usize
pub fn input(&self, i: usize) -> Option<ImageFilter>
pub fn get_input(&self, i: usize) -> Option<ImageFilter>
pub fn inputs(&self) -> impl Iterator<Item = Option<ImageFilter>> + use<'_>
pub fn compute_fast_bounds(&self, bounds: impl AsRef<Rect>) -> Rect
pub fn can_compute_fast_bounds(&self) -> bool
pub fn with_local_matrix(&self, matrix: &Matrix) -> Option<ImageFilter>
pub fn filter_path( &self, src: &Path, stroke_rec: &StrokeRec, cull_rect: impl AsRef<Rect>, ) -> Option<(PathBuilder, StrokeRec)>
pub fn filter_path_inplace( &self, dst: &mut PathBuilder, src: &Path, stroke_rec: &mut StrokeRec, cull_rect: impl AsRef<Rect>, ) -> bool
pub fn filter_path_inplace_with_matrix( &self, dst: &mut PathBuilder, src: &Path, stroke_rec: &mut StrokeRec, cull_rect: impl AsRef<Rect>, ctm: &Matrix, ) -> bool
pub fn needs_ctm(&self) -> bool
pub fn playback(&self, canvas: &Canvas)
pub fn cull_rect(&self) -> Rect
pub fn unique_id(&self) -> u32
pub fn serialize(&self) -> Data
pub fn approximate_op_count(&self) -> usize
pub fn approximate_op_count_nested( &self, nested: impl Into<Option<bool>>, ) -> usize
pub fn approximate_bytes_used(&self) -> usize
pub fn to_shader<'a, 'b>( &self, tm: impl Into<Option<(TileMode, TileMode)>>, mode: FilterMode, local_matrix: impl Into<Option<&'a Matrix>>, tile_rect: impl Into<Option<&'b Rect>>, ) -> Shader
pub fn dimensions(&self) -> ISize
pub fn width(&self) -> i32
pub fn height(&self) -> i32
pub unsafe fn pixels(&self) -> *mut c_void
pub fn row_bytes(&self) -> usize
pub fn generation_id(&self) -> u32
pub fn is_immutable(&self) -> bool
Sourcepub fn is_opaque(&self) -> bool
pub fn is_opaque(&self) -> bool
Returns true if the shader is guaranteed to produce only opaque
colors, subject to the crate::Paint using the shader to apply an opaque
alpha value. Subclasses should override this to allow some
optimizations.
Sourcepub fn image(&self) -> Option<(Image, Matrix, (TileMode, TileMode))>
pub fn image(&self) -> Option<(Image, Matrix, (TileMode, TileMode))>
Returns iff this shader is backed by a single Image.
If not, returns None.
pub fn is_a_image(&self) -> bool
Sourcepub fn with_local_matrix(&self, matrix: &Matrix) -> Self
pub fn with_local_matrix(&self, matrix: &Matrix) -> Self
Return a shader that will apply the specified local_matrix to this shader.
The specified matrix will be applied before any matrix associated with this shader.
Sourcepub fn with_color_filter(&self, color_filter: impl Into<ColorFilter>) -> Self
pub fn with_color_filter(&self, color_filter: impl Into<ColorFilter>) -> Self
Create a new shader that produces the same colors as invoking this shader and then applying the color filter.
Sourcepub fn with_working_color_space(
&self,
input_cs: impl Into<Option<ColorSpace>>,
output_cs: impl Into<Option<ColorSpace>>,
) -> Self
pub fn with_working_color_space( &self, input_cs: impl Into<Option<ColorSpace>>, output_cs: impl Into<Option<ColorSpace>>, ) -> Self
Return a shader that will compute this shader in a context such that any child shaders
return RGBA values converted to the input_cs colorspace.
It is then assumed that the RGBA values returned by this shader have been transformed into
output_cs by the shader being wrapped. By default, shaders are assumed to return values
in the destination colorspace and premultiplied. Using a different output_cs than input_cs
allows custom shaders to replace the color management Skia normally performs w/o forcing
authors to otherwise manipulate surface/image color info to avoid unnecessary or incorrect
work.
If the shader is not performing colorspace conversion but needs to operate in the input_cs
then it should have output_cs be the same as input_cs. Regardless of the output_cs here,
the RGBA values of the returned Shader are always converted from output_cs to the
destination surface color space.
A None input_cs is assumed to be the destination CS.
A None output_cs is assumed to be the input_cs.
Sourcepub fn width(&self) -> i32
pub fn width(&self) -> i32
Returns pixel count in each row; may be zero or greater.
Returns: number of pixel columns
Sourcepub fn height(&self) -> i32
pub fn height(&self) -> i32
Returns pixel row count; may be zero or greater.
Returns: number of pixel rows
Sourcepub fn image_info(&self) -> ImageInfo
pub fn image_info(&self) -> ImageInfo
Returns an ImageInfo describing the surface.
Sourcepub fn recording_context(&self) -> Option<RecordingContext>
pub fn recording_context(&self) -> Option<RecordingContext>
Returns the recording context being used by the Surface.
Returns: the recording context, if available; None otherwise
Sourcepub fn direct_context(&self) -> Option<DirectContext>
pub fn direct_context(&self) -> Option<DirectContext>
rust-skia helper, not in Skia
Sourcepub fn props(&self) -> &SurfaceProps
pub fn props(&self) -> &SurfaceProps
Returns SurfaceProps for surface.
Returns: LCD striping orientation and setting for device independent fonts