aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/ccdred/src/ccdcopy.x
blob: a12b21236280498e378c123a81f229d0080cde7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
include	<imhdr.h>

# CCDCOPY -- Copy an image.  This should be done with an IMIO procedure
# but there isn't one yet.

procedure ccdcopy (old, new)

char	old[ARB]		# Image to be copied
char	new[ARB]		# New copy

int	i, nc, nl
pointer	in, out, immap(), imgl2s(), impl2s(), imgl2r(), impl2r()

begin
	in = immap (old, READ_ONLY, 0)
	out = immap (new, NEW_COPY, in)

	nc = IM_LEN(in,1)
	nl = IM_LEN(in,2)
	switch (IM_PIXTYPE(in)) {
	case TY_SHORT:
	    do i = 1, nl
		call amovs (Mems[imgl2s(in,i)], Mems[impl2s(out,i)], nc)
	default:
	    do i = 1, nl
		call amovr (Memr[imgl2r(in,i)], Memr[impl2r(out,i)], nc)
	}

	call imunmap (in)
	call imunmap (out)
end