Changes to demos.tcl.
| ︙ | | | ︙ | |
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
image delete $photo
return $image
}
# # ## ### ##### ######## #############
proc demo_list {} {
global dir demo dcurrent
set dcurrent {}
foreach f [glob -directory $dir/demos *.tcl] {
set thedemo {}
source $f
#puts <$thedemo>
set demo([dict get $thedemo name]) $thedemo
}
return [lsort -dict [array names demo]]
}
proc demo_label {name} {
global demo
return [dict get $demo($name) label]
}
proc demo_setup {name} {
global demo dcurrent
demo_close
set dcurrent $name
namespace eval ::DEMO [dict get $demo($name) setup]
return
}
proc demo_close {} {
global demo dcurrent
if {![bases]} return
show_image [base]
if {$dcurrent eq {}} return
reframe
namespace eval ::DEMO [dict get $demo($dcurrent) shutdown]
namespace delete ::DEMO
set dcurrent {}
return
}
proc demo_usable {} {
global demo
foreach n [array names demo] {
if {![dict exists $demo($n) active]} {
set active [expr {[bases] == 1}]
} else {
set active [namespace eval ::DEMO [dict get $demo($n) active]]
}
set state [expr { $active ? "normal" : "disabled" }]
#puts du/$n/$active/$state
.t itemconfigure $n -state $state
}
return
}
proc def {name dict} {
upvar 1 thedemo thedemo
lappend thedemo setup {} shutdown {} {*}$dict name $name
return
}
# # ## ### ##### ######## #############
proc reframe {} {
destroy .left .right .top .bottom
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
<
<
|
<
<
|
>
>
>
>
>
>
>
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
image delete $photo
return $image
}
# # ## ### ##### ######## #############
proc demo_init {} {
global dir demo dcurrent
set dcurrent {}
foreach f [glob -directory $dir/demos *.tcl] {
set thedemo {}
source $f
#puts <$thedemo>
set demo([dict get $thedemo name]) $thedemo
}
return
}
proc demo_list {} {
global demo
return [lsort -dict [array names demo]]
}
proc demo_label {name} {
global demo
return [dict get $demo($name) label]
}
proc demo_use {name} {
demo_setup $name
demo_setup_image
return
}
proc demo_setup {name} {
global demo dcurrent
demo_close
set dcurrent $name
namespace eval ::DEMO [dict get $demo($name) setup]
return
}
proc demo_setup_image {} {
global dcurrent demo
namespace eval ::DEMO [dict get $demo($dcurrent) setup_image]
return
}
proc demo_isactive {} {
global dcurrent
if {$dcurrent eq {}} {return 0}
return [string equal [.t itemcget $dcurrent -state] normal]
}
proc demo_close {} {
global demo dcurrent
if {![bases]} return
show_image [base]
if {$dcurrent eq {}} return
reframe
namespace eval ::DEMO [dict get $demo($dcurrent) shutdown]
namespace delete ::DEMO
set dcurrent {}
return
}
proc demo_usable {} {
global demo
foreach n [array names demo] {
set active [namespace eval ::DEMO [dict get $demo($n) active]]
set state [expr { $active ? "normal" : "disabled" }]
#puts du/$n/$active/$state
.t itemconfigure $n -state $state
}
return
}
proc def {name dict} {
upvar 1 thedemo thedemo
lappend thedemo \
setup {} \
setup_image {} \
shutdown {} \
active {
expr {[bases] == 1}
} \
{*}$dict name $name
return
}
# # ## ### ##### ######## #############
proc reframe {} {
destroy .left .right .top .bottom
|
| ︙ | | | ︙ | |
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
grid .bottom -row 3 -column 1 -columnspan 3 -sticky swen
return
}
proc gui {} {
widget::toolbar .t
.t add button reset -text Reset -command demo_close
set sep 1
foreach demo [demo_list] {
.t add button $demo \
-text [demo_label $demo] \
-command [list demo_setup $demo] \
-separator $sep
set sep 0
}
.t add button exit -text Exit -command ::exit -separator 1
widget::scrolledwindow .sc -borderwidth 1 -relief sunken
widget::scrolledwindow .sl -borderwidth 1 -relief sunken
|
|
|
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
grid .bottom -row 3 -column 1 -columnspan 3 -sticky swen
return
}
proc gui {} {
widget::toolbar .t
.t add button reset -text Original -command demo_close
set sep 1
foreach demo [demo_list] {
.t add button $demo \
-text [demo_label $demo] \
-command [list demo_use $demo] \
-separator $sep
set sep 0
}
.t add button exit -text Exit -command ::exit -separator 1
widget::scrolledwindow .sc -borderwidth 1 -relief sunken
widget::scrolledwindow .sl -borderwidth 1 -relief sunken
|
| ︙ | | | ︙ | |
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# # ## ### ##### ######## #############
proc show_selection {} {
set selection [.l curselection]
#if {![llength $selection]} return
show $selection
demo_usable
return
}
proc show {indices} {
global base
set base {}
foreach index $indices {
lappend base [images_get $index]
}
demo_close
return
}
# # ## ### ##### ######## #############
## DEMO API
##
## base = Returns the currently selected and loaded input image.
|
>
>
>
>
>
<
|
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
# # ## ### ##### ######## #############
proc show_selection {} {
set selection [.l curselection]
#if {![llength $selection]} return
show $selection
demo_usable
if {[demo_isactive]} {
demo_setup_image
} else {
demo_close
}
return
}
proc show {indices} {
global base
set base {}
foreach index $indices {
lappend base [images_get $index]
}
return
}
# # ## ### ##### ######## #############
## DEMO API
##
## base = Returns the currently selected and loaded input image.
|
| ︙ | | | ︙ | |
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
return [llength $base]
}
# # ## ### ##### ######## #############
proc main {} {
images_init
gui
after 100 {
.l selection set 0
event generate .l <<ListboxSelect>>
}
return
}
main
vwait forever
# vim: set sts=4 sw=4 tw=80 et ft=tcl:
|
>
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
return [llength $base]
}
# # ## ### ##### ######## #############
proc main {} {
images_init
demo_init
gui
after 100 {
.l selection set 0
event generate .l <<ListboxSelect>>
}
return
}
main
vwait forever
# vim: set sts=4 sw=4 tw=80 et ft=tcl:
|
Changes to demos/alpha.tcl.
1
2
3
4
5
6
|
def rgba_alpha {
label Alpha
setup {
show_image [lindex [crimp split [base]] 3]
}
}
|
|
|
1
2
3
4
5
6
|
def rgba_alpha {
label Alpha
setup_image {
show_image [lindex [crimp split [base]] 3]
}
}
|
Changes to demos/blend_hsv.tcl.
1
2
3
4
5
6
7
8
9
10
|
def op_alpha_blend_hsv {
label {Blend HSV}
active { expr {[bases] == 2} }
setup {
# We manage a cache of the blended images to make the
# scrolling of the scale smoother over time. An improvement
# would be to use timer events to precompute the various
# blends.
variable cache
array set cache {}
|
|
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
def op_alpha_blend_hsv {
label {Blend HSV}
active {
expr {
([bases] == 2) &&
([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
}
}
setup {
# We manage a cache of the blended images to make the
# scrolling of the scale smoother over time. An improvement
# would be to use timer events to precompute the various
# blends.
variable cache
array set cache {}
|
| ︙ | | | ︙ | |
Changes to demos/blend_rgb.tcl.
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
|
def op_alpha_blend_rgb {
label {Blend RGB}
active { expr {[bases] == 2} }
setup {
# We manage a cache of the blended images to make the
# scrolling of the scale smoother over time. An improvement
# would be to use timer events to precompute the various
# blends.
variable cache
array set cache {}
set cache(255) [base 0]
set cache(0) [base 1]
variable black [crimp blank rgba 800 600 0 0 0 255]
variable alpha 255
scale .left.s -variable DEMO::alpha \
-from 0 -to 255 \
-orient vertical \
-command [list ::apply {{thealpha} {
variable cache
variable black
if {[info exists cache($thealpha)]} {
show_image $cache($thealpha)
return
}
set theblend [crimp blend [base 0] [base 1] $thealpha]
|
|
>
>
>
>
>
<
<
|
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
|
def op_alpha_blend_rgb {
label {Blend RGB}
active {
expr {
([bases] == 2) &&
([crimp dimensions [base 0]] eq [crimp dimensions [base 1]])
}
}
setup {
# We manage a cache of the blended images to make the
# scrolling of the scale smoother over time. An improvement
# would be to use timer events to precompute the various
# blends.
variable cache
array set cache {}
set cache(255) [base 0]
set cache(0) [base 1]
variable alpha 255
scale .left.s -variable DEMO::alpha \
-from 0 -to 255 \
-orient vertical \
-command [list ::apply {{thealpha} {
variable cache
if {[info exists cache($thealpha)]} {
show_image $cache($thealpha)
return
}
set theblend [crimp blend [base 0] [base 1] $thealpha]
|
| ︙ | | | ︙ | |
Changes to demos/blue.tcl.
1
2
3
4
5
6
|
def rgba_blue {
label Blue
setup {
show_image [lindex [crimp split [base]] 2]
}
}
|
|
|
1
2
3
4
5
6
|
def rgba_blue {
label Blue
setup_image {
show_image [lindex [crimp split [base]] 2]
}
}
|
Changes to demos/degamma.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
def op_gamma_invers {
label Degamma
setup {
variable gamma 1
variable table {}
plot .left.p -variable ::DEMO::table -title {Invers Gamma}
scale .left.s -variable ::DEMO::gamma \
-from 5 -to 1 -resolution 0.01 \
-orient vertical \
-command [list ::apply {{thegamma} {
variable table [crimp table degamma $thegamma]
show_image [crimp degamma [base] $thegamma]
} ::DEMO}]
grid .left.p -row 0 -column 0 -sticky swen
grid .left.s -row 0 -column 1 -sticky swen
}
}
|
>
>
>
>
>
>
>
>
>
>
>
>
<
<
<
|
>
>
>
|
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
|
def op_gamma_invers {
label Degamma
setup {
variable gamma 1
variable table {}
proc show {thegamma} {
variable table [crimp table degamma $thegamma]
show_image [crimp degamma [base] $thegamma]
return
}
proc showit {} {
variable gamma
show $gamma
return
}
plot .left.p -variable ::DEMO::table -title {Invers Gamma}
scale .left.s -variable ::DEMO::gamma \
-from 5 -to 1 -resolution 0.01 \
-orient vertical \
-command ::DEMO::show
grid .left.p -row 0 -column 0 -sticky swen
grid .left.s -row 0 -column 1 -sticky swen
}
setup_image {
showit
}
}
|
Changes to demos/flip_horizontal.tcl.
1
2
3
4
5
6
|
def op_flip_horizontal {
label \u2194
setup {
show_image [crimp flip horizontal [base]]
}
}
|
|
|
1
2
3
4
5
6
|
def op_flip_horizontal {
label \u2194
setup_image {
show_image [crimp flip horizontal [base]]
}
}
|
Changes to demos/flip_transpose.tcl.
1
2
3
4
5
6
|
def op_flip_transpose {
label \\
setup {
show_image [crimp flip transpose [base]]
}
}
|
|
|
1
2
3
4
5
6
|
def op_flip_transpose {
label \\
setup_image {
show_image [crimp flip transpose [base]]
}
}
|
Changes to demos/flip_transverse.tcl.
1
2
3
4
5
6
|
def op_flip_transverse {
label /
setup {
show_image [crimp flip transverse [base]]
}
}
|
|
|
1
2
3
4
5
6
|
def op_flip_transverse {
label /
setup_image {
show_image [crimp flip transverse [base]]
}
}
|
Changes to demos/flip_vertical.tcl.
1
2
3
4
5
6
|
def op_flip_vertical {
label \u2191\u2193
setup {
show_image [crimp flip vertical [base]]
}
}
|
|
|
1
2
3
4
5
6
|
def op_flip_vertical {
label \u2191\u2193
setup_image {
show_image [crimp flip vertical [base]]
}
}
|
Changes to demos/gamma.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
def op_gamma {
label Gamma
setup {
variable gamma 1
variable table {}
plot .left.p -variable ::DEMO::table -title Gamma
scale .left.s -variable ::DEMO::gamma \
-from 5 -to 1 -resolution 0.01 \
-orient vertical \
-command [list ::apply {{thegamma} {
variable table [crimp table gamma $thegamma]
show_image [crimp gamma [base] $thegamma]
} ::DEMO}]
grid .left.p -row 0 -column 0 -sticky swen
grid .left.s -row 0 -column 1 -sticky swen
}
}
|
>
>
>
>
>
>
>
>
>
>
>
>
<
<
<
|
>
>
>
|
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
|
def op_gamma {
label Gamma
setup {
variable gamma 1
variable table {}
proc show {thegamma} {
variable table [crimp table gamma $thegamma]
show_image [crimp gamma [base] $thegamma]
return
}
proc showit {} {
variable gamma
show $gamma
return
}
plot .left.p -variable ::DEMO::table -title Gamma
scale .left.s -variable ::DEMO::gamma \
-from 5 -to 1 -resolution 0.01 \
-orient vertical \
-command ::DEMO::show
grid .left.p -row 0 -column 0 -sticky swen
grid .left.s -row 0 -column 1 -sticky swen
}
setup_image {
showit
}
}
|
Changes to demos/green.tcl.
1
2
3
4
5
6
|
def rgba_green {
label Green
setup {
show_image [lindex [crimp split [base]] 1]
}
}
|
|
|
1
2
3
4
5
6
|
def rgba_green {
label Green
setup_image {
show_image [lindex [crimp split [base]] 1]
}
}
|
Changes to demos/histogram.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
def effect_histogram {
label Histogram
setup {
variable TR {0 1}
variable TG {0 1}
variable TB {0 1}
variable TS {0 1}
variable TV {0 1}
variable TL {0 1}
variable mask [lindex [crimp split [base]] end]
proc HISTO {image} {
variable HR ; variable HG ; variable HB ; variable HL ; variable HH ; variable HS ; variable HV
variable TR ; variable TG ; variable TB ; variable TL ; variable TS ; variable TV
array set TMP [crimp histogram $image]
array set TMP [crimp histogram [crimp convert 2grey8 $image]]
|
>
>
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
def effect_histogram {
label Histogram
setup_image {
variable mask [lindex [crimp split [base]] end]
EQNONE
}
setup {
variable TR {0 1}
variable TG {0 1}
variable TB {0 1}
variable TS {0 1}
variable TV {0 1}
variable TL {0 1}
variable mask
proc HISTO {image} {
variable HR ; variable HG ; variable HB ; variable HL ; variable HH ; variable HS ; variable HV
variable TR ; variable TG ; variable TB ; variable TL ; variable TS ; variable TV
array set TMP [crimp histogram $image]
array set TMP [crimp histogram [crimp convert 2grey8 $image]]
|
| ︙ | | | ︙ | |
Changes to demos/hsv_as_rgb.tcl.
1
2
3
4
5
6
|
def effect_hsv_as_rgb {
label {HSV as RGB}
setup {
show_image [crimp join 2rgb {*}[crimp split [crimp convert 2hsv [base]]]]
}
}
|
|
|
1
2
3
4
5
6
|
def effect_hsv_as_rgb {
label {HSV as RGB}
setup_image {
show_image [crimp join 2rgb {*}[crimp split [crimp convert 2hsv [base]]]]
}
}
|
Changes to demos/hue.tcl.
1
2
3
4
5
6
|
def hsv_hue {
label Hue
setup {
show_image [lindex [crimp split [crimp convert 2hsv [base]]] 0]
}
}
|
|
|
1
2
3
4
5
6
|
def hsv_hue {
label Hue
setup_image {
show_image [lindex [crimp split [crimp convert 2hsv [base]]] 0]
}
}
|
Changes to demos/invert.tcl.
1
2
3
4
5
6
|
def op_invert {
label Invert
setup {
show_image [crimp invert [base]]
}
}
|
|
|
1
2
3
4
5
6
|
def op_invert {
label Invert
setup_image {
show_image [crimp invert [base]]
}
}
|
Changes to demos/luma.tcl.
1
2
3
4
5
6
|
def op_luma {
label Luma
setup {
show_image [crimp convert 2grey8 [base]]
}
}
|
|
|
1
2
3
4
5
6
|
def op_luma {
label Luma
setup_image {
show_image [crimp convert 2grey8 [base]]
}
}
|
Changes to demos/matrix.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
def effect_matrix {
label RotMatrix
setup {
scale .left.s \
-from -180 -to 180 -resolution 0.01 \
-orient vertical \
-command [list ::apply {{theangle} {
set s [expr {sin($theangle * 0.017453292519943295769236907684886)}]
set c [expr {cos($theangle * 0.017453292519943295769236907684886)}]
set matrix [list \
[list $c $s 0] \
[list [expr {-$s}] $c 0] \
[list $s $s 1]]
show_image [crimp matrix [base] $matrix]
}}]
pack .left.s -side left -fill both -expand 1
}
}
|
|
|
<
|
|
|
|
|
|
|
|
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
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
|
def effect_matrix {
label RotMatrix
setup {
variable angle 0
proc show {theangle} {
set s [expr {sin($theangle * 0.017453292519943295769236907684886)}]
set c [expr {cos($theangle * 0.017453292519943295769236907684886)}]
set matrix [list \
[list $c $s 0] \
[list [expr {-$s}] $c 0] \
[list $s $s 1]]
show_image [crimp matrix [base] $matrix]
return
}
proc showit {} {
variable angle
show $angle
return
}
scale .left.s -variable ::DEMO::angle \
-from -180 -to 180 -resolution 0.01 \
-orient vertical \
-command ::DEMO::show
pack .left.s -side left -fill both -expand 1
}
setup_image {
showit
}
}
|
Changes to demos/over.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
def op_alpha_over {
label Over
active { expr {[bases] == 2} }
setup {
# We use the foreground image's luma as opacity (bright =
# opaque, dark = transparent) to merge it with the background
# image. At last we force fully opaque to avoid mix effects
# against the canvas background color.
show_image [crimp convert 2rgb \
[crimp over \
[crimp setalpha [base] [crimp convert 2grey8 [base]]] \
[base 1]]]
}
}
|
|
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
def op_alpha_over {
label Over
active { expr {[bases] == 2} }
setup_image {
# We use the foreground image's luma as opacity (bright =
# opaque, dark = transparent) to merge it with the background
# image. At last we force fully opaque to avoid mix effects
# against the canvas background color.
show_image [crimp convert 2rgb \
[crimp over \
[crimp setalpha \
[base] \
[crimp convert 2grey8 [base]]] \
[base 1]]]
}
}
|
Changes to demos/overi.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
def op_alpha_over_revers {
label {Over Revers}
active { expr {[bases] == 2} }
setup {
# We use the foreground image's luma as opacity (bright =
# opaque, dark = transparent) to merge it with the background
# image. At last we force fully opaque to avoid mix effects
# against the canvas background color.
show_image [crimp convert 2rgb \
[crimp over \
[crimp setalpha [base 1] [crimp convert 2grey8 [base 1]]] \
[base 0]]]
}
}
|
|
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
def op_alpha_over_revers {
label {Over Revers}
active { expr {[bases] == 2} }
setup_image {
# We use the foreground image's luma as opacity (bright =
# opaque, dark = transparent) to merge it with the background
# image. At last we force fully opaque to avoid mix effects
# against the canvas background color.
show_image [crimp convert 2rgb \
[crimp over \
[crimp setalpha \
[base 1] \
[crimp convert 2grey8 [base 1]]] \
[base 0]]]
}
}
|
Changes to demos/red.tcl.
1
2
3
4
5
6
|
def rgba_red {
label Red
setup {
show_image [lindex [crimp split [base]] 0]
}
}
|
|
|
1
2
3
4
5
6
|
def rgba_red {
label Red
setup_image {
show_image [lindex [crimp split [base]] 0]
}
}
|
Changes to demos/rehsv.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
def effect_rehsv {
label {Change HSV}
setup {
variable hsvbase [crimp convert 2hsv [base]]
variable ghg 1 ; variable gsg 1 ; variable gvg 1
variable ghb 0 ; variable gsb 0 ; variable gvb 0
variable th [crimp table gainw $ghg $ghb] ; variable mh [crimp map gainw $ghg $ghb]
variable ts [crimp table gain $gsg $gsb] ; variable ms [crimp map gain $gsg $gsb]
variable tv [crimp table gain $gvg $gvb] ; variable mv [crimp map gain $gvg $gvb]
variable mask [lindex [crimp split [base]] end]
proc H {args} {
variable ghb
variable ghg
variable th [crimp table gainw $ghg $ghb]
variable mh [crimp map gainw $ghg $ghb]
UPDATE
|
|
>
>
<
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
def effect_rehsv {
label {Change HSV}
setup {
variable hsvbase
variable mask
variable ghg 1 ; variable gsg 1 ; variable gvg 1
variable ghb 0 ; variable gsb 0 ; variable gvb 0
variable th [crimp table gainw $ghg $ghb] ; variable mh [crimp map gainw $ghg $ghb]
variable ts [crimp table gain $gsg $gsb] ; variable ms [crimp map gain $gsg $gsb]
variable tv [crimp table gain $gvg $gvb] ; variable mv [crimp map gain $gvg $gvb]
proc H {args} {
variable ghb
variable ghg
variable th [crimp table gainw $ghg $ghb]
variable mh [crimp map gainw $ghg $ghb]
UPDATE
|
| ︙ | | | ︙ | |
67
68
69
70
71
72
73
74
75
|
grid .left.sg -row 1 -column 0 -sticky sen
grid .left.ps -row 1 -column 1 -sticky swen
grid .left.sb -row 1 -column 2 -sticky sen
grid .left.vg -row 2 -column 0 -sticky sen
grid .left.pv -row 2 -column 1 -sticky swen
grid .left.vb -row 2 -column 2 -sticky sen
}
}
|
>
>
>
>
|
>
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
grid .left.sg -row 1 -column 0 -sticky sen
grid .left.ps -row 1 -column 1 -sticky swen
grid .left.sb -row 1 -column 2 -sticky sen
grid .left.vg -row 2 -column 0 -sticky sen
grid .left.pv -row 2 -column 1 -sticky swen
grid .left.vb -row 2 -column 2 -sticky sen
}
setup_image {
variable hsvbase [crimp convert 2hsv [base]]
variable mask [lindex [crimp split [base]] end]
UPDATE
}
}
|
Changes to demos/rgb2hsv2rgb.tcl.
1
2
3
4
5
6
|
def effect_rgb2hsv2rgb {
label "RGB \u2192 HSV \u2192 RGB"
setup {
show_image [crimp convert 2rgba [crimp convert 2hsv [base]]]
}
}
|
|
|
1
2
3
4
5
6
|
def effect_rgb2hsv2rgb {
label "RGB \u2192 HSV \u2192 RGB"
setup_image {
show_image [crimp convert 2rgba [crimp convert 2hsv [base]]]
}
}
|
Changes to demos/saturation.tcl.
1
2
3
4
5
6
|
def hsv_saturation {
label Saturation
setup {
show_image [lindex [crimp split [crimp convert 2hsv [base]]] 1]
}
}
|
|
|
1
2
3
4
5
6
|
def hsv_saturation {
label Saturation
setup_image {
show_image [lindex [crimp split [crimp convert 2hsv [base]]] 1]
}
}
|
Changes to demos/solarize.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
def op_solarize {
label Solarize
setup {
variable threshold 256
variable table {}
plot .left.p -variable ::DEMO::table -title Threshold
scale .left.s -variable ::DEMO::threshold \
-from 0 -to 256 \
-orient horizontal \
-command [list ::apply {{thethreshold} {
variable table [crimp table solarize $thethreshold]
show_image [crimp solarize [base] $thethreshold]
} ::DEMO}]
grid .left.s -row 0 -column 0 -sticky swen
grid .left.p -row 1 -column 0 -sticky swen
}
}
|
>
>
>
>
>
>
>
>
>
>
>
>
<
<
<
|
>
>
>
|
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
|
def op_solarize {
label Solarize
setup {
variable threshold 256
variable table {}
proc show {thethreshold} {
variable table [crimp table solarize $thethreshold]
show_image [crimp solarize [base] $thethreshold]
return
}
proc showit {} {
variable threshold
show $threshold
return
}
plot .left.p -variable ::DEMO::table -title Threshold
scale .left.s -variable ::DEMO::threshold \
-from 0 -to 256 \
-orient horizontal \
-command ::DEMO::show
grid .left.s -row 0 -column 0 -sticky swen
grid .left.p -row 1 -column 0 -sticky swen
}
setup_image {
showit
}
}
|
Changes to demos/value.tcl.
1
2
3
4
5
6
|
def hsv_value {
label Value
setup {
show_image [lindex [crimp split [crimp convert 2hsv [base]]] 2]
}
}
|
|
|
1
2
3
4
5
6
|
def hsv_value {
label Value
setup_image {
show_image [lindex [crimp split [crimp convert 2hsv [base]]] 2]
}
}
|
Changes to demos/wavy.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
def effect_wavy {
label Wavy
setup {
proc W {args} {
variable wa
variable wb
variable wc
show_image [crimp wavy [base] $wa $wb $wc]
return
}
variable wa 1
variable wb 1
variable wc 1
scale .left.wa -variable ::DEMO::wa -from -20 -to 20 -resolution 0.01 -orient vertical -command ::DEMO::W
scale .left.wb -variable ::DEMO::wb -from -20 -to 20 -resolution 0.01 -orient vertical -command ::DEMO::W
scale .left.wc -variable ::DEMO::wc -from -20 -to 20 -resolution 0.01 -orient vertical -command ::DEMO::W
pack .left.wa -side left -expand 1 -fill both
pack .left.wb -side left -expand 1 -fill both
pack .left.wc -side left -expand 1 -fill both
}
}
|
|
|
|
|
>
|
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
|
def effect_wavy {
label Wavy
setup {
proc show {args} {
variable wa
variable wb
variable wc
show_image [crimp wavy [base] $wa $wb $wc]
return
}
variable wa 1
variable wb 1
variable wc 1
scale .left.wa -variable ::DEMO::wa -from -20 -to 20 -resolution 0.01 -orient vertical -command ::DEMO::show
scale .left.wb -variable ::DEMO::wb -from -20 -to 20 -resolution 0.01 -orient vertical -command ::DEMO::show
scale .left.wc -variable ::DEMO::wc -from -20 -to 20 -resolution 0.01 -orient vertical -command ::DEMO::show
pack .left.wa -side left -expand 1 -fill both
pack .left.wb -side left -expand 1 -fill both
pack .left.wc -side left -expand 1 -fill both
}
setup_image { show }
}
|