Struct polystrip::pixel::PixelTranslator [−][src]
When constructed from a WindowTarget
, tracks the window’s size and provides methods which
convert between pixel space and screen space for that window.
Rectangles
The various rectangle methods defined on this struct output vertices in the following layout:
(0)---(1)
| |
(3)---(2)
Implementations
impl PixelTranslator
[src]
pub fn pixel_position(&self, x: i32, y: i32) -> Vector2
[src]
Converts a pixel value into an absolute screen space position. Doing arithmetic operations with absolute screen space
positions will not give expected values. See the pixel_offset
method to create screen space
offsets
pub fn pixel_offset(&self, x: i32, y: i32) -> Vector2
[src]
Converts a pixel value into a screen space offset.
pub fn colored_rect(&self, rect: Rect, color: Color) -> [ColorVertex; 4]
[src]
Converts a Rect
into a set of ColorVertex
es with the given Color
and height 0.0
.
pub fn textured_rect(&self, rect: Rect) -> [TextureVertex; 4]
[src]
Converts a Rect
into a set of TextureVertex
es with height 0.0
.
The texture will be scaled to fit entirely onto the Rect
.
pub fn texture_at(
&self,
texture: &Texture,
x: i32,
y: i32
) -> [TextureVertex; 4]
[src]
&self,
texture: &Texture,
x: i32,
y: i32
) -> [TextureVertex; 4]
Creates a set of TextureVertex
es with the width and height of the passed Texture
and height 0.0
.
pub fn texture_scaled(
&self,
texture: &Texture,
x: i32,
y: i32,
scale: f32
) -> [TextureVertex; 4]
[src]
&self,
texture: &Texture,
x: i32,
y: i32,
scale: f32
) -> [TextureVertex; 4]
Creates a set of TextureVertex
es with the width and height of the passed Texture
and height 0.0
.
The dimensions of the texture will be scaled by the provided scale
factor. The x
and y
positions will not change.
pub fn texture_cropped(
&self,
texture: &Texture,
x: i32,
y: i32,
crop: Rect
) -> [TextureVertex; 4]
[src]
&self,
texture: &Texture,
x: i32,
y: i32,
crop: Rect
) -> [TextureVertex; 4]
Creates a set of TextureVertex
es with the width and height of the passed Texture
and height 0.0
.
Only the part of the texture inside the passed crop
rectangle is shown. The top-left corner of the crop rectangle
is drawn at (x
, y
)
pub fn texture_scaled_cropped(
&self,
texture: &Texture,
destination: Rect,
crop: Rect
) -> [TextureVertex; 4]
[src]
&self,
texture: &Texture,
destination: Rect,
crop: Rect
) -> [TextureVertex; 4]
Creates a set of TextureVertex
es with the width and height of the passed Texture
and height 0.0
.
Only the part of the texture inside the passed crop
rectangle is shown. The top-left corner of the crop rectangle
is drawn at (x
, y
)
Auto Trait Implementations
impl !RefUnwindSafe for PixelTranslator
impl !Send for PixelTranslator
impl !Sync for PixelTranslator
impl Unpin for PixelTranslator
impl !UnwindSafe for PixelTranslator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,