Add image editor with annotation tools
Integrates an editor accessible via "Letzte Aufnahme bearbeiten…" or "Bild bearbeiten…" in the menu bar. Supports arrow, rectangle, ellipse, and text annotations with color picker, line width, undo/redo, and export to file or clipboard. New files in Sources/Editor/: - AnnotationItem/Document: data model and state management - AnnotationCanvasView: NSView with CG rendering and mouse interaction - AnnotationRenderer: shared rendering for canvas and image export - EditorToolbarView: SwiftUI toolbar with tool selection and actions - EditorWindowController: window lifecycle following SettingsWindowController pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import AppKit
|
||||
import Foundation
|
||||
|
||||
enum AnnotationKind: String, CaseIterable, Codable {
|
||||
case arrow
|
||||
case rectangle
|
||||
case ellipse
|
||||
case text
|
||||
}
|
||||
|
||||
struct AnnotationItem: Identifiable {
|
||||
let id: UUID
|
||||
var kind: AnnotationKind
|
||||
var rect: CGRect
|
||||
var color: NSColor
|
||||
var lineWidth: CGFloat
|
||||
var text: String?
|
||||
var fontSize: CGFloat
|
||||
|
||||
init(
|
||||
kind: AnnotationKind,
|
||||
rect: CGRect,
|
||||
color: NSColor = .systemRed,
|
||||
lineWidth: CGFloat = 3,
|
||||
text: String? = nil,
|
||||
fontSize: CGFloat = 24
|
||||
) {
|
||||
self.id = UUID()
|
||||
self.kind = kind
|
||||
self.rect = rect
|
||||
self.color = color
|
||||
self.lineWidth = lineWidth
|
||||
self.text = text
|
||||
self.fontSize = fontSize
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user