/* Copyright 1998 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* prtablegen.h */
#ifndef __prtablegen_h_
#define __prtablegen_h_

#ifdef __cplusplus
  extern "C" {
#endif

typedef unsigned char uint8;

typedef struct
{
  float ediff_density;  /* effective error diff 1-ink density (%) */

  float red_adj_my;     /* red 2-ink: magenta-yellow adjust (%) */
  float green_adj_cy;   /* green 2-ink: cyan-yellow adjust (%) */
  float blue_adj_cm;    /* blue 2-ink: cyan-magenta adjust (%) */

  float bright[2];      /* brightness (~1) error diff, halftone */
  float contrast;       /* contrast (~1) */

  float gamma[4];       /* r,g,b,grey - final gammas, for inks */

  float deplete1ink[4]; /* 1-ink depletion (%), c,m,y,grey */
  float deplete2ink;    /* 2-ink depletion (%) */
  float deplete3ink;    /* 3-ink depletion (%) */

  float k_gcr[2];       /* black grey-component-replacement parms. (%,%) */
  float k_gen[2];       /* black generate parameters (%,%) */
  int   k_mnz;          /* black generate min-non-zero value */
} calib_t;

typedef struct
{
  int     ediff_density;
  uint8   cyanED[256];    /* error diffused case */
  uint8   magentaED[256];
  uint8   yellowED[256];
  uint8   cyanHT[256];    /* halftone case */
  uint8   magentaHT[256];
  uint8   yellowHT[256];
  uint8   kGCR_kgen[512]; /* interleaved GCR[k],kgen[k] */
  uint8   Cmin_M_Y[512];  /* for C is min, interleaved M[t],Y[t], t=two-ink */
  uint8   Mmin_C_Y[512];
  uint8   Ymin_C_M[512];
  uint8   greyED[256];
  uint8   greyHT[256];
  calib_t calib;
} tables_t;

extern void prtablegen(FILE *fp, calib_t *calib, tables_t *tables);
extern void write_calib(calib_t *ca, FILE *fp);
extern void debug_calib(calib_t *ca, char *sp);
extern int validate_calib(calib_t *ca);
extern void set_tables(calib_t *ca, tables_t *ta);

extern calib_t default_ca;
#ifdef __cplusplus
   }
#endif

#endif
