WP-0: SwiftPM scaffold, shared model, signed app bundle script
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import Foundation
|
||||
|
||||
/// One screenshot plus everything needed to place it on a PDF page.
|
||||
public struct Capture: Codable, Sendable, Identifiable, Equatable {
|
||||
public let id: UUID
|
||||
/// 1-based position within its session. Stable; never renumbered on delete.
|
||||
public let sequence: Int
|
||||
/// File name only (e.g. "001-A1B2C3D4.png"), never a path.
|
||||
/// The directory is always the owning session's directory.
|
||||
public let fileName: String
|
||||
/// Pixel dimensions of the PNG on disk.
|
||||
public let pixelWidth: Int
|
||||
public let pixelHeight: Int
|
||||
/// Backing scale the capture was taken at (2.0 on Retina). Needed so the PDF
|
||||
/// composer lays the image out at its true point size, not its pixel size.
|
||||
public let scale: CGFloat
|
||||
/// When the screenshot was taken. Always stored as an absolute instant;
|
||||
/// rendered in Asia/Dubai wherever a human sees it.
|
||||
public let capturedAt: Date
|
||||
|
||||
public init(
|
||||
id: UUID,
|
||||
sequence: Int,
|
||||
fileName: String,
|
||||
pixelWidth: Int,
|
||||
pixelHeight: Int,
|
||||
scale: CGFloat,
|
||||
capturedAt: Date
|
||||
) {
|
||||
self.id = id
|
||||
self.sequence = sequence
|
||||
self.fileName = fileName
|
||||
self.pixelWidth = pixelWidth
|
||||
self.pixelHeight = pixelHeight
|
||||
self.scale = scale
|
||||
self.capturedAt = capturedAt
|
||||
}
|
||||
|
||||
/// True when the image is wider than it is tall. Drives page orientation.
|
||||
public var isLandscape: Bool {
|
||||
pixelWidth > pixelHeight
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user