// The ALBUM as INSTANT PRINTS PINNED ON A CORK BOARD (the owner's pick, 30 Oct// 2026, 00:25 IST: "for albums I like the album board"; the album picture// `objects-2/photos-2/5-album-board`): a cork board in its thin pine frame// lying bare on the Photos tool's oxblood bookcloth (`FaceGround.bookcloth`),// with no paper and no rule of the deck's. The board, its frame, its shadow,// the brass pins, the instant prints' card and the label's paper are// PAINTED (`Media.xcassets`, cut and imported by// `scripts/import-photos-materials.py`); the face draws live only what the// album decides://// up to five of its prints, each a picture drawn inside a painted instant// print's square window, laid at the board's five places and tilts, the// cover first, largest and on top, the rest under and round it;// a brass pin in each place, holding its print — and in a place the// album has no print for, standing in the bare cork: fewer prints leave// the cork bare, never a stand-in print;// the typed paper label pinned at the board's top: the album's name (three// lines at most, the label growing with it) and under it how many photos it holds and its days.//// Every word is the core's (`DeckCard`): the name (`title`), the count// (`count`, said "23 photos" by the shell's own count line) and the days// (`span`); the prints are the album's own rows the deck reads for its card// (`DeckCard.prints`, the cover named by `photo` first). Stepped by a tap,// it cuts (`FaceStep.cut`).importCottonPaperimportCottonValuesimportSwiftUIenumAlbumBoardFaceKnobs {// THE BOARD, as painted (`album-board`, 1050 by 1308 pixels): its width// over its height, and how far its shadow (`album-board-shadow`)// reaches past it on every side, as a share of its width.staticlet aspect: CGFloat = 0.8025staticlet shadowReach: CGFloat = 0.0577/// The board in the card's room: the most of its width and height.staticlet fill: CGFloat = 0.97// AN INSTANT PRINT, as painted (`album-instant`, 680 by 836): the// layer's width over its height, and the card's and the picture// window's place in it (left, top, right, bottom, as shares of the// layer; the rest is its shadow).staticlet instantAspect: CGFloat = 680.0 / 836.0staticlet instantCard: [CGFloat] = [0.0588, 0.0478, 0.9412, 0.9522]staticlet instantWindow: [CGFloat] = [0.1091, 0.0956, 0.8928, 0.7332]/// An instant print's card, its width over its height, as painted.staticvar cardAspect: CGFloat { (instantCard[2] - instantCard[0]) * instantAspect / (instantCard[3] - instantCard[1]) }// A PIN (`album-pin`, 132 square): its head's share of the layer.staticlet pinHead: CGFloat = 0.7272/// A pin's head across, as a share of the board's width.staticlet pinSize: CGFloat = 0.05/// How far below a print's top edge its pin stands, as a share of the/// print's height.staticlet pinDrop: CGFloat = 0.055// THE LABEL (`album-label`, 780 by 279): its paper's place in the layer.staticlet labelPaper: [CGFloat] = [0.0385, 0.1075, 0.9615, 0.8925]/// The label's paper: its width, its top and its middle across, as/// shares of the board's.staticlet labelWidth: CGFloat = 0.72staticlet labelTop: CGFloat = 0.035staticlet labelTurn: Double = -0.6/// The type on the label, as shares of the board's width (on a phone's/// board, about 17 and 12 points): print on an object scales with the/// object, never with Dynamic Type.staticlet nameSize: CGFloat = 0.054staticlet factsSize: CGFloat = 0.037/// The name takes up to three lines, the label growing with it, and a/// name longer still is set a little smaller, down to `nameLeast` of its/// size, before its last line is cut.staticlet nameLines = 3staticlet nameLeast: CGFloat = 0.8/// The label's paper round its words, as shares of the board's width.staticlet labelPadding = EdgeInsets(top: 0.03, leading: 0.04, bottom: 0.028, trailing: 0.04)staticlet lineGap: CGFloat = 0.006}/// One of the board's five places: where a print's card stands (its middle,/// as shares of the board's width and height), how wide it is (a share of/// the board's width), how far it is tilted, and where across its top its/// pin goes in (a share of its width from its middle), so every pin stands/// clear of the prints laid over it.publicstructBoardPlace: Equatable, Sendable {publicvar x: CGFloatpublicvar y: CGFloatpublicvar width: CGFloatpublicvar turn: Doublepublicvar pin: CGFloat/// The five places, the cover's first, in the order the album's prints/// fill them.publicstaticlet all = [BoardPlace(x: 0.42, y: 0.45, width: 0.5, turn: -1.5, pin: 0),BoardPlace(x: 0.79, y: 0.36, width: 0.32, turn: 3.5, pin: 0),BoardPlace(x: 0.21, y: 0.77, width: 0.36, turn: -4, pin: -0.22),BoardPlace(x: 0.6, y: 0.79, width: 0.34, turn: -2.5, pin: 0.32),BoardPlace(x: 0.8, y: 0.66, width: 0.32, turn: 3, pin: 0), ]/// The order the places are laid in, back to front: the cover last, on top.publicstaticlet stacking = [1, 4, 3, 2, 0]/// The card's height on a board `board` points.func height(on board: CGSize) -> CGFloat { width * board.width / AlbumBoardFaceKnobs.cardAspect }/// Where its pin stands on a board `board` points: at its print's top,/// a little down and along it as the place says, turned with it.publicfunc pin(on board: CGSize) -> CGPoint {let height = height(on: board)let up = height / 2 - AlbumBoardFaceKnobs.pinDrop * heightlet across = pin * width * board.widthlet angle = turn * .pi / 180return CGPoint( x: x * board.width + cos(angle) * across + sin(angle) * up, y: y * board.height + sin(angle) * across - cos(angle) * up) }/// Whether its card, on a board `board` points, covers `point`.publicfunc covers(_ point: CGPoint, on board: CGSize) -> Bool {let angle = -turn * .pi / 180let dx = point.x - x * board.widthlet dy = point.y - y * board.heightlet along = dx * cos(angle) - dy * sin(angle)let down = dx * sin(angle) + dy * cos(angle)return abs(along) <= width * board.width / 2 && abs(down) <= height(on: board) / 2 }}/// The prints an album's board shows: the cover first, then the album's/// others as it holds them, at most one for each place.publicenumBoardPrints {publicstaticfunc shown(_ card: DeckCard) -> [String] {Array(AlbumPrints.ordered(card.prints ?? [], cover: card.text("photo")).prefix(BoardPlace.all.count)) }/// The facts typed under the album's name: how many photos it holds and/// its days, as the core says them; nil when it says neither.publicstaticfunc facts(_ card: DeckCard) -> String? {let said = [count(card), card.text("span")].compactMap { $0 }return said.isEmpty ? nil : said.joined(separator: ShellLines.line("cards", "join")) }/// How many photos the album holds, "23 photos", in the shell's own/// count line; nil when the card says no count.publicstaticfunc count(_ card: DeckCard) -> String? { card.text("count").map { words inlet number = Int(words.filter(\.isNumber)) ?? 0returnShellLines.line("projects", number == 1 ? "count.photo.one" : "count.photo.many", ["n": words]) } }}publicstructAlbumBoardFace: View {let card: DeckCardpublicinit(card: DeckCard) {self.card = card }publicvar body: someView {let knobs = AlbumBoardFaceKnobs.selfGeometryReader { box inlet width = min(box.size.width * knobs.fill, box.size.height * knobs.fill * knobs.aspect)let size = CGSize(width: width, height: width / knobs.aspect)CorkBoard(card: card, prints: BoardPrints.shown(card), size: size) .frame(width: size.width, height: size.height) .frame(width: box.size.width, height: box.size.height) } .accessibilityElement(children: .contain) .accessibilityIdentifier("album-board") }}/// A painted layer, by its catalogue name, at the scale it was painted/// for; nil where this build carries no pictures.privatefunc painted(_ name: String) -> Image? {CottonMedia.image(name, scale: 3)}/// The board lying on the cloth: its shadow, the board, the prints in their/// places with their pins, the empty places' pins, and the label over all.privatestructCorkBoard: View {let card: DeckCardlet prints: [String]let size: CGSizevar body: someView {let knobs = AlbumBoardFaceKnobs.selflet w = size.widthlet reach = knobs.shadowReach * w ZStack(alignment: .topLeading) {iflet shadow = painted("album-board-shadow") { shadow.resizable() .frame(width: w + 2 * reach, height: size.height + 2 * reach) .offset(x: -reach, y: -reach) .accessibilityHidden(true) }Group {iflet board = painted("album-board") { board.resizable().interpolation(.high) } else {PhotosMaterial.pine.colour .overlay(PhotosMaterial.cork.colour.padding(w * 0.045)) } } .frame(width: w, height: size.height) .accessibilityHidden(true)ForEach(BoardPlace.stacking, id: \.self) { index inlet place = BoardPlace.all[index]if index < prints.count {InstantPrint(key: prints[index], width: place.width * w) .rotationEffect(.degrees(place.turn)) .position(x: place.x * w, y: place.y * size.height) .facePart(.picture) }Pin(size: knobs.pinSize * w) .position(place.pin(on: size)) }BoardLabel(card: card, width: knobs.labelWidth * w, board: w) .rotationEffect(.degrees(knobs.labelTurn)) .frame(width: w, alignment: .top) .padding(.top, knobs.labelTop * size.height) } .frame(width: w, height: size.height, alignment: .topLeading) }}/// One instant print: the picture in the painted print's square window,/// the painted card over its edge, its shadow round it.privatestructInstantPrint: View {let key: String/// The card's width, in points.let width: CGFloatvar body: someView {let knobs = AlbumBoardFaceKnobs.selflet card = knobs.instantCardlet window = knobs.instantWindowlet layer = CGSize(width: width / (card[2] - card[0]), height: width / (card[2] - card[0]) / knobs.instantAspect)let opening = CGRect( x: window[0] * layer.width, y: window[1] * layer.height, width: (window[2] - window[0]) * layer.width, height: (window[3] - window[1]) * layer.height) ZStack(alignment: .topLeading) {FacePicture(key: key, edge: max(opening.width, opening.height)) .frame(width: opening.width + 2, height: opening.height + 2) .clipped() .offset(x: opening.minX - 1, y: opening.minY - 1)iflet print = painted("album-instant") { print.resizable().interpolation(.high) .frame(width: layer.width, height: layer.height) } else {Rectangle() .path(in: CGRect( x: card[0] * layer.width, y: card[1] * layer.height, width: (card[2] - card[0]) * layer.width, height: (card[3] - card[1]) * layer.height)) .subtracting(Rectangle().path(in: opening)) .fill(PhotosMaterial.card.colour) } } .frame(width: layer.width, height: layer.height, alignment: .topLeading) .accessibilityHidden(true) }}/// A brass drawing pin's head, `size` points across, its shadow round it.privatestructPin: View {let size: CGFloatvar body: someView {let layer = size / AlbumBoardFaceKnobs.pinHeadGroup {iflet pin = painted("album-pin") { pin.resizable().interpolation(.high) } else {Circle().fill(PhotosMaterial.brass.colour).padding(layer * (1 - AlbumBoardFaceKnobs.pinHead) / 2) } } .frame(width: layer, height: layer) .accessibilityHidden(true) }}/// The typed paper label pinned at the board's top: the album's name, and/// under it its count and its days.privatestructBoardLabel: View {let card: DeckCard/// The paper's width, and the board's, in points.let width: CGFloatlet board: CGFloatvar body: someView {let knobs = AlbumBoardFaceKnobs.selflet paper = knobs.labelPaperlet pad = knobs.labelPaddinglet facts = BoardPrints.facts(card) VStack(spacing: knobs.lineGap * board) {iflet title = card.text("title") {Text(title) .font(CottonFonts.type(knobs.nameSize * board)) .lineLimit(knobs.nameLines) .minimumScaleFactor(knobs.nameLeast) .multilineTextAlignment(.center) .fixedSize(horizontal: false, vertical: true) .foregroundStyle(PhotosMaterial.type.colour) .accessibilityIdentifier("deck-title") .facePart(.title) }iflet facts {FactsLine(card: card, size: knobs.factsSize * board) .accessibilityRepresentation { Text(facts) } .accessibilityIdentifier("album-board-facts") } } .padding(EdgeInsets(top: pad.top * board, leading: pad.leading * board, bottom: pad.bottom * board, trailing: pad.trailing * board)) .frame(width: width) .background {GeometryReader { room inlet layer = CGSize(width: room.size.width / (paper[2] - paper[0]), height: room.size.height / (paper[3] - paper[1]))Group {iflet label = painted("album-label") { label.resizable().interpolation(.high) } else {PhotosMaterial.label.colour .padding(EdgeInsets( top: paper[1] * layer.height, leading: paper[0] * layer.width, bottom: (1 - paper[3]) * layer.height, trailing: (1 - paper[2]) * layer.width)) } } .frame(width: layer.width, height: layer.height) .offset(x: -paper[0] * layer.width, y: -paper[1] * layer.height) .accessibilityHidden(true) } } .overlay(alignment: .top) {Pin(size: knobs.pinSize * board) .offset(y: -knobs.pinSize * board * 0.35) } }}/// The label's second line: the count (the corner's) and the days (when),/// each its own part, joined as the core joins facts.privatestructFactsLine: View {let card: DeckCardlet size: CGFloatvar body: someView {let count = BoardPrints.count(card)let span = card.text("span") HStack(spacing: 0) {iflet count {Text(count).facePart(.corner) }if count != nil, span != nil {Text(ShellLines.line("cards", "join")) }iflet span {Text(span).facePart(.when) } } .font(CottonFonts.type(size)) .lineLimit(1) .minimumScaleFactor(0.6) .foregroundStyle(PhotosMaterial.type.colour) }}/// The album board, by its id beside the album's own face, and the albums/// it is reviewed in: invented pictures only.publicenumAlbumBoardFaceCatalogue {publicstaticlet stock: FaceStock = .ownpublicstaticlet ground: FaceGround = .bookclothpublicstaticlet face = Face(id: "album.board", specimens: [Specimen("weekend", weekend, picture: "kelmoor-lake"), Specimen("two", two, picture: "verandah"),Specimen("long-name", longName, picture: "waterfall"), ], steps: .cut) { card, _, _ inAlbumBoardFace(card: card) }staticfunc album(_ fields: [String: RecordValue], prints: [String]) -> DeckCard {var card = DeckCard(face: "album.board", corner: nil, pressing: false, pace: nil, plate: nil, fields: fields) card.prints = printsreturn card }/// A weekend away: more prints than the board holds, the lake its cover.publicstaticlet weekend = album(["title": .text("Weekend in Kelmoor"),"count": .text("23"),"span": .text("Sun 26 Oct"),"subtitle": .text("Kelmoor"),"photo": .text("kelmoor-lake"), ], prints: ["kelmoor-jetty", "kelmoor-lake", "portrait", "verandah", "waterfall", "verandah-wide", "invitation-dinner"])/// An afternoon's two prints: three places left to the bare cork.publicstaticlet two = album(["title": .text("Tea at the hill house"),"count": .text("2"),"span": .text("Sat 17 Oct"),"photo": .text("verandah"), ], prints: ["verandah", "verandah-wide"])/// A name that takes the label's two lines, over ten days.publicstaticlet longName = album(["title": .text("The long drive down the coast and the night at the lighthouse"),"count": .text("41"),"span": .text("Fri 2 Oct \u{2013} Sun 11 Oct"),"photo": .text("waterfall"), ], prints: ["waterfall", "kelmoor-jetty", "verandah-wide", "portrait", "kelmoor-lake", "verandah"])}/// The prints an album's card lays out.enumAlbumPrints {/// The prints in the order the card lays them: the cover first when the/// album names one, then the rest as the album holds them, each once.staticfunc ordered(_ keys: [String], cover: String?) -> [String] {var seen = Set<String>()return ([cover].compactMap { $0 } + keys).filter { !$0.isEmpty && seen.insert($0).inserted } }}