aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/iis/ids/idslutfill.x
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/images/tv/iis/ids/idslutfill.x')
-rw-r--r--pkg/images/tv/iis/ids/idslutfill.x36
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/images/tv/iis/ids/idslutfill.x b/pkg/images/tv/iis/ids/idslutfill.x
new file mode 100644
index 00000000..be42c774
--- /dev/null
+++ b/pkg/images/tv/iis/ids/idslutfill.x
@@ -0,0 +1,36 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <gki.h>
+
+# IDSLUTFILL -- Fill a lookup table from a set of line end points
+
+procedure idslfill (in, icount, out, lenlut, lutmin, lutmax)
+
+short in[ARB] # input: line end points
+int icount # number of input data items
+short out[ARB] # output: the lookup table
+int lenlut # lut size
+int lutmin,lutmax # inclusive range for lut values
+
+int i,j
+int xs, ys, xe, ye
+real slope
+
+begin
+ # xs and xe are zero based coordinates
+ xs = real(in[1]) * (lenlut - 1)/GKI_MAXNDC. + 0.5
+ ys = real(in[2]) * (lutmax - lutmin)/GKI_MAXNDC. + lutmin + 0.5
+ do i = 3, icount, 2 {
+ xe = real(in[i]) * (lenlut - 1)/GKI_MAXNDC. + 0.5
+ ye = real(in[i+1]) * (lutmax - lutmin)/GKI_MAXNDC. + lutmin + 0.5
+ if (xe != xs) {
+ slope = real(ye - ys) / (xe - xs)
+ do j = xs, xe {
+ out[j+1] = ys + (j - xs) * slope
+ }
+ }
+ xs = xe
+ ys = ye
+ }
+ out[1] = 0 # keep background at zero
+end