aboutsummaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorlecoanet2004-03-23 08:23:38 +0000
committerlecoanet2004-03-23 08:23:38 +0000
commit50d14214169c405aa823640e604885a259b4c0b4 (patch)
treed2fcaf9956851336e384b6c41aba62b6f9c7eda6 /demos
parent2df45127939155e6279dd1c5415c0a6849daf375 (diff)
downloadtkzinc-50d14214169c405aa823640e604885a259b4c0b4.zip
tkzinc-50d14214169c405aa823640e604885a259b4c0b4.tar.gz
tkzinc-50d14214169c405aa823640e604885a259b4c0b4.tar.bz2
tkzinc-50d14214169c405aa823640e604885a259b4c0b4.tar.xz
Backup the previous patch following addition of -position
in Groups.
Diffstat (limited to 'demos')
-rw-r--r--demos/magicLens.tcl55
1 files changed, 22 insertions, 33 deletions
diff --git a/demos/magicLens.tcl b/demos/magicLens.tcl
index 0ff19e2..9fa8482 100644
--- a/demos/magicLens.tcl
+++ b/demos/magicLens.tcl
@@ -131,21 +131,14 @@ proc LensStart {x y} {
proc LensMove {x y} {
global dx dy zoom zinc infoView
- set dx [expr $x + $dx]
- set dy [expr $y + $dy]
-
- foreach {lx ly} [$zinc itemcget lens -position] break
- set lx [expr $lx + $dx]
- set ly [expr $ly + $dy]
-
- $zinc itemconfigure lens -position [list $lx $ly]
- $zinc translate lenszone $dx $dy
-
- $zinc itemconfigure $infoView -position [list [expr $lx * (1 - $zoom)] \
- [expr $ly * (1 - $zoom)]]
+ $zinc translate current [expr $x + $dx] [expr $y + $dy]
+ $zinc translate lenszone [expr $x + $dx] [expr $y + $dy]
+ set dx [expr 0 - $x]
+ set dy [expr 0 - $y]
- set dx [expr -$x]
- set dy [expr -$y]
+ foreach {lx ly} [$zinc coords lens 0 0] break
+ $zinc coords $infoView [list [expr $lx * (1 - $zoom)] \
+ [expr $ly * (1 - $zoom)]]
}
@@ -168,15 +161,11 @@ proc LensTranslate {way} {
down {set dy 10}
}
- foreach {lx ly} [$zinc itemcget lens -position] break
- set lx [expr $lx + $dx]
- set ly [expr $ly + $dy]
-
- $zinc itemconfigure lens -position [list $lx $ly]
+ $zinc translate lens $dx $dy
$zinc translate lenszone $dx $dy
-
- $zinc itemconfigure $infoView -position [list [expr $lx * (1 - $zoom)] \
- [expr $ly * (1 - $zoom)]]
+ foreach {lx ly} [$zinc coords lens 0 0] break
+ $zinc coords $infoView [list [expr $lx * (1 - $zoom)] \
+ [expr $ly * (1 - $zoom)]]
}
@@ -208,11 +197,10 @@ set lensView [$zinc add group 1 -priority 200]
set infoView [$zinc add group $lensView]
set zoom 1.20
-#set zoom 1.0
$zinc scale $infoView $zoom $zoom
$zinc add rectangle $infoView {{0 0} {1000 900}} \
- -filled 1 -fillcolor \#000000 -tile $lensTexture -linewidth 2
+ -filled 1 -fillcolor \#000000 -tile $lensTexture -linewidth 0
set x 60
for {set i 0} {$i < 12} {incr i} {
@@ -254,32 +242,33 @@ for {set i 0} {$i < 12} {incr i} {
}
# Create intermediate steps between colors (saturation -> desaturation)
- for {set c 0} {$c < 11} {incr c} {
+ for {set c 0} {$c < 11} {incr c} {
# Color of the current step
set color [lindex $znColors $c]
-
+
# Create a zinc item for the color
set sample [$zinc clone $refItem -fillcolor $color]
$zinc translate $sample 0 [expr 65*($c+1)]
-
+
# Add its shape to the multi-contours curve
$zinc contour $gradBar add 1 $sample
-
+
# Move the item to the info group
$zinc chggroup $sample $lGroup
-
+
# Text of label (% saturation + ZnColor)
set txtColor "[expr ((10 - $c)*10)]%\n$color"
$zinc add text $lGroup -priority 200 -position [list 0 [expr ($c + 1)* 65]] \
-text $txtColor -anchor center -alignment center -font $font8 -spacing 2 \
-composescale 0
- }
+ }
incr x 80
}
# Create the lens itself
-set lensGroup [$zinc add group 1 -priority 300 -atomic 1 -position {300 110} -tags lens]
+set lensGroup [$zinc add group 1 -priority 300 -atomic 1 -tags lens]
+$zinc coords $lensGroup {300 110}
set dx 0
set dy 0
LensMove 0 0
@@ -297,8 +286,8 @@ $zinc itemconfigure $lensView -clip $lensZone
set consigne [$zinc add text 1 -position {30 840} -font $font8 -alignment left \
-color \#ffffff -spacing 2 \
-text "<Up>, <Down>, <Left> and <Right> keys or <Mouse Drag>
-# Move the Magic Color Lens behind the color gradiants
-# to see the ZnColor value of Hue/saturation"]
+Move the Magic Color Lens behind the color gradiants
+to see the ZnColor value of Hue/saturation"]
set cClone [$zinc clone $consigne -font $font9b]
$zinc chggroup $cClone $infoView