actually rotate the image in output
This commit is contained in:
parent
0417c354d5
commit
9db0ddd15c
3
Photo.cs
3
Photo.cs
@ -219,6 +219,9 @@ public class Photo {
|
|||||||
Console.WriteLine($"{Filename} => {jpgOut}");
|
Console.WriteLine($"{Filename} => {jpgOut}");
|
||||||
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 });
|
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 });
|
||||||
|
|
||||||
|
if (Math.Abs(RotationDegrees) > 0.001) {
|
||||||
|
image.Mutate(x => x.Rotate(RotationDegrees));
|
||||||
|
}
|
||||||
if (CropRectangle != Rectangle.Empty) {
|
if (CropRectangle != Rectangle.Empty) {
|
||||||
image.Mutate(x => x.Crop(CropRectangle));
|
image.Mutate(x => x.Crop(CropRectangle));
|
||||||
}
|
}
|
||||||
|
11
Program.cs
11
Program.cs
@ -265,6 +265,10 @@ public class StraightenTool : ITool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ToolStatus HandleInput(KeyboardState input, MouseState mouse, Transform transform, Game game, Photo photo, UiGeometry geometry) {
|
public ToolStatus HandleInput(KeyboardState input, MouseState mouse, Transform transform, Game game, Photo photo, UiGeometry geometry) {
|
||||||
|
if (input.IsKeyPressed(Keys.D0)) {
|
||||||
|
photo.RotationDegrees = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (input.IsKeyPressed(Keys.Left)) {
|
if (input.IsKeyPressed(Keys.Left)) {
|
||||||
photo.RotationDegrees += .1f;
|
photo.RotationDegrees += .1f;
|
||||||
}
|
}
|
||||||
@ -700,6 +704,7 @@ public class Game : GameWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle tool switching.
|
// Handle tool switching.
|
||||||
|
// FIXME: prevent photo switching when tools other than ViewTool are active?
|
||||||
if (photos[photoIndex] != previousPhoto) {
|
if (photos[photoIndex] != previousPhoto) {
|
||||||
activeTool = viewTool;
|
activeTool = viewTool;
|
||||||
}
|
}
|
||||||
@ -708,7 +713,7 @@ public class Game : GameWindow {
|
|||||||
if (input.IsKeyPressed(Keys.C)) {
|
if (input.IsKeyPressed(Keys.C)) {
|
||||||
activeTool = new CropTool(photos[photoIndex]);
|
activeTool = new CropTool(photos[photoIndex]);
|
||||||
}
|
}
|
||||||
if (input.IsKeyPressed(Keys.S)) {
|
if (input.IsKeyPressed(Keys.X)) {
|
||||||
activeTool = new StraightenTool(photos[photoIndex]);
|
activeTool = new StraightenTool(photos[photoIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -789,10 +794,10 @@ public class Game : GameWindow {
|
|||||||
// Load photos from a directory.
|
// Load photos from a directory.
|
||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\photos-test\");
|
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\photos-test\");
|
||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\14\");
|
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\14\");
|
||||||
string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\09\06\jpg");
|
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\09\06\jpg");
|
||||||
// string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
// string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\totte-output\2023\08\03");
|
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\totte-output\2023\08\03");
|
||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\export");
|
string[] files = Directory.GetFiles(@"c:\users\colin\desktop\export");
|
||||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
||||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
||||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
||||||
|
Loading…
Reference in New Issue
Block a user