Refactor texture image filtering
- Support only `Linear` or `Nearest` - Simplify `Layer` groups - Move `FilterMethod` to `Image` and `image::Viewer`
This commit is contained in:
parent
75c9afc608
commit
a5125d6fea
12 changed files with 250 additions and 160 deletions
|
|
@ -22,19 +22,21 @@ pub struct Viewer<Handle> {
|
|||
max_scale: f32,
|
||||
scale_step: f32,
|
||||
handle: Handle,
|
||||
filter_method: image::FilterMethod,
|
||||
}
|
||||
|
||||
impl<Handle> Viewer<Handle> {
|
||||
/// Creates a new [`Viewer`] with the given [`State`].
|
||||
pub fn new(handle: Handle) -> Self {
|
||||
Viewer {
|
||||
handle,
|
||||
padding: 0.0,
|
||||
width: Length::Shrink,
|
||||
height: Length::Shrink,
|
||||
min_scale: 0.25,
|
||||
max_scale: 10.0,
|
||||
scale_step: 0.10,
|
||||
handle,
|
||||
filter_method: image::FilterMethod::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -329,6 +331,7 @@ where
|
|||
image::Renderer::draw(
|
||||
renderer,
|
||||
self.handle.clone(),
|
||||
self.filter_method,
|
||||
Rectangle {
|
||||
x: bounds.x,
|
||||
y: bounds.y,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue