pub struct Img { /* private fields */ }
Expand description
An image that can be drawn using the Window.draw()
method. Currently only PNG format is
supported.
If you are looking at an image in Photoshop, the “right” direction is the “front” of the
image. direction
is the angle in radians that the image will be rotated.
If you want your image to have transparency without getting white borders, export as a PNG-8
with Transparency checked, and Matte set to None. See media/png-settings-screenshot.png
in
the repository for a screenshot of the Photoshop “Export > Save for Web” settings that are known
to work. Or just exporting as a 24-bit PNG might work.
Implementations§
source§impl Img
impl Img
sourcepub fn new(window: &Window, tint: Option<Color>, filename: &str) -> Self
pub fn new(window: &Window, tint: Option<Color>, filename: &str) -> Self
Create a new image. filename
is relative to the root of the project you are running from.
For example, if you created a media
subdirectory in the root of your project and then put
soldier.png
in it, then your filename would be media/soldier.png
.
Trait Implementations§
source§impl Drawable for Img
impl Drawable for Img
fn get_shader_items(&self) -> ThingToDraw<'_>
Auto Trait Implementations§
impl !RefUnwindSafe for Img
impl !Send for Img
impl !Sync for Img
impl Unpin for Img
impl !UnwindSafe for Img
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SetParameter for T
impl<T> SetParameter for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.