#[repr(C)]pub struct ClipParamsGpu {
pub rect: [f32; 4],
pub radius: f32,
pub mode: u32,
pub _pad: u32,
pub _struct_pad: u32,
}Expand description
Uniform block for clip_alpha in WGSL (32 bytes, 16-byte aligned).
§Examples
use ailloli_ui_render_wgpu::clip::ClipParamsGpu;
assert_eq!(std::mem::size_of::<ClipParamsGpu>(), 32);Fields§
§rect: [f32; 4]Physical [x, y, width, height] bounding rectangle.
radius: f32Rounded-corner radius in physical pixels; zero for rectangles and no clip.
mode: u32Shader discriminator, one of MODE_NONE, MODE_RECT, or MODE_ROUND.
_pad: u32Explicit alignment padding; always zero.
_struct_pad: u32Struct tail padding (WGSL expects 32 bytes, not 28).
Implementations§
Source§impl ClipParamsGpu
impl ClipParamsGpu
Sourcepub const MODE_NONE: u32 = 0u32
pub const MODE_NONE: u32 = 0u32
Shader mode for an inactive clip.
§Examples
use ailloli_ui_render_wgpu::clip::ClipParamsGpu;
assert_eq!(ClipParamsGpu::MODE_NONE, 0);Sourcepub const MODE_RECT: u32 = 1u32
pub const MODE_RECT: u32 = 1u32
Shader mode for an axis-aligned rectangle.
§Examples
use ailloli_ui_render_wgpu::clip::ClipParamsGpu;
assert_eq!(ClipParamsGpu::MODE_RECT, 1);Sourcepub const MODE_ROUND: u32 = 2u32
pub const MODE_ROUND: u32 = 2u32
Shader mode for a rounded rectangle.
§Examples
use ailloli_ui_render_wgpu::clip::ClipParamsGpu;
assert_eq!(ClipParamsGpu::MODE_ROUND, 2);Sourcepub fn none() -> Self
pub fn none() -> Self
Creates the zeroed inactive uniform block.
§Examples
use ailloli_ui_render_wgpu::clip::ClipParamsGpu;
let params = ClipParamsGpu::none();
assert_eq!((params.mode, params.radius), (ClipParamsGpu::MODE_NONE, 0.0));Sourcepub fn from_shape(shape: &ClipShape, dpr: f32) -> Self
pub fn from_shape(shape: &ClipShape, dpr: f32) -> Self
Converts a logical clip shape to its physical-pixel shader parameters.
Every coordinate and the rounded radius are multiplied by dpr without
clamping. Callers are responsible for a finite positive scale.
§Examples
use ailloli_ui_core::{ClipShape, Rect};
use ailloli_ui_render_wgpu::clip::ClipParamsGpu;
let params = ClipParamsGpu::from_shape(
&ClipShape::Rect(Rect::new(1.0, 2.0, 3.0, 4.0)), 2.0);
assert_eq!(params.rect, [2.0, 4.0, 6.0, 8.0]);
assert_eq!(params.mode, ClipParamsGpu::MODE_RECT);Trait Implementations§
Source§impl Clone for ClipParamsGpu
impl Clone for ClipParamsGpu
Source§fn clone(&self) -> ClipParamsGpu
fn clone(&self) -> ClipParamsGpu
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClipParamsGpu
impl Debug for ClipParamsGpu
impl Copy for ClipParamsGpu
impl Pod for ClipParamsGpu
Auto Trait Implementations§
impl Freeze for ClipParamsGpu
impl RefUnwindSafe for ClipParamsGpu
impl Send for ClipParamsGpu
impl Sync for ClipParamsGpu
impl Unpin for ClipParamsGpu
impl UnwindSafe for ClipParamsGpu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more