gray_scott_gtk3 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e51538c0607dbd7abd706bf127a5de9b9efd3254578d360aacf12d2abb63206d
4
+ data.tar.gz: 26aabb7887ef709f20cb1a078ad93ff2acf2d5d1af0a37d3896d18bb47f5c4a4
5
+ SHA512:
6
+ metadata.gz: 46f2add8430ed66c3fc620e640dfc48f627997c9b2a4d403de8b0d3b71037b796177caeee007f8d76cee8e271d79ee23fabf1532b5312592d2bd135ef4a547fe
7
+ data.tar.gz: 7fb61ff2a7f07ef0e2209501cfd151afeabb0e4c588d83ea88e777c32ec62333ce999235c4c61fe678dadc709efbbfc5ba774cc8b1452c542af3b4d41bf79a87
data/.gitignore ADDED
@@ -0,0 +1,51 @@
1
+ *.gem
2
+ *.rbc
3
+ *.glade~
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ ## Specific to RubyMotion:
18
+ .dat*
19
+ .repl_history
20
+ build/
21
+ *.bridgesupport
22
+ build-iPhoneOS/
23
+ build-iPhoneSimulator/
24
+
25
+ ## Specific to RubyMotion (use of CocoaPods):
26
+ #
27
+ # We recommend against adding the Pods directory to your .gitignore. However
28
+ # you should judge for yourself, the pros and cons are mentioned at:
29
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
+ #
31
+ # vendor/Pods/
32
+
33
+ ## Documentation cache and generated files:
34
+ /.yardoc/
35
+ /_yardoc/
36
+ /doc/
37
+ /rdoc/
38
+
39
+ ## Environment normalization:
40
+ /.bundle/
41
+ /vendor/bundle
42
+ /lib/bundler/man/
43
+
44
+ # for a library or gem, you might want to ignore these files since the code is
45
+ # intended to run in multiple environments; otherwise, check them in:
46
+ # Gemfile.lock
47
+ # .ruby-version
48
+ # .ruby-gemset
49
+
50
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in gray_scott_gtk3.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gray_scott_gtk3 (0.3.0)
5
+ gtk3
6
+ numo-narray
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ atk (3.3.0)
12
+ glib2 (= 3.3.0)
13
+ cairo (1.16.2)
14
+ native-package-installer (>= 1.0.3)
15
+ pkg-config (>= 1.2.2)
16
+ cairo-gobject (3.3.0)
17
+ cairo (>= 1.16.1)
18
+ glib2 (= 3.3.0)
19
+ gdk3 (3.3.0)
20
+ cairo-gobject (= 3.3.0)
21
+ gdk_pixbuf2 (= 3.3.0)
22
+ pango (= 3.3.0)
23
+ gdk_pixbuf2 (3.3.0)
24
+ gio2 (= 3.3.0)
25
+ gio2 (3.3.0)
26
+ glib2 (= 3.3.0)
27
+ gobject-introspection (= 3.3.0)
28
+ glib2 (3.3.0)
29
+ native-package-installer (>= 1.0.3)
30
+ pkg-config (>= 1.2.2)
31
+ gobject-introspection (3.3.0)
32
+ glib2 (= 3.3.0)
33
+ gtk3 (3.3.0)
34
+ atk (= 3.3.0)
35
+ gdk3 (= 3.3.0)
36
+ gdk_pixbuf2 (= 3.3.0)
37
+ gio2 (= 3.3.0)
38
+ pango (= 3.3.0)
39
+ native-package-installer (1.0.6)
40
+ numo-narray (0.9.1.3)
41
+ pango (3.3.0)
42
+ cairo-gobject (= 3.3.0)
43
+ gobject-introspection (= 3.3.0)
44
+ pkg-config (1.3.2)
45
+ rake (10.5.0)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ bundler (~> 1.17)
52
+ gray_scott_gtk3!
53
+ rake (~> 10.0)
54
+
55
+ BUNDLED WITH
56
+ 1.17.1
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Gray-Scott
2
+
3
+ ![screenshot](https://raw.githubusercontent.com/kojix2/Gray-Scott/master/screenshot/screenshot.png)
4
+
5
+ ## Requirements
6
+
7
+ * Ruby
8
+ * Numo/NArray
9
+ * Ruby/Gtk3
10
+
11
+ ## Installation
12
+
13
+ $ gem install gray_scott_gtk3
14
+
15
+ ## Usage
16
+
17
+ $ grayscott 40 # msec
18
+
19
+ ## Known issue
20
+
21
+ Glib::Timeout.add(number_of_seconds)
22
+ If processing can not be completed within the time, it will not be displayed.
23
+ In this case, you should increase the number of seconds.
24
+
25
+ ## Contributing
26
+
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kojix2/gray_scott_gtk3.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gray_scott_gtk3"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/grayscott ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "gray_scott_gtk3"
4
+
5
+ if ARGV[0]
6
+ module GrayScottGtk3
7
+ MSEC = ARGV[0].to_i
8
+ end
9
+ else
10
+ puts 'please specify command-line argument. For example `grayscott 40`'
11
+ exit
12
+ end
13
+
14
+ module GrayScottGtk3
15
+ class << self
16
+ def run
17
+ xml_path = File.expand_path('../resources/', __dir__)
18
+ Controller.new xml_path
19
+ end
20
+ end
21
+ end
22
+
23
+ GrayScottGtk3.run
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "gray_scott_gtk3/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gray_scott_gtk3"
8
+ spec.version = GrayScottGtk3::VERSION
9
+ spec.authors = ["kojix2"]
10
+ spec.email = ["2xijok@gmail.com"]
11
+
12
+ spec.summary = %q{Gray-Scott model.}
13
+ spec.description = %q{Gray-Scott model.}
14
+ spec.homepage = "https://github.com/kojix2/Gray-Scott"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "numo-narray"
26
+ spec.add_dependency "gtk3"
27
+
28
+ spec.add_development_dependency "bundler", "~> 1.17"
29
+ spec.add_development_dependency "rake", "~> 10.0"
30
+ end
@@ -0,0 +1,21 @@
1
+ require 'numo/narray'
2
+ require 'gtk3'
3
+
4
+ module ShortNumo
5
+ N = Numo
6
+ class Numo::SFloat
7
+ alias _ inplace
8
+ end
9
+ SFloat = Numo::SFloat
10
+ UInt8 = Numo::UInt8
11
+ end
12
+
13
+ require 'gray_scott_gtk3/model'
14
+ require 'gray_scott_gtk3/controller'
15
+ require 'gray_scott_gtk3/laplacian'
16
+ require 'gray_scott_gtk3/version'
17
+
18
+ module GrayScottGtk3
19
+ class Error < StandardError; end
20
+ # Your code goes here...
21
+ end
@@ -0,0 +1,185 @@
1
+ module GrayScottGtk3
2
+ class Controller
3
+ include ShortNumo
4
+ attr_accessor :resource_dir, :height, :width, :model
5
+
6
+ def initialize(dir)
7
+ @resource_dir = dir
8
+ @height = 256
9
+ @width = 256
10
+ @model = Model.new(height: height, width: width)
11
+ @show_u = true
12
+ @color = 'colorful'
13
+
14
+ builder = Gtk::Builder.new
15
+ builder.add_from_file File.join(resource_dir, 'gray_scott.glade')
16
+
17
+ %w[win gimage legend_image uv_combobox pen_density pen_radius].each do |s|
18
+ instance_variable_set('@' + s, builder.get_object(s))
19
+ end
20
+
21
+ builder.connect_signals { |handler| method(handler) }
22
+
23
+ @win.show_all # window
24
+ Gtk.main
25
+ end
26
+
27
+ def show_about
28
+ a = Gtk::AboutDialog.new
29
+ a.program_name = 'Gray-Scott'
30
+ a.logo = GdkPixbuf::Pixbuf.new(file: File.join(resource_dir, 'about_icon.png'))
31
+ a.authors = ['kojix2']
32
+ a.version = GrayScottGtk3::VERSION
33
+ a.run
34
+ a.destroy
35
+ end
36
+
37
+ def on_f_changed(f)
38
+ model.f = f.value
39
+ end
40
+
41
+ def on_k_changed(k)
42
+ model.k = k.value
43
+ end
44
+
45
+ def display
46
+ @gimage.pixbuf = to_pixbuf(@show_u ? model.u : model.v)
47
+ end
48
+
49
+ def display_legend
50
+ legend = (SFloat.new(1, 512).seq * SFloat.ones(16, 1)) / 512
51
+ data = colorize(legend, @color)
52
+ string = data.to_string
53
+ pixbuf = GdkPixbuf::Pixbuf.new data: string, width: 512, height: 16
54
+ @legend_image.pixbuf = pixbuf
55
+ end
56
+
57
+ def on_execute_toggled(widget)
58
+ if widget.active?
59
+ execute
60
+ else
61
+ @doing_now = false
62
+ end
63
+ end
64
+
65
+ def execute
66
+ @doing_now = true
67
+ GLib::Timeout.add MSEC do
68
+ model.update
69
+ display
70
+ @doing_now
71
+ end
72
+ end
73
+
74
+ def on_save_clicked
75
+ @doing_now = false
76
+
77
+ dialog = Gtk::FileChooserDialog.new(title: 'PNG画像を保存',
78
+ action: :save,
79
+ buttons: [%i[save accept], %i[cancel cancel]])
80
+ dialog.do_overwrite_confirmation = true
81
+ if dialog.run == :accept
82
+ filename = dialog.filename
83
+ @gimage.pixbuf.save(filename, :png)
84
+ end
85
+ dialog.destroy
86
+ end
87
+
88
+ def main_quit
89
+ Gtk.main_quit
90
+ end
91
+
92
+ def on_new_clicked
93
+ model.clear
94
+ if @show_u && !@doing_now
95
+ dialog = Gtk::MessageDialog.new(message: 'display V density',
96
+ type: :info,
97
+ tutton_type: :close)
98
+ dialog.run
99
+ @uv_combobox.active = 1 # v
100
+ dialog.destroy
101
+ end
102
+ display_legend
103
+ display
104
+ end
105
+
106
+ def on_uv_combobox_changed(w)
107
+ @show_u = w.active_text == 'U'
108
+ display unless doing_now?
109
+ end
110
+
111
+ def on_color_combobox_changed(w)
112
+ @color = w.active_text
113
+ display_legend
114
+ display unless doing_now?
115
+ end
116
+
117
+ def on_motion(_widget, e)
118
+ x = e.x * width / 512
119
+ y = e.y * height / 512
120
+ r = @pen_radius.value
121
+ if x > r && y > r && x < (height - 1 - r) && y < (width - 1 - r)
122
+ model.v[(y - r)..(y + r), (x - r)..(x + r)] = @pen_density.value
123
+ end
124
+ display unless doing_now?
125
+ end
126
+
127
+ def colorize(ar, color_type)
128
+ case color_type
129
+ when 'colorful'
130
+ hsv2rgb(ar)
131
+ when 'reverse-colorful'
132
+ hsv2rgb(1.0 - ar)
133
+ when 'red'
134
+ uint8_zeros_256(0, ar)
135
+ when 'green'
136
+ uint8_zeros_256(1, ar)
137
+ when 'blue'
138
+ uint8_zeros_256(2, ar)
139
+ when 'reverse-red'
140
+ uint8_zeros_256(0, (1.0 - ar))
141
+ when 'reverse-green'
142
+ uint8_zeros_256(1, (1.0 - ar))
143
+ when 'reverse-blue'
144
+ uint8_zeros_256(2, (1.0 - ar))
145
+ end
146
+ end
147
+
148
+ def uint8_zeros_256(ch, ar)
149
+ d = UInt8.zeros(*ar.shape, 3)
150
+ d[true, true, ch] = UInt8.cast(ar * 256)
151
+ d
152
+ end
153
+
154
+ def to_pixbuf(ar, color_type = @color)
155
+ data = colorize(ar, color_type).to_string
156
+ height, width = ar.shape
157
+ pixbuf = GdkPixbuf::Pixbuf.new data: data, width: width, height: height
158
+ pixbuf.scale_simple 512, 512, :bilinear
159
+ end
160
+
161
+ def hsv2rgb(h)
162
+ height, width = h.shape
163
+ i = UInt8.cast(h * 6)
164
+ f = (h * 6.0) - i
165
+ p = UInt8.zeros height, width, 1
166
+ v = UInt8.new(height, width, 1).fill 255
167
+ q = (1.0 - f) * 256
168
+ t = f * 256
169
+ rgb = UInt8.zeros height, width, 3
170
+ t = UInt8.cast(t).expand_dims(2)
171
+ i = UInt8.dstack([i, i, i])
172
+ rgb[i.eq 0] = UInt8.dstack([v, t, p])[i.eq 0]
173
+ rgb[i.eq 1] = UInt8.dstack([q, v, p])[i.eq 1]
174
+ rgb[i.eq 2] = UInt8.dstack([p, v, t])[i.eq 2]
175
+ rgb[i.eq 3] = UInt8.dstack([p, q, v])[i.eq 3]
176
+ rgb[i.eq 4] = UInt8.dstack([t, p, v])[i.eq 4]
177
+ rgb[i.eq 5] = UInt8.dstack([v, p, q])[i.eq 5]
178
+ rgb
179
+ end
180
+
181
+ def doing_now?
182
+ @doing_now
183
+ end
184
+ end
185
+ end
@@ -0,0 +1,27 @@
1
+ module Numo
2
+ class SFloat
3
+ # To avoid mistakes
4
+ A = (1..-1).freeze
5
+ B = (0..-2).freeze
6
+ T = true
7
+
8
+ def self.laplacian2d(uv, dx)
9
+ l_uv = uv.new_zeros
10
+ l_uv[A, T]._ + uv[B, T]
11
+ l_uv[T, A]._ + uv[T, B]
12
+
13
+ l_uv[0, T]._ + uv[-1, T]
14
+ l_uv[T, 0]._ + uv[T, -1]
15
+
16
+ l_uv[B, T]._ + uv[A, T]
17
+ l_uv[T, B]._ + uv[T, A]
18
+
19
+ l_uv[-1, T]._ + uv[0, T]
20
+ l_uv[T, -1]._ + uv[T, 0]
21
+
22
+ l_uv._ - (uv * 4)
23
+ l_uv._ / (dx * dx)
24
+ l_uv
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,39 @@
1
+ module GrayScottGtk3
2
+ class Model
3
+ include ShortNumo
4
+
5
+ Dx = 0.01
6
+ Dt = 1
7
+
8
+ Du = 2e-5
9
+ Dv = 1e-5
10
+
11
+ attr_accessor :f, :k, :u, :v
12
+
13
+ def initialize(width: 256, height: 256)
14
+ # Feed rate
15
+ @f = 0.04
16
+ # Kill rate
17
+ @k = 0.06
18
+
19
+ @u = SFloat.ones height, width
20
+ @v = SFloat.zeros height, width
21
+ end
22
+
23
+ def clear
24
+ u.fill 1.0
25
+ v.fill 0.0
26
+ end
27
+
28
+ def update
29
+ l_u = SFloat.laplacian2d u, Dx
30
+ l_v = SFloat.laplacian2d v, Dx
31
+
32
+ uvv = u * v * v
33
+ dudt = Du * l_u - uvv + @f * (1.0 - u)
34
+ dvdt = Dv * l_v + uvv - (@f + @k) * v
35
+ u._ + (Dt * dudt)
36
+ v._ + (Dt * dvdt)
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ module GrayScottGtk3
2
+ VERSION = '0.3.0'.freeze
3
+ end
Binary file
@@ -0,0 +1,492 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.22.1 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.20"/>
5
+ <object class="GtkAdjustment" id="f">
6
+ <property name="upper">0.10000000000000001</property>
7
+ <property name="value">0.040000000000000001</property>
8
+ <property name="step_increment">0.01</property>
9
+ <property name="page_increment">0.01</property>
10
+ <signal name="value-changed" handler="on_f_changed" swapped="no"/>
11
+ </object>
12
+ <object class="GtkAdjustment" id="k">
13
+ <property name="upper">0.10000000000000001</property>
14
+ <property name="value">0.059999999999999998</property>
15
+ <property name="step_increment">0.01</property>
16
+ <property name="page_increment">0.01</property>
17
+ <signal name="value-changed" handler="on_k_changed" swapped="no"/>
18
+ </object>
19
+ <object class="GtkAdjustment" id="pen_density">
20
+ <property name="upper">1</property>
21
+ <property name="value">0.5</property>
22
+ <property name="step_increment">0.01</property>
23
+ <property name="page_increment">0.10000000000000001</property>
24
+ </object>
25
+ <object class="GtkAdjustment" id="pen_radius">
26
+ <property name="lower">1</property>
27
+ <property name="upper">16</property>
28
+ <property name="value">0.5</property>
29
+ <property name="step_increment">1</property>
30
+ <property name="page_increment">2</property>
31
+ </object>
32
+ <object class="GtkWindow" id="win">
33
+ <property name="can_focus">False</property>
34
+ <property name="has_tooltip">True</property>
35
+ <property name="title" translatable="yes">Gray-Scott model</property>
36
+ <property name="resizable">False</property>
37
+ <signal name="destroy" handler="main_quit" swapped="no"/>
38
+ <child>
39
+ <placeholder/>
40
+ </child>
41
+ <child>
42
+ <object class="GtkBox">
43
+ <property name="visible">True</property>
44
+ <property name="can_focus">False</property>
45
+ <property name="orientation">vertical</property>
46
+ <child>
47
+ <object class="GtkMenuBar">
48
+ <property name="visible">True</property>
49
+ <property name="can_focus">False</property>
50
+ <child>
51
+ <object class="GtkMenuItem">
52
+ <property name="visible">True</property>
53
+ <property name="can_focus">False</property>
54
+ <property name="label" translatable="yes">File</property>
55
+ <property name="use_underline">True</property>
56
+ <child type="submenu">
57
+ <object class="GtkMenu">
58
+ <property name="visible">True</property>
59
+ <property name="can_focus">False</property>
60
+ <child>
61
+ <object class="GtkImageMenuItem">
62
+ <property name="label">gtk-new</property>
63
+ <property name="visible">True</property>
64
+ <property name="can_focus">False</property>
65
+ <property name="use_underline">True</property>
66
+ <property name="use_stock">True</property>
67
+ <signal name="activate" handler="on_new_clicked" swapped="no"/>
68
+ </object>
69
+ </child>
70
+ <child>
71
+ <object class="GtkImageMenuItem">
72
+ <property name="label">gtk-save-as</property>
73
+ <property name="visible">True</property>
74
+ <property name="can_focus">False</property>
75
+ <property name="use_underline">True</property>
76
+ <property name="use_stock">True</property>
77
+ <signal name="activate" handler="on_save_clicked" swapped="no"/>
78
+ </object>
79
+ </child>
80
+ <child>
81
+ <object class="GtkSeparatorMenuItem">
82
+ <property name="visible">True</property>
83
+ <property name="can_focus">False</property>
84
+ </object>
85
+ </child>
86
+ <child>
87
+ <object class="GtkImageMenuItem">
88
+ <property name="label">gtk-quit</property>
89
+ <property name="visible">True</property>
90
+ <property name="can_focus">False</property>
91
+ <property name="use_underline">True</property>
92
+ <property name="use_stock">True</property>
93
+ <signal name="activate" handler="main_quit" swapped="no"/>
94
+ </object>
95
+ </child>
96
+ </object>
97
+ </child>
98
+ </object>
99
+ </child>
100
+ <child>
101
+ <object class="GtkMenuItem">
102
+ <property name="visible">True</property>
103
+ <property name="can_focus">False</property>
104
+ <property name="label" translatable="yes">Help</property>
105
+ <property name="use_underline">True</property>
106
+ <child type="submenu">
107
+ <object class="GtkMenu">
108
+ <property name="visible">True</property>
109
+ <property name="can_focus">False</property>
110
+ <child>
111
+ <object class="GtkImageMenuItem">
112
+ <property name="label">gtk-about</property>
113
+ <property name="visible">True</property>
114
+ <property name="can_focus">False</property>
115
+ <property name="use_underline">True</property>
116
+ <property name="use_stock">True</property>
117
+ <signal name="activate" handler="show_about" swapped="no"/>
118
+ </object>
119
+ </child>
120
+ </object>
121
+ </child>
122
+ </object>
123
+ </child>
124
+ </object>
125
+ <packing>
126
+ <property name="expand">False</property>
127
+ <property name="fill">True</property>
128
+ <property name="position">0</property>
129
+ </packing>
130
+ </child>
131
+ <child>
132
+ <object class="GtkBox">
133
+ <property name="visible">True</property>
134
+ <property name="can_focus">False</property>
135
+ <property name="margin_left">5</property>
136
+ <property name="margin_right">5</property>
137
+ <property name="spacing">5</property>
138
+ <child>
139
+ <object class="GtkButton" id="new_button">
140
+ <property name="label">gtk-new</property>
141
+ <property name="visible">True</property>
142
+ <property name="can_focus">True</property>
143
+ <property name="receives_default">True</property>
144
+ <property name="use_stock">True</property>
145
+ <property name="image_position">bottom</property>
146
+ <property name="always_show_image">True</property>
147
+ <signal name="clicked" handler="on_new_clicked" swapped="no"/>
148
+ </object>
149
+ <packing>
150
+ <property name="expand">False</property>
151
+ <property name="fill">True</property>
152
+ <property name="position">0</property>
153
+ </packing>
154
+ </child>
155
+ <child>
156
+ <object class="GtkGrid">
157
+ <property name="visible">True</property>
158
+ <property name="can_focus">False</property>
159
+ <property name="margin_top">1</property>
160
+ <property name="border_width">0</property>
161
+ <child>
162
+ <object class="GtkLabel" id="klabel">
163
+ <property name="visible">True</property>
164
+ <property name="can_focus">False</property>
165
+ <property name="tooltip_text" translatable="yes">Kill is the removal/kill rate of U</property>
166
+ <property name="margin_left">5</property>
167
+ <property name="margin_right">5</property>
168
+ <property name="margin_top">5</property>
169
+ <property name="margin_bottom">5</property>
170
+ <property name="label" translatable="yes">Kill</property>
171
+ </object>
172
+ <packing>
173
+ <property name="left_attach">0</property>
174
+ <property name="top_attach">1</property>
175
+ </packing>
176
+ </child>
177
+ <child>
178
+ <object class="GtkLabel" id="flabel">
179
+ <property name="visible">True</property>
180
+ <property name="can_focus">False</property>
181
+ <property name="tooltip_text" translatable="yes">Feed is the feed rate of V</property>
182
+ <property name="margin_left">5</property>
183
+ <property name="margin_right">5</property>
184
+ <property name="margin_top">5</property>
185
+ <property name="margin_bottom">5</property>
186
+ <property name="label" translatable="yes">Feed</property>
187
+ </object>
188
+ <packing>
189
+ <property name="left_attach">0</property>
190
+ <property name="top_attach">0</property>
191
+ </packing>
192
+ </child>
193
+ <child>
194
+ <object class="GtkScale" id="fscale">
195
+ <property name="visible">True</property>
196
+ <property name="can_focus">True</property>
197
+ <property name="tooltip_text" translatable="yes">Feed is the feed rate of V</property>
198
+ <property name="margin_left">5</property>
199
+ <property name="margin_right">5</property>
200
+ <property name="hexpand">True</property>
201
+ <property name="adjustment">f</property>
202
+ <property name="restrict_to_fill_level">False</property>
203
+ <property name="fill_level">0</property>
204
+ <property name="round_digits">0</property>
205
+ <property name="digits">4</property>
206
+ <property name="value_pos">left</property>
207
+ </object>
208
+ <packing>
209
+ <property name="left_attach">1</property>
210
+ <property name="top_attach">0</property>
211
+ </packing>
212
+ </child>
213
+ <child>
214
+ <object class="GtkScale" id="kscale">
215
+ <property name="visible">True</property>
216
+ <property name="can_focus">True</property>
217
+ <property name="tooltip_text" translatable="yes">Kill is the removal/kill rate of U</property>
218
+ <property name="margin_left">5</property>
219
+ <property name="margin_right">5</property>
220
+ <property name="hexpand">True</property>
221
+ <property name="adjustment">k</property>
222
+ <property name="restrict_to_fill_level">False</property>
223
+ <property name="fill_level">0</property>
224
+ <property name="round_digits">0</property>
225
+ <property name="digits">4</property>
226
+ <property name="value_pos">left</property>
227
+ </object>
228
+ <packing>
229
+ <property name="left_attach">1</property>
230
+ <property name="top_attach">1</property>
231
+ </packing>
232
+ </child>
233
+ </object>
234
+ <packing>
235
+ <property name="expand">True</property>
236
+ <property name="fill">True</property>
237
+ <property name="position">1</property>
238
+ </packing>
239
+ </child>
240
+ <child>
241
+ <object class="GtkButton" id="save_button">
242
+ <property name="label">gtk-save</property>
243
+ <property name="visible">True</property>
244
+ <property name="can_focus">True</property>
245
+ <property name="receives_default">True</property>
246
+ <property name="tooltip_text" translatable="yes">Save as PNG image</property>
247
+ <property name="use_stock">True</property>
248
+ <property name="image_position">top</property>
249
+ <property name="always_show_image">True</property>
250
+ <signal name="clicked" handler="on_save_clicked" swapped="no"/>
251
+ </object>
252
+ <packing>
253
+ <property name="expand">False</property>
254
+ <property name="fill">True</property>
255
+ <property name="position">2</property>
256
+ </packing>
257
+ </child>
258
+ <child>
259
+ <object class="GtkToggleButton" id="execute">
260
+ <property name="label">gtk-execute</property>
261
+ <property name="visible">True</property>
262
+ <property name="can_focus">True</property>
263
+ <property name="receives_default">True</property>
264
+ <property name="use_stock">True</property>
265
+ <property name="image_position">top</property>
266
+ <property name="always_show_image">True</property>
267
+ <signal name="toggled" handler="on_execute_toggled" swapped="no"/>
268
+ </object>
269
+ <packing>
270
+ <property name="expand">False</property>
271
+ <property name="fill">True</property>
272
+ <property name="position">3</property>
273
+ </packing>
274
+ </child>
275
+ </object>
276
+ <packing>
277
+ <property name="expand">True</property>
278
+ <property name="fill">True</property>
279
+ <property name="padding">5</property>
280
+ <property name="position">1</property>
281
+ </packing>
282
+ </child>
283
+ <child>
284
+ <object class="GtkBox">
285
+ <property name="visible">True</property>
286
+ <property name="can_focus">False</property>
287
+ <property name="orientation">vertical</property>
288
+ <child>
289
+ <object class="GtkActionBar">
290
+ <property name="visible">True</property>
291
+ <property name="can_focus">False</property>
292
+ <child>
293
+ <object class="GtkComboBoxText" id="uv_combobox">
294
+ <property name="visible">True</property>
295
+ <property name="can_focus">False</property>
296
+ <property name="active">0</property>
297
+ <items>
298
+ <item translatable="yes">U</item>
299
+ <item translatable="yes">V</item>
300
+ </items>
301
+ <signal name="changed" handler="on_uv_combobox_changed" swapped="no"/>
302
+ </object>
303
+ <packing>
304
+ <property name="position">0</property>
305
+ </packing>
306
+ </child>
307
+ <child>
308
+ <object class="GtkComboBoxText">
309
+ <property name="visible">True</property>
310
+ <property name="can_focus">False</property>
311
+ <property name="active">0</property>
312
+ <items>
313
+ <item translatable="yes">colorful</item>
314
+ <item translatable="yes">reverse-colorful</item>
315
+ <item translatable="yes">red</item>
316
+ <item translatable="yes">green</item>
317
+ <item translatable="yes">blue</item>
318
+ <item translatable="yes">reverse-red</item>
319
+ <item translatable="yes">reverse-green</item>
320
+ <item translatable="yes">reverse-blue</item>
321
+ </items>
322
+ <signal name="changed" handler="on_color_combobox_changed" swapped="no"/>
323
+ </object>
324
+ <packing>
325
+ <property name="position">0</property>
326
+ </packing>
327
+ </child>
328
+ <child>
329
+ <object class="GtkScaleButton" id="pen_radius_scale">
330
+ <property name="visible">True</property>
331
+ <property name="can_focus">True</property>
332
+ <property name="focus_on_click">False</property>
333
+ <property name="receives_default">True</property>
334
+ <property name="tooltip_text" translatable="yes">pen radius</property>
335
+ <property name="relief">none</property>
336
+ <property name="orientation">vertical</property>
337
+ <property name="adjustment">pen_radius</property>
338
+ <property name="icons">applications-graphics
339
+ applications-graphics
340
+ applications-graphics</property>
341
+ <child internal-child="plus_button">
342
+ <object class="GtkButton">
343
+ <property name="can_focus">True</property>
344
+ <property name="receives_default">True</property>
345
+ <property name="halign">center</property>
346
+ <property name="valign">center</property>
347
+ <property name="relief">none</property>
348
+ </object>
349
+ </child>
350
+ <child internal-child="minus_button">
351
+ <object class="GtkButton">
352
+ <property name="can_focus">True</property>
353
+ <property name="receives_default">True</property>
354
+ <property name="halign">center</property>
355
+ <property name="valign">center</property>
356
+ <property name="relief">none</property>
357
+ </object>
358
+ </child>
359
+ </object>
360
+ <packing>
361
+ <property name="position">2</property>
362
+ </packing>
363
+ </child>
364
+ <child>
365
+ <object class="GtkScaleButton" id="pen_density_scale">
366
+ <property name="visible">True</property>
367
+ <property name="can_focus">True</property>
368
+ <property name="focus_on_click">False</property>
369
+ <property name="receives_default">True</property>
370
+ <property name="tooltip_text" translatable="yes">pen density</property>
371
+ <property name="relief">none</property>
372
+ <property name="orientation">vertical</property>
373
+ <property name="adjustment">pen_density</property>
374
+ <property name="icons">applications-graphics
375
+ applications-graphics
376
+ applications-graphics</property>
377
+ <child internal-child="plus_button">
378
+ <object class="GtkButton">
379
+ <property name="can_focus">True</property>
380
+ <property name="receives_default">True</property>
381
+ <property name="halign">center</property>
382
+ <property name="valign">center</property>
383
+ <property name="relief">none</property>
384
+ </object>
385
+ </child>
386
+ <child internal-child="minus_button">
387
+ <object class="GtkButton">
388
+ <property name="can_focus">True</property>
389
+ <property name="receives_default">True</property>
390
+ <property name="halign">center</property>
391
+ <property name="valign">center</property>
392
+ <property name="relief">none</property>
393
+ </object>
394
+ </child>
395
+ </object>
396
+ <packing>
397
+ <property name="position">3</property>
398
+ </packing>
399
+ </child>
400
+ </object>
401
+ <packing>
402
+ <property name="expand">False</property>
403
+ <property name="fill">True</property>
404
+ <property name="position">0</property>
405
+ </packing>
406
+ </child>
407
+ <child>
408
+ <object class="GtkSeparator">
409
+ <property name="visible">True</property>
410
+ <property name="can_focus">False</property>
411
+ </object>
412
+ <packing>
413
+ <property name="expand">False</property>
414
+ <property name="fill">True</property>
415
+ <property name="position">1</property>
416
+ </packing>
417
+ </child>
418
+ </object>
419
+ <packing>
420
+ <property name="expand">False</property>
421
+ <property name="fill">True</property>
422
+ <property name="position">2</property>
423
+ </packing>
424
+ </child>
425
+ <child>
426
+ <object class="GtkBox">
427
+ <property name="visible">True</property>
428
+ <property name="can_focus">False</property>
429
+ <property name="orientation">vertical</property>
430
+ <child>
431
+ <object class="GtkImage" id="legend_image">
432
+ <property name="width_request">512</property>
433
+ <property name="height_request">16</property>
434
+ <property name="visible">True</property>
435
+ <property name="can_focus">False</property>
436
+ <property name="stock">gtk-select-color</property>
437
+ <property name="icon_size">1</property>
438
+ </object>
439
+ <packing>
440
+ <property name="expand">False</property>
441
+ <property name="fill">False</property>
442
+ <property name="position">0</property>
443
+ </packing>
444
+ </child>
445
+ <child>
446
+ <object class="GtkSeparator">
447
+ <property name="visible">True</property>
448
+ <property name="can_focus">False</property>
449
+ </object>
450
+ <packing>
451
+ <property name="expand">False</property>
452
+ <property name="fill">True</property>
453
+ <property name="position">1</property>
454
+ </packing>
455
+ </child>
456
+ <child>
457
+ <object class="GtkEventBox">
458
+ <property name="visible">True</property>
459
+ <property name="can_focus">False</property>
460
+ <property name="margin_left">5</property>
461
+ <property name="margin_right">5</property>
462
+ <property name="margin_top">5</property>
463
+ <property name="margin_bottom">5</property>
464
+ <signal name="motion-notify-event" handler="on_motion" swapped="no"/>
465
+ <child>
466
+ <object class="GtkImage" id="gimage">
467
+ <property name="width_request">512</property>
468
+ <property name="height_request">512</property>
469
+ <property name="visible">True</property>
470
+ <property name="can_focus">False</property>
471
+ <property name="stock">gtk-discard</property>
472
+ <property name="icon_size">6</property>
473
+ </object>
474
+ </child>
475
+ </object>
476
+ <packing>
477
+ <property name="expand">False</property>
478
+ <property name="fill">True</property>
479
+ <property name="position">2</property>
480
+ </packing>
481
+ </child>
482
+ </object>
483
+ <packing>
484
+ <property name="expand">False</property>
485
+ <property name="fill">True</property>
486
+ <property name="position">4</property>
487
+ </packing>
488
+ </child>
489
+ </object>
490
+ </child>
491
+ </object>
492
+ </interface>
Binary file
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gray_scott_gtk3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - kojix2
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: numo-narray
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gtk3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.17'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: Gray-Scott model.
70
+ email:
71
+ - 2xijok@gmail.com
72
+ executables:
73
+ - grayscott
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - Gemfile.lock
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - exe/grayscott
85
+ - gray_scott_gtk3.gemspec
86
+ - lib/gray_scott_gtk3.rb
87
+ - lib/gray_scott_gtk3/controller.rb
88
+ - lib/gray_scott_gtk3/laplacian.rb
89
+ - lib/gray_scott_gtk3/model.rb
90
+ - lib/gray_scott_gtk3/version.rb
91
+ - resources/about_icon.png
92
+ - resources/gray_scott.glade
93
+ - screenshot/screenshot.png
94
+ homepage: https://github.com/kojix2/Gray-Scott
95
+ licenses: []
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.7.6
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Gray-Scott model.
117
+ test_files: []