From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- pkg/obsolete/fixline.gx | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pkg/obsolete/fixline.gx (limited to 'pkg/obsolete/fixline.gx') diff --git a/pkg/obsolete/fixline.gx b/pkg/obsolete/fixline.gx new file mode 100644 index 00000000..8a6c3672 --- /dev/null +++ b/pkg/obsolete/fixline.gx @@ -0,0 +1,50 @@ +include +include + +$for (silrdx) + +# FIXLINE -- Linearly interpolate lines across a region. + +procedure fixline$t (image, x1, x2, y1, y2) + +pointer image # Image pointer +int x1, x2, y1, y2 # Region to be fixed + +int i, nx, ny +$if (datatype == x) +complex f1, f2 +$else $if (datatype == d) +double f1, f2 +$else +real f1, f2 +$endif $endif +pointer a, b, c + +pointer imgs2$t(), imps2$t() + +begin + c = imps2$t (image, x1, x2, y1, y2) + + nx = x2 - x1 + 1 + ny = y2 - y1 + 1 + if (y1 == 1) { + a = imgs2$t (image, x1, x2, y2 + 1, y2 + 1) + do i = 1, ny + call amov$t (Mem$t[a], Mem$t[c + (i - 1) * nx], nx) + } else if (y2 == IM_LEN (image, 2)) { + a = imgs2$t (image, x1, x2, y1 - 1, y1 - 1) + do i = 1, ny + call amov$t (Mem$t[a], Mem$t[c + (i - 1) * nx], nx) + } else { + call imseti (image, IM_NBUFS, 2) + a = imgs2$t (image, x1, x2, y1 - 1, y1 - 1) + b = imgs2$t (image, x1, x2, y2 + 1, y2 + 1) + do i = 1, ny { + f2 = i / (ny + 1.) + f1 = 1 - f2 + call awsu$t (Mem$t[a], Mem$t[b], Mem$t[c+(i-1)*nx], nx, f1, f2) + } + } +end + +$endfor -- cgit