vips 8.6.3.2 → 8.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +27 -22
  3. data/CHANGELOG.md +273 -0
  4. data/example/annotate.rb +2 -2
  5. data/example/daltonize8.rb +26 -28
  6. data/example/example1.rb +1 -2
  7. data/example/example2.rb +6 -6
  8. data/example/example3.rb +5 -5
  9. data/example/example4.rb +6 -6
  10. data/example/example5.rb +6 -7
  11. data/example/inheritance_with_refcount.rb +201 -218
  12. data/example/thumb.rb +10 -12
  13. data/example/trim8.rb +6 -6
  14. data/example/watermark.rb +14 -35
  15. data/example/wobble.rb +24 -24
  16. data/lib/vips.rb +335 -312
  17. data/lib/vips/access.rb +9 -9
  18. data/lib/vips/align.rb +7 -8
  19. data/lib/vips/angle.rb +8 -9
  20. data/lib/vips/angle45.rb +12 -13
  21. data/lib/vips/bandformat.rb +16 -18
  22. data/lib/vips/blend_mode.rb +32 -0
  23. data/lib/vips/coding.rb +11 -12
  24. data/lib/vips/compass_direction.rb +13 -14
  25. data/lib/vips/direction.rb +7 -8
  26. data/lib/vips/extend.rb +13 -14
  27. data/lib/vips/gobject.rb +92 -96
  28. data/lib/vips/gvalue.rb +231 -237
  29. data/lib/vips/image.rb +1329 -1330
  30. data/lib/vips/interesting.rb +10 -11
  31. data/lib/vips/interpolate.rb +49 -54
  32. data/lib/vips/interpretation.rb +25 -26
  33. data/lib/vips/kernel.rb +18 -19
  34. data/lib/vips/methods.rb +2319 -2141
  35. data/lib/vips/object.rb +204 -213
  36. data/lib/vips/operation.rb +317 -323
  37. data/lib/vips/operationboolean.rb +10 -11
  38. data/lib/vips/operationcomplex.rb +8 -9
  39. data/lib/vips/operationcomplex2.rb +6 -7
  40. data/lib/vips/operationcomplexget.rb +7 -8
  41. data/lib/vips/operationmath.rb +14 -15
  42. data/lib/vips/operationmath2.rb +6 -7
  43. data/lib/vips/operationrelational.rb +11 -12
  44. data/lib/vips/operationround.rb +7 -8
  45. data/lib/vips/size.rb +9 -10
  46. data/lib/vips/version.rb +1 -1
  47. data/vips.gemspec +1 -1
  48. metadata +9 -8
data/lib/vips/access.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  module Vips
2
- # The type of access an operation has to supply.
3
- #
4
- # * `:random` means requests can come in any order.
5
- #
6
- # * `:sequential` means requests will be top-to-bottom, but with some
7
- # amount of buffering behind the read point for small non-local
8
- # accesses.
9
- class Access < Symbol
10
- end
2
+ # The type of access an operation has to supply.
3
+ #
4
+ # * `:random` means requests can come in any order.
5
+ #
6
+ # * `:sequential` means requests will be top-to-bottom, but with some
7
+ # amount of buffering behind the read point for small non-local
8
+ # accesses.
9
+ class Access < Symbol
10
+ end
11
11
  end
data/lib/vips/align.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  module Vips
2
+ # Various types of alignment. See {Image#join}, for example.
3
+ #
4
+ # * `:low` Align on the low coordinate edge
5
+ # * `:centre` Align on the centre
6
+ # * `:high` Align on the high coordinate edge
2
7
 
3
- # Various types of alignment. See {Image#join}, for example.
4
- #
5
- # * `:low` Align on the low coordinate edge
6
- # * `:centre` Align on the centre
7
- # * `:high` Align on the high coordinate edge
8
-
9
- class Align < Symbol
10
- end
8
+ class Align < Symbol
9
+ end
11
10
  end
data/lib/vips/angle.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  module Vips
2
+ # Various fixed 90 degree rotation angles. See {Image#rot}.
3
+ #
4
+ # * `:d0` no rotate
5
+ # * `:d90` 90 degrees clockwise
6
+ # * `:d180` 180 degrees
7
+ # * `:d270` 90 degrees anti-clockwise
2
8
 
3
- # Various fixed 90 degree rotation angles. See {Image#rot}.
4
- #
5
- # * `:d0` no rotate
6
- # * `:d90` 90 degrees clockwise
7
- # * `:d180` 180 degrees
8
- # * `:d270` 90 degrees anti-clockwise
9
-
10
- class Angle < Symbol
11
- end
9
+ class Angle < Symbol
10
+ end
12
11
  end
data/lib/vips/angle45.rb CHANGED
@@ -1,16 +1,15 @@
1
1
  module Vips
2
+ # Various fixed 45 degree rotation angles. See {Image#rot45}.
3
+ #
4
+ # * `:d0` no rotate
5
+ # * `:d45` 45 degrees clockwise
6
+ # * `:d90` 90 degrees clockwise
7
+ # * `:d135` 135 degrees clockwise
8
+ # * `:d180` 180 degrees
9
+ # * `:d225` 135 degrees anti-clockwise
10
+ # * `:d270` 90 degrees anti-clockwise
11
+ # * `:d315` 45 degrees anti-clockwise
2
12
 
3
- # Various fixed 45 degree rotation angles. See {Image#rot45}.
4
- #
5
- # * `:d0` no rotate
6
- # * `:d45` 45 degrees clockwise
7
- # * `:d90` 90 degrees clockwise
8
- # * `:d135` 135 degrees clockwise
9
- # * `:d180` 180 degrees
10
- # * `:d225` 135 degrees anti-clockwise
11
- # * `:d270` 90 degrees anti-clockwise
12
- # * `:d315` 45 degrees anti-clockwise
13
-
14
- class Angle45 < Symbol
15
- end
13
+ class Angle45 < Symbol
14
+ end
16
15
  end
@@ -1,20 +1,18 @@
1
1
  module Vips
2
-
3
- # The format used for each band element. Each corresponds to a native C type
4
- # for the current machine.
5
- #
6
- # * `:notset` invalid setting
7
- # * `:uchar` unsigned char format
8
- # * `:char` char format
9
- # * `:ushort` unsigned short format
10
- # * `:short` short format
11
- # * `:uint` unsigned int format
12
- # * `:int` int format
13
- # * `:float` float format
14
- # * `:complex` complex (two floats) format
15
- # * `:double` double float format
16
- # * `:dpcomplex` double complex (two double) format
17
- class BandFormat < Symbol
18
- end
19
-
2
+ # The format used for each band element. Each corresponds to a native C type
3
+ # for the current machine.
4
+ #
5
+ # * `:notset` invalid setting
6
+ # * `:uchar` unsigned char format
7
+ # * `:char` char format
8
+ # * `:ushort` unsigned short format
9
+ # * `:short` short format
10
+ # * `:uint` unsigned int format
11
+ # * `:int` int format
12
+ # * `:float` float format
13
+ # * `:complex` complex (two floats) format
14
+ # * `:double` double float format
15
+ # * `:dpcomplex` double complex (two double) format
16
+ class BandFormat < Symbol
17
+ end
20
18
  end
@@ -0,0 +1,32 @@
1
+ module Vips
2
+ # Blend mode to use when compositing images. See {Image#composite}.
3
+ #
4
+ # `:clear` - where the second object is drawn, the first is removed
5
+ # `:source` - the second object is drawn as if nothing were below
6
+ # `:over` - the image shows what you would expect if you held two semi-transparent slides on top of each other
7
+ # `:in` - the first object is removed completely, the second is only drawn where the first was
8
+ # `:out` - the second is drawn only where the first isn't
9
+ # `:atop` - this leaves the first object mostly intact, but mixes both objects in the overlapping area
10
+ # `:dest` - leaves the first object untouched, the second is discarded completely
11
+ # `:dest_over` - like `:over`, but swaps the arguments
12
+ # `:dest_in` - like `:in`, but swaps the arguments
13
+ # `:dest_out` - like `:out`, but swaps the arguments
14
+ # `:dest_atop` - like `:atop`, but swaps the arguments
15
+ # `:xor` - something like a difference operator
16
+ # `:add` - a bit like adding the two images
17
+ # `:saturate` - a bit like the darker of the two
18
+ # `:multiply` - at least as dark as the darker of the two inputs
19
+ # `:screen` - at least as light as the lighter of the inputs
20
+ # `:overlay` - multiplies or screens colors, depending on the lightness
21
+ # `:darken` - the darker of each component
22
+ # `:lighten` - the lighter of each component
23
+ # `:colour_dodge` - brighten first by a factor second
24
+ # `:colour_burn` - darken first by a factor of second
25
+ # `:hard_light` - multiply or screen, depending on lightness
26
+ # `:soft_light` - darken or lighten, depending on lightness
27
+ # `:difference` - difference of the two
28
+ # `:exclusion` - somewhat like `:difference`, but lower-contrast
29
+
30
+ class BlendMode < Symbol
31
+ end
32
+ end
data/lib/vips/coding.rb CHANGED
@@ -1,14 +1,13 @@
1
1
  module Vips
2
-
3
- # How pixels are coded.
4
- #
5
- # Normally, pixels are uncoded and can be manipulated as you would expect.
6
- # However some file formats code pixels for compression, and sometimes it's
7
- # useful to be able to manipulate images in the coded format.
8
- #
9
- # * `:none` pixels are not coded
10
- # * `:labq` pixels encode 3 float CIELAB values as 4 uchar
11
- # * `:rad` pixels encode 3 float RGB as 4 uchar (Radiance coding)
12
- class Coding < Symbol
13
- end
2
+ # How pixels are coded.
3
+ #
4
+ # Normally, pixels are uncoded and can be manipulated as you would expect.
5
+ # However some file formats code pixels for compression, and sometimes it's
6
+ # useful to be able to manipulate images in the coded format.
7
+ #
8
+ # * `:none` pixels are not coded
9
+ # * `:labq` pixels encode 3 float CIELAB values as 4 uchar
10
+ # * `:rad` pixels encode 3 float RGB as 4 uchar (Radiance coding)
11
+ class Coding < Symbol
12
+ end
14
13
  end
@@ -1,17 +1,16 @@
1
1
  module Vips
2
+ # A direction on a compass used for placing images. See {Image#gravity}.
3
+ #
4
+ # * `:centre`
5
+ # * `:north`
6
+ # * `:east`
7
+ # * `:south`
8
+ # * `:west`
9
+ # * `:"north-east"`
10
+ # * `:"south-east"`
11
+ # * `:"south-west"`
12
+ # * `:"north-west"`
2
13
 
3
- # A direction on a compass used for placing images. See {Image#gravity}.
4
- #
5
- # * `:centre`
6
- # * `:north`
7
- # * `:east`
8
- # * `:south`
9
- # * `:west`
10
- # * `:north-east`
11
- # * `"south-east`
12
- # * `:south-west`
13
- # * `:north-west`
14
-
15
- class CompassDirection < Symbol
16
- end
14
+ class CompassDirection < Symbol
15
+ end
17
16
  end
@@ -1,11 +1,10 @@
1
1
  module Vips
2
+ # Operations like {Image#flip} need to be told whether to flip
3
+ # left-right or top-bottom.
4
+ #
5
+ # * `:horizontal` left-right
6
+ # * `:vertical` top-bottom
2
7
 
3
- # Operations like {Image#flip} need to be told whether to flip
4
- # left-right or top-bottom.
5
- #
6
- # * `:horizontal` left-right
7
- # * `:vertical` top-bottom
8
-
9
- class Direction < Symbol
10
- end
8
+ class Direction < Symbol
9
+ end
11
10
  end
data/lib/vips/extend.rb CHANGED
@@ -1,17 +1,16 @@
1
1
  module Vips
2
+ # When the edges of an image are extended, you can specify
3
+ # how you want the extension done.
4
+ # See {Image#embed}, {Image#conv}, {Image#affine} and
5
+ # so on.
6
+ #
7
+ # * `:black` new pixels are black, ie. all bits are zero.
8
+ # * `:copy` each new pixel takes the value of the nearest edge pixel
9
+ # * `:repeat` the image is tiled to fill the new area
10
+ # * `:mirror` the image is reflected and tiled to reduce hash edges
11
+ # * `:white` new pixels are white, ie. all bits are set
12
+ # * `:background` colour set from the @background property
2
13
 
3
- # When the edges of an image are extended, you can specify
4
- # how you want the extension done.
5
- # See {Image#embed}, {Image#conv}, {Image#affine} and
6
- # so on.
7
- #
8
- # * `:black` new pixels are black, ie. all bits are zero.
9
- # * `:copy` each new pixel takes the value of the nearest edge pixel
10
- # * `:repeat` the image is tiled to fill the new area
11
- # * `:mirror` the image is reflected and tiled to reduce hash edges
12
- # * `:white` new pixels are white, ie. all bits are set
13
- # * `:background` colour set from the @background property
14
-
15
- class Extend < Symbol
16
- end
14
+ class Extend < Symbol
15
+ end
17
16
  end
data/lib/vips/gobject.rb CHANGED
@@ -8,115 +8,111 @@ require 'ffi'
8
8
  require 'forwardable'
9
9
 
10
10
  module GObject
11
-
12
- # we have a number of things we need to inherit in different ways:
13
- #
14
- # - we want to be able to subclass GObject in Ruby in a simple way
15
- # - the layouts of the nested structs need to inherit
16
- # - we need to be able to cast between structs which share a base struct
17
- # without creating new wrappers or messing up refcounting
18
- # - we need automatic gobject refcounting
19
- #
20
- # the solution is to split the class into four areas which we treat
21
- # differently:
22
- #
23
- # - we have a "wrapper" Ruby class to allow easy subclassing ... this has a
24
- # @struct member which holds the actual pointer
25
- # - we use "forwardable" to forward the various ffi methods on to the
26
- # @struct member ... we arrange things so that subclasses do not need to
27
- # do the forwarding themselves
28
- # - we have two versions of the struct: a plain one which we can use for
29
- # casting that will not change the refcounts
30
- # - and a managed one with an unref which we just use for .new
31
- # - we separate the struct layout into a separate module to avoid repeating
32
- # ourselves
33
-
34
- class GObject
35
- extend Forwardable
36
- extend SingleForwardable
37
-
38
- def_instance_delegators :@struct, :[], :to_ptr
39
- def_single_delegators :ffi_struct, :ptr
40
-
41
- # the layout of the GObject struct
42
- module GObjectLayout
43
- def self.included base
44
- base.class_eval do
45
- layout :g_type_instance, :pointer,
46
- :ref_count, :uint,
47
- :qdata, :pointer
48
- end
49
- end
50
- end
51
-
52
- # the struct with unref ... manage object lifetime with this
53
- class ManagedStruct < FFI::ManagedStruct
54
- include GObjectLayout
55
-
56
- def self.release ptr
57
- # GLib::logger.debug("GObject::GObject::ManagedStruct.release") {
58
- # "unreffing #{ptr}"
59
- # }
60
- ::GObject::g_object_unref ptr
61
- end
62
- end
63
-
64
- # the plain struct ... cast with this
65
- class Struct < FFI::Struct
66
- include GObjectLayout
67
-
11
+ # we have a number of things we need to inherit in different ways:
12
+ #
13
+ # - we want to be able to subclass GObject in Ruby in a simple way
14
+ # - the layouts of the nested structs need to inherit
15
+ # - we need to be able to cast between structs which share a base struct
16
+ # without creating new wrappers or messing up refcounting
17
+ # - we need automatic gobject refcounting
18
+ #
19
+ # the solution is to split the class into four areas which we treat
20
+ # differently:
21
+ #
22
+ # - we have a "wrapper" Ruby class to allow easy subclassing ... this has a
23
+ # @struct member which holds the actual pointer
24
+ # - we use "forwardable" to forward the various ffi methods on to the
25
+ # @struct member ... we arrange things so that subclasses do not need to
26
+ # do the forwarding themselves
27
+ # - we have two versions of the struct: a plain one which we can use for
28
+ # casting that will not change the refcounts
29
+ # - and a managed one with an unref which we just use for .new
30
+ # - we separate the struct layout into a separate module to avoid repeating
31
+ # ourselves
32
+
33
+ class GObject
34
+ extend Forwardable
35
+ extend SingleForwardable
36
+
37
+ def_instance_delegators :@struct, :[], :to_ptr
38
+ def_single_delegators :ffi_struct, :ptr
39
+
40
+ # the layout of the GObject struct
41
+ module GObjectLayout
42
+ def self.included base
43
+ base.class_eval do
44
+ layout :g_type_instance, :pointer,
45
+ :ref_count, :uint,
46
+ :qdata, :pointer
68
47
  end
48
+ end
49
+ end
69
50
 
70
- # don't allow ptr == nil, we never want to allocate a GObject struct
71
- # ourselves, we just want to wrap GLib-allocated GObjects
72
- #
73
- # here we use ManagedStruct, not Struct, since this is the ref that will
74
- # need the unref
75
- def initialize ptr
76
- # GLib::logger.debug("GObject::GObject.initialize") {"ptr = #{ptr}"}
77
- @struct = ffi_managed_struct.new ptr
78
- end
51
+ # the struct with unref ... manage object lifetime with this
52
+ class ManagedStruct < FFI::ManagedStruct
53
+ include GObjectLayout
79
54
 
80
- # access to the casting struct for this class
81
- def ffi_struct
82
- self.class.ffi_struct
83
- end
55
+ def self.release ptr
56
+ # GLib::logger.debug("GObject::GObject::ManagedStruct.release") {
57
+ # "unreffing #{ptr}"
58
+ # }
59
+ ::GObject::g_object_unref ptr
60
+ end
61
+ end
84
62
 
85
- class << self
86
- def ffi_struct
87
- self.const_get :Struct
88
- end
89
- end
63
+ # the plain struct ... cast with this
64
+ class Struct < FFI::Struct
65
+ include GObjectLayout
66
+ end
90
67
 
91
- # access to the managed struct for this class
92
- def ffi_managed_struct
93
- self.class.ffi_managed_struct
94
- end
68
+ # don't allow ptr == nil, we never want to allocate a GObject struct
69
+ # ourselves, we just want to wrap GLib-allocated GObjects
70
+ #
71
+ # here we use ManagedStruct, not Struct, since this is the ref that will
72
+ # need the unref
73
+ def initialize ptr
74
+ # GLib::logger.debug("GObject::GObject.initialize") {"ptr = #{ptr}"}
75
+ @struct = ffi_managed_struct.new ptr
76
+ end
95
77
 
96
- class << self
97
- def ffi_managed_struct
98
- self.const_get :ManagedStruct
99
- end
100
- end
78
+ # access to the casting struct for this class
79
+ def ffi_struct
80
+ self.class.ffi_struct
81
+ end
101
82
 
83
+ class << self
84
+ def ffi_struct
85
+ self.const_get :Struct
86
+ end
102
87
  end
103
88
 
104
- class GParamSpec < FFI::Struct
105
- # the first few public fields
106
- layout :g_type_instance, :pointer,
107
- :name, :string,
108
- :flags, :uint,
109
- :value_type, :GType,
110
- :owner_type, :GType
89
+ # access to the managed struct for this class
90
+ def ffi_managed_struct
91
+ self.class.ffi_managed_struct
111
92
  end
112
93
 
113
- class GParamSpecPtr < FFI::Struct
114
- layout :value, GParamSpec.ptr
94
+ class << self
95
+ def ffi_managed_struct
96
+ self.const_get :ManagedStruct
97
+ end
115
98
  end
99
+ end
100
+
101
+ class GParamSpec < FFI::Struct
102
+ # the first few public fields
103
+ layout :g_type_instance, :pointer,
104
+ :name, :string,
105
+ :flags, :uint,
106
+ :value_type, :GType,
107
+ :owner_type, :GType
108
+ end
116
109
 
117
- attach_function :g_param_spec_get_blurb, [GParamSpec.ptr], :string
110
+ class GParamSpecPtr < FFI::Struct
111
+ layout :value, GParamSpec.ptr
112
+ end
118
113
 
119
- attach_function :g_object_ref, [:pointer], :void
120
- attach_function :g_object_unref, [:pointer], :void
114
+ attach_function :g_param_spec_get_blurb, [GParamSpec.ptr], :string
121
115
 
116
+ attach_function :g_object_ref, [:pointer], :void
117
+ attach_function :g_object_unref, [:pointer], :void
122
118
  end