aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/imutil/src/imaadd.gx
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /pkg/images/imutil/src/imaadd.gx
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/images/imutil/src/imaadd.gx')
-rw-r--r--pkg/images/imutil/src/imaadd.gx55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkg/images/imutil/src/imaadd.gx b/pkg/images/imutil/src/imaadd.gx
new file mode 100644
index 00000000..a31b47fc
--- /dev/null
+++ b/pkg/images/imutil/src/imaadd.gx
@@ -0,0 +1,55 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <imhdr.h>
+
+$for (silrd)
+# IMA_ADD -- Image arithmetic addition.
+
+procedure ima_add$t (im_a, im_b, im_c, a, b)
+
+pointer im_a, im_b, im_c
+PIXEL a, b
+
+int len
+pointer im[3], buf[3]
+long v[IM_MAXDIM, 3]
+
+int ima_nl$t()
+
+begin
+ # Loop through all of the image lines.
+ im[1] = im_c
+ len = IM_LEN (im[1], 1)
+ call amovkl (long(1), v, 3 * IM_MAXDIM)
+
+ # If imagea is constant then read imageb and do a vector/scalar
+ # addition to imagec.
+ if (im_a == NULL) {
+ im[2] = im_b
+ while (ima_nl$t (im, buf, v, 2) != EOF) {
+ if (a == 0$f)
+ call amov$t (Mem$t[buf[2]], Mem$t[buf[1]], len)
+ else
+ call aaddk$t (Mem$t[buf[2]], a, Mem$t[buf[1]], len)
+ }
+
+ # If imageb is constant then read imagea and do a vector/scalar
+ # addition to imagec.
+ } else if (im_b == NULL) {
+ im[2] = im_a
+ while (ima_nl$t (im, buf, v, 2) != EOF) {
+ if (b == 0$f)
+ call amov$t (Mem$t[buf[2]], Mem$t[buf[1]], len)
+ else
+ call aaddk$t (Mem$t[buf[2]], b, Mem$t[buf[1]], len)
+ }
+
+ # Read imagea and imageb and do a vector addition into imagec.
+ } else {
+ im[2] = im_a
+ im[3] = im_b
+ while (ima_nl$t (im, buf, v, 3) != EOF)
+ call aadd$t (Mem$t[buf[2]], Mem$t[buf[3]], Mem$t[buf[1]], len)
+ }
+end
+$endfor