edit/crop: Support vertical mirroring
This commit is contained in:
parent
df9589aa9a
commit
5c31272605
6 changed files with 52 additions and 33 deletions
|
|
@ -58,8 +58,9 @@ impl OperationsSnapshot {
|
|||
for operation in operations.operations() {
|
||||
let operation_result = match operation {
|
||||
Operation::Clip(rect) => self.clip(*rect),
|
||||
Operation::Rotate(rotation) => self.rotate(*rotation),
|
||||
Operation::MirrorHorizontally => self.mirror_horizontally(),
|
||||
Operation::MirrorVertically => self.mirror_vertically(),
|
||||
Operation::Rotate(rotation) => self.rotate(*rotation),
|
||||
unsupported_operation => {
|
||||
return Err(EditingError::UnsupportedOperation(
|
||||
unsupported_operation.clone(),
|
||||
|
|
@ -116,6 +117,18 @@ impl OperationsSnapshot {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn mirror_vertically(&mut self) -> Result<(), OperationError> {
|
||||
let snapshot = gtk::Snapshot::new();
|
||||
|
||||
snapshot.translate(&graphene::Point::new(0., self.height as f32 * self.scale));
|
||||
snapshot.scale(1., -1.);
|
||||
snapshot.append_node(self.current_node.clone());
|
||||
|
||||
self.current_node = snapshot.to_node().ok_or(OperationError::EmptyNode)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn rotate(
|
||||
&mut self,
|
||||
rotation: gufo_common::orientation::Rotation,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue