summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2022-11-18 02:18:08 +0000
committerOmar Rizwan <omar@omar.website>2022-11-18 02:18:08 +0000
commitd715fa296f96b3f21edbc53dbac5786d2754f5e7 (patch)
treef5132d0ed4f85ef1b81b1195e8996431ea7bffd8 /virtual-programs
parentFix memory leak with Camera images. Do arg checking in c.tcl (diff)
downloadfolk-d715fa296f96b3f21edbc53dbac5786d2754f5e7.tar.gz
folk-d715fa296f96b3f21edbc53dbac5786d2754f5e7.zip
Start working on image folk file
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/image.folk25
1 files changed, 25 insertions, 0 deletions
diff --git a/virtual-programs/image.folk b/virtual-programs/image.folk
new file mode 100644
index 00000000..7aff5305
--- /dev/null
+++ b/virtual-programs/image.folk
@@ -0,0 +1,25 @@
+Wish $this has filename "image.folk"
+
+namespace eval ::image {
+ proc width {im} { dict get $im width }
+ proc height {im} { dict get $im height }
+ proc subimage {im x y subwidth subheight} {
+ dict with im {
+ set subdata [expr {$data + ($y * $width + $x) * $components}]
+ dict create \
+ width $subwidth height $subheight \
+ components $components \
+ bytesPerRow $bytesPerRow \
+ data [format 0x%x $subdata]
+ }
+ }
+ namespace export *
+ namespace ensemble create
+}
+
+When the camera frame is /f/ {
+ When $this has region /r/ {
+ # Wish $this is labelled [regionToBbox $r]
+ }
+ Wish $this is labelled "$f\n[image subimage $f 0 0 100 100]"
+} \ No newline at end of file