aboutsummaryrefslogtreecommitdiff
path: root/pkg/obsolete/fixline.gx
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/obsolete/fixline.gx')
-rw-r--r--pkg/obsolete/fixline.gx50
1 files changed, 50 insertions, 0 deletions
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 <imhdr.h>
+include <imset.h>
+
+$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