7.1 kB 107 lines
7e68a437
⋯
apps/photos/CLAUDE.md
download raw history
at main Markdown

c8-photos #

Photos: the picture viewer (the folder a flip away, zoom, slide show, lossless rotate, crop, Set as) and a Pictures folder grid or all of it by month; c8-photos-tile, the live tile. Depends on: c8ui, gio, glycin-2, gexiv2-0.16 (optional).

org.cont8nuum.Photos, binary c8-photos, one copy (c8ui_app_main), after Windows 8's Photos; dark throughout. picture.c decodes through glycin (glycin-2, every decoder in bwrap; EXIF orientation applied by glycin; frames asked for in cairo's premultiplied layout so a frame's GBytes becomes an image surface without a copy; SVGs rendered at 4096; animations fetch the next frame when the shown one is due, only while playing). ph_picture has owners (ph_picture_ref/release): the viewer's slots share one. folder.c lists a folder on a GTask thread (pictures by glycin's MIME types, folders first, Files' name order; ph_entrys are refcounted, shared by the grid and the viewer). viewer.c is one custom widget: the current picture and slots for prev, next, the slide show's next and the one fading out, all decoded ahead (refresh_cache reuses by uri). Fit (never enlarged) or scale with cx, cy (the picture point in the view's middle); zoom_at keeps a window point fixed. Shrunk pictures draw through c8ui_draw_surface once a zoom settled (SETTLE_MS), else cairo scales the whole surface under a clip (nearest from 2x). Input: arrows at the sides for a moving mouse, wheel flips (or zooms: the Options page), Ctrl+wheel/pinch/+/-/0/1 zoom, double click or tap toggles, drag/finger pans when zoomed, a finger drags the next one in, two fingers sideways on the touchpad or three (c8ui_tab_swipe) flip, a single tap or right click toggles the app bar. Slide show: F5 or the app bar, crossfade every slide_seconds, shuffle; any press or key (but Left/Right) ends it. browse.c: the folder grid (kept list items, thumbnails from c8ui_thumbnail_load, folders as a drawn glyph; the folder watched and reread 300 ms after a change; back button above Pictures). meta.c (gexiv2 0.16, metadata feature): Rotate sets the EXIF orientation (JPEG, PNG, WebP, TIFF; nothing re-encoded) on a thread, turns asked meanwhile added up (turns_pending); the Details flyout's camera lines. main.c: opened with one picture it shows it at once and then swaps in its folder (siblings); Escape/back goes to the grid at that folder with the picture selected. App bar: Delete (asks, then Trash), Copy (uri-list, gnome-copied-files, path, and the bytes for PNG and JPEG), Open with, Show in folder (the default file manager, launched with our token), Details (Alt+Enter), Rotate (Ctrl+R, Ctrl+./Ctrl+,), Slide show, All pictures; on the grid Open (portal) and Refresh. Search charm: names in the folder or the viewer's set; Options in ~/.config/cont8nuum/photos.ini. The app bar glyphs object-rotate-left/right and view-presentation are in c8-theme. Tested headless, wide and at 480: the grid, a folder, opening, flipping (PNG, JPEG, an animated GIF, a broken file's message), actual size and panning, the app bar, Details (with camera lines), the slide show, back to the grid, turning a JPEG and a PNG (direction checked, three quick turns queued). Untested: mouse and touch, the charms, Copy, Open with, Delete. Crop (Ctrl+E, the app bar; viewer.c's crop mode, not for an animation or in the slide show): a box over the fitted picture (CROP_MARGIN), dimmed outside, thirds, eight handles (GRAB_PX, by touch GRAB_TOUCH_PX); dragging inside moves it. Arrows move it by a hundredth of the picture, Shift+arrows its bottom-right corner; the root's crop_keys hands arrows to viewer_crop_key because the ratio button or Save may have the focus (they did nothing after picking a ratio, 2026-12-04), and picking a ratio gives the focus back to the viewer so Enter saves rather than opening the menu again. Escape cancels, Enter saves. The crop bar under the viewer: Aspect ratio (Any, Original, Square, 16:9, 4:3, 3:2, turned for a portrait picture), Save a copy, Cancel. encode.c (no c8ui, also in the tile provider): glycin decodes again (ph_decode) and encodes (GlyCreator, sandboxed like its loaders; JPEG as RGB q92, else RGBA unpremultiplied only when not opaque) on a GTask thread (ph_save, which copies the region first). A copy is "Name (cropped).ext" or "(cropped N)", same type when glycin can write it, HEIF/AVIF/JXL as JPEG, else PNG; then the folder is read again and the copy shown. Copies lose the metadata (already turned as the EXIF said). Only local files. Set as (app bar): Start background, Lock screen or Both; the whole picture, at most 3840 a side, JPEG, to c8_background_path (c8-base background.h). Start redraws by itself, the lock screen reads it when it locks, c8-sync sends it to the account, and the shell copies the lock one for the sign-in screen (c8-shell LOCK-AUTH.md). PC settings' Personalise says one is set and has Remove. By date (app bar on the grid, Folders back; [view] by_date): all of Pictures (ph_list_dates, folder.c: depth 8, 50000 at most, hidden skipped) newest first, one SUBHEADER and one grid list per month in a vertical box (browse.c's dscroll; a list with spans would fill a month's gap with the next's pictures); one selection across them, and opening one flips through all of them in date order. The date is EXIF DateTimeOriginal (else DateTime; ph_taken, meta.c, needs gexiv2), else the file's mtime, cached in ~/.cache/cont8nuum/photos-dates.ini (path = "taken mtime", read again when the mtime differs). A folder opened from a link or a search shows folders again. Live tile (tile.c, c8-photos-tile, data/c8-photos.widget, wide): the 5 newest pictures in Pictures by mtime (depth 6, SVGs skipped) as 640 px JPEGs in ~/.cache/cont8nuum/photos-tile/ (named by the md5 of path and mtime; the shell reads files only, so not the originals: big, any type, and undecoded outside glycin's sandbox), sent as tagged image updates p0..p4 to the tile and to org.cont8nuum.Photos, only when the set changed. A copy that dropped out goes at the next look, not at once, as the tile may still show it. Pictures' top folder is watched (5 s settle) and looked at every 10 minutes. Tested headless 2026-12-04, wide and at 480: By date (months, order, flipping in date order, back, Folders, the pref, the cache), crop (Square, arrows, Shift+arrows, Enter: a 952x952 copy shown after), the crop bar and the app bar narrow, Set as Both (both files, Start's picture, the lock screen's), the tile (taking turns, a new picture picked up). Untested: dragging the crop handles (headless can't hold a button), touch, EXIF dates from a camera, a crop of a non-JPEG. Stealth mode (stealth.h, c8-base): the Details flyout's Name and Folder, the grid's names and title, the window title and the Delete question show the stand-ins for the login and home folder; the watch (stealth_changed in main.c) redraws the grid and the title, an open Details flyout keeps what it had. Tested headless: Details' Folder. Untested: the grid on /home, flipping it with the grid shown.