rszr 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce6596f9a3f8e4d355c5d974da7e918dd574517b1ab87aaf6f66e35c8c26c600
4
- data.tar.gz: 21905d628d567cbc06de0b0db56dc1515c5da7f533acc3917aedb8d91962b9cc
3
+ metadata.gz: 42f7ff2b0188f0d494a5ec087af2d15c835d309d276c0d4d2074138aa88e621b
4
+ data.tar.gz: e808c1406cec89ce6d65a111531742140b678f003c9c786f172a1d5f14bc01fe
5
5
  SHA512:
6
- metadata.gz: 262f3cda5bc4ff4c6a86a5e7bb2ab4de2414f2652648d09e0d8d2a327c62e37eaf83d091fff515853f2d853754d6d5dd56c8a97e51a851c46c427bd69207213d
7
- data.tar.gz: 1bd9c512ccbd0b95cb665d8a439c2ffa24456671d8165c555ad190058a16bad70913dfada98fbe6a4280a843ccfd83db02ea203746764ef8050586abcfd414fa
6
+ metadata.gz: 206c800ef7aad7318e4ad417332ab8c2647f7f05e1e92365be749833cfddd90e11048aa9088b390b8e8dfed820482b1955e1d4868fb7c15b365e1acd8e9ca55c
7
+ data.tar.gz: 92299076d2bdb47a383692d5c26387969cf680d22806640503090acba11c1eb74310a71adf3ca33bde211e296a98de0f92ae2d04d25f8fc962296096991ac99d
data/README.md CHANGED
@@ -45,7 +45,7 @@ apt-get install libimlib2 libimlib2-dev
45
45
  ```ruby
46
46
  # bounding box 400x300
47
47
  image = Rszr::Image.load('image.jpg')
48
- image.resize(400, 300)
48
+ image.resize!(400, 300)
49
49
 
50
50
  # save it
51
51
  image.save('resized.jpg')
data/ext/rszr/image.c CHANGED
@@ -53,7 +53,7 @@ static VALUE rszr_image__initialize(VALUE self, VALUE rb_width, VALUE rb_height)
53
53
  }
54
54
 
55
55
 
56
- static VALUE rszr_image_s__load(VALUE klass, VALUE rb_path)
56
+ static VALUE rszr_image_s__load(VALUE klass, VALUE rb_path, VALUE rb_immediately)
57
57
  {
58
58
  rszr_image_handle * handle;
59
59
  Imlib_Image image;
@@ -64,7 +64,11 @@ static VALUE rszr_image_s__load(VALUE klass, VALUE rb_path)
64
64
  path = StringValueCStr(rb_path);
65
65
 
66
66
  imlib_set_cache_size(0);
67
- image = imlib_load_image_without_cache(path);
67
+ if (RTEST(rb_immediately)) {
68
+ image = imlib_load_image_immediately_without_cache(path);
69
+ } else {
70
+ image = imlib_load_image_without_cache(path);
71
+ }
68
72
 
69
73
  if (!image) {
70
74
  image = imlib_load_image_with_error_return(path, &error);
@@ -668,7 +672,7 @@ void Init_rszr_image()
668
672
  rb_define_alloc_func(cImage, rszr_image_s_allocate);
669
673
 
670
674
  // Class methods
671
- rb_define_private_method(rb_singleton_class(cImage), "_load", rszr_image_s__load, 1);
675
+ rb_define_private_method(rb_singleton_class(cImage), "_load", rszr_image_s__load, 2);
672
676
 
673
677
  // Instance methods
674
678
  rb_define_method(cImage, "width", rszr_image_width, 0);
data/lib/rszr/image.rb CHANGED
@@ -12,7 +12,7 @@ module Rszr
12
12
  def load(path, autorotate: Rszr.autorotate, **opts)
13
13
  path = path.to_s
14
14
  raise FileNotFound unless File.exist?(path)
15
- image = _load(path)
15
+ image = _load(path, opts[:immediately])
16
16
  autorotate(image, path) if autorotate
17
17
  image
18
18
  end
@@ -21,7 +21,7 @@ module Rszr
21
21
  def load_data(data, autorotate: Rszr.autorotate, **opts)
22
22
  raise LoadError, 'Unknown format' unless format = identify(data)
23
23
  with_tempfile(format, data) do |file|
24
- load(file.path, autorotate: autorotate, **opts)
24
+ load(file.path, autorotate: autorotate, **opts.merge(immediately: true))
25
25
  end
26
26
  end
27
27
 
@@ -41,7 +41,9 @@ module Rszr
41
41
  self._format = fmt
42
42
  end
43
43
 
44
- alias_method :alpha?, :alpha
44
+ def alpha?
45
+ !!alpha
46
+ end
45
47
 
46
48
  def [](x, y)
47
49
  if x >= 0 && x <= width - 1 && y >= 0 && y <= height - 1
data/lib/rszr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rszr
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rszr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Grosser
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fast image resizer - do one thing and do it fast.
14
14
  email:
@@ -48,7 +48,7 @@ homepage: https://github.com/mtgrosser/rszr
48
48
  licenses:
49
49
  - MIT
50
50
  metadata: {}
51
- post_install_message:
51
+ post_install_message:
52
52
  rdoc_options: []
53
53
  require_paths:
54
54
  - lib
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - imlib2
68
68
  rubygems_version: 3.1.4
69
- signing_key:
69
+ signing_key:
70
70
  specification_version: 4
71
71
  summary: Fast image resizer
72
72
  test_files: []