Skip to content

Commit

Permalink
Interpolate.new_from_name -> Interpolate.new
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandlo committed Mar 27, 2024
1 parent c23119b commit b1f4202
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/interpolate_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("image interpolation", function()
end)

it("can rotate an image using nearest interpolator", function()
local interpolate = vips.Interpolate.new_from_name("nearest")
local interpolate = vips.Interpolate.new("nearest")
local original = {
{ 1, 2, 3 },
{ 4, 5, 6 },
Expand Down
8 changes: 2 additions & 6 deletions src/vips/Interpolate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,14 @@ Interpolate.vobject = function(self)
return ffi.cast(vobject.typeof, self)
end

Interpolate.new = function(self)
return vobject.new(self)
end

Interpolate.new_from_name = function(name)
Interpolate.new = function(name)
-- there could potentially be other params here, but ignore that for now
local interpolate = vips_lib.vips_interpolate_new(name)
if interpolate == nil then
error("no such interpolator\n" .. verror.get())
end

return Interpolate.new(interpolate)
return vobject.new(interpolate)
end

return ffi.metatype("VipsInterpolate", {
Expand Down

0 comments on commit b1f4202

Please sign in to comment.