feat(packages): ludic.photo - a camera's photographs: what the lens sees (the frustum and a line of sight over the ground and the trunks), a grade out of a hundred on size, framing, light and the moment weighted by how much subject there is, the frame's best subject and its tags, the roll with its order and pages, a buyer's price on the grade's curve, the best of each subject; the lens, the light and the market through ports; kept, full, deleted and sold as facts; the roll in its own save section
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
473552cc81
commit
24a35f1174
17 changed files with 975 additions and 0 deletions
54
packages/ludic.photo/order.ludic
Normal file
54
packages/ludic.photo/order.ludic
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# order.ludic - the roll's order and its pages. Forty frames is a pile in taking order; once a frame
|
||||
# has a grade the useful question is which are the best. The index is mapped, never the roll resorted.
|
||||
export const PHOTO_NEWEST: int = 0
|
||||
export const PHOTO_BEST: int = 1
|
||||
export const PHOTO_BY_SUBJECT: int = 2
|
||||
export const PHOTO_PAGE: int = 8
|
||||
|
||||
var pht_sort: int = 0
|
||||
var pht_page: int = 0
|
||||
var pht_order: []int = null
|
||||
|
||||
export function photo_sort() -> int { return pht_sort }
|
||||
export function photo_sort_next() -> void { pht_sort = (pht_sort + 1) % 3 }
|
||||
export function photo_sort_set(s: int) -> void { pht_sort = Math.clamp(s, 0, 2) }
|
||||
|
||||
# the roll in the chosen order: newest first, best first, or by subject
|
||||
export function photo_order() -> []int {
|
||||
pht_order = new []int
|
||||
for i in 0 .. pht_n { push(pht_order, i) }
|
||||
if pht_sort == PHOTO_NEWEST {
|
||||
for i in 0 .. pht_n { pht_order[i] = pht_n - 1 - i }
|
||||
return pht_order
|
||||
}
|
||||
for i in 0 .. pht_n {
|
||||
var best = i
|
||||
for k in i + 1 .. pht_n { if pht_before(pht_order[k], pht_order[best]) { best = k } }
|
||||
let t = pht_order[i]
|
||||
pht_order[i] = pht_order[best]
|
||||
pht_order[best] = t
|
||||
}
|
||||
return pht_order
|
||||
}
|
||||
|
||||
function pht_before(a: int, b: int) -> bool {
|
||||
if pht_sort == PHOTO_BEST { return pht_grade[a] > pht_grade[b] }
|
||||
return pht_mask[a] < pht_mask[b]
|
||||
}
|
||||
|
||||
export function photo_pages() -> int { return (pht_n + PHOTO_PAGE - 1) / PHOTO_PAGE }
|
||||
export function photo_page_now() -> int { return pht_page }
|
||||
export function photo_page_step(d: int) -> void { pht_page = Math.clamp(pht_page + d, 0, Math.max(photo_pages() - 1, 0)) }
|
||||
|
||||
# a page of the roll, in its order; the page is held inside the roll
|
||||
export function photo_page_list() -> []int {
|
||||
let out = new []int
|
||||
if pht_n == 0 { return out }
|
||||
let order = photo_order()
|
||||
if pht_page >= photo_pages() { pht_page = photo_pages() - 1 }
|
||||
for k in 0 .. PHOTO_PAGE {
|
||||
let oi = pht_page * PHOTO_PAGE + k
|
||||
if oi < pht_n { push(out, order[oi]) }
|
||||
}
|
||||
return out
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue