webp-ffi 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: e31c8360882b799459efbb17d02a0c8c05182264
4
- data.tar.gz: ad4344c8ce850645cc5f092d627e40860a2e4ae5
3
+ metadata.gz: 7745e9bcd09baff6c5ffe977eaf00e2ff078a628
4
+ data.tar.gz: b948b1fa7ac70829b4ec1a95a19072aec525165f
5
5
  SHA512:
6
- metadata.gz: 9ebce606526ecd0e5e715f3f83e259ef43dba995dc07cda35fb7d8dbf16e38aadf7171c9092ec5809613cf8073af8251a44539ff51446c2161c42f3912e1c3c5
7
- data.tar.gz: dced6dcbbad67660e1b531317f60af8dcbcac734b2757baad107972e29ed4ed346445e6841f1f852a1909e006d4fff9c4856205935881e57604fb779b881745f
6
+ metadata.gz: 249cff2c45f5e988acedff8bd63226f8ad3ab845e97919281a4774b608ae17c16ba5451b3f8702de1bac5554c7bdfaf32ab82e69839ed92f96cb32a4223a1702
7
+ data.tar.gz: 17e4db3fd151581ade623b92d406f0c4477d4c0980255897ea8e9be660bad97562f8fa6952e2937e42029d58f03c0f79c11d559adf4666cbc02f3f95d29932c9
data/.travis.yml CHANGED
@@ -5,6 +5,7 @@ rvm:
5
5
  - 1.9.2
6
6
  - 1.9.3
7
7
  - 2.0.0
8
+ - 2.1.0
8
9
  - jruby-19mode
9
10
  - rbx-19mode
10
11
  - ruby-head
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.2.1
2
+
3
+ * Fix output for bmp, tiff and yuv
4
+
1
5
  ## v0.2.0
2
6
 
3
7
  * Checked and fixed for webp 0.4.0
data/lib/webp/options.rb CHANGED
@@ -1,59 +1,59 @@
1
1
  module WebP
2
2
  class Options
3
-
3
+
4
4
  def initialize(options)
5
5
  @user_options = options
6
6
  end
7
-
7
+
8
8
  def encode_pointer
9
9
  options_pointer = FFI::MemoryPointer.new :char, C::FfiWebpEncodeConfig.size, false
10
10
  options_struct = C::FfiWebpEncodeConfig.new options_pointer
11
- [:lossless, :method, :target_size, :target_PSNR, :segments,
12
- :sns_strength, :filter_strength, :filter_sharpness,
13
- :filter_type, :autofilter, :alpha_compression, :alpha_filtering,
14
- :alpha_quality, :pass, :show_compressed, :preprocessing, :partitions,
11
+ [:lossless, :method, :target_size, :target_PSNR, :segments,
12
+ :sns_strength, :filter_strength, :filter_sharpness,
13
+ :filter_type, :autofilter, :alpha_compression, :alpha_filtering,
14
+ :alpha_quality, :pass, :show_compressed, :preprocessing, :partitions,
15
15
  :partition_limit, :width, :height].each do |key|
16
16
  options_struct[key] = @user_options[key] ? @user_options[key] : -1
17
17
  end
18
18
  encode_default(options_struct)
19
- [:quality, :crop_x, :crop_y, :crop_w,
19
+ [:quality, :crop_x, :crop_y, :crop_w,
20
20
  :crop_h, :resize_w, :resize_h].each do |key|
21
21
  options_struct[key] = @user_options[key] if @user_options[key]
22
22
  end
23
23
  options_pointer
24
24
  end
25
-
25
+
26
26
  def decode_pointer
27
27
  options_pointer = FFI::MemoryPointer.new :char, C::FfiWebpDecodeConfig.size, false
28
28
  options_struct = C::FfiWebpDecodeConfig.new options_pointer
29
29
  decode_default(options_struct)
30
30
  # options
31
- if @user_options[:output_format] && [:png, :pam, :ppm, :pgm, :alpha_plane_only].include?(@user_options[:output_format])
31
+ if @user_options[:output_format] && [:png, :pam, :ppm, :pgm, :bmp, :tiff, :yuv, :alpha_plane_only].include?(@user_options[:output_format])
32
32
  options_struct[:output_format] = C::OutputFileFormat[@user_options[:output_format]]
33
33
  end
34
34
  [:bypass_filtering, :no_fancy_upsampling, :use_threads].each do |key|
35
35
  options_struct[key] = 1 if @user_options[key] && true == @user_options[key]
36
36
  end
37
- [:crop_x, :crop_y, :crop_w,
37
+ [:crop_x, :crop_y, :crop_w,
38
38
  :crop_h, :resize_w, :resize_h].each do |key|
39
39
  options_struct[key] = @user_options[key] if @user_options[key]
40
40
  end
41
41
  options_pointer
42
42
  end
43
-
43
+
44
44
  private
45
45
 
46
46
  def encode_default(options_struct)
47
47
  options_struct[:quality] = 100
48
48
  similar_default(options_struct)
49
49
  end
50
-
50
+
51
51
  def decode_default(options_struct)
52
52
  # default format is png
53
53
  options_struct[:output_format] = C::OutputFileFormat[:png]
54
54
  similar_default(options_struct)
55
55
  end
56
-
56
+
57
57
  def similar_default(options_struct)
58
58
  options_struct[:crop_x] = options_struct[:crop_y] = 0
59
59
  options_struct[:crop_w] = options_struct[:crop_h] = 0
data/lib/webp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module WebP
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webp-ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Vasyliev