# PixelPoint

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/struct-pixelpoint/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct PixelPoint
```

Represents a point in device pixels.

Integer arithmetic wraps on overflow. Conversions from floating point truncate
toward zero and saturate at the `i32` range (NaN becomes 0).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L15)

## Members

- [`x`](#struct_field-x)
- [`y`](#struct_field-y)
- [`ORIGIN`](#assoc_const-origin)
- [`new`](#function-new)
- [`parse`](#function-parse)
- [`equals`](#function-equals)
- [`with_x`](#function-with_x)
- [`with_y`](#function-with_y)
- [`to_point`](#function-to_point)
- [`to_point_vector`](#function-to_point_vector)
- [`to_point_with_dpi`](#function-to_point_with_dpi)
- [`to_point_with_dpi_vector`](#function-to_point_with_dpi_vector)
- [`from_point`](#function-from_point)
- [`from_point_vector`](#function-from_point_vector)
- [`from_point_with_dpi`](#function-from_point_with_dpi)
- [`from_point_with_dpi_vector`](#function-from_point_with_dpi_vector)

<a id="struct_field-x"></a>

### x

```rust
x: i32
```

The X co-ordinate.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L17)

<a id="struct_field-y"></a>

### y

```rust
y: i32
```

The Y co-ordinate.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L19)

<a id="assoc_const-origin"></a>

### ORIGIN

```rust
const ORIGIN: PixelPoint
```

A point representing 0,0.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L24)

<a id="function-new"></a>

### new

```rust
const fn new(x: i32, y: i32) -> Self
```

Initializes a new instance of the `PixelPoint` structure.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L28)

<a id="function-parse"></a>

### parse

```rust
fn parse(s: &str) -> Result<Self, FormatError>
```

Parses a `PixelPoint` string (`"x, y"`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L33)

<a id="function-equals"></a>

### equals

```rust
const fn equals(self: &Self, other: PixelPoint) -> bool
```

Returns a boolean indicating whether the point is equal to the other given point.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L40)

<a id="function-with_x"></a>

### with_x

```rust
const fn with_x(self: &Self, x: i32) -> PixelPoint
```

Returns a new `PixelPoint` with the same Y co-ordinate and the specified X co-ordinate.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L46)

<a id="function-with_y"></a>

### with_y

```rust
const fn with_y(self: &Self, y: i32) -> PixelPoint
```

Returns a new `PixelPoint` with the same X co-ordinate and the specified Y co-ordinate.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L52)

<a id="function-to_point"></a>

### to_point

```rust
fn to_point(self: &Self, scale: f64) -> Point
```

Converts the `PixelPoint` to a device-independent `Point` using the
specified scaling factor.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L59)

<a id="function-to_point_vector"></a>

### to_point_vector

```rust
fn to_point_vector(self: &Self, scale: Vector) -> Point
```

Converts the `PixelPoint` to a device-independent `Point` using the
specified per-axis scaling factor.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L66)

<a id="function-to_point_with_dpi"></a>

### to_point_with_dpi

```rust
fn to_point_with_dpi(self: &Self, dpi: f64) -> Point
```

Converts the `PixelPoint` to a device-independent `Point` using the
specified dots per inch (DPI).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L73)

<a id="function-to_point_with_dpi_vector"></a>

### to_point_with_dpi_vector

```rust
fn to_point_with_dpi_vector(self: &Self, dpi: Vector) -> Point
```

Converts the `PixelPoint` to a device-independent `Point` using the
specified per-axis dots per inch (DPI).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L80)

<a id="function-from_point"></a>

### from_point

```rust
fn from_point(point: Point, scale: f64) -> PixelPoint
```

Converts a `Point` to device pixels using the specified scaling factor.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L86)

<a id="function-from_point_vector"></a>

### from_point_vector

```rust
fn from_point_vector(point: Point, scale: Vector) -> PixelPoint
```

Converts a `Point` to device pixels using the specified per-axis scaling factor.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L92)

<a id="function-from_point_with_dpi"></a>

### from_point_with_dpi

```rust
fn from_point_with_dpi(point: Point, dpi: f64) -> PixelPoint
```

Converts a `Point` to device pixels using the specified dots per inch (DPI).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L98)

<a id="function-from_point_with_dpi_vector"></a>

### from_point_with_dpi_vector

```rust
fn from_point_with_dpi_vector(point: Point, dpi: Vector) -> PixelPoint
```

Converts a `Point` to device pixels using the specified per-axis dots per inch (DPI).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/pixel_point.rs#L104)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)
- `Clone`
- `Copy`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Hash`
- `Default`
- `From<PixelPoint>`
- `Add`
- `Add<PixelVector>`
- `Sub`
- `Sub<PixelVector>`
- `AddAssign`
- `AddAssign<PixelVector>`
- `SubAssign`
- `SubAssign<PixelVector>`
- `FromStr`
- `Display`
- `From<PixelVector>`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
