diff --git a/virtual-programs/images.folk b/virtual-programs/images.folk index 2fceeb6e..8d75067c 100644 --- a/virtual-programs/images.folk +++ b/virtual-programs/images.folk @@ -279,15 +279,17 @@ namespace eval ::image { variable imagesCache [dict create] # Loads a URL or file path if passed. If passed a valid image_t, # just returns that image_t. - proc load {im} { + proc load {im {name ""}} { variable imagesCache + if {[dict exists $imagesCache $im]} { set im [dict get $imagesCache $im] } else { set impath $im if {[string match "http*://*" $impath]} { - set im /tmp/[regsub -all {\W+} $impath "_"] - exec -ignorestderr curl -o$im $impath + set name [expr { $name ne "" ? $name : [regsub -all {\W+} $impath "_"] }] + set im /tmp/$name + exec -ignorestderr curl -o $im $impath } if {[string match "*jpg" $im] || [string match "*jpeg" $im] || @@ -345,8 +347,11 @@ When /someone/ wishes /p/ displays camera slice /slice/ & /p/ has region /r/ { Wish to draw an image with center $center image $slice radians 0 scale 1 } -When /someone/ wishes /p/ displays image /im/ with scale /s/ { - set im [image load $im] +When /someone/ wishes /p/ displays image /im/ with /...options/ { + set s [dict_getdef $options scale 1] + set name [dict_getdef $options name ""] + + set im [image load $im $name] When $p has region /r/ { # Compute a scale for im that will fit in the region width/height # Draw im with scale and rotation diff --git a/virtual-programs/mask-tags.folk b/virtual-programs/mask-tags.folk index 749bb26c..d498d08a 100644 --- a/virtual-programs/mask-tags.folk +++ b/virtual-programs/mask-tags.folk @@ -1,16 +1,16 @@ -When tag /something/ has corners /corners/ { - set tagCorners [lmap p $corners {::cameraToProjector $p}] +# When tag /id/ has corners /corners/ & /nobody/ claims /id/ is not masked { +# set tagCorners [lmap p $corners {::cameraToProjector $p}] - set vecBottom [sub [lindex $tagCorners 1] [lindex $tagCorners 0]] - set vecRight [sub [lindex $tagCorners 2] [lindex $tagCorners 1]] +# set vecBottom [sub [lindex $tagCorners 1] [lindex $tagCorners 0]] +# set vecRight [sub [lindex $tagCorners 2] [lindex $tagCorners 1]] - set offsets {{-0.5 -0.5} {0.5 -0.5} {0.5 0.5} {-0.5 0.5}} - set scales [matmul $offsets [list $vecBottom $vecRight]] - set corners [add $tagCorners $scales] +# set offsets {{-0.5 -0.5} {0.5 -0.5} {0.5 0.5} {-0.5 0.5}} +# set scales [matmul $offsets [list $vecBottom $vecRight]] +# set corners [add $tagCorners $scales] - set p0 [lindex $corners 0] - set p1 [lindex $corners 1] - set p2 [lindex $corners 2] - set p3 [lindex $corners 3] - Wish to draw a quad with p0 $p0 p1 $p1 p2 $p2 p3 $p3 color black layer 1 -} \ No newline at end of file +# set p0 [lindex $corners 0] +# set p1 [lindex $corners 1] +# set p2 [lindex $corners 2] +# set p3 [lindex $corners 3] +# Wish to draw a quad with p0 $p0 p1 $p1 p2 $p2 p3 $p3 color black layer 1 +# }