/usr/lib/goo/mods/samurui/intrinsic.goo is in goo 0.155-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | (use goo)
(use samurui/samurui)
;; Intrinsic rendering... color, shape, size, (texture, transparentcy), etc.
;; Lightweight object drawing protocol.
(dc <lightweight-renderer> (<any>))
(dg draw-lightweight (canvas|<any> at-point|<point> renderer|<lightweight-renderer> item|<any>))
(dg get-lightweight-dimensions (renderer|<lightweight-renderer> item|<any> => <rectangle>))
(dc <visi-intrinsic> (<lightweight-renderer>))
(dv $pretty-blue #f)
(dm map-color (renderer|<visi-intrinsic> item|<any> => <gui-color>)
(unless $pretty-blue
(set $pretty-blue (color 0 16 192))
)
$pretty-blue
)
(dm draw-lightweight (canvas|<any> at-point|<point> renderer|<visi-intrinsic> item|<any>)
(draw-ellipse canvas
(rect-around (floor (point-x at-point))
(floor (point-y at-point))
4 4)
#t
(map-color renderer item))
)
(dm get-lightweight-dimensions (renderer|<visi-intrinsic> item|<any> => <rectangle>)
(rect 0 0 8 8)
)
(dm point-in-lightweight (renderer|<visi-intrinsic> item|<any> object-point|<point> test-point|<point> => <log>)
(def dx (- (point-x test-point) (point-x object-point)))
(def dy (- (point-y test-point) (point-y object-point)))
(> 16 (+ (* dx dx) (* dy dy)))
)
;; Mapping Techniques:
;; Explicit set mapping -- each unique value mapped to a unique shape/color
;; Range mapping -- for numeric values, map a given percentage in the range to a given
;; swath of color-space, or parametric shape morphing, etc.
;; Derived values... decorated? Statistical analyses of a set, colorize based on deviation, etc.
;; Specialized heuristics, possibly based on consuming James's quantities?
;; -- since the dimensions are explicit, we can tell when we're talking about temperature,
;; speed, etc.
(export
<visi-intrinsic>
<lightweight-renderer>
draw-lightweight
get-lightweight-dimensions
point-in-lightweight
map-color
)
|