rmagick4j 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/Manifest.txt +122 -107
  2. data/lib/RMagick.rb +84 -4
  3. data/lib/magick4j.jar +0 -0
  4. data/lib/rmagick4j/constants.rb +1 -0
  5. data/lib/rmagick4j/image.rb +51 -3
  6. data/lib/rmagick4j/image_list.rb +4 -0
  7. data/lib/rmagick4j/rmagick4j.rb +0 -1
  8. data/lib/rmagick4j/version.rb +1 -1
  9. data/test/eyetests/bullseye.rb +2 -1
  10. data/test/eyetests/doc.rb +79 -0
  11. data/test/eyetests/tests/draw_multiline_type_metrics.rb +1 -1
  12. data/test/eyetests/tests/draw_pop_push.rb +16 -0
  13. data/test/eyetests/tests/draw_pop_push_translate.rb +1 -1
  14. data/test/eyetests/tests/effect_blur.rb +9 -0
  15. data/test/eyetests/tests/effect_charcoal.rb +9 -0
  16. data/test/eyetests/tests/effect_edge.rb +9 -0
  17. data/test/eyetests/tests/effect_implode.rb +9 -0
  18. data/test/eyetests/tests/effect_negate.rb +9 -0
  19. data/test/eyetests/tests/effect_negate_true.rb +9 -0
  20. data/test/eyetests/tests/effect_normalize.rb +9 -0
  21. data/test/eyetests/tests/effect_shade.rb +9 -0
  22. data/test/eyetests/tests/effect_solarize.rb +10 -0
  23. data/test/eyetests/tests/effect_wave.rb +9 -0
  24. data/test/eyetests/tests/gradient_fill_vertical_fill.rb +1 -1
  25. data/test/eyetests/tests/gruff_dot_1.rb +19 -0
  26. data/test/eyetests/tests/gruff_line_2.rb +1 -1
  27. data/test/eyetests/tests/gruff_pie_1.rb +1 -1
  28. data/test/eyetests/tests/gruff_stacked_area_1.rb +23 -0
  29. data/test/eyetests/tests/new_image.rb +8 -1
  30. data/test/gruff_tests/test/gruff_test_case.rb +5 -2
  31. data/test/gruff_tests/test/test_bar.rb +15 -3
  32. data/test/gruff_tests/test/test_bullet.rb +26 -26
  33. data/test/gruff_tests/test/test_dot.rb +273 -0
  34. data/test/gruff_tests/test/test_legend.rb +37 -40
  35. data/test/gruff_tests/test/test_line.rb +75 -14
  36. data/test/gruff_tests/test/test_mini_bar.rb +1 -0
  37. data/test/gruff_tests/test/test_stacked_area.rb +52 -0
  38. data/test/spec/draw_spec.rb +1 -0
  39. data/test/spec/image_spec.rb +15 -1
  40. data/test/spec/stories/geometry_runner.rb +1 -1
  41. data/test/spec/stories/geometry_story.rb +1 -1
  42. metadata +186 -164
  43. data/lib/jhlabs-filters.jar +0 -0
@@ -4,147 +4,162 @@ README.txt
4
4
  Rakefile
5
5
  LICENSE.txt
6
6
  lib/RMagick.rb
7
- lib/rmagick4j/constants.rb
8
- lib/rmagick4j/draw.rb
9
- lib/rmagick4j/enum.rb
10
- lib/rmagick4j/gradient_fill.rb
11
- lib/rmagick4j/image.rb
12
- lib/rmagick4j/image_list.rb
13
- lib/rmagick4j/pixel.rb
14
- lib/rmagick4j/rmagick4j.rb
15
- lib/rmagick4j/texture_fill.rb
16
- lib/rmagick4j/type_metric.rb
17
- lib/rmagick4j/version.rb
18
- lib/rvg/clippath.rb
19
- lib/rvg/container.rb
7
+ lib/rvg/stylable.rb
20
8
  lib/rvg/deep_equal.rb
21
- lib/rvg/describable.rb
22
- lib/rvg/embellishable.rb
9
+ lib/rvg/pathdata.rb
10
+ lib/rvg/units.rb
11
+ lib/rvg/container.rb
23
12
  lib/rvg/misc.rb
24
13
  lib/rvg/paint.rb
25
- lib/rvg/pathdata.rb
26
- lib/rvg/rvg.rb
27
- lib/rvg/stretchable.rb
28
- lib/rvg/stylable.rb
14
+ lib/rvg/embellishable.rb
15
+ lib/rvg/describable.rb
29
16
  lib/rvg/text.rb
30
17
  lib/rvg/transformable.rb
31
- lib/rvg/units.rb
32
- lib/jhlabs-filters.jar
33
- lib/magick4j.jar
18
+ lib/rvg/rvg.rb
19
+ lib/rvg/clippath.rb
20
+ lib/rvg/stretchable.rb
21
+ lib/rmagick4j/constants.rb
22
+ lib/rmagick4j/gradient_fill.rb
23
+ lib/rmagick4j/draw.rb
24
+ lib/rmagick4j/pixel.rb
25
+ lib/rmagick4j/rmagick4j.rb
26
+ lib/rmagick4j/image.rb
27
+ lib/rmagick4j/image_list.rb
28
+ lib/rmagick4j/version.rb
29
+ lib/rmagick4j/enum.rb
30
+ lib/rmagick4j/type_metric.rb
31
+ lib/rmagick4j/texture_fill.rb
34
32
  lib/svgsalamander.jar
33
+ lib/magick4j.jar
35
34
  test/implemented_methods.rb
36
35
  test/RMagickTestSuite.rb
37
36
  test/eyetests/bullseye.rb
38
- test/eyetests/tests/draw_arc_basic.rb
39
- test/eyetests/tests/draw_circle_affine.rb
40
- test/eyetests/tests/draw_circle_basic.rb
41
- test/eyetests/tests/draw_clip_path.rb
42
- test/eyetests/tests/draw_ellipse_affine.rb
43
- test/eyetests/tests/draw_ellipse_basic.rb
44
- test/eyetests/tests/draw_line_affine.rb
37
+ test/eyetests/doc.rb
38
+ test/eyetests/tests/path_c_command_01.rb
45
39
  test/eyetests/tests/draw_line_basic.rb
46
- test/eyetests/tests/draw_multiline_type_metrics.rb
47
- test/eyetests/tests/draw_pattern_1.rb
48
- test/eyetests/tests/draw_polygon_affine.rb
49
- test/eyetests/tests/draw_polygon_basic.rb
40
+ test/eyetests/tests/gruff_stacked_bar_2.rb
41
+ test/eyetests/tests/effect_blur.rb
42
+ test/eyetests/tests/draw_clip_path.rb
43
+ test/eyetests/tests/gruff_sidestacked_bar_1.rb
44
+ test/eyetests/tests/store_pixel_smiley.rb
45
+ test/eyetests/tests/gruff_bar_1.rb
50
46
  test/eyetests/tests/draw_polyline_affine.rb
51
- test/eyetests/tests/draw_polyline_basic.rb
52
- test/eyetests/tests/draw_pop_push_translate.rb
53
- test/eyetests/tests/draw_rectangle_affine.rb
54
- test/eyetests/tests/draw_rectangle_basic.rb
55
- test/eyetests/tests/draw_rmagick_test_01.rb
47
+ test/eyetests/tests/effect_charcoal.rb
56
48
  test/eyetests/tests/draw_rmagick_test_02.rb
49
+ test/eyetests/tests/path_m_command_02.rb
50
+ test/eyetests/tests/draw_circle_affine.rb
51
+ test/eyetests/tests/gruff_pie_2.rb
52
+ test/eyetests/tests/effect_negate_true.rb
53
+ test/eyetests/tests/draw_pattern_1.rb
54
+ test/eyetests/tests/draw_arc_basic.rb
55
+ test/eyetests/tests/gruff_net_1.rb
56
+ test/eyetests/tests/path_h_command_01.rb
57
+ test/eyetests/tests/path_a_command_02.rb
58
+ test/eyetests/tests/path_m_command_03.rb
59
+ test/eyetests/tests/effect_implode.rb
57
60
  test/eyetests/tests/draw_rmagick_test_03.rb
58
- test/eyetests/tests/draw_rmagick_test_04.rb
59
- test/eyetests/tests/draw_rotate_01.rb
61
+ test/eyetests/tests/gruff_scene_2.rb
62
+ test/eyetests/tests/path_h_command_02.rb
60
63
  test/eyetests/tests/draw_roundrectangle_affine.rb
61
- test/eyetests/tests/draw_roundrectangle_basic.rb
62
- test/eyetests/tests/draw_scale_01.rb
63
- test/eyetests/tests/draw_skewx_01.rb
64
- test/eyetests/tests/draw_skewy_01.rb
65
- test/eyetests/tests/draw_stroke_miterlimit.rb
66
- test/eyetests/tests/gradient_fill_horizontal_diagonal_fill.rb
67
- test/eyetests/tests/gradient_fill_horizontal_fill.rb
68
- test/eyetests/tests/gradient_fill_point_fill.rb
69
- test/eyetests/tests/gradient_fill_vertical_diagonal_fill.rb
70
- test/eyetests/tests/gradient_fill_vertical_fill.rb
71
- test/eyetests/tests/gruff_accumulator_bar.rb
72
- test/eyetests/tests/gruff_area_1.rb
73
- test/eyetests/tests/gruff_area_2.rb
74
- test/eyetests/tests/gruff_bar_1.rb
75
64
  test/eyetests/tests/gruff_bar_2.rb
76
- test/eyetests/tests/gruff_line_1.rb
77
- test/eyetests/tests/gruff_line_2.rb
78
- test/eyetests/tests/gruff_net_1.rb
79
- test/eyetests/tests/gruff_net_2.rb
80
- test/eyetests/tests/gruff_pie_1.rb
81
- test/eyetests/tests/gruff_pie_2.rb
82
- test/eyetests/tests/gruff_scene_1.rb
83
- test/eyetests/tests/gruff_scene_2.rb
84
- test/eyetests/tests/gruff_sidebar.rb
85
- test/eyetests/tests/gruff_sidestacked_bar_1.rb
86
- test/eyetests/tests/gruff_sidestacked_bar_2.rb
87
- test/eyetests/tests/gruff_spider_1.rb
88
- test/eyetests/tests/gruff_spider_2.rb
89
- test/eyetests/tests/gruff_stacked_bar_1.rb
90
- test/eyetests/tests/gruff_stacked_bar_2.rb
91
- test/eyetests/tests/hatch_fill.rb
92
- test/eyetests/tests/image_list_flatten_images.rb
93
- test/eyetests/tests/new_image.rb
94
- test/eyetests/tests/path_a_command_01.rb
95
- test/eyetests/tests/path_a_command_02.rb
96
- test/eyetests/tests/path_c_command_01.rb
65
+ test/eyetests/tests/gruff_area_1.rb
97
66
  test/eyetests/tests/path_c_command_02.rb
67
+ test/eyetests/tests/hatch_fill.rb
68
+ test/eyetests/tests/gruff_line_1.rb
98
69
  test/eyetests/tests/path_complex_01.rb
99
- test/eyetests/tests/path_espiral_01.rb
100
- test/eyetests/tests/path_h_command_01.rb
101
- test/eyetests/tests/path_h_command_02.rb
102
- test/eyetests/tests/path_l_command_01.rb
103
70
  test/eyetests/tests/path_l_command_02.rb
104
- test/eyetests/tests/path_m_command_01.rb
105
- test/eyetests/tests/path_m_command_02.rb
106
- test/eyetests/tests/path_m_command_03.rb
107
- test/eyetests/tests/path_q_command_01.rb
108
- test/eyetests/tests/path_q_command_02.rb
109
71
  test/eyetests/tests/path_q_command_03.rb
110
- test/eyetests/tests/path_s_command_01.rb
111
- test/eyetests/tests/path_s_command_02.rb
112
72
  test/eyetests/tests/path_star_01.rb
73
+ test/eyetests/tests/gruff_stacked_area_1.rb
74
+ test/eyetests/tests/effect_normalize.rb
75
+ test/eyetests/tests/path_espiral_01.rb
76
+ test/eyetests/tests/effect_solarize.rb
77
+ test/eyetests/tests/draw_rotate_01.rb
78
+ test/eyetests/tests/gruff_area_2.rb
79
+ test/eyetests/tests/gruff_net_2.rb
80
+ test/eyetests/tests/draw_ellipse_affine.rb
81
+ test/eyetests/tests/draw_rectangle_affine.rb
82
+ test/eyetests/tests/gruff_spider_1.rb
83
+ test/eyetests/tests/gruff_pie_1.rb
113
84
  test/eyetests/tests/path_t_command_01.rb
85
+ test/eyetests/tests/gruff_sidebar.rb
86
+ test/eyetests/tests/gruff_scene_1.rb
87
+ test/eyetests/tests/draw_pop_push.rb
88
+ test/eyetests/tests/draw_ellipse_basic.rb
89
+ test/eyetests/tests/draw_rmagick_test_01.rb
90
+ test/eyetests/tests/gruff_dot_1.rb
91
+ test/eyetests/tests/gradient_fill_horizontal_fill.rb
114
92
  test/eyetests/tests/path_t_command_02.rb
115
- test/eyetests/tests/path_v_command_01.rb
116
93
  test/eyetests/tests/path_v_command_02.rb
117
- test/eyetests/tests/store_pixel_smiley.rb
94
+ test/eyetests/tests/gruff_accumulator_bar.rb
95
+ test/eyetests/tests/path_l_command_01.rb
96
+ test/eyetests/tests/gruff_line_2.rb
97
+ test/eyetests/tests/path_s_command_02.rb
98
+ test/eyetests/tests/draw_multiline_type_metrics.rb
99
+ test/eyetests/tests/effect_wave.rb
100
+ test/eyetests/tests/path_q_command_01.rb
101
+ test/eyetests/tests/draw_rmagick_test_04.rb
102
+ test/eyetests/tests/draw_stroke_miterlimit.rb
103
+ test/eyetests/tests/draw_roundrectangle_basic.rb
104
+ test/eyetests/tests/gruff_spider_2.rb
105
+ test/eyetests/tests/gradient_fill_horizontal_diagonal_fill.rb
106
+ test/eyetests/tests/path_s_command_01.rb
107
+ test/eyetests/tests/image_list_flatten_images.rb
108
+ test/eyetests/tests/effect_shade.rb
109
+ test/eyetests/tests/draw_pop_push_translate.rb
110
+ test/eyetests/tests/draw_polygon_basic.rb
111
+ test/eyetests/tests/path_q_command_02.rb
112
+ test/eyetests/tests/draw_polyline_basic.rb
113
+ test/eyetests/tests/path_v_command_01.rb
114
+ test/eyetests/tests/draw_skewy_01.rb
115
+ test/eyetests/tests/gradient_fill_vertical_diagonal_fill.rb
116
+ test/eyetests/tests/gruff_sidestacked_bar_2.rb
117
+ test/eyetests/tests/path_m_command_01.rb
118
+ test/eyetests/tests/effect_edge.rb
119
+ test/eyetests/tests/draw_skewx_01.rb
120
+ test/eyetests/tests/gradient_fill_vertical_fill.rb
121
+ test/eyetests/tests/gruff_stacked_bar_1.rb
122
+ test/eyetests/tests/draw_polygon_affine.rb
123
+ test/eyetests/tests/draw_circle_basic.rb
124
+ test/eyetests/tests/new_image.rb
125
+ test/eyetests/tests/effect_negate.rb
118
126
  test/eyetests/tests/texture_fill.rb
119
- test/gruff_tests/test/gruff_test_case.rb
120
- test/gruff_tests/test/monkey_gruff.rb
121
- test/gruff_tests/test/test_accumulator_bar.rb
122
- test/gruff_tests/test/test_area.rb
123
- test/gruff_tests/test/test_bar.rb
127
+ test/eyetests/tests/draw_rectangle_basic.rb
128
+ test/eyetests/tests/path_a_command_01.rb
129
+ test/eyetests/tests/draw_scale_01.rb
130
+ test/eyetests/tests/gradient_fill_point_fill.rb
131
+ test/eyetests/tests/draw_line_affine.rb
124
132
  test/gruff_tests/test/test_base.rb
125
- test/gruff_tests/test/test_bullet.rb
126
- test/gruff_tests/test/test_legend.rb
127
- test/gruff_tests/test/test_line.rb
128
- test/gruff_tests/test/test_mini_bar.rb
129
- test/gruff_tests/test/test_mini_pie.rb
130
- test/gruff_tests/test/test_mini_side_bar.rb
131
- test/gruff_tests/test/test_net.rb
133
+ test/gruff_tests/test/test_scene.rb
132
134
  test/gruff_tests/test/test_photo.rb
135
+ test/gruff_tests/test/test_legend.rb
136
+ test/gruff_tests/test/test_dot.rb
137
+ test/gruff_tests/test/test_bullet.rb
138
+ test/gruff_tests/test/test_area.rb
139
+ test/gruff_tests/test/test_bar.rb
133
140
  test/gruff_tests/test/test_pie.rb
134
- test/gruff_tests/test/test_scene.rb
135
- test/gruff_tests/test/test_side_bar.rb
141
+ test/gruff_tests/test/test_net.rb
142
+ test/gruff_tests/test/test_mini_bar.rb
143
+ test/gruff_tests/test/test_stacked_bar.rb
144
+ test/gruff_tests/test/monkey_gruff.rb
145
+ test/gruff_tests/test/test_accumulator_bar.rb
146
+ test/gruff_tests/test/test_stacked_area.rb
136
147
  test/gruff_tests/test/test_sidestacked_bar.rb
148
+ test/gruff_tests/test/test_line.rb
149
+ test/gruff_tests/test/test_side_bar.rb
150
+ test/gruff_tests/test/test_mini_side_bar.rb
151
+ test/gruff_tests/test/gruff_test_case.rb
152
+ test/gruff_tests/test/test_mini_pie.rb
137
153
  test/gruff_tests/test/test_spider.rb
138
- test/gruff_tests/test/test_stacked_bar.rb
139
154
  test/spec/draw_spec.rb
155
+ test/spec/pixel_spec.rb
140
156
  test/spec/image_constants.rb
141
157
  test/spec/image_spec.rb
142
- test/spec/pixel_spec.rb
158
+ test/spec/stories/image_filling_steps.rb
159
+ test/spec/stories/geometry_story.rb
160
+ test/spec/stories/image_filling_story.rb
143
161
  test/spec/stories/geometry_runner.rb
144
162
  test/spec/stories/geometry_steps.rb
145
- test/spec/stories/geometry_story.rb
146
163
  test/spec/stories/image_filling_runner.rb
147
- test/spec/stories/image_filling_steps.rb
148
- test/spec/stories/image_filling_story.rb
149
164
  test/images/clown.jpg
150
165
  test/images/texture.jpg
@@ -1,4 +1,4 @@
1
- # $Id: RMagick.rb,v 1.72 2008/06/08 13:41:39 rmagick Exp $
1
+ # $Id: RMagick.rb,v 1.80 2009/01/02 21:08:14 rmagick Exp $
2
2
  #==============================================================================
3
3
  # Copyright (C) 2008 by Timothy P. Hunter
4
4
  # Name: RMagick.rb
@@ -364,6 +364,30 @@ class Draw
364
364
  primitive "gravity #{GRAVITY_NAMES[grav.to_i]}"
365
365
  end
366
366
 
367
+ # IM 6.4.8-3 and later
368
+ def interword_spacing(space)
369
+ begin
370
+ Float(space)
371
+ rescue ArgumentError
372
+ Kernel.raise ArgumentError, "invalid value for interword_spacing"
373
+ rescue TypeError
374
+ Kernel.raise TypeError, "can't convert #{space.class} into Float"
375
+ end
376
+ primitive "interword-spacing #{space}"
377
+ end
378
+
379
+ # IM 6.4.8-3 and later
380
+ def kerning(space)
381
+ begin
382
+ Float(space)
383
+ rescue ArgumentError
384
+ Kernel.raise ArgumentError, "invalid value for kerning"
385
+ rescue TypeError
386
+ Kernel.raise TypeError, "can't convert #{space.class} into Float"
387
+ end
388
+ primitive "kerning #{space}"
389
+ end
390
+
367
391
  # Draw a line
368
392
  def line(startX, startY, endX, endY)
369
393
  primitive "line " + sprintf("%g,%g %g,%g", startX, startY, endX, endY)
@@ -734,6 +758,8 @@ end # module Magick::IPTC
734
758
  class Image
735
759
  include Comparable
736
760
 
761
+ alias_method :affinity, :remap
762
+
737
763
  # Provide an alternate version of Draw#annotate, for folks who
738
764
  # want to find it in this class.
739
765
  def annotate(draw, width, height, x, y, text, &block)
@@ -1409,7 +1435,7 @@ public
1409
1435
  end
1410
1436
 
1411
1437
  [:at, :each, :each_index, :empty?, :fetch,
1412
- :first, :hash, :include?, :index, :length, :nitems, :rindex, :sort!].each do |mth|
1438
+ :first, :hash, :include?, :index, :length, :rindex, :sort!].each do |mth|
1413
1439
  module_eval <<-END_SIMPLE_DELEGATES
1414
1440
  def #{mth}(*args, &block)
1415
1441
  @images.#{mth}(*args, &block)
@@ -1418,6 +1444,13 @@ public
1418
1444
  end
1419
1445
  alias_method :size, :length
1420
1446
 
1447
+ # Array#nitems is not available in 1.9
1448
+ if Array.instance_methods.include?("nitems")
1449
+ def nitems()
1450
+ @images.nitems()
1451
+ end
1452
+ end
1453
+
1421
1454
  def clear
1422
1455
  @scene = nil
1423
1456
  @images.clear
@@ -1467,6 +1500,9 @@ public
1467
1500
  alias_method :map!, :collect!
1468
1501
  alias_method :__map__!, :collect!
1469
1502
 
1503
+ # ImageMagic used affinity in 6.4.3, switch to remap in 6.4.4.
1504
+ alias_method :affinity, :remap
1505
+
1470
1506
  def compact
1471
1507
  current = get_current()
1472
1508
  ilist = self.class.new
@@ -1571,11 +1607,11 @@ public
1571
1607
  end
1572
1608
 
1573
1609
  # Initialize new instances
1574
- def initialize(*filenames)
1610
+ def initialize(*filenames, &block)
1575
1611
  @images = []
1576
1612
  @scene = nil
1577
1613
  filenames.each { |f|
1578
- Magick::Image.read(f).each { |n| @images << n }
1614
+ Magick::Image.read(f, &block).each { |n| @images << n }
1579
1615
  }
1580
1616
  if length > 0
1581
1617
  @scene = length - 1 # last image in array
@@ -1621,6 +1657,19 @@ public
1621
1657
  return a
1622
1658
  end
1623
1659
 
1660
+ # Custom marshal/unmarshal for Ruby 1.8.
1661
+ def marshal_dump()
1662
+ ary = [@scene]
1663
+ @images.each {|i| ary << Marshal.dump(i)}
1664
+ ary
1665
+ end
1666
+
1667
+ def marshal_load(ary)
1668
+ @scene = ary.shift
1669
+ @images = []
1670
+ ary.each {|a| @images << Marshal.load(a)}
1671
+ end
1672
+
1624
1673
  # The ImageList class supports the Magick::Image class methods by simply sending
1625
1674
  # the method to the current image. If the method isn't explicitly supported,
1626
1675
  # send it to the current image in the array. If there are no images, send
@@ -1833,6 +1882,37 @@ public
1833
1882
 
1834
1883
  end # Magick::ImageList
1835
1884
 
1885
+
1886
+ # Collects non-specific optional method arguments
1887
+ class OptionalMethodArguments
1888
+ def initialize(img)
1889
+ @img = img
1890
+ end
1891
+
1892
+ # miscellaneous options like -verbose
1893
+ def method_missing(mth, val)
1894
+ @img.define(mth.to_s.tr('_', '-'), val)
1895
+ end
1896
+
1897
+ # set(key, val) corresponds to -set option:key val
1898
+ def define(key, val = nil)
1899
+ @img.define(key, val)
1900
+ end
1901
+
1902
+ # accepts Pixel object or color name
1903
+ def highlight_color=(color)
1904
+ color = @img.to_color(color) if color.respond_to?(:to_color)
1905
+ @img.define("highlight-color", color)
1906
+ end
1907
+
1908
+ # accepts Pixel object or color name
1909
+ def lowlight_color=(color)
1910
+ color = @img.to_color(color) if color.respond_to?(:to_color)
1911
+ @img.define("lowlight-color", color)
1912
+ end
1913
+ end
1914
+
1915
+
1836
1916
  # Example fill class. Fills the image with the specified background
1837
1917
  # color, then crosshatches with the specified crosshatch color.
1838
1918
  # @dist is the number of pixels between hatch lines.
Binary file
@@ -1,4 +1,5 @@
1
1
  module Magick
2
+ Effects = Java::Magick4jEffects
2
3
  Magick4J = Java::magick4j
3
4
  RMagick4J = Java::rmagick4j
4
5
 
@@ -1,4 +1,3 @@
1
-
2
1
  module Magick
3
2
  class Image
4
3
 
@@ -52,10 +51,19 @@ module Magick
52
51
  value = Pixel.from_color(value) if value.is_a?(String)
53
52
  @image.setBackgroundColor(value)
54
53
  end
54
+
55
+ def blur
56
+ @image.getBlur
57
+ end
55
58
 
59
+ def blur=(value)
60
+ raise TypeError, "no implicit conversion to float from #{value.class.to_s.downcase}" unless value.is_a? Numeric
61
+ @image.setBlur(value)
62
+ end
63
+
56
64
  def blur_image(radius=0.0, sigma=1.0)
57
65
  # Swap order on purpose. I wanted them the other way around in Magick4J.
58
- Image.from_image(@image.blurred(sigma, radius))
66
+ Image.from_image(Effects.BlurEffect.new(radius,sigma).apply(_image))
59
67
  end
60
68
 
61
69
  def change_geometry(geometry)
@@ -72,6 +80,10 @@ module Magick
72
80
  self
73
81
  end
74
82
 
83
+ def charcoal(radius=0.0, sigma=1.0)
84
+ Image.from_image(Effects.CharcoalEffect.new(radius,sigma).apply(_image))
85
+ end
86
+
75
87
  def columns
76
88
  @image.getWidth
77
89
  end
@@ -126,7 +138,11 @@ module Magick
126
138
  @image.display
127
139
  self
128
140
  end
129
-
141
+
142
+ def edge(radius=0.0)
143
+ Image.from_image(Effects.EdgeEffect.new(radius).apply(_image))
144
+ end
145
+
130
146
  def erase!
131
147
  @image.erase
132
148
  end
@@ -156,6 +172,10 @@ module Magick
156
172
  def _image=(new_image)
157
173
  @image = new_image
158
174
  end
175
+
176
+ def implode(amount=0.5)
177
+ Image.from_image(Effects.ImplodeEffect.new(amount).apply(_image))
178
+ end
159
179
 
160
180
  def _info
161
181
  @info
@@ -171,10 +191,22 @@ module Magick
171
191
  fill.fill(self) if fill.respond_to? :fill
172
192
  end
173
193
 
194
+ def matte
195
+ @image.getMatte
196
+ end
197
+
174
198
  def matte= matte
175
199
  @image.setMatte(matte)
176
200
  end
177
201
 
202
+ def negate(grayscale=false)
203
+ Image.from_image(Effects.NegateEffect.new(grayscale).apply(_image))
204
+ end
205
+
206
+ def normalize
207
+ Image.from_image(Effects.NormalizeEffect.new().apply(_image))
208
+ end
209
+
178
210
  def quantize(number_colors=256, colorspace=RGBColorspace, dither=true, tree_depth=0, measure_error=false)
179
211
  Image.from_image(@image.quantized(number_colors, colorspace._val, dither, tree_depth, measure_error))
180
212
  end
@@ -183,6 +215,10 @@ module Magick
183
215
  Image.from_image(@image.raised(width, height, raise))
184
216
  end
185
217
 
218
+ def remap
219
+ # TODO: Implement. Just here to avoid warning in RMagick 2.9 file.
220
+ end
221
+
186
222
  def resize(*args)
187
223
  copy.resize!(*args)
188
224
  end
@@ -225,7 +261,15 @@ module Magick
225
261
  def rows
226
262
  @image.getHeight
227
263
  end
264
+
265
+ def shade(shading=false,azimuth=30,elevation=30)
266
+ Image.from_image(Effects.ShadeEffect.new(shading,azimuth,elevation).apply(_image))
267
+ end
228
268
 
269
+ def solarize(threshold=50)
270
+ Image.from_image(Effects.SolarizeEffect.new(threshold).apply(_image))
271
+ end
272
+
229
273
  def store_pixels(x, y, columns, rows, pixels)
230
274
  ria_size = columns*rows
231
275
  raise IndexError, "not enough elements in array - expecting #{ria_size}, got #{pixels.size}" if pixels.size < ria_size
@@ -249,6 +293,10 @@ module Magick
249
293
  self
250
294
  end
251
295
 
296
+ def wave(amplitude=25.0, wavelength=150.0)
297
+ Image.from_image(Effects.WaveEffect.new(amplitude,wavelength).apply(_image))
298
+ end
299
+
252
300
  def write(file, &add)
253
301
  # TODO I'm having trouble finding out how this info is used, so I'll skip using it for now.
254
302
  info = Info.new(&add)