home *** CD-ROM | disk | FTP | other *** search
- #ifndef __SCANNER_H__
- #define __SCANNER_H__
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*
- * scanner.h
- *
- * Generic scanner interface application side
- *
- * Copyright 1992, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
- * Inc.; the contents of this file may not be disclosed to third
- * parties, copied or duplicated in any form, in whole or in part,
- * without the prior written permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to
- * restrictions as set forth in subdivision (c)(1)(ii) of the Rights
- * in Technical Data and Computer Software clause at DFARS
- * 252.227-7013, and/or in similar or successor clauses in the FAR,
- * DOD or NASA FAR Supplement. Unpublished - rights reserved under the
- * Copyright Laws of the United States.
- */
-
- #ident "$Revision: 1.27 $"
-
- #define SC_VERSION (1.2)
-
- #define SC_INCHES (1L)
- #define SC_CENTIM (2L)
- #define SC_PIXELS (4L)
-
- #define SC_PACKPIX 0
- #define SC_PACKBAND 1
- #define SC_PACKPLANE 2
-
- #define SC_MONO 0
- #define SC_GREY 1
- #define SC_RGB 2
- #define SC_CMY 3
- #define SC_CMYK 4
-
- #define SC_MAXERRSTR 512
-
- /*
- * Error codes
- */
- #define SCEBASE 200
-
- #define SCENOTSCANNER SCEBASE
- #define SCEWRONGSCANNER (SCEBASE + 1)
- #define SCESCANFD (SCEBASE + 2)
- #define SCECOMM (SCEBASE + 3)
- #define SCENOMEM (SCEBASE + 4)
- #define SCECANTACCESS (SCEBASE + 5)
- #define SCESHORTREAD (SCEBASE + 6)
- #define SCEILLCOMM (SCEBASE + 7)
- #define SCENOTIDENT (SCEBASE + 8)
- #define SCEBADTYPE (SCEBASE + 9)
- #define SCENOTSUPPORTED (SCEBASE + 10)
- #define SCEBADRES (SCEBASE + 11)
- #define SCESCANREAD (SCEBASE + 12)
- #define SCENOTSCANNING (SCEBASE + 13)
- #define SCEDEV (SCEBASE + 14)
- #define SCEBADPARAM (SCEBASE + 15)
- #define SCEBUSY (SCEBASE + 16)
- #define SCENOSCANNER (SCEBASE + 17)
- #define SCEBADMETRIC (SCEBASE + 18)
- #define SCEFEEDEREMPTY (SCEBASE + 19)
- #define SCENOFEEDER (SCEBASE + 20)
- #define SCEAUTOONLY (SCEBASE + 21)
- #define SCEFEEDERJAMMED (SCEBASE + 22)
- #define SCEFEEDERERR (SCEBASE + 23)
- #define SCENOTPROGFEED (SCEBASE + 24)
- #define SCENOSCANNERS (SCEBASE + 25)
- #define SCENODRIVER (SCEBASE + 26)
- #define SCENOOPTIONS (SCEBASE + 27)
- #define SCEALREADYOPTIONS (SCEBASE + 28)
- #define SCEAREATOOSMALL (SCEBASE + 29)
- #define SCEDRVMSG (SCEBASE + 30)
- #define SCENOSAVEOPT (SCEBASE + 31)
- #define SCEBADSAVEOPT (SCEBASE + 32)
- #define SCENOEVENTPENDING (SCEBASE + 33)
- #define SCELAST SCENOEVENTPENDING
-
- #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
-
- struct tag_scanner;
-
- typedef struct tag_scanner SCANNER;
-
- typedef struct tag_scanent {
- char *name;
- char *driver;
- char *device;
- char *options;
- } SCANENT;
-
- enum scstate { SC_READY, SC_SCANNING, SC_ERROR };
-
- typedef struct tag_scstatus {
- enum scstate state;
- int errno; /* only valid if state == SC_ERROR */
- long curline;
- int pass;
- } SCSTATUS;
-
- typedef struct tag_scdatatype {
- unsigned int packing : 4;
- unsigned int channels : 4;
- unsigned int type : 8;
- unsigned int bpp : 8;
- } SCDATATYPE;
-
- typedef struct tag_infoChange {
- unsigned int pageSizeChanged : 1;
- unsigned int resolutionChanged : 1;
- unsigned int dataTypesChanged : 1;
- unsigned int feederFlagsChanged : 1;
- } SCINFOCHANGE;
-
- #define SCEVENT_INFOCHANGE 1
-
- typedef struct tag_scevent {
- unsigned int eventType;
- union {
- SCINFOCHANGE infoChange;
- } event;
- } SCEVENT;
-
- typedef unsigned int SCFEEDERFLAGS;
-
- #define SC_HASFEEDER 1
- #define SC_AUTOFEED 2
- #define SC_PROGFEED 4
-
- void SCPerror(char *ident);
- char *SCErrorString(int err);
-
- /*
- * Rendezvous
- */
- char * SCDefaultScannerName(void);
- SCANNER *SCOpen(char *name);
- SCANNER *SCOpenScreen(char *screen);
- SCANNER *SCOpenFile(char *file);
- int SCClose(SCANNER *s);
- FILE *SCSetScanEnt(void);
- SCANENT *SCGetScanEnt(FILE *fp);
- int SCEndScanEnt(FILE *fp);
- char *SCScannerName(SCANNER *s);
- SCANENT *SCScannerEnt(SCANNER *s);
- int SCOptions(SCANNER *s);
- int SCHasOptions(SCANNER *s);
- int SCGetUserInfo(char *scanner, char **login, char **name, char **hostName);
-
- /*
- * Resolution
- */
- int SCGetMinMaxRes(SCANNER *s, int metric, float *minx, float *miny,
- float *maxx, float *maxy);
- int SCGetScannerRes(SCANNER *s, int metric, float **xres,
- float **yres, int *nres);
-
- /*
- * Scanning window
- */
- int SCGetPageSize(SCANNER *s, int metric, float *x, float *y,
- float *width, float *height);
-
- /*
- * Data types
- */
- int SCGetDataTypes(SCANNER *s, SCDATATYPE **dt, int *ntypes);
-
- /*
- * Scanning state
- */
- int
- SCSetup(SCANNER *s, int preview, SCDATATYPE *type,
- int rmetric, float xres, float yres,
- int wmetric, float x, float y, float width, float height);
- int SCScan(SCANNER *s);
- int SCScanFD(SCANNER *s, int fd);
- int SCAbort(SCANNER *s);
- int SCGetStatus(SCANNER *s, SCSTATUS *st);
- int SCGetStatusFD(SCANNER *s);
- int SCGetSaveOptions(SCANNER *s, void **options, int *nBytes);
- int SCSetSaveOptions(SCANNER *s, void *options, int nBytes);
-
- /*
- * Scan data
- */
- int SCGetScanLine(SCANNER *s, void *buf, long bytes);
- int SCGetScanSize(SCANNER *s, long *width, long *height, long *bytesPerLine);
- int SCGetFD(SCANNER *s);
- int SCDataReady(SCANNER *s);
-
- /*
- * Events
- */
- int SCGetEventFD(SCANNER *s);
- int SCEventPending(SCANNER *s);
- int SCGetEvent(SCANNER *s, SCEVENT *event);
-
- /*
- * Document feeder
- */
- int SCFeederGetFlags(SCANNER *s, SCFEEDERFLAGS *flags);
- int SCFeederSetFlags(SCANNER *s, SCFEEDERFLAGS flags);
- int SCFeederAdvance(SCANNER *s);
- int SCFeederReady(SCANNER *s);
-
- extern int SCerrno;
-
- #endif /* C || C++ */
-
- #ifdef __cplusplus
- }
- #endif
- #endif /* !__SCANNER_H__ */
-