pikl 0.2.5-x86-mswin32 → 0.2.6-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/README.txt +1 -1
- data/lib/pikl/image.rb +13 -1
- data/lib/pikl/pikl.dll +0 -0
- data/lib/pikl/version.rb +1 -1
- data/lib/pikl.rb +2 -2
- data/test/test_pikl_image.rb +44 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,17 +1,27 @@
|
|
1
|
+
== 0.2.6
|
2
|
+
|
3
|
+
* Bug Fix for mswin32 dll.
|
4
|
+
|
1
5
|
== 0.2.5
|
6
|
+
|
2
7
|
* Added fit method.
|
3
8
|
|
4
9
|
== 0.2.4
|
10
|
+
|
5
11
|
* Added flexible rotate.
|
6
12
|
|
7
13
|
== 0.2.3
|
14
|
+
|
8
15
|
* Change description.
|
9
16
|
|
10
17
|
== 0.2.1
|
18
|
+
|
11
19
|
* fix gem for mswin32.
|
12
20
|
|
13
21
|
== 0.2.0
|
22
|
+
|
14
23
|
* Supports method chain.
|
15
24
|
|
16
25
|
== 0.1.0
|
26
|
+
|
17
27
|
* First release!
|
data/README.txt
CHANGED
@@ -45,7 +45,7 @@ notice: pikl use binary library on windows. so these libraries aren't necessary
|
|
45
45
|
(The MIT License)
|
46
46
|
|
47
47
|
Copyright (c) 2008 pikl.rb Ryota Maruko
|
48
|
-
Copyright (c) 2008 pikl.so Keiko
|
48
|
+
Copyright (c) 2008 pikl.so Keiko Soezima
|
49
49
|
|
50
50
|
Permission is hereby granted, free of charge, to any person obtaining
|
51
51
|
a copy of this software and associated documentation files (the
|
data/lib/pikl/image.rb
CHANGED
@@ -83,7 +83,7 @@ module Pikl
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def fit(width, height, mode = :inner)
|
86
|
-
|
86
|
+
validate_fit_mode(mode)
|
87
87
|
self.send("fit_#{mode.to_s}", width, height)
|
88
88
|
end
|
89
89
|
|
@@ -128,6 +128,14 @@ module Pikl
|
|
128
128
|
self
|
129
129
|
end
|
130
130
|
|
131
|
+
def is_vertical?
|
132
|
+
self.height > self.width
|
133
|
+
end
|
134
|
+
|
135
|
+
def is_horizontal?
|
136
|
+
self.height <= self.width
|
137
|
+
end
|
138
|
+
|
131
139
|
# threshold=0-255
|
132
140
|
# threshold=0の時は変化しません
|
133
141
|
# threshold=255の時は全ての色にアンシャープ処理が働きます
|
@@ -253,6 +261,10 @@ module Pikl
|
|
253
261
|
error("invalid compress parameter. # => #{v}") unless /^\d+$/ =~ v.to_s
|
254
262
|
error("invalid compress parameter. # => #{v}") unless v.to_i >= 0 && v.to_i <= 10
|
255
263
|
end
|
264
|
+
|
265
|
+
def validate_fit_mode(v)
|
266
|
+
error("invalid fit parameter. # => #{v}") unless [:inner, :outer].include?(v)
|
267
|
+
end
|
256
268
|
|
257
269
|
def error(message)
|
258
270
|
#self.close
|
data/lib/pikl/pikl.dll
CHANGED
Binary file
|
data/lib/pikl/version.rb
CHANGED
data/lib/pikl.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#--
|
2
2
|
# = Pikl - a simple image library.
|
3
|
-
# Author:: Ryota Maruko and Keiko
|
4
|
-
# Copyright:: (c) 2008 Ryota Maruko and Keiko
|
3
|
+
# Author:: Ryota Maruko and Keiko Soezima
|
4
|
+
# Copyright:: (c) 2008 Ryota Maruko and Keiko Soezima
|
5
5
|
# License:: MIT License
|
6
6
|
#++
|
7
7
|
$:.unshift(File.dirname(__FILE__)) unless
|
data/test/test_pikl_image.rb
CHANGED
@@ -80,7 +80,6 @@ class TestPiklImage < Test::Unit::TestCase
|
|
80
80
|
assert_equal(160, img.height)
|
81
81
|
img.close()
|
82
82
|
end
|
83
|
-
|
84
83
|
|
85
84
|
def test_trim
|
86
85
|
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
@@ -194,7 +193,51 @@ class TestPiklImage < Test::Unit::TestCase
|
|
194
193
|
end
|
195
194
|
end
|
196
195
|
end
|
196
|
+
|
197
|
+
def test_fit_inner
|
198
|
+
# vertical-inner
|
199
|
+
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
200
|
+
img.fit(20,100)
|
201
|
+
img.save(SAMPLE_OUTPUT)
|
202
|
+
assert_equal(20,img.width)
|
203
|
+
assert_equal((SAMPLE_IMAGE_H*20/SAMPLE_IMAGE_W).to_i,img.height)
|
204
|
+
end
|
205
|
+
|
206
|
+
# horizontal-inner
|
207
|
+
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
208
|
+
img.fit(100,20)
|
209
|
+
img.save(SAMPLE_OUTPUT)
|
210
|
+
assert_equal(20,img.height)
|
211
|
+
assert_equal((SAMPLE_IMAGE_W*20/SAMPLE_IMAGE_H).to_i,img.width)
|
212
|
+
end
|
213
|
+
|
214
|
+
# vertical-inner
|
215
|
+
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
216
|
+
img.fit(200,500)
|
217
|
+
assert_equal(200,img.width)
|
218
|
+
assert_equal((SAMPLE_IMAGE_H*200/SAMPLE_IMAGE_W).to_i,img.height)
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
# horizontal-inner
|
223
|
+
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
224
|
+
img.fit(500,200)
|
225
|
+
assert_equal(200,img.height)
|
226
|
+
assert_equal((SAMPLE_IMAGE_W*200/SAMPLE_IMAGE_H).to_i,img.width)
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
197
230
|
|
231
|
+
def test_vh
|
232
|
+
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
233
|
+
assert_equal(true,img.is_vertical?)
|
234
|
+
assert_equal(false,img.is_horizontal?)
|
235
|
+
img.rotate(90)
|
236
|
+
assert_equal(false,img.is_vertical?)
|
237
|
+
assert_equal(true,img.is_horizontal?)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
198
241
|
def test_effect
|
199
242
|
Pikl::Image.open(SAMPLE_IMAGE) do |img|
|
200
243
|
img.unshapmask(255, 10)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pikl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: x86-mswin32
|
6
6
|
authors:
|
7
7
|
- Ryota Maruko
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-08-19 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|