~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/display/libsrc/rimg.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
  Copyright (C) 1994-2009 European Southern Observatory (ESO)
 
3
 
 
4
  This program is free software; you can redistribute it and/or 
 
5
  modify it under the terms of the GNU General Public License as 
 
6
  published by the Free Software Foundation; either version 2 of 
 
7
  the License, or (at your option) any later version.
 
8
 
 
9
  This program is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
  GNU General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU General Public 
 
15
  License along with this program; if not, write to the Free 
 
16
  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, 
 
17
  MA 02139, USA.
 
18
 
 
19
  Correspondence concerning ESO-MIDAS should be addressed as follows:
 
20
        Internet e-mail: midas@eso.org
 
21
        Postal address: European Southern Observatory
 
22
                        Data Management Division 
 
23
                        Karl-Schwarzschild-Strasse 2
 
24
                        D 85748 Garching bei Muenchen 
 
25
                        GERMANY
 
26
===========================================================================*/
 
27
 
 
28
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
29
.IDENTIFIER  ROTA_C
 
30
.LANGUAGE    C
 
31
.AUTHOR      R.M. van Hees IPG-ESO Garching
 
32
.KEYWORDS    ImageDisplay, memory board
 
33
.PURPOSE     read a 2-D image/mask from given memory board of ImageDisplay
 
34
.ALGORITHM   use IDI interfaces to read memory and store into real data array
 
35
.INPUT/OUTPUT
 
36
   call as   void RIMG_C( chan, ittflg, bgnA, dimA, pntrA )
 
37
 
 
38
  input:
 
39
        int   chan   :          memory board to read image/mask from
 
40
        int   ittflg :          if = 1, map pixel data with current ITT
 
41
        int   bgnA[2]:          start screen (x,y)
 
42
        int   dimA[2]:          no. of x,y-pixels on screen
 
43
 
 
44
  output:
 
45
        float *pntrA :          array to be filled with image for RIMG
 
46
         
 
47
.RETURNS     nothing
 
48
.ENVIRONment MIDAS
 
49
             #include <midas_def.h>   Prototypes for MIDAS interfaces
 
50
 
 
51
.VERSIONS    1.00       940517  F2C, taken from RIMG.FOR   RvH
 
52
 
 
53
 090706         last modif
 
54
------------------------------------------------------------*/
 
55
 
 
56
/*
 
57
 * Define _POSIX_SOURCE to indicate
 
58
 * that this is a POSIX program
 
59
 */
 
60
#define  _POSIX_SOURCE 1
 
61
 
 
62
/*
 
63
 * definition of the used functions in this module
 
64
 */
 
65
#include <midas_def.h>
 
66
 
 
67
/*
 
68
 * define some macros and constants
 
69
 */
 
70
#include <idinumd.h>
 
71
#include <proto_II.h>
 
72
 
 
73
/*
 
74
 * here starts the code of the function
 
75
 */
 
76
void RIMG_C( chan, ittflg, bgnA, dimA, pntrA )
 
77
int   chan, ittflg, *bgnA, *dimA;
 
78
float *pntrA;
 
79
{
 
80
unsigned char *cdata;
 
81
int nopix;
 
82
 
 
83
/*
 
84
 * Initialised variables
 
85
 */
 
86
int imx = 0, imy = 0, kpack = 4;           /* data offset and packing factor */
 
87
 
 
88
/*
 
89
 * Set up transfer window
 
90
 */
 
91
(void) IIMSTW_C( QDSPNO, chan, LOADDR, *dimA, dimA[1], QMDEP, *bgnA, bgnA[1] );
 
92
      
 
93
/*
 
94
 * Read all data at once from Display memory
 
95
 */
 
96
nopix = *dimA * dimA[1];
 
97
cdata = (unsigned char *) osmmget( nopix * sizeof( unsigned char ) );
 
98
(void) IIMRMY_C( QDSPNO, chan, nopix, imx, imy, QMDEP, kpack, ittflg, cdata );
 
99
 
 
100
/*
 
101
 * Do unscrambling
 
102
 */
 
103
F1UNPA_C( cdata, nopix, pntrA );
 
104
 
 
105
/*
 
106
 * That's it folks...
 
107
 */
 
108
(void) osmmfree( (char *) cdata );
 
109
}