vello_common/filter/offset.rs
1// Copyright 2026 the Vello Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! The offset filter.
5
6/// Translation/shift filter.
7///
8/// This shifts the input image by `(dx, dy)` in device pixel space.
9#[derive(Clone, Copy, Debug)]
10pub struct Offset {
11 /// The x-offset that should be applied.
12 pub dx: f32,
13 /// The y-offset that should be applied.
14 pub dy: f32,
15}
16
17impl Offset {
18 /// Create a new offset filter.
19 pub fn new(dx: f32, dy: f32) -> Self {
20 Self { dx, dy }
21 }
22}