aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/impmmapo.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/imio/impmmapo.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/impmmapo.x')
-rw-r--r--sys/imio/impmmapo.x62
1 files changed, 62 insertions, 0 deletions
diff --git a/sys/imio/impmmapo.x b/sys/imio/impmmapo.x
new file mode 100644
index 00000000..318ce573
--- /dev/null
+++ b/sys/imio/impmmapo.x
@@ -0,0 +1,62 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <pmset.h>
+include <imhdr.h>
+include <imio.h>
+include <plio.h>
+
+# IM_PMMAPO -- Map an open pixel list onto an image descriptor, so that the
+# pixel list may be accessed as a virtual "mask image". If a reference image
+# is specified the mask image inherits any image section etc., defined for
+# the reference image.
+
+pointer procedure im_pmmapo (pl, ref_im)
+
+pointer pl #I mask descriptor
+pointer ref_im #I reference image or NULL
+
+pointer im
+long axlen[IM_MAXDIM]
+int naxes, depth, i
+errchk syserr, immapz, pl_gsize
+pointer immapz()
+
+begin
+ # Get the mask size.
+ call pl_gsize (pl, naxes, axlen, depth)
+
+ # Verify the size if there is a reference image.
+ if (ref_im != NULL)
+ do i = 1, max (naxes, IM_NPHYSDIM(ref_im))
+ if (IM_SVLEN(ref_im,i) != axlen[i])
+ call syserr (SYS_IMPLSIZE)
+
+ # Open an image header for the mask.
+ call iki_init()
+ im = immapz ("dev$null", NEW_IMAGE, 0)
+
+ # Set up the image descriptor.
+ IM_NDIM(im) = naxes
+ IM_PIXTYPE(im) = TY_INT
+ call amovl (axlen, IM_LEN(im,1), IM_MAXDIM)
+
+ IM_PL(im) = pl
+ IM_PLREFIM(im) = ref_im
+ IM_PLFLAGS(im) = 0
+ IM_MIN(im) = 0
+ IM_MAX(im) = 2 ** depth - 1
+ IM_LIMTIME(im) = IM_MTIME(im) + 1
+ IM_UPDATE(im) = NO
+
+ PM_REFIM(pl) = im
+ if (ref_im != NULL)
+ PM_MAPXY(pl) = IM_SECTUSED(ref_im)
+ else
+ PM_MAPXY(pl) = NO
+
+ # Further setup of the image descriptor is carried out by IMOPSF
+ # when the first i/o access occurs, as for a regular image.
+
+ return (im)
+end