/*
(c) Copyright 1994 HEWLETT-PACKARD COMPANY

To anyone who acknowledges that this file is provided 
"AS IS" without any express or implied warranty:
permission to use, copy, modify, and distribute this 
file for any purpose is hereby granted without fee, 
provided that the above copyright notice and this 
notice appears in all copies, and that the name of 
Hewlett-Packard Company not be used in advertising or 
publicity pertaining to distribution of the software 
without specific, written prior permission.  Hewlett-
Packard Company makes no representations about the 
suitability of this software for any purpose.
*/



#ifndef _XSCM_LIB_H
#define _XSCM_LIB_H

#if NeedFunctionPrototypes
#include <stdio.h>
#include <string.h>
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/Xatom.h>
#endif

    /*  Values for "type" to XscmFindColorSCM() */
#define XSCM_ANY              0
#define XSCM_DEFAULT_VISUAL   1
#define XSCM_DEFAULT_COLORMAP 2

    /*  Values for XscmRec.renderType */
#define XSCM_RENDER_484       0
#define XSCM_RENDER_884       1
#define XSCM_RENDER_884_CR    2
#define XSCM_RENDER_24_BIT    3
#define XSCM_RENDER_GRAY      4
#define XSCM_RENDER_884_CR_REV1 5

typedef struct {
    int             renderType;
    Display        *display;
    int             screen;
    Visual         *visual;
    Colormap        colormap;
    int             depth;
    int             bytesPerPixel;
    int             basePixel;
    int             redShift, greenShift, blueShift;
    } XscmInfoRec;


    /*  Functions to find standard colormaps. */

extern int XscmFind24BitSCM (
#if NeedFunctionPrototypes
        Display        *display,
        int             screen,
        XscmInfoRec    *pInfo
#endif
);

extern int XscmFind8BitSCM (
#if NeedFunctionPrototypes
        Display        *display,
        int             screen,
        XscmInfoRec    *pInfo
#endif
);

extern int XscmFindDefaultSCM (
#if NeedFunctionPrototypes
        Display        *display,
        int             screen,
        XscmInfoRec    *pInfo
#endif
);

extern int XscmFindGraySCM (
#if NeedFunctionPrototypes
        Display        *display,
        int             screen,
        XscmInfoRec    *pInfo
#endif
);

extern int XscmFindCRSCM (
#if NeedFunctionPrototypes
        Display        *display,
        int             screen,
        int             useDefaultVisual,
        XscmInfoRec    *pInfo
#endif
);

extern int XscmFindColorSCM (
#if NeedFunctionPrototypes
    Display        *display,
    int             screen,
    int             scmType,
    XscmInfoRec    *pInfo
#endif
);


#if NeedFunctionPrototypes
#   define XSCM_RENDER_PARS \
    XscmInfoRec  *pInfo, \
    unsigned char *src, \
    int           srcRowBytes, \
    int           width, \
    int           height, \
    int          *pRed, \
    int          *pGreen, \
    int          *pBlue, \
    int           dstRowBytes, \
    unsigned char *dst
#else
#   define XSCM_RENDER_PARS
#endif

#if NeedFunctionPrototypes
#   define XSCM_DISPLAY_PARS \
    XscmInfoRec  *pInfo, \
    unsigned char *src, \
    int           srcRowBytes, \
    int           width, \
    int           height, \
    int          *pRed, \
    int          *pGreen, \
    int          *pBlue, \
    Drawable      drawable, \
    GC            gc, \
    int           x, \
    int           y
#else
#   define XSCM_DISPLAY_PARS
#endif


    /*  Functions to render or display with Color Recovery */
extern int XscmRenderCR (
    XSCM_RENDER_PARS
);

extern int XscmDisplayCR (
    XSCM_DISPLAY_PARS
);


extern int XscmRenderCRRev1 (
    XSCM_RENDER_PARS
);

extern int XscmDisplayCRRev1 (
    XSCM_DISPLAY_PARS
);


    /*  Functions to render or display with 24 bit best map */
extern int XscmRender24Bit (
    XSCM_RENDER_PARS
);

extern int XscmDisplay24Bit (
    XSCM_DISPLAY_PARS
);


    /*  Functions to render or display with 8 bit 884 */
extern int XscmRender8Bit (
    XSCM_RENDER_PARS
);

extern int XscmDisplay8Bit (
    XSCM_DISPLAY_PARS
);


    /*  Functions to render or display with default map */
extern int XscmRenderDefault (
    XSCM_RENDER_PARS
);

extern int XscmDisplayDefault (
    XSCM_DISPLAY_PARS
);


    /*  Functions to render or display gray */
extern int XscmRGBToGray (
    XSCM_RENDER_PARS
);

extern int XscmDisplayGray (
    XSCM_DISPLAY_PARS
);


    /*  Functions to render or display to all types */
extern int XscmRender (
    XSCM_RENDER_PARS
);

extern int XscmDisplay (
    XSCM_DISPLAY_PARS
);

#endif

