shogi_koma 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +1 -1
- data/NEWS.md +10 -0
- data/README.md +1 -2
- data/Rakefile +5 -4
- data/lib/shogi_koma/painter.rb +8 -3
- data/lib/shogi_koma/version.rb +1 -1
- data/lib/shogi_koma.rb +0 -1
- data/shogi_koma.gemspec +1 -1
- data/test/{test-painter.rb → painter_test.rb} +1 -1
- data/test/test_helper.rb +6 -0
- metadata +14 -15
- data/test/run-test.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7006549d9682989e456fbd720bb13eab1d86f24e4e371cc0f4ee41f859ef50f7
|
4
|
+
data.tar.gz: e7bfcc042fb4f5fac11769bb5610376eb5ab001afa6c230b405494691e04a737
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7334f9c148ab19dd9106a56f9aeff5ba6a4f91c5c28f3f0b422ee426a73e5c51b225474851273ae6eef9667da633507864841680920707d0e755b5dfcc9ae8b5
|
7
|
+
data.tar.gz: 94243255b8037eeb37f91d12c479caa53a97725fcaf0ec82c959cb13f051a997776ec827c3d150db519c21de64443765ba2d3703117fc20d3c7d6bb54e5c823f
|
data/.travis.yml
CHANGED
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -37,7 +37,7 @@ require "shogi_koma"
|
|
37
37
|
painter = ShogiKoma::Painter.new
|
38
38
|
#painter.width = 200 # as default
|
39
39
|
#painter.height = 200 # as default
|
40
|
-
#painter.font = "
|
40
|
+
#painter.font = "xxx" # default: "Hiragino Mincho" or "MS Mincho" or "Noto"
|
41
41
|
painter.write_to_png("歩", "shogi_koma-fu1.png")
|
42
42
|
painter.write_to_png("歩兵", "shogi_koma-fu2.png")
|
43
43
|
```
|
@@ -55,7 +55,6 @@ Cairo::ImageSurface.new(:argb32, width, height) do |surface|
|
|
55
55
|
Cairo::Context.new(surface) do |context|
|
56
56
|
context.scale(width, height)
|
57
57
|
painter = ShogiKoma::Painter.new
|
58
|
-
#painter.font = "IPAMincho" # as default
|
59
58
|
painter.draw(context, "歩")
|
60
59
|
end
|
61
60
|
end
|
data/Rakefile
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
7
8
|
end
|
8
9
|
|
9
10
|
task :default => :test
|
data/lib/shogi_koma/painter.rb
CHANGED
@@ -3,12 +3,16 @@ require "fontdock"
|
|
3
3
|
|
4
4
|
module ShogiKoma
|
5
5
|
class Painter
|
6
|
-
attr_accessor :width, :height, :font
|
6
|
+
attr_accessor :width, :height, :font, :border_scale
|
7
7
|
attr_reader :body_color, :frame_color, :text_color
|
8
8
|
def initialize
|
9
9
|
@width = 200
|
10
10
|
@height = 200
|
11
|
-
|
11
|
+
["Hiragino Mincho", "MS Mincho", "Noto"].each do |font_name|
|
12
|
+
@font = Fontdock::Local.find(font_name)
|
13
|
+
break if @font
|
14
|
+
end
|
15
|
+
@border_scale = 1.0
|
12
16
|
set_body_rgb(1, 0.8, 0.2)
|
13
17
|
set_frame_color(:black)
|
14
18
|
set_text_color(:black)
|
@@ -62,7 +66,8 @@ module ShogiKoma
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def draw_body(context)
|
65
|
-
|
69
|
+
border_width = 0.01 * @border_scale
|
70
|
+
context.set_line_width(border_width)
|
66
71
|
context.move_to(0.2, 0.2)
|
67
72
|
context.line_to(0.5, 0.1)
|
68
73
|
context.line_to(0.8, 0.2)
|
data/lib/shogi_koma/version.rb
CHANGED
data/lib/shogi_koma.rb
CHANGED
data/shogi_koma.gemspec
CHANGED
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency("test-unit")
|
25
25
|
spec.add_development_dependency("test-unit-notify")
|
26
26
|
spec.add_development_dependency("test-unit-rr")
|
27
|
-
spec.add_development_dependency("bundler"
|
27
|
+
spec.add_development_dependency("bundler")
|
28
28
|
spec.add_development_dependency("rake")
|
29
29
|
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shogi_koma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masafumi Yokoyama
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cairo
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,13 +128,13 @@ files:
|
|
128
128
|
- lib/shogi_koma/version.rb
|
129
129
|
- sample/shogikoma.rb
|
130
130
|
- shogi_koma.gemspec
|
131
|
-
- test/
|
132
|
-
- test/
|
131
|
+
- test/painter_test.rb
|
132
|
+
- test/test_helper.rb
|
133
133
|
homepage: https://github.com/myokoym/shogi_koma
|
134
134
|
licenses:
|
135
135
|
- MIT
|
136
136
|
metadata: {}
|
137
|
-
post_install_message:
|
137
|
+
post_install_message:
|
138
138
|
rdoc_options: []
|
139
139
|
require_paths:
|
140
140
|
- lib
|
@@ -149,11 +149,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
|
-
|
153
|
-
|
154
|
-
signing_key:
|
152
|
+
rubygems_version: 3.5.3
|
153
|
+
signing_key:
|
155
154
|
specification_version: 4
|
156
155
|
summary: An image generater for Shogi's pieces
|
157
156
|
test_files:
|
158
|
-
- test/
|
159
|
-
- test/
|
157
|
+
- test/painter_test.rb
|
158
|
+
- test/test_helper.rb
|
data/test/run-test.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "test-unit"
|
4
|
-
require "test/unit/notify"
|
5
|
-
require "test/unit/rr"
|
6
|
-
|
7
|
-
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
8
|
-
$LOAD_PATH.unshift(File.join(base_dir, "lib"))
|
9
|
-
$LOAD_PATH.unshift(File.join(base_dir, "test"))
|
10
|
-
|
11
|
-
exit Test::Unit::AutoRunner.run(true)
|