Skip to main content

Image

Struct Image 

Source
pub struct Image(/* private fields */);
Expand description

An Image value, not yet erased to a view.

The same reason super::Shape exists: Image.resizable(_:_:) and .renderingMode(_:) are methods on Image that return an Image, so they are not view modifiers and an AnyView cannot be their receiver. An Image is one word, so it travels in a register both ways.

Implementations§

Source§

impl Image

Source

pub fn system(name: &str) -> Self

Image(systemName:)

Source

pub fn system_variable(name: &str, value: Option<f64>) -> Self

Image(systemName:variableValue:) — a symbol drawn at a fill level.

The Double? does not travel in a float register. It goes as its raw bits in an integer register with the tag in the next one, which is what the IR spells: (i64, ptr, i64, i8) for a String and an Optional<Double>.

Source

pub fn allowed_dynamic_range_high(self) -> Self

.allowedDynamicRange(_:) with .high.

Image.DynamicRange is a resilient struct, so its size is a run-time question and .high is handed back through x8 rather than in a register. The Optional wrapper is the struct’s own bytes in a buffer the optional’s size — zeroed, which is .some for a payload with spare inhabitants — and it travels by address with the image beside it.

Source

pub fn named(name: &str) -> Self

Image(_:) — a named asset from the main bundle’s catalogue.

Source

pub fn resizable(self, mode: ResizingMode) -> Self

.resizable(capInsets:resizingMode:), with the zero cap insets Swift source gets from the bare .resizable().

EdgeInsets is four CGFloats and nothing else, which makes it a homogeneous float aggregate: it travels in d0–d3 rather than by address. The resizing mode does not travel in a register, though — see Image::rendering_mode.

Source

pub fn interpolation(self, mode: Interpolation) -> Self

.interpolation(_:) — how the image is resampled when scaled.

The same argument convention as Image::resizable: the mode by address in x0, the image itself as a plain second argument in x1 rather than in x20, and the new image back in x0. Not what a method on a struct usually looks like, which is why it is read out of the IR rather than assumed.

Source

pub fn symbol_rendering_mode(self, mode: Option<SymbolRenderingMode>) -> Self

.symbolRenderingMode(_:) — the overload on Image, which returns Image.

Its View neighbour writes the environment and wraps the image in a ModifiedContent; Apple’s own listings reach this one, so a chain that went through the environment rendered the same and typed differently. Same shape as Image::rendering_mode: the mode is address-only and self is an ordinary second argument, not a swiftself.

Source

pub fn antialiased(self, on: bool) -> Self

.antialiased(_:)

Source

pub fn rendering_mode(self, mode: Option<TemplateRenderingMode>) -> Self

.renderingMode(_:)

Neither of these two takes its enum in a register, and neither takes self in x20. Image.TemplateRenderingMode is not @frozen, so its size is only known at run time and the argument is address-only; and the IR shows plain pointers rather than a swiftself, so the receiver is an ordinary second argument. Passing the case number in x0 and the image in x20 — which is what every view modifier in this crate wants — faults inside the runtime.

Source

pub fn view(self) -> ViewHandle

The image as a view.

Trait Implementations§

Source§

impl Clone for Image

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Image

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnsafeUnpin for Image

§

impl UnwindSafe for Image

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.