CRIMP
Check-in [a4d17c5fe4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Converted the remainder of akdemo into plugins for the new xdemo.
Timelines: family | ancestors | descendants | both | ak-experimental
Files: files | file ages | folders
SHA1: a4d17c5fe4705f257706340c450d9650aa553ae8
User & Date: andreask 2010-07-07 20:03:11.000
Context
2010-07-07
20:04
Dropped old demos (mine and andy's) check-in: ecaf4070d8 user: andreask tags: ak-experimental
20:03
Converted the remainder of akdemo into plugins for the new xdemo. check-in: a4d17c5fe4 user: andreask tags: ak-experimental
06:38

Created a new demo application which is properly modular.

I.e. this application pulls in the demo definitions from a directory,
automatically extending the GUI (toolbar), and also allowing each demo
to extend the GUI in a limited way.

Started to port the demos in akdemo over to this system.


check-in: 8a9e88dbdc user: andreask tags: ak-experimental
Changes
Unified Diff Ignore Whitespace Patch
Added demos/alpha.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def rgba_alpha {
    label Alpha
    setup {
	show_image [lindex [crimp split [base]] 3]
    }
}
Added demos/blue.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def rgba_blue {
    label Blue
    setup {
	show_image [lindex [crimp split [base]] 2]
    }
}
Changes to demos/degamma.tcl.
1
2
3
4
5
6
7
8
def degamma {
    label Degamma
    setup {
	set ::DEGAMMA 1
	scale .g \
	    -variable ::DEGAMMA \
	    -from 0.01 \
	    -to   5.00 \
|







1
2
3
4
5
6
7
8
def op_gamma_invers {
    label Degamma
    setup {
	set ::DEGAMMA 1
	scale .g \
	    -variable ::DEGAMMA \
	    -from 0.01 \
	    -to   5.00 \
Added demos/flip_horizontal.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def op_flip_horizontal {
    label \u2194
    setup {
	show_image [crimp flip horizontal [base]]
    }
}
Added demos/flip_transpose.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def op_flip_transpose {
    label \\
    setup {
	show_image [crimp flip transpose [base]]
    }
}
Added demos/flip_transverse.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def op_flip_transverse {
    label /
    setup {
	show_image [crimp flip transverse [base]]
    }
}
Added demos/flip_vertical.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def op_flip_vertical {
    label \u2191\u2193
    setup {
	show_image [crimp flip vertical [base]]
    }
}
Changes to demos/gamma.tcl.
1
2
3
4
5
6
7
8
def gamma {
    label Gamma
    setup {
	set ::GAMMA 1
	scale .g \
	    -variable ::GAMMA \
	    -from 0 \
	    -to 5 \
|







1
2
3
4
5
6
7
8
def op_gamma {
    label Gamma
    setup {
	set ::GAMMA 1
	scale .g \
	    -variable ::GAMMA \
	    -from 0 \
	    -to 5 \
Added demos/green.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def rgba_green {
    label Green
    setup {
	show_image [lindex [crimp split [base]] 1]
    }
}
Added 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]]]]
    }
}
Added 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]
    }
}
Changes to demos/invert.tcl.
1
2
3
4
5
6
def invert {
    label Invert
    setup {
	show_image [crimp invert [base]]
    }
}
|





1
2
3
4
5
6
def op_invert {
    label Invert
    setup {
	show_image [crimp invert [base]]
    }
}
Added demos/luma.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def op_luma {
    label Luma
    setup {
	show_image [crimp convert 2grey8 [base]]
    }
}
Added demos/matrix.tcl.










































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def effect_matrix {
    label RotMatrix
    setup {
	scale .s -from -180 -to 180 -resolution 0.01 \
	    -orient vertical -command [list ::apply {{angle} {
		set s [expr {sin($angle * 0.017453292519943295769236907684886)}]
		set c [expr {cos($angle * 0.017453292519943295769236907684886)}]
		set matrix [list \
				[list $c           $s 0] \
				[list [expr {-$s}] $c 0] \
				[list $s           $s 1]]
		#puts matrix...
		show_image [crimp matrix [base] $matrix]
	    }}]

	extendgui .s
    }
    shutdown {
	destroy .s
    }
}
Changes to demos/psych.tcl.
1
2
3
4
5
6
7
8
9
10
11

12
13
def psychedelia {
    label Psychedelia
    setup {
	proc ::P {} {
	    show_image [crimp psychedelia 320 240 100]
	    set ::PX [after 100 ::P]
	}
	::P
    }
    shutdown {
	after cancel $::PX

    }
}
|










>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
def effect_psychedelia {
    label Psychedelia
    setup {
	proc ::P {} {
	    show_image [crimp psychedelia 320 240 100]
	    set ::PX [after 100 ::P]
	}
	::P
    }
    shutdown {
	after cancel $::PX
	unset ::PX
    }
}
Added demos/red.tcl.












>
>
>
>
>
>
1
2
3
4
5
6
def rgba_red {
    label Red
    setup {
	show_image [lindex [crimp split [base]] 0]
    }
}
Added demos/rehsv.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
29
30
31
32
33
34
35
36
37
38
def effect_rehsv {
    label {Change HSV}
    setup {
	proc ::RE {args} {
	    global gh gs gv ghsv

	    set mh [crimp map gain $gh]
	    set ms [crimp map gain $gs]
	    set mv [crimp map gain $gv]

	    show_image [crimp convert 2rgb [crimp remap $ghsv $mh $ms $mv]]
	    return
	}

	set ::gh 1
	set ::gs 1
	set ::gv 1

	frame .f

	scale .f.gh -variable ::gh -from 0 -to 20 -resolution 0.01 -orient vertical -command ::RE
	scale .f.gs -variable ::gs -from 0 -to 20 -resolution 0.01 -orient vertical -command ::RE
	scale .f.gv -variable ::gv -from 0 -to 20 -resolution 0.01 -orient vertical -command ::RE

	pack .f.gh -side left -expand 1 -fill both
	pack .f.gs -side left -expand 1 -fill both
	pack .f.gv -side left -expand 1 -fill both

	extendgui .f

	set ::ghsv [crimp convert 2hsv [base]]

    }
    shutdown {
	unset ::gh ::gs ::gv ::ghsv
	destroy .f
    }
}
Added 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]]]
    }
}
Added 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]
    }
}
Changes to demos/solarize.tcl.
1
2
3
4
5
6
7
8
def solarize {
    label Solarize
    setup {
	set ::X 256
	scale .s \
	    -variable ::X \
	    -from 0 \
	    -to 256 \
|







1
2
3
4
5
6
7
8
def op_solarize {
    label Solarize
    setup {
	set ::X 256
	scale .s \
	    -variable ::X \
	    -from 0 \
	    -to 256 \
Added 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]
    }
}
Added 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
25
26
27
28
29
30
def effect_wavy {
    label Wavy
    setup {
	proc ::W {args} {
	    global wa wb wc
	    show_image [crimp wavy [base] $wa $wb $wc]
	    return
	}

	set ::wa 1
	set ::wb 1
	set ::wc 1

	frame .f

	scale .f.wa -variable ::wa -from -20 -to 20 -resolution 0.01 -orient vertical -command ::W
	scale .f.wb -variable ::wb -from -20 -to 20 -resolution 0.01 -orient vertical -command ::W
	scale .f.wc -variable ::wc -from -20 -to 20 -resolution 0.01 -orient vertical -command ::W

	pack .f.wa -side left -expand 1 -fill both
	pack .f.wb -side left -expand 1 -fill both
	pack .f.wc -side left -expand 1 -fill both

	extendgui .f
    }
    shutdown {
	unset ::wa ::wb ::wc
	destroy .f
    }
}
Changes to xdemo.tcl.
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    foreach f [glob -directory $dir/demos *.tcl] {
	set thedemo {}
	source $f
	#puts <$thedemo>
	set demo([dict get $thedemo name]) $thedemo
    }

    return [array names demo]
}

proc demo_label {name} {
    global demo
    return [dict get $demo($name) label]
}








|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    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]
}