aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/impl1.gx
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/impl1.gx
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/impl1.gx')
-rw-r--r--sys/imio/impl1.gx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/imio/impl1.gx b/sys/imio/impl1.gx
new file mode 100644
index 00000000..4fe23b4b
--- /dev/null
+++ b/sys/imio/impl1.gx
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+include <imio.h>
+
+# IMPL1? -- Put a line to an apparently one dimensional image. If there
+# is only one input buffer, no image section, we are not referencing out of
+# bounds, and no datatype conversion needs to be performed, directly access
+# the pixels to reduce the overhead per line.
+
+pointer procedure impl1$t (im)
+
+pointer im # image header pointer
+int fd, nchars
+long offset
+pointer bp, impgs$t(), fwritep()
+errchk imopsf
+
+begin
+ repeat {
+ if (IM_FAST(im) == YES && IM_PIXTYPE(im) == TY_PIXEL) {
+ fd = IM_PFD(im)
+ if (fd == NULL) {
+ call imopsf (im)
+ next
+ }
+ offset = IM_PIXOFF(im)
+ nchars = IM_PHYSLEN(im,1) * SZ_PIXEL
+ ifnoerr (bp = (fwritep (fd, offset, nchars) - 1) / SZ_PIXEL + 1)
+ return (bp)
+ }
+ return (impgs$t (im, long(1), IM_LEN(im,1), 1))
+ }
+end