summaryrefslogtreecommitdiffstats
path: root/ext/tk/sample/tkextlib/blt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/tkextlib/blt')
-rw-r--r--ext/tk/sample/tkextlib/blt/barchart5.rb101
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7.rb40
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7a.rb63
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7b.rb41
-rw-r--r--ext/tk/sample/tkextlib/blt/graph7c.rb45
-rw-r--r--ext/tk/sample/tkextlib/blt/images/buckskin.gifbin0 -> 7561 bytes
-rw-r--r--ext/tk/sample/tkextlib/blt/images/qv100.t.gifbin0 -> 2694 bytes
-rw-r--r--ext/tk/sample/tkextlib/blt/images/sample.gifbin0 -> 186103 bytes
-rw-r--r--ext/tk/sample/tkextlib/blt/plot1.rb9
-rw-r--r--ext/tk/sample/tkextlib/blt/plot1b.rb10
-rw-r--r--ext/tk/sample/tkextlib/blt/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/blt/scripts/stipples.rb156
-rw-r--r--ext/tk/sample/tkextlib/blt/winop1.rb40
-rw-r--r--ext/tk/sample/tkextlib/blt/winop2.rb28
14 files changed, 535 insertions, 0 deletions
diff --git a/ext/tk/sample/tkextlib/blt/barchart5.rb b/ext/tk/sample/tkextlib/blt/barchart5.rb
new file mode 100644
index 000000000..db181d10c
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/barchart5.rb
@@ -0,0 +1,101 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+load File.join(File.dirname(File.expand_path(__FILE__)),
+ 'scripts', 'stipples.rb')
+
+TkOption.add('*graph.x.Title', 'X Axis Label')
+TkOption.add('*graph.y.Title', 'Y Axis Label')
+TkOption.add('*graph.title', 'A Simple Barchart')
+TkOption.add('*graph.x.Font', 'Times 10')
+TkOption.add('*graph.Element.Relief', :raised)
+
+visual = Tk.root.winfo_screenvisual
+if visual != 'staticgray' && visual != 'grayscale'
+ TkOption.add('*graph.LineMarker.color', 'yellow')
+ TkOption.add('*graph.Element.Background', 'white')
+ TkOption.add('*graph.Legend.activeForeground', 'pink')
+ TkOption.add('*print.background', 'yellow')
+ TkOption.add('*quit.background', 'red')
+ TkOption.add('*graph.background', 'palegreen')
+ TkOption.add('*graph.plotBackground', 'lightblue')
+end
+
+htext = Tk::BLT::Htext.new(:widgetname=>'.htext', :text=><<EOD)
+ This is an example of the barchart widget. The barchart has
+ many components; x and y axis, legend, crosshairs, elements, etc.
+ To create a postscript file "bar.ps", press the %%
+
+ ruby {
+ b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window,
+ :widgetname=>'print', :text=>'Print',
+ :command=>proc{
+ $graph.postsript(:output=>'bar.ps')
+ })
+ Tk::BLT::Htext::Htext_Widget.window.append(b)
+ }
+
+%% button.
+%%
+
+ ruby {
+ $graph = Tk::BLT::Barchart.new(:widgetname=>'.htext.graph',
+ :relief=>:raised, :borderwidth=>2)
+ $graph.xaxis_configure(:rotate=>90, :stepsize=>0)
+ Tk::BLT::Htext::Htext_Widget.window.append($graph,
+ :fill=>:both, :padx=>4)
+ }
+
+%%
+ Hit the %%
+
+ ruby {
+ b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window,
+ :widgetname=>'quit', :text=>'Quit',
+ :command=>proc{ exit })
+ Tk::BLT::Htext::Htext_Widget.window.append(b)
+ }
+
+%% button when you've seen enough.%%
+
+ ruby {
+ l = TkLabel.new(Tk::BLT::Htext::Htext_Widget.window, :bitmap=>'BLT')
+ Tk::BLT::Htext::Htext_Widget.window.append(l, :padx=>20)
+ }
+
+%%
+EOD
+
+names = %w(One Two Three Four Five Six Seven Eight)
+if visual == 'staticgray' || visual == 'grayscale'
+ fgcolors = %w(white white white white white white white white)
+ bgcolors = %w(black black black black black black black black)
+else
+ fgcolors = %w(yellow orange red magenta purple blue cyan green)
+ bgcolors = %w(yellow4 orange4 red4 magenta4 purple4 blue4 cyan4 green4)
+end
+
+numColors = names.length
+
+Tk::TCL_PRECISION.value = 15
+
+x = Tk::BLT::Vector.new
+y = Tk::BLT::Vector.new
+x.seq(-5.0, 5.0, 0.2)
+y.expr("sin(#{x})")
+barWidth = 0.19
+
+$graph.element_create('sin', :relief=>:raised, :borderwidth=>1,
+ :x=>x, :y=>y, :barwidth=>barWidth)
+
+Tk::BLT::Table.add(Tk.root, htext, :fill=>:both)
+
+Tk.root.minsize(0, 0)
+
+Tk::BLT.zoom_stack($graph)
+Tk::BLT.crosshairs($graph)
+Tk::BLT.active_legend($graph)
+Tk::BLT.closest_point($graph)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7.rb b/ext/tk/sample/tkextlib/blt/graph7.rb
new file mode 100644
index 000000000..27fbe53d9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/graph7.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+length = 250000
+graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
+graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
+graph.yaxis_configure(:title=>'Y Axis Label')
+graph.legend_configure(:activerelief=>:sunken, :background=>'')
+
+Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
+
+v_x = Tk::BLT::Vector.new(length)
+v_y = Tk::BLT::Vector.new(length)
+v_x.expr("random(#{v_x})")
+v_y.expr("random(#{v_y})")
+v_x.sort(v_y)
+
+plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
+ :color=>'green4', :fill=>'green2',
+ :linewidth=>0, :outlinewidth=>1,
+ :pixels=>4, :label=>'plot',
+ :xdata=>v_x, :ydata=>v_y)
+
+Tk.root.minsize(0, 0)
+
+#graph.zoom_stack
+#graph.crosshairs
+#graph.active_legend
+#graph.closest_point
+Tk::BLT.zoom_stack(graph)
+Tk::BLT.crosshairs(graph)
+Tk::BLT.active_legend(graph)
+Tk::BLT.closest_point(graph)
+
+Tk::BLT::Busy.hold(graph)
+Tk.update
+Tk::BLT::Busy.release(graph)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7a.rb b/ext/tk/sample/tkextlib/blt/graph7a.rb
new file mode 100644
index 000000000..a014f72fc
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/graph7a.rb
@@ -0,0 +1,63 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+file = File.join(File.dirname(File.expand_path(__FILE__)),
+ 'images', 'buckskin.gif')
+bgTexture = TkPhotoImage.new(:file=>file)
+
+TkOption.add('*Graph.Tile', bgTexture)
+TkOption.add('*Label.Tile', bgTexture)
+TkOption.add('*Frame.Tile', bgTexture)
+TkOption.add('*Htext.Tile', bgTexture)
+TkOption.add('*TileOffset', 0)
+TkOption.add('*HighlightThickness', 0)
+TkOption.add('*Element.ScaleSybols', false)
+TkOption.add('*Element.Smooth', :linear)
+TkOption.add('*activeLine.Color', 'yellow4')
+TkOption.add('*activeLine.Fill', 'yellow')
+TkOption.add('*activeLine.LineWidth', 0)
+TkOption.add('*Element.Pixels', 3)
+TkOption.add('*Graph.halo', '7i')
+
+if Tk.root.winfo_screenvisual != 'staticgray'
+ TkOption.add('*print.background', 'yellow')
+ TkOption.add('*quit.background', 'red')
+end
+
+length = 250000
+graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
+graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
+graph.yaxis_configure(:title=>'Y Axis Label')
+graph.legend_configure(:activerelief=>:sunken, :background=>'')
+
+Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
+
+v_x = Tk::BLT::Vector.new(length)
+v_y = Tk::BLT::Vector.new(length)
+v_x.expr("random(#{v_x})")
+v_y.expr("random(#{v_y})")
+v_x.sort(v_y)
+
+plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
+ :color=>'green4', :fill=>'green2',
+ :linewidth=>0, :outlinewidth=>1,
+ :pixels=>4, :label=>'plot',
+ :xdata=>v_x, :ydata=>v_y)
+
+Tk.root.minsize(0, 0)
+
+#graph.zoom_stack
+#graph.crosshairs
+#graph.active_legend
+#graph.closest_point
+Tk::BLT.zoom_stack(graph)
+Tk::BLT.crosshairs(graph)
+Tk::BLT.active_legend(graph)
+Tk::BLT.closest_point(graph)
+
+Tk::BLT::Busy.hold(graph)
+Tk.update
+Tk::BLT::Busy.release(graph)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7b.rb b/ext/tk/sample/tkextlib/blt/graph7b.rb
new file mode 100644
index 000000000..c589f18d8
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/graph7b.rb
@@ -0,0 +1,41 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+length = 250000
+graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
+graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
+graph.yaxis_configure(:title=>'Y Axis Label')
+graph.legend_configure(:activerelief=>:sunken, :background=>'')
+
+Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
+
+x = Array.new(length)
+y = Array.new(length)
+(0...length).each{|i|
+ x[i] = rand
+ y[i] = rand
+}
+
+plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
+ :color=>'green4', :fill=>'green2',
+ :linewidth=>0, :outlinewidth=>1,
+ :pixels=>4, :label=>'plot',
+ :xdata=>x, :ydata=>y)
+
+Tk.root.minsize(0, 0)
+
+#graph.zoom_stack
+#graph.crosshairs
+#graph.active_legend
+#graph.closest_point
+Tk::BLT.zoom_stack(graph)
+Tk::BLT.crosshairs(graph)
+Tk::BLT.active_legend(graph)
+Tk::BLT.closest_point(graph)
+
+Tk::BLT::Busy.hold(graph)
+Tk.update
+Tk::BLT::Busy.release(graph)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/graph7c.rb b/ext/tk/sample/tkextlib/blt/graph7c.rb
new file mode 100644
index 000000000..495b66f4a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/graph7c.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+length = 250000
+graph = Tk::BLT::Graph.new(:title=>"Scatter Plot\n#{length} points")
+graph.xaxis_configure(:loose=>false, :title=>'X Axis Label')
+graph.yaxis_configure(:title=>'Y Axis Label')
+graph.legend_configure(:activerelief=>:sunken, :background=>'')
+
+Tk::BLT::Table.add(Tk.root, graph, [0,0], :fill=>:both)
+
+v_x = Tk::BLT::Vector.new(length)
+v_y = Tk::BLT::Vector.new(length)
+x = Array.new(length)
+y = Array.new(length)
+(0...length).each{|i|
+ x[i] = rand
+ y[i] = rand
+}
+v_x.set(x)
+v_y.set(y)
+
+plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square,
+ :color=>'green4', :fill=>'green2',
+ :linewidth=>0, :outlinewidth=>1,
+ :pixels=>4, :label=>'plot',
+ :xdata=>v_x, :ydata=>v_y)
+
+Tk.root.minsize(0, 0)
+
+#graph.zoom_stack
+#graph.crosshairs
+#graph.active_legend
+#graph.closest_point
+Tk::BLT.zoom_stack(graph)
+Tk::BLT.crosshairs(graph)
+Tk::BLT.active_legend(graph)
+Tk::BLT.closest_point(graph)
+
+Tk::BLT::Busy.hold(graph)
+Tk.update
+Tk::BLT::Busy.release(graph)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/images/buckskin.gif b/ext/tk/sample/tkextlib/blt/images/buckskin.gif
new file mode 100644
index 000000000..e2d7be9d6
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/images/buckskin.gif
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/images/qv100.t.gif b/ext/tk/sample/tkextlib/blt/images/qv100.t.gif
new file mode 100644
index 000000000..1e738ee86
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/images/qv100.t.gif
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/images/sample.gif b/ext/tk/sample/tkextlib/blt/images/sample.gif
new file mode 100644
index 000000000..1d8a4010c
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/images/sample.gif
Binary files differ
diff --git a/ext/tk/sample/tkextlib/blt/plot1.rb b/ext/tk/sample/tkextlib/blt/plot1.rb
new file mode 100644
index 000000000..07dff4829
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/plot1.rb
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+graph = Tk::BLT::Graph.new.pack
+plot = Tk::BLT::PlotComponent::Element.new(graph, :linewidth=>0, :label=>'foo')
+plot.data([[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/plot1b.rb b/ext/tk/sample/tkextlib/blt/plot1b.rb
new file mode 100644
index 000000000..eb41e361f
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/plot1b.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+graph = Tk::BLT::Graph.new.pack
+plot = graph.element_create
+plot.configure(:linewidth=>0, :label=>'foo',
+ :data=>[[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten)
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/readme.txt b/ext/tk/sample/tkextlib/blt/readme.txt
new file mode 100644
index 000000000..fe12dd88a
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/readme.txt
@@ -0,0 +1,2 @@
+The scripts and image files in this directory are based on demo files
+of Tcl/Tk's BLT extention.
diff --git a/ext/tk/sample/tkextlib/blt/scripts/stipples.rb b/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
new file mode 100644
index 000000000..47f3c4d06
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/scripts/stipples.rb
@@ -0,0 +1,156 @@
+$stipples = {} unless $stipples
+
+$stipples['bdiagonal1'] = Tk::BLT::Bitmap.new(<<EOD)
+#define bdiagonal1_width 8
+#define bdiagonal1_height 8
+static unsigned char bdiagonal1_bits[] = {
+ 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11};
+EOD
+
+$stipples['bdiagonal2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define bdiagonal2_width 8
+#define bdiagonal2_height 8
+static unsigned char bdiagonal2_bits[] = {
+ 0x08, 0x04, 0x02, 0x01, 0x80, 0x40, 0x20, 0x10};
+EOD
+
+$stipples['checker2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define checker2_width 8
+#define checker2_height 8
+static unsigned char checker2_bits[] = {
+ 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc};
+EOD
+
+
+$stipples['checker3'] = Tk::BLT::Bitmap.new(<<EOD)
+#define checker3_width 8
+#define checker3_height 8
+static unsigned char checker3_bits[] = {
+ 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0};
+EOD
+
+$stipples['cross1'] = Tk::BLT::Bitmap.new(<<EOD)
+#define cross1_width 8
+#define cross1_height 8
+static unsigned char cross_bits[] = {
+ 0xff, 0xaa, 0xff, 0xaa, 0xff, 0xaa, 0xff, 0xaa};
+EOD
+
+$stipples['cross2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define cross2_width 8
+#define cross2_height 8
+static unsigned char cross2_bits[] = {
+ 0xff, 0x88, 0x88, 0x88, 0xff, 0x88, 0x88, 0x88};
+EOD
+
+$stipples['cross3'] = Tk::BLT::Bitmap.new(<<EOD)
+#define cross3_width 8
+#define cross3_height 8
+static unsigned char cross3_bits[] = {
+ 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
+EOD
+
+$stipples['crossdiag'] = Tk::BLT::Bitmap.new(<<EOD)
+#define crossdiag_width 8
+#define crossdiag_height 8
+static unsigned char crossdiag2_bits[] = {
+ 0x18, 0x24, 0x42, 0x81, 0x81, 0x42, 0x24, 0x18};
+EOD
+
+$stipples['dot1'] = Tk::BLT::Bitmap.new(<<EOD)
+#define dot1_width 8
+#define dot1_height 8
+static unsigned char dot1_bits[] = {
+ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa};
+EOD
+
+$stipples['dot2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define dot2_width 8
+#define dot2_height 8
+static unsigned char dot2_bits[] = {
+ 0x55, 0x00, 0x55, 0x00, 0x55, 0x00, 0x55, 0x00};
+EOD
+
+$stipples['dot3'] = Tk::BLT::Bitmap.new(<<EOD)
+#define dot3_width 8
+#define dot3_height 8
+static unsigned char dot3_bits[] = {
+ 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00};
+EOD
+
+$stipples['dot4'] = Tk::BLT::Bitmap.new(<<EOD)
+#define dot4_width 8
+#define dot4_height 8
+static unsigned char dot4_bits[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+EOD
+
+$stipples['fdiagonal1'] = Tk::BLT::Bitmap.new(<<EOD)
+#define fdiagonal1_width 8
+#define fdiagonal1_height 8
+static unsigned char fdiagonal1_bits[] = {
+ 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88};
+EOD
+
+$stipples['fdiagonal2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define fdiagonal2_width 8
+#define fdiagonal2_height 8
+static unsigned char fdiagonal2_bits[] = {
+ 0x10, 0x20, 0x40, 0x80, 0x01, 0x02, 0x04, 0x08};
+EOD
+
+$stipples['hline1'] = Tk::BLT::Bitmap.new(<<EOD)
+#define hline1_width 8
+#define hline1_height 8
+static unsigned char hline1_bits[] = {
+ 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00};
+EOD
+
+$stipples['hline2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define hline2_width 8
+#define hline2_height 8
+static unsigned char hline2_bits[] = {
+ 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00};
+EOD
+
+$stipples['lbottom'] = Tk::BLT::Bitmap.new(<<EOD)
+#define lbottom_width 8
+#define lbottom_height 8
+static unsigned char lbottom_bits[] = {
+ 0x00, 0x11, 0x11, 0x77, 0x00, 0x11, 0x11, 0x77};
+EOD
+
+$stipples['ltop'] = Tk::BLT::Bitmap.new(<<EOD)
+#define ltop_width 8
+#define ltop_height 8
+static unsigned char ltop_bits[] = {
+ 0xee, 0x88, 0x88, 0x00, 0xee, 0x88, 0x88, 0x00};
+EOD
+
+$stipples['rbottom'] = Tk::BLT::Bitmap.new(<<EOD)
+#define rbottom_width 8
+#define rbottom_height 8
+static unsigned char rbottom_bits[] = {
+ 0x00, 0x88, 0x88, 0xee, 0x00, 0x88, 0x88, 0xee};
+EOD
+
+$stipples['rtop'] = Tk::BLT::Bitmap.new(<<EOD)
+#define rtop_width 8
+#define rtop_height 8
+static unsigned char rtop_bits[] = {
+ 0x77, 0x11, 0x11, 0x00, 0x77, 0x11, 0x11, 0x00};
+EOD
+
+$stipples['vline1'] = Tk::BLT::Bitmap.new(<<EOD)
+#define vline1_width 8
+#define vline1_height 8
+static unsigned char vline1_bits[] = {
+ 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
+EOD
+
+$stipples['vline2'] = Tk::BLT::Bitmap.new(<<EOD)
+#define vline2_width 8
+#define vline2_height 8
+static unsigned char vline2_bits[] = {
+ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33};
+EOD
diff --git a/ext/tk/sample/tkextlib/blt/winop1.rb b/ext/tk/sample/tkextlib/blt/winop1.rb
new file mode 100644
index 000000000..e94138cd9
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/winop1.rb
@@ -0,0 +1,40 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+file = File.join(File.dirname(File.expand_path(__FILE__)),
+ 'images', 'sample.gif')
+if File.exist?(file)
+ src = TkPhotoImage.new(:file=>file)
+else
+ fail RuntimeError, 'no image file'
+end
+
+width = src.width
+height = src.height
+
+TkOption.add('*Label.font', '*helvetica*10*')
+TkOption.add('*Label.background', 'white')
+
+l_img0 = TkLabel.new(:image=>src)
+l_hdr0 = TkLabel.new(:text=>"#{width} x #{height}")
+l_ftr0 = TkLabel.new(:text=>'100%')
+Tk.root.background('white')
+
+(2..10).each{|i|
+ iw = width/i
+ ih = height/i
+ r = '%6g'%(100.0/i)
+ dst = TkPhotoImage.new(:width=>iw, :height=>ih)
+ Tk::BLT::Winop.image_resample(src, dst, :sinc)
+ l_hdr = TkLabel.new(:text=>"#{iw} x #{ih}")
+ l_ftr = TkLabel.new(:text=>"#{r}%")
+ l_img = TkLabel.new(:image=>dst)
+ Tk::BLT::Table.add(Tk.root,
+ [0,i], l_hdr,
+ [1,i], l_img,
+ [2,i], l_ftr)
+ Tk.update
+}
+
+Tk.mainloop
diff --git a/ext/tk/sample/tkextlib/blt/winop2.rb b/ext/tk/sample/tkextlib/blt/winop2.rb
new file mode 100644
index 000000000..1f674ee89
--- /dev/null
+++ b/ext/tk/sample/tkextlib/blt/winop2.rb
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+require 'tk'
+require 'tkextlib/blt'
+
+file = File.join(File.dirname(File.expand_path(__FILE__)),
+ 'images', 'qv100.t.gif')
+if File.exist?(file)
+ src = TkPhotoImage.new(:file=>file)
+else
+ fail RuntimeError, 'no image file'
+end
+
+width = src.width
+height = src.height
+
+TkOption.add('*Label.font', '*helvetica*10*')
+TkOption.add('*Label.background', 'white')
+
+[0, 90, 180, 270, 360, 45].each_with_index{|r, i|
+ dest = TkPhotoImage.new
+ Tk::BLT::Winop.image_rotate(src, dest, r)
+ l_txt = TkLabel.new(:text=>"#{r} degrees")
+ l_img = TkLabel.new(:image=>dest)
+ Tk::BLT::Table.add(Tk.root, [0,i], l_img, [1,i], l_txt)
+ Tk.update
+}
+
+Tk.mainloop