draw guides for straightening
This commit is contained in:
parent
8b57464056
commit
5c8aa2520a
25
Program.cs
25
Program.cs
@ -843,10 +843,10 @@ public class Game : GameWindow {
|
||||
// Load photos from a directory.
|
||||
// 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\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(@"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\Desktop\Germany all\104D7000");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
||||
@ -1009,6 +1009,7 @@ public class Game : GameWindow {
|
||||
Photo activePhoto = photos[photoIndex];
|
||||
Texture active = activePhoto.Texture();
|
||||
bool cropActive = activeTool is CropTool;
|
||||
bool straightenActive = activeTool is StraightenTool;
|
||||
|
||||
// FIXME: make a function for scaling & centering one box on another.
|
||||
// FIXME: cropping is fucky because activeScale is using the texture size, not the photo size.
|
||||
@ -1036,7 +1037,11 @@ public class Game : GameWindow {
|
||||
Texture star = (activePhoto.Rating > i) ? STAR_FILLED : STAR_EMPTY;
|
||||
DrawTexture(star, geometry.StarBoxes[i].Min.X, geometry.StarBoxes[i].Min.Y);
|
||||
}
|
||||
DrawCropRectangle(cropActive);
|
||||
if (straightenActive) {
|
||||
DrawStraightenGuides();
|
||||
} else {
|
||||
DrawCropRectangle(cropActive);
|
||||
}
|
||||
|
||||
// Draw thumbnail boxes.
|
||||
ribbonIndex = Math.Clamp(photoIndex - (geometry.ThumbnailBoxes.Count - 1) / 2,
|
||||
@ -1133,6 +1138,20 @@ public class Game : GameWindow {
|
||||
}
|
||||
}
|
||||
|
||||
void DrawStraightenGuides() {
|
||||
Box2i box = geometry.PhotoBox;
|
||||
int lineSpacing = 48;
|
||||
Color4 color = new(1f, 1f, 1f, 0.5f);
|
||||
for (int y = box.Min.Y + lineSpacing / 2; y < box.Max.Y; y += lineSpacing) {
|
||||
DrawHorizontalLine(box.Min.X, y, box.Max.X, color);
|
||||
// DrawHorizontalLine(box.Min.X, y + 1, box.Max.X, color);
|
||||
}
|
||||
for (int x = box.Min.X + lineSpacing / 2; x < box.Max.X; x += lineSpacing) {
|
||||
DrawVerticalLine(x, box.Min.Y, box.Max.Y, color);
|
||||
// DrawVerticalLine(x + 1, box.Min.Y, box.Max.Y, color);
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawTexture(Texture texture, int x, int y) {
|
||||
DrawTexture(texture, Util.MakeBox(x, y, texture.Size.X, texture.Size.Y));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user