Skip to content

Commit 65359c0

Browse files
jcupittrolandlo
authored andcommitted
try adding interpolate
1 parent 82fdc17 commit 65359c0

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/vips.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ local vips = {
2222
vobject = require "vips.vobject",
2323
voperation = require "vips.voperation",
2424
Image = require "vips.Image_methods",
25+
Image = require "vips.Interpolate",
2526
}
2627

2728
function vips.leak_set(leak)

src/vips/Interpolate.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
-- make image interpolators, see affine
2+
3+
local ffi = require "ffi"
4+
5+
local verror = require "vips.verror"
6+
local vobject = require "vips.vobject"
7+
8+
local vips_lib = ffi.load(ffi.os == "Windows" and "libvips-42.dll" or "vips")
9+
10+
local Interpolate = {}
11+
12+
Interpolate.vobject = function(self)
13+
return ffi.cast(vobject.typeof, self)
14+
end
15+
16+
Interpolate.new = function(self)
17+
return vobject.new(self)
18+
end
19+
20+
Interpolate.new_from_name = function(name)
21+
-- there could potentially be other params here, but ignore that for now
22+
local interpolate = vips_lib.vips_interpolate_new(name)
23+
if interpolate == nil then
24+
error("no such interpolator\n" .. verror.get())
25+
end
26+
27+
return Interpolate.new(interpolate)
28+
end
29+
30+
return ffi.metatype("Interpolate", {
31+
__index = Interpolate
32+
})
33+
34+

src/vips/cdefs.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ ffi.cdef [[
188188
// opaque
189189
} VipsOperation;
190190

191+
VipsInterpolate *vips_interpolate_new (const char *name);
192+
191193
VipsOperation *vips_operation_new (const char *name);
192194

193195
typedef void * (*VipsArgumentMapFn) (VipsOperation *object,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy