Sha256: 6156ead6fd2f4fa4688a07a9bd2de4ba33d8db5be927d49b74345f37344e28e2

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

module Vips
  attach_function :vips_interpolate_new, [:string], :pointer

  # An interpolator. One of these can be given to operations like
  # {Image#affine} or {Image#mapim} to select the type of pixel interpolation
  # to use.
  #
  # To see all interpolators supported by your
  # libvips, try
  #
  # ```
  # $ vips -l interpolate
  # ```
  #
  # But at least these should be available:
  #
  # *   `:nearest` Nearest-neighbour interpolation.
  # *   `:bilinear` Bilinear interpolation.
  # *   `:bicubic` Bicubic interpolation.
  # *   `:lbb` Reduced halo bicubic interpolation.
  # *   `:nohalo` Edge sharpening resampler with halo reduction.
  # *   `:vsqbs` B-Splines with antialiasing smoothing.
  #
  #  For example:
  #
  #  ```ruby
  #  im = im.affine [2, 0, 0, 2],
  #      :interpolate => Vips::Interpolate.new(:bicubic)
  #  ```

  class Interpolate < Vips::Object
    # the layout of the VipsInterpolate struct
    module InterpolateLayout
      def self.included base
        base.class_eval do
          layout :parent, Vips::Object::Struct
          # rest opaque
        end
      end
    end

    class Struct < Vips::Object::Struct
      include InterpolateLayout
    end

    class ManagedStruct < Vips::Object::ManagedStruct
      include InterpolateLayout
    end

    def initialize name
      name = name.to_s if name.is_a? Symbol
      pointer = Vips.vips_interpolate_new name
      raise Vips::Error if pointer.nil?

      super(pointer)
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/ruby-vips-2.2.1/lib/vips/interpolate.rb
ruby-vips-2.2.2 lib/vips/interpolate.rb
ruby-vips-2.2.1 lib/vips/interpolate.rb