rmagick4j 0.3.3-java → 0.3.4-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.
data/lib/RMagick.jar CHANGED
Binary file
data/lib/RMagick.rb CHANGED
@@ -8,8 +8,8 @@
8
8
  # to the classes.
9
9
  #==============================================================================
10
10
 
11
- require 'RMagick.so'
12
-
11
+ #require 'RMagick.so'
12
+ require "rmagick4j/rmagick4j"
13
13
  module Magick
14
14
  @@formats = nil
15
15
 
data/lib/magick4j.jar CHANGED
Binary file
@@ -24,13 +24,18 @@ class Draw
24
24
  end
25
25
 
26
26
  def fill= fill
27
- @draw.setFill(Magick4J.ColorDatabase.queryDefault(fill))
27
+ @draw.fill = Magick4J.ColorDatabase.query_default(fill)
28
+ self
29
+ end
30
+
31
+ def font_family= font_family
32
+ @draw.font_family = font_family
28
33
  self
29
34
  end
30
35
 
31
36
  def font_weight= font_weight
32
37
  font_weight = {BoldWeight => 700, NormalWeight => 400}[font_weight]
33
- @draw.setFontWeight(font_weight)
38
+ @draw.font_weight = font_weight
34
39
  end
35
40
 
36
41
  def get_type_metrics(*args)
@@ -129,7 +134,7 @@ class Image
129
134
  # TODO Use info somehow
130
135
  info = Info.new(&add)
131
136
  # TODO multiple images in file
132
- [Image.new(Magick4J.MagickImage.fromBlob(blob.to_java_bytes))]
137
+ [Image.new(Magick4J.MagickImage.from_blob(blob.to_java_bytes))]
133
138
  end
134
139
 
135
140
  def self.read(file, &add)
@@ -142,7 +147,7 @@ class Image
142
147
  end
143
148
 
144
149
  def columns
145
- @image.getWidth
150
+ @image.width
146
151
  end
147
152
 
148
153
  def composite(*args)
@@ -152,9 +157,36 @@ class Image
152
157
  Image.new(@image.composited(*args))
153
158
  end
154
159
 
155
- def crop(x, y, width, height)
156
- Image.new(@image.cropped(x, y, width, height))
157
- end
160
+ def copy
161
+ Image.new(@image.clone)
162
+ end
163
+
164
+ def crop(*args)
165
+ copy.crop!(*args)
166
+ end
167
+
168
+ def crop!(*args)
169
+ # gravity, x, y, width, height, reset_offset
170
+ # Defaults.
171
+ gravity = nil
172
+ x = y = 0
173
+ reset_offset = false
174
+ # Find available args.
175
+ if args.first.is_a? Magick4J::Gravity
176
+ gravity = args.shift
177
+ end
178
+ if [FalseClass, TrueClass].member? args.last.class
179
+ reset = args.pop
180
+ end
181
+ if args.length == 4
182
+ x, y = args[0..1]
183
+ end
184
+ width, height = args[-2..-1]
185
+ # Call Java.
186
+ # TODO Why wouldn't we reset offset information? Do we need to use that?
187
+ @image.crop(gravity, x, y, width, height)
188
+ self
189
+ end
158
190
 
159
191
  def display
160
192
  @image.display
@@ -214,8 +246,18 @@ class Image
214
246
  Image.new(@image.resized(scale_factor))
215
247
  end
216
248
 
217
- def rotate(scale_factor)
218
- Image.new(@image.rotated(scale_factor))
249
+ def resize!(scale_factor)
250
+ @image.resize(scale_factor)
251
+ self
252
+ end
253
+
254
+ def rotate(amount)
255
+ Image.new(@image.rotated(amount))
256
+ end
257
+
258
+ def rotate!(amount)
259
+ @image.rotate(amount)
260
+ self
219
261
  end
220
262
 
221
263
  def rows
@@ -223,12 +265,22 @@ class Image
223
265
  end
224
266
 
225
267
  def to_blob(&add)
226
- # TODO Use info.
227
268
  info = Info.new(&add)
228
269
  @image.setFormat(info.format) if info.format
229
270
  String.from_java_bytes(@image.toBlob)
230
271
  end
231
272
 
273
+ def watermark(mark, lightness=1.0, saturation=1.0, gravity=nil, x_offset=0, y_offset=0)
274
+ if gravity.is_a? Numeric
275
+ # gravity is technically an optional argument in the middle.
276
+ gravity = nil
277
+ y_offset = x_offset
278
+ x_offset = gravity
279
+ end
280
+ # TODO Perform watermark.
281
+ self
282
+ end
283
+
232
284
  def write(file, &add)
233
285
  # TODO I'm having trouble finding out how this info is used, so I'll skip using it for now.
234
286
  info = Info.new(&add)
metadata CHANGED
@@ -1,43 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
- cert_chain:
3
- rubygems_version: 0.9.4
4
- description: RMagick4J is a JRuby back end to support the RMagick library. It bundles
5
- a Java library called Magick4J that implements ImageMagick and some RMagick native
6
- functionality.
7
- version: !ruby/object:Gem::Version
8
- version: 0.3.3
9
- requirements: []
10
- test_files: []
11
- bindir: bin
12
- email: jruby-extras-devel@rubyforge.org
13
- autorequire:
14
2
  extensions: []
15
- summary: RMagick4J is a JRuby back end for RMagick.
16
- post_install_message:
17
3
  homepage: http://code.google.com/p/rmagick4j/
18
- dependencies: []
19
- has_rdoc: false
20
- required_ruby_version: !ruby/object:Gem::Version::Requirement
21
- version:
22
- requirements:
23
- - - '>'
24
- - !ruby/object:Gem::Version
25
- version: 0.0.0
26
- require_paths:
27
- - lib
28
- signing_key:
29
- name: rmagick4j
30
4
  executables: []
31
- rdoc_options: []
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.3.4
7
+ post_install_message:
8
+ date: 2008-04-14 22:00:00 +00:00
32
9
  files:
33
- - lib
34
- - lib/RMagick.jar
35
- - lib/RMagick.rb
36
10
  - lib/jhlabs-filters.jar
37
11
  - lib/magick4j.jar
12
+ - lib/RMagick.jar
13
+ - lib/RMagick.rb
38
14
  - lib/rmagick4j
39
- - lib/rmagick4j/rmagick4j.rb
40
15
  - lib/rvg
16
+ - lib/svgsalamander.jar
17
+ - lib/rmagick4j/rmagick4j.rb
41
18
  - lib/rvg/clippath.rb
42
19
  - lib/rvg/container.rb
43
20
  - lib/rvg/deep_equal.rb
@@ -52,12 +29,40 @@ files:
52
29
  - lib/rvg/text.rb
53
30
  - lib/rvg/transformable.rb
54
31
  - lib/rvg/units.rb
55
- - lib/svgsalamander.jar
32
+ rubygems_version: 1.0.1
33
+ rdoc_options: []
34
+ signing_key:
35
+ cert_chain: []
36
+ name: rmagick4j
37
+ has_rdoc: false
56
38
  platform: java
57
- rubyforge_project: jruby-extras
58
- date: 2007-06-05 07:00:00 +00:00
39
+ summary: RMagick4J is a JRuby back end for RMagick.
40
+ default_executable:
41
+ bindir: bin
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ version:
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: !str 0
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ version:
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: !str 0
54
+ require_paths:
55
+ - lib
56
+ specification_version: 2
57
+ test_files: []
58
+ dependencies: []
59
+ description: RMagick4J is a JRuby back end to support the RMagick library. It bundles
60
+ a Java library called Magick4J that implements ImageMagick and some RMagick native
61
+ functionality.
62
+ email: jruby-extras-devel@rubyforge.org
59
63
  authors:
60
- - Tom Palmer
64
+ - Tom Palmer & Serabe
61
65
  extra_rdoc_files: []
62
- specification_version: 1
63
- default_executable:
66
+ requirements: []
67
+ rubyforge_project: jruby-extras
68
+ autorequire: