Struct WorldFile

Source
pub struct WorldFile {
    pub x_scale: f64,
    pub y_scale: f64,
    pub x_skew: f64,
    pub y_skew: f64,
    pub x_coord: f64,
    pub y_coord: f64,
}
Expand description

A World File

See the module top level documention

Fields§

§x_scale: f64§y_scale: f64§x_skew: f64§y_skew: f64§x_coord: f64§y_coord: f64

Implementations§

Source§

impl WorldFile

Source

pub fn from_path(p: impl AsRef<Path>) -> Result<Self, ()>

Open a world file from a path

Source

pub fn from_reader(r: impl Read) -> Result<Self, ()>

Open a world file from something that can Read

Source

pub fn from_string(s: impl AsRef<str>) -> Result<Self, ()>

Open a world file from a raw string file content

Source

pub fn to_string(&self) -> String

Convert this world file to a raw string

Source

pub fn write_to_writer(&self, w: impl Write)

Write this world file to this Write object

Source

pub fn write_to_path(&self, p: impl AsRef<Path>)

Write this world file to a path

Source

pub fn image_to_world(&self, image_x_y: impl Into<(f64, f64)>) -> (f64, f64)

Convert image coordinates to world coordinates.

Source

pub fn world_to_image(&self, world_x_y: impl Into<(f64, f64)>) -> (f64, f64)

Convert world coordinates to image coordinates

Trait Implementations§

Source§

impl Debug for WorldFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for WorldFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for WorldFile

Source§

fn eq(&self, other: &WorldFile) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for WorldFile

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.