[−][src]Struct romy::Image
An image that can be displayed by the runtime.
Internally stores data as an array of 32 bit RGBA values.
Methods
impl Image
[src]
pub fn new(width: i32, height: i32, color: Color) -> Image
[src]
Create a blank image
Arguments
width
- the number of horizontal pixelsheight
- the number of vertical pixels.color
- the initial color of all pixels in the image.
pub fn from_data(width: i32, height: i32, data: &[u8]) -> Image
[src]
Create an image from a slice of existing data
Arguments
width
- the number of horizontal pixelsheight
- the number of vertical pixelsdata
- slice of existing data.
pub fn set_pixel(&mut self, x: i32, y: i32, color: Color)
[src]
Sets a pixel in the image to a specified color
Arguments
x
- horizontal coordinatey
- vertical coordinatecolor
- color to set the pixel to
pub fn width(&self) -> i32
[src]
Gets the number of horizontal pixels
pub fn height(&self) -> i32
[src]
Gets the number of vertical pixels
pub fn pixels(&self) -> &[u32]
[src]
Gets a reference to the raw pixel buffer
pub fn pixels8(&self) -> &[u8]
[src]
Gets a reference to the raw pixel as u8s
pub fn pixels_mut(&mut self) -> &mut [u32]
[src]
Gets a mutable reference to the raw pixel buffer
pub fn pixels8_mut(&mut self) -> &mut [u8]
[src]
Gets a mutable reference to the raw pixel buffer as u8s
pub fn blit(&mut self, source: &Image, x: i32, y: i32, width: i32, height: i32)
[src]
Draws an image into a section of this one, will ignore fully transparent pixels, but does not blend semi-transparent ones.
Arguments
- `source' - Image to take data from
x
- horizontal coordinate to draw at in this imagey
- vertical coordinate to draw at in this imagewidth
- horizontal pixel span to draw into on this imageheight
- vertical pixel span to draw into on this image
Trait Implementations
impl<'de> Deserialize<'de> for Image
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<Image, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Image, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl Debug for Image
[src]
impl Serialize for Image
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.