pub struct Window {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}Expand description
Canvas image window coordinates
Defines a rectangular window on the canvas to export the image from.
The window origin is defined by its the upper left corner.
§Basic operations
use planetarium::Window;
// Create a new rectangular window with origin at (0, 0).
let wnd1 = Window::new(128, 64);
// Move the window origin to (250, 150).
let wnd2 = wnd1.at(250, 150);
// Check the resulting string representation.
assert_eq!(wnd2.to_string(), "(250, 150)+(128, 64)");§Conversions
// From a tuple of tuples representing the origin coordinates
// and window dimensions
let wnd1 = Window::from(((100, 200), (128, 128)));
// Check the resulting string representation.
assert_eq!(wnd1.to_string(), "(100, 200)+(128, 128)");Fields§
§x: u32Window origin X coordinate
y: u32Window origin Y coordinate
w: u32Width in X direction
h: u32Height in Y direction
Implementations§
Trait Implementations§
impl Copy for Window
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
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
Mutably borrows from an owned value. Read more