// The photograph in a print's window, for any record whose photo column // holds a picture key — a person's print, a cover's image, a page's hero. // // **The picture is a KEY, and bytes never cross the boundary.** Whether a // record HAS a photograph is its photo column being set, which the list read // already answers — so a grid knows print-or-card without touching a byte. The // bytes are asked for only by the print that is going on screen, and the ask // is `read.mediaPath` — where the bytes ARE on this phone, never a fetch // (`MediaImages.load`), decoded at the edge drawn. A print whose bytes have // not arrived on this phone yet shows its empty window, which is visibly a // window rather than a grey photograph pretending to load. Moved here from the // old People screens, which drew it first. import CottonKit import SwiftUI #if canImport(UIKit) import UIKit #endif /// The photograph in a print's window: the picture filling the square, or the /// window's own paint while it is not here. struct RecordPicture: View { @Environment(\.theme) private var theme let avatarKey: String? /// The edge the picture is drawn at, in points. let edge: CGFloat /// The picture AND the key it is about — a re-ask over the same key keeps /// the face on screen rather than blanking it for a frame. @State private var slot = MediaImageSlot() var body: some View { ZStack { Rectangle().fill(theme.printWindow) if let image = slot.image { Image(uiImage: image) .resizable() .scaledToFill() } } .accessibilityHidden(true) .mediaSlot($slot, key: avatarKey, edge: edge) } }