rmagick4j 0.3.4-java → 0.3.9-java
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 +7 -0
- data/History.txt +84 -0
- data/LICENSE.txt +31 -0
- data/README.txt +25 -0
- data/Rakefile +65 -0
- data/lib/magick4j.jar +0 -0
- data/lib/{RMagick.rb → rmagick.rb} +574 -405
- data/lib/rmagick4j/constants.rb +34 -0
- data/lib/rmagick4j/draw.rb +124 -0
- data/lib/rmagick4j/enum.rb +120 -0
- data/lib/rmagick4j/gradient_fill.rb +14 -0
- data/lib/rmagick4j/image.rb +351 -0
- data/lib/rmagick4j/image_list.rb +25 -0
- data/lib/rmagick4j/pixel.rb +170 -0
- data/lib/rmagick4j/rmagick4j.rb +15 -430
- data/lib/rmagick4j/texture_fill.rb +14 -0
- data/lib/rmagick4j/type_metric.rb +8 -0
- data/lib/rmagick4j/version.rb +5 -0
- data/lib/rvg/clippath.rb +2 -2
- data/lib/rvg/container.rb +2 -2
- data/lib/rvg/describable.rb +2 -2
- data/lib/rvg/embellishable.rb +2 -2
- data/lib/rvg/misc.rb +3 -3
- data/lib/rvg/paint.rb +7 -2
- data/lib/rvg/pathdata.rb +2 -2
- data/lib/rvg/rvg.rb +3 -3
- data/lib/rvg/stretchable.rb +15 -3
- data/lib/rvg/stylable.rb +2 -2
- data/lib/rvg/text.rb +2 -2
- data/lib/rvg/transformable.rb +2 -2
- data/lib/rvg/units.rb +2 -2
- data/test/RMagickTestSuite.rb +129 -0
- data/test/eyetests/bullseye.rb +151 -0
- data/test/eyetests/doc.rb +79 -0
- data/test/eyetests/tests/draw_arc_basic.rb +16 -0
- data/test/eyetests/tests/draw_circle_affine.rb +19 -0
- data/test/eyetests/tests/draw_circle_basic.rb +16 -0
- data/test/eyetests/tests/draw_clip_path.rb +44 -0
- data/test/eyetests/tests/draw_ellipse_affine.rb +19 -0
- data/test/eyetests/tests/draw_ellipse_basic.rb +16 -0
- data/test/eyetests/tests/draw_line_affine.rb +24 -0
- data/test/eyetests/tests/draw_line_basic.rb +21 -0
- data/test/eyetests/tests/draw_multiline_type_metrics.rb +42 -0
- data/test/eyetests/tests/draw_pattern_1.rb +35 -0
- data/test/eyetests/tests/draw_polygon_affine.rb +22 -0
- data/test/eyetests/tests/draw_polygon_basic.rb +19 -0
- data/test/eyetests/tests/draw_polyline_affine.rb +19 -0
- data/test/eyetests/tests/draw_polyline_basic.rb +18 -0
- data/test/eyetests/tests/draw_pop_push.rb +16 -0
- data/test/eyetests/tests/draw_pop_push_translate.rb +22 -0
- data/test/eyetests/tests/draw_rectangle_affine.rb +16 -0
- data/test/eyetests/tests/draw_rectangle_basic.rb +16 -0
- data/test/eyetests/tests/draw_rectangle_narrow.rb +18 -0
- data/test/eyetests/tests/draw_rmagick_test_01.rb +35 -0
- data/test/eyetests/tests/draw_rmagick_test_02.rb +40 -0
- data/test/eyetests/tests/draw_rmagick_test_03.rb +17 -0
- data/test/eyetests/tests/draw_rmagick_test_04.rb +21 -0
- data/test/eyetests/tests/draw_rotate_01.rb +33 -0
- data/test/eyetests/tests/draw_roundrectangle_affine.rb +19 -0
- data/test/eyetests/tests/draw_roundrectangle_basic.rb +16 -0
- data/test/eyetests/tests/draw_scale_01.rb +33 -0
- data/test/eyetests/tests/draw_skewx_01.rb +34 -0
- data/test/eyetests/tests/draw_skewy_01.rb +33 -0
- data/test/eyetests/tests/draw_stroke_miterlimit.rb +21 -0
- data/test/eyetests/tests/effect_blur.rb +9 -0
- data/test/eyetests/tests/effect_charcoal.rb +9 -0
- data/test/eyetests/tests/effect_edge.rb +9 -0
- data/test/eyetests/tests/effect_implode.rb +9 -0
- data/test/eyetests/tests/effect_negate.rb +9 -0
- data/test/eyetests/tests/effect_negate_true.rb +9 -0
- data/test/eyetests/tests/effect_normalize.rb +9 -0
- data/test/eyetests/tests/effect_shade.rb +9 -0
- data/test/eyetests/tests/effect_solarize.rb +10 -0
- data/test/eyetests/tests/effect_wave.rb +9 -0
- data/test/eyetests/tests/gradient_fill_horizontal_diagonal_fill.rb +9 -0
- data/test/eyetests/tests/gradient_fill_horizontal_fill.rb +9 -0
- data/test/eyetests/tests/gradient_fill_point_fill.rb +9 -0
- data/test/eyetests/tests/gradient_fill_vertical_diagonal_fill.rb +9 -0
- data/test/eyetests/tests/gradient_fill_vertical_fill.rb +9 -0
- data/test/eyetests/tests/gruff_accumulator_bar.rb +29 -0
- data/test/eyetests/tests/gruff_area_1.rb +16 -0
- data/test/eyetests/tests/gruff_area_2.rb +27 -0
- data/test/eyetests/tests/gruff_bar_1.rb +29 -0
- data/test/eyetests/tests/gruff_bar_2.rb +19 -0
- data/test/eyetests/tests/gruff_dot_1.rb +19 -0
- data/test/eyetests/tests/gruff_line_1.rb +13 -0
- data/test/eyetests/tests/gruff_line_2.rb +20 -0
- data/test/eyetests/tests/gruff_net_1.rb +16 -0
- data/test/eyetests/tests/gruff_net_2.rb +16 -0
- data/test/eyetests/tests/gruff_pie_1.rb +21 -0
- data/test/eyetests/tests/gruff_pie_2.rb +22 -0
- data/test/eyetests/tests/gruff_scene_1.rb +14 -0
- data/test/eyetests/tests/gruff_scene_2.rb +14 -0
- data/test/eyetests/tests/gruff_sidebar.rb +32 -0
- data/test/eyetests/tests/gruff_sidestacked_bar_1.rb +26 -0
- data/test/eyetests/tests/gruff_sidestacked_bar_2.rb +26 -0
- data/test/eyetests/tests/gruff_spider_1.rb +22 -0
- data/test/eyetests/tests/gruff_spider_2.rb +15 -0
- data/test/eyetests/tests/gruff_stacked_area_1.rb +23 -0
- data/test/eyetests/tests/gruff_stacked_bar_1.rb +23 -0
- data/test/eyetests/tests/gruff_stacked_bar_2.rb +26 -0
- data/test/eyetests/tests/hatch_fill.rb +9 -0
- data/test/eyetests/tests/image_list_flatten_images.rb +15 -0
- data/test/eyetests/tests/new_image.rb +31 -0
- data/test/eyetests/tests/path_a_command_01.rb +16 -0
- data/test/eyetests/tests/path_a_command_02.rb +19 -0
- data/test/eyetests/tests/path_c_command_01.rb +16 -0
- data/test/eyetests/tests/path_c_command_02.rb +16 -0
- data/test/eyetests/tests/path_complex_01.rb +16 -0
- data/test/eyetests/tests/path_espiral_01.rb +29 -0
- data/test/eyetests/tests/path_h_command_01.rb +16 -0
- data/test/eyetests/tests/path_h_command_02.rb +16 -0
- data/test/eyetests/tests/path_l_command_01.rb +16 -0
- data/test/eyetests/tests/path_l_command_02.rb +16 -0
- data/test/eyetests/tests/path_m_command_01.rb +16 -0
- data/test/eyetests/tests/path_m_command_02.rb +16 -0
- data/test/eyetests/tests/path_m_command_03.rb +16 -0
- data/test/eyetests/tests/path_q_command_01.rb +16 -0
- data/test/eyetests/tests/path_q_command_02.rb +16 -0
- data/test/eyetests/tests/path_q_command_03.rb +25 -0
- data/test/eyetests/tests/path_s_command_01.rb +16 -0
- data/test/eyetests/tests/path_s_command_02.rb +16 -0
- data/test/eyetests/tests/path_star_01.rb +19 -0
- data/test/eyetests/tests/path_t_command_01.rb +16 -0
- data/test/eyetests/tests/path_t_command_02.rb +16 -0
- data/test/eyetests/tests/path_v_command_01.rb +16 -0
- data/test/eyetests/tests/path_v_command_02.rb +16 -0
- data/test/eyetests/tests/store_pixel_smiley.rb +123 -0
- data/test/eyetests/tests/texture_fill.rb +11 -0
- data/test/gruff_tests/test/gruff_test_case.rb +123 -0
- data/test/gruff_tests/test/monkey_gruff.rb +7 -0
- data/test/gruff_tests/test/test_accumulator_bar.rb +50 -0
- data/test/gruff_tests/test/test_area.rb +134 -0
- data/test/gruff_tests/test/test_bar.rb +295 -0
- data/test/gruff_tests/test/test_base.rb +8 -0
- data/test/gruff_tests/test/test_bullet.rb +26 -0
- data/test/gruff_tests/test/test_dot.rb +273 -0
- data/test/gruff_tests/test/test_legend.rb +68 -0
- data/test/gruff_tests/test/test_line.rb +554 -0
- data/test/gruff_tests/test/test_mini_bar.rb +33 -0
- data/test/gruff_tests/test/test_mini_pie.rb +20 -0
- data/test/gruff_tests/test/test_mini_side_bar.rb +37 -0
- data/test/gruff_tests/test/test_net.rb +230 -0
- data/test/gruff_tests/test/test_photo.rb +41 -0
- data/test/gruff_tests/test/test_pie.rb +154 -0
- data/test/gruff_tests/test/test_scene.rb +100 -0
- data/test/gruff_tests/test/test_side_bar.rb +12 -0
- data/test/gruff_tests/test/test_sidestacked_bar.rb +89 -0
- data/test/gruff_tests/test/test_spider.rb +216 -0
- data/test/gruff_tests/test/test_stacked_area.rb +52 -0
- data/test/gruff_tests/test/test_stacked_bar.rb +52 -0
- data/test/images/clown.jpg +0 -0
- data/test/images/texture.jpg +0 -0
- data/test/implemented_methods.rb +18 -0
- data/test/spec/draw_spec.rb +43 -0
- data/test/spec/features/step_definitions/geometry_steps.rb +22 -0
- data/test/spec/features/step_definitions/image_filling_steps.rb +49 -0
- data/test/spec/features/support/env.rb +3 -0
- data/test/spec/image_constants.rb +76 -0
- data/test/spec/image_spec.rb +83 -0
- data/test/spec/pixel_spec.rb +89 -0
- metadata +333 -45
- data/lib/RMagick.jar +0 -0
- data/lib/jhlabs-filters.jar +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + "/gruff_test_case"
|
|
4
|
+
|
|
5
|
+
class TestGruffStackedBar < GruffTestCase
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@datasets = [
|
|
9
|
+
[:Jimmy, [25, 36, 86, 39]],
|
|
10
|
+
[:Charles, [80, 54, 67, 54]],
|
|
11
|
+
[:Julie, [22, 29, 35, 38]],
|
|
12
|
+
]
|
|
13
|
+
@sample_labels = {
|
|
14
|
+
0 => '5/6',
|
|
15
|
+
1 => '5/15',
|
|
16
|
+
2 => '5/24'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_bar_graph
|
|
22
|
+
g = Gruff::StackedBar.new
|
|
23
|
+
g.title = "Visual Stacked Bar Graph Test"
|
|
24
|
+
g.labels = {
|
|
25
|
+
0 => '5/6',
|
|
26
|
+
1 => '5/15',
|
|
27
|
+
2 => '5/24',
|
|
28
|
+
3 => '5/30',
|
|
29
|
+
}
|
|
30
|
+
@datasets.each do |data|
|
|
31
|
+
g.data(data[0], data[1])
|
|
32
|
+
end
|
|
33
|
+
g.write "test/output/stacked_bar_keynote.png"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_bar_graph_small
|
|
38
|
+
g = Gruff::StackedBar.new(400)
|
|
39
|
+
g.title = "Visual Stacked Bar Graph Test"
|
|
40
|
+
g.labels = {
|
|
41
|
+
0 => '5/6',
|
|
42
|
+
1 => '5/15',
|
|
43
|
+
2 => '5/24',
|
|
44
|
+
3 => '5/30',
|
|
45
|
+
}
|
|
46
|
+
@datasets.each do |data|
|
|
47
|
+
g.data(data[0], data[1])
|
|
48
|
+
end
|
|
49
|
+
g.write "test/output/stacked_bar_keynote_small.png"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__),'..','lib','magick4j')
|
|
2
|
+
require File.join(File.dirname(__FILE__),'..','lib','rmagick4j','constants')
|
|
3
|
+
require File.join(File.dirname(__FILE__),'..','lib','rmagick4j','image')
|
|
4
|
+
require File.join(File.dirname(__FILE__),'spec','image_constants.rb')
|
|
5
|
+
|
|
6
|
+
include Magick
|
|
7
|
+
|
|
8
|
+
@image = Image.read(File.join(File.dirname(__FILE__),'clown.jpg'))
|
|
9
|
+
|
|
10
|
+
puts 'Image class'
|
|
11
|
+
|
|
12
|
+
num_implemented_methods = 0
|
|
13
|
+
|
|
14
|
+
IMAGE_METHODS.each do |method|
|
|
15
|
+
num_implemented_methods += 1 if @image.respond_to? method.to_sym
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
puts "Implemented #{num_implemented_methods}/#{IMAGE_METHODS_SIZE} (#{100.0*num_implemented_methods.to_f/IMAGE_METHODS_SIZE.to_f}%)."
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
if PLATFORM == 'java'
|
|
2
|
+
require File.join(File.dirname(__FILE__),'..','..','lib','RMagick')
|
|
3
|
+
else
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'RMagick'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
include Magick
|
|
9
|
+
|
|
10
|
+
describe Draw do
|
|
11
|
+
|
|
12
|
+
before(:each) do
|
|
13
|
+
@draw = Draw.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should clone correctly the primitives" do
|
|
17
|
+
@draw.line(0, 0, 100, 100)
|
|
18
|
+
b = @draw.clone
|
|
19
|
+
b.push
|
|
20
|
+
|
|
21
|
+
@draw.inspect.should_not == b.inspect
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should say that has no primitives defined" do
|
|
25
|
+
@draw.inspect.should == '(no primitives defined)'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should add one line per primitive" do
|
|
29
|
+
@draw.path 'M150,150
|
|
30
|
+
l50,50'
|
|
31
|
+
@draw.inspect.split(/\n/).size.should == 1
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should have the maximum width" do
|
|
35
|
+
string = "get\nmultiline\ntype\nmetrics"
|
|
36
|
+
@draw.get_multiline_type_metrics(string).width.should == string.split(/\n/).map{|x| @draw.get_type_metrics(x).width }.max
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should have the correct multiline height" do
|
|
40
|
+
string = "get\nmultiline\ntype\nmetrics"
|
|
41
|
+
@draw.get_multiline_type_metrics(string).height.should == string.split(/\n/).map{|x| @draw.get_type_metrics(x).height }.inject{|memo, obj| memo + obj}
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Given /a new Image sized (\d+) x (\d+)/ do |width, height|
|
|
2
|
+
@image = Image.new(width.to_i, height.to_i)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Given /a new Geometry from string (.*)/ do |geometry|
|
|
6
|
+
@geometry = Geometry.from_s(geometry)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When /changing geometry/ do
|
|
10
|
+
@image.change_geometry(@geometry) do |cols, rows, image|
|
|
11
|
+
@new_width = cols
|
|
12
|
+
@new_height = rows
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Then /the new width should be (\d+)/ do |value|
|
|
17
|
+
@new_width.should eql(value.to_f)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Then /the new height should be (\d+)/ do |value|
|
|
21
|
+
@new_height.should eql(value.to_f)
|
|
22
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Given /a new GradientFill with starting line (\d+) (\d+) (\d+) (\d+) with start color: (.*) and end color: (.*)/ do |x1, y1, x2, y2, start_color, end_color|
|
|
2
|
+
@fill = GradientFill.new(x1.to_i, y1.to_i, x2.to_i, y2.to_i, '#'+start_color, '#'+end_color)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Given /a new GradientFill with starting point (\d+) (\d+) with start color: (.*) and end color: (.*)/ do |x, y, start_color, end_color|
|
|
6
|
+
@fill = GradientFill.new(x.to_i, y.to_i, x.to_i, y.to_i, '#'+start_color, '#'+end_color)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /a new Image (.*) with extension (.*)/ do |image_name, extension|
|
|
10
|
+
@image = Image.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'images', image_name+'.'+extension))
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Given /a new TextureFill from image/ do
|
|
14
|
+
@fill = TextureFill.new(@image.first)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When /filling a new image sized (\d+) (\d+) with the Fill object/ do |columns, rows|
|
|
18
|
+
begin
|
|
19
|
+
@image = Image.new(columns.to_i, rows.to_i, @fill)
|
|
20
|
+
rescue
|
|
21
|
+
@image = nil
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then /the new image should not be (.*)/ do |value|
|
|
26
|
+
expected_value = case value
|
|
27
|
+
when 'nil': nil
|
|
28
|
+
when 'false': false
|
|
29
|
+
when 'true': true
|
|
30
|
+
when value.to_i.to_s: value.to_i
|
|
31
|
+
when value.to_f.to_s: value.to_f
|
|
32
|
+
else
|
|
33
|
+
value
|
|
34
|
+
end
|
|
35
|
+
@image.should_not be expected_value
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
Then /the new image should be (.*)/ do |value|
|
|
39
|
+
expected_value = case value
|
|
40
|
+
when 'nil': nil
|
|
41
|
+
when 'false': false
|
|
42
|
+
when 'true': true
|
|
43
|
+
when value.to_i.to_s: value.to_i
|
|
44
|
+
when value.to_f.to_s: value.to_f
|
|
45
|
+
else
|
|
46
|
+
value
|
|
47
|
+
end
|
|
48
|
+
@image.should be expected_value
|
|
49
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
IMAGE_METHODS = ["<", "<=", "<=>", "==", "===", "=~", ">", ">=", "[]", "[]=",
|
|
2
|
+
"__display__", "__id__", "__send__", "_dump", "adaptive_blur",
|
|
3
|
+
"adaptive_blur_channel", "adaptive_resize", "adaptive_sharpen",
|
|
4
|
+
"adaptive_sharpen_channel", "adaptive_threshold", "add_noise",
|
|
5
|
+
"add_noise_channel", "add_profile", "affine_transform", "annotate",
|
|
6
|
+
"auto_orient", "auto_orient!", "background_color", "background_color=",
|
|
7
|
+
"base_columns", "base_filename", "base_rows", "between?", "bias",
|
|
8
|
+
"bias=", "bilevel_channel", "black_point_compensation",
|
|
9
|
+
"black_point_compensation=", "black_threshold", "blend", "blur",
|
|
10
|
+
"blur=", "blur_channel", "blur_image", "border", "border!",
|
|
11
|
+
"border_color", "border_color=", "bounding_box", "change_geometry",
|
|
12
|
+
"change_geometry!", "changed?", "channel", "channel_compare",
|
|
13
|
+
"channel_depth", "channel_extrema", "channel_mean", "channel_threshold",
|
|
14
|
+
"charcoal", "chop", "chromaticity", "chromaticity=", "class",
|
|
15
|
+
"class_type", "class_type=", "clone", "color_fill_to_border",
|
|
16
|
+
"color_flood_fill", "color_floodfill", "color_histogram",
|
|
17
|
+
"color_point", "color_profile", "color_profile=", "color_reset!",
|
|
18
|
+
"colorize", "colormap", "colors", "colorspace", "colorspace=",
|
|
19
|
+
"columns", "compare_channel", "compose", "compose=", "composite",
|
|
20
|
+
"composite!", "composite_affine", "composite_channel",
|
|
21
|
+
"composite_channel!", "compress_colormap!", "compression", "compression=",
|
|
22
|
+
"contrast", "contrast_stretch_channel", "convolve", "convolve_channel",
|
|
23
|
+
"copy", "crop", "crop!", "crop_resized", "crop_resized!", "cur_image",
|
|
24
|
+
"cycle_colormap", "delay", "delay=", "delete_profile", "density",
|
|
25
|
+
"density=", "depth", "despeckle", "difference", "directory", "dispatch",
|
|
26
|
+
"displace", "display", "dispose", "dispose=", "dissolve",
|
|
27
|
+
"distortion_channel", "dup", "each_iptc_dataset", "each_profile", "edge",
|
|
28
|
+
"emboss", "endian", "endian=", "enhance", "eql?", "equal?", "equalize",
|
|
29
|
+
"erase!", "export_pixels", "export_pixels_to_str", "extend",
|
|
30
|
+
"extract_info", "extract_info=", "filename", "filesize", "filter",
|
|
31
|
+
"filter=", "find_similar_region", "flip", "flip!", "flop", "flop!",
|
|
32
|
+
"format", "format=", "frame", "freeze", "frozen?", "fuzz", "fuzz=", "gamma",
|
|
33
|
+
"gamma=", "gamma_channel", "gamma_correct", "gaussian_blur",
|
|
34
|
+
"gaussian_blur_channel", "gem", "geometry", "geometry=",
|
|
35
|
+
"get_exif_by_entry", "get_exif_by_number", "get_iptc_dataset", "get_pixels",
|
|
36
|
+
"gray?", "grayscale_pseudo_class", "grey?", "hash", "id", "image_type",
|
|
37
|
+
"image_type=", "implode", "import_pixels", "inspect", "instance_eval",
|
|
38
|
+
"instance_of?", "instance_variable_defined?", "instance_variable_get",
|
|
39
|
+
"instance_variable_set", "instance_variables", "interlace", "interlace=",
|
|
40
|
+
"iptc_profile", "iptc_profile=", "is_a?", "iterations", "iterations=",
|
|
41
|
+
"kind_of?", "level", "level2", "level_channel", "linear_stretch",
|
|
42
|
+
"magnify", "magnify!", "map", "mask", "mask=", "matte", "matte=",
|
|
43
|
+
"matte_color", "matte_color=", "matte_fill_to_border", "matte_flood_fill",
|
|
44
|
+
"matte_floodfill", "matte_point", "matte_replace", "matte_reset!",
|
|
45
|
+
"mean_error_per_pixel", "median_filter", "method", "methods", "mime_type",
|
|
46
|
+
"minify", "minify!", "modulate", "monitor=", "monochrome?", "montage",
|
|
47
|
+
"montage=", "motion_blur", "negate", "negate_channel", "nil?", "normalize",
|
|
48
|
+
"normalize_channel", "normalized_maximum_error", "normalized_mean_error",
|
|
49
|
+
"number_colors", "object_id", "offset", "offset=", "oil_paint", "opacity=",
|
|
50
|
+
"opaque", "opaque?", "ordered_dither", "orientation", "orientation=",
|
|
51
|
+
"page", "page=", "palette?", "pixel_color", "pixel_interpolation_method",
|
|
52
|
+
"pixel_interpolation_method=", "polaroid", "posterize", "preview",
|
|
53
|
+
"private_methods", "profile!", "properties", "protected_methods",
|
|
54
|
+
"public_methods", "quality", "quantize", "quantum_depth",
|
|
55
|
+
"quantum_operator", "radial_blur", "radial_blur_channel",
|
|
56
|
+
"raise", "random_channel_threshold", "random_threshold_channel",
|
|
57
|
+
"recolor", "reduce_noise", "rendering_intent", "rendering_intent=",
|
|
58
|
+
"require", "resample", "resize", "resize!", "resize_to_fit",
|
|
59
|
+
"resize_to_fit!", "respond_to?", "roll", "rotate", "rotate!", "rows",
|
|
60
|
+
"sample", "sample!", "scale", "scale!", "scene", "segment", "send",
|
|
61
|
+
"sepiatone", "set_channel_depth", "shade", "shadow", "sharpen",
|
|
62
|
+
"sharpen_channel", "shave", "shave!", "shear", "sigmoidal_contrast_channel",
|
|
63
|
+
"signature", "singleton_methods", "sketch", "solarize", "splice", "spread",
|
|
64
|
+
"start_loop", "start_loop=", "statistics", "stegano", "stereo",
|
|
65
|
+
"store_pixels", "strip!", "swirl", "taint", "tainted?",
|
|
66
|
+
"texture_fill_to_border", "texture_flood_fill", "texture_floodfill",
|
|
67
|
+
"threshold", "thumbnail", "thumbnail!", "ticks_per_second",
|
|
68
|
+
"ticks_per_second=", "tile_info", "tile_info=", "tint", "to_a", "to_blob",
|
|
69
|
+
"to_color", "to_s", "total_colors", "transparent", "transparent_color",
|
|
70
|
+
"transparent_color=", "transpose", "transpose!", "transverse",
|
|
71
|
+
"transverse!", "trim", "trim!", "type", "unique_colors", "units", "units=",
|
|
72
|
+
"unsharp_mask", "unsharp_mask_channel", "untaint", "view", "vignette",
|
|
73
|
+
"virtual_pixel_method", "virtual_pixel_method=", "watermark", "wave",
|
|
74
|
+
"wet_floor", "white_threshold", "write", "x_resolution", "x_resolution=",
|
|
75
|
+
"y_resolution", "y_resolution="]
|
|
76
|
+
IMAGE_METHODS_SIZE = IMAGE_METHODS.size
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
if PLATFORM == 'java'
|
|
2
|
+
require File.join(File.dirname(__FILE__),'..','..','lib','RMagick')
|
|
3
|
+
else
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'RMagick'
|
|
6
|
+
end
|
|
7
|
+
require File.join(File.dirname(__FILE__),"image_constants.rb")
|
|
8
|
+
|
|
9
|
+
include Magick
|
|
10
|
+
|
|
11
|
+
describe Image do
|
|
12
|
+
|
|
13
|
+
before(:each) do
|
|
14
|
+
@image = Image.read(File.join(File.dirname(__FILE__),'..','images','clown.jpg'))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should have the same methods as the standard RMagick" do
|
|
18
|
+
IMAGE_METHODS.each do |method|
|
|
19
|
+
# It fails, use test/implemented_methods instead (at least, until
|
|
20
|
+
# we got some more methods implemented, no just 13%
|
|
21
|
+
# @image.should respond_to? method.to_sym
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should keep format after resized!" do
|
|
26
|
+
@image = @image.first
|
|
27
|
+
first_format = @image.format
|
|
28
|
+
@image.resize!(50,50)
|
|
29
|
+
@image.format.should == first_format
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should keep format after crop_resized!" do
|
|
33
|
+
@image = @image.first
|
|
34
|
+
first_format = @image.format
|
|
35
|
+
@image.crop_resized!(50, 50, NorthGravity)
|
|
36
|
+
@image.format.should == first_format
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should return a one-item array after reading an image" do
|
|
40
|
+
@image.should have(1).images
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "should have type for file with extension jpeg" do
|
|
44
|
+
@image = @image.first
|
|
45
|
+
@image.file_type('img.jpeg').should == 'JPEG'
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should have type for file with extension jpg" do
|
|
49
|
+
@image = @image.first
|
|
50
|
+
@image.file_type('img.jpg').should == 'JPEG'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "should have type for file with prefix jpeg" do
|
|
54
|
+
@image = @image.first
|
|
55
|
+
@image.file_type('jpeg:img').should == 'JPEG'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should have type for file with prefix jpg" do
|
|
59
|
+
@image = @image.first
|
|
60
|
+
@image.file_type('jpg:img').should == 'JPEG'
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "should have path for file with extension jpeg" do
|
|
64
|
+
@image = @image.first
|
|
65
|
+
@image.file_path('img.jpeg').should == 'img.jpeg'
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "should have type for file with extension jpg" do
|
|
69
|
+
@image = @image.first
|
|
70
|
+
@image.file_path('img.jpg').should == 'img.jpg'
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "should have type for file with prefix jpeg" do
|
|
74
|
+
@image = @image.first
|
|
75
|
+
@image.file_path('jpeg:img').should == 'img'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "should have type for file with prefix jpg" do
|
|
79
|
+
@image = @image.first
|
|
80
|
+
@image.file_path('jpg:img').should == 'img'
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
if PLATFORM == 'java'
|
|
2
|
+
require File.join(File.dirname(__FILE__),'..','..','lib','RMagick')
|
|
3
|
+
else
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'RMagick'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
include Magick
|
|
9
|
+
|
|
10
|
+
class IntConverter
|
|
11
|
+
def to_int
|
|
12
|
+
1
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe Pixel do
|
|
17
|
+
Red = 233
|
|
18
|
+
Green = 234
|
|
19
|
+
Blue = 235
|
|
20
|
+
Opacity = 151
|
|
21
|
+
Color = ['AliceBlue', Pixel.new(240, 248, 255, 0)]
|
|
22
|
+
|
|
23
|
+
it "should allow limited or no parameters without error" do
|
|
24
|
+
Pixel.new
|
|
25
|
+
Pixel.new(1)
|
|
26
|
+
Pixel.new(1, 1)
|
|
27
|
+
Pixel.new(1, 1, 1)
|
|
28
|
+
Pixel.new(1, 1, 1, 1)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should accept float values and round down" do
|
|
32
|
+
Pixel.new(1.1).red.should == 1
|
|
33
|
+
Pixel.new(1.9).red.should == 1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should accept values greater than 256 using the modulo operator on them" do
|
|
37
|
+
Pixel.new(256).red.should == 256%256
|
|
38
|
+
Pixel.new(233, 266).green.should == 266%256
|
|
39
|
+
Pixel.new(233, 233, 276).blue.should == 276%256
|
|
40
|
+
Pixel.new(233, 233, 233, -56).opacity.should == (-56)%256
|
|
41
|
+
[-290, -256, -100, 0, 23, 256, 380].each do |x|
|
|
42
|
+
Pixel.new(x).red.should == x%256
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should call to_int on pixel values" do
|
|
47
|
+
Pixel.new(IntConverter.new).red.should == 1
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
before(:each) do
|
|
51
|
+
@pixel = Pixel.new(Red, Green, Blue, Opacity)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "should return the red value" do
|
|
55
|
+
@pixel.red.should eql(Red)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "should return the green value" do
|
|
59
|
+
@pixel.green.should eql(Green)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "should return the blue value" do
|
|
63
|
+
@pixel.blue.should eql(Blue)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should return the opacity value" do
|
|
67
|
+
@pixel.opacity.should eql(Opacity)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should not find the value and raise and exception" do
|
|
71
|
+
lambda {Pixel.from_color('mathematica')}.should raise_error(ArgumentError)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "should find the right value for #{Color[0]}" do
|
|
75
|
+
lambda {
|
|
76
|
+
Pixel.from_color(Color[0]).should eql(Color[1])
|
|
77
|
+
}.should_not raise_error(ArgumentError)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should type error on invalud types to fcmp" do
|
|
81
|
+
lambda { @pixel.fcmp('a') }.should raise_error(TypeError)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "should return the color name (#{Color[0]})" do
|
|
85
|
+
Color[1].to_color.should eql(Color[0])
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
|