summaryrefslogtreecommitdiff
path: root/render/thscreen.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-05-01 16:24:15 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-05-01 16:24:15 +0200
commita30ba67504ffd12c4db499adbb5ce47a7d1f6036 (patch)
tree9ae1a7e3849dda6bbb5c578232f6f2fa5b2e7e7e /render/thscreen.h
parent89e99e8a827859729729dfc92d74be4a8f96f1a4 (diff)
parent094535c010320967639e8e86f974d878e80baa72 (diff)
New release 1.7.0
Diffstat (limited to 'render/thscreen.h')
-rw-r--r--render/thscreen.h52
1 files changed, 37 insertions, 15 deletions
diff --git a/render/thscreen.h b/render/thscreen.h
index d3ac9b1..9a504bc 100644
--- a/render/thscreen.h
+++ b/render/thscreen.h
@@ -5,20 +5,22 @@
/*
* render2d
*
- * Threshold screen pixel processing object.
+ * Threshold or Error diffusion screen pixel processing object.
* (Simplified from DPS code)
*
* Author: Graeme W. Gill
* Date: 11/7/2005
* Version: 1.00
*
- * Copyright 2005, 2012 Graeme W. Gill
+ * Copyright 2005, 2012, 2014 Graeme W. Gill
* All rights reserved.
* This material is licenced under the GNU AFFERO GENERAL PUBLIC LICENSE Version 3 :-
* see the License.txt file for licencing details.
*
*/
+#define THMXCH2D 8 /* Maximum color channels */
+
/* Light Separation in screening flag */
typedef enum {
scls_false = 0, /* Don't do light ink separation during screening. */
@@ -45,15 +47,31 @@ struct _thscreens {
int np; /* Number of planes */
struct _thscreen **sc; /* List of screens */
- /* Screen a single color plane */
+ int oebpc; /* Output encoding bits per component, 1,2,4 or 8 */
+ int oelev; /* Output encoding levels. Must be <= 2 ^ oebpc */
+ int oevalues[256]; /* Output encoding values for each level */
+
+ int edif; /* nz if using error diffusion */
+ int **luts; /* Lookup tables */
+ int mxwidth; /* max width in pixels of raster to be screened */
+ int lastyoff; /* Last y offset */
+ float **ebuf; /* Error buffer for each plane */
+ /* ebuf[][-1] is used for next pixel error */
+
+ void (*quant)(void *qcntx, double *out, double *in); /* optional quantization func. for edif */
+ void *qcntx; /* Context for quant */
+
+ sobol *so; /* Random number generator for error diffusion */
+
+ /* Screen pixel values */
void (* screen)( /* Pointer to dither function */
struct _thscreens *t, /* Screening object pointer */
int width, int height, /* Width and height to screen in pixels */
int xoff, int yoff, /* Offset into screening pattern */
- unsigned char *in, /* Input pixel buffer */
- unsigned long ipitch, /* Increment between input lines */
unsigned char *out, /* Output pixel buffer */
- unsigned long opitch); /* Increment between output lines */
+ unsigned long opitch, /* Increment between output lines in components */
+ unsigned char *in, /* Input pixel buffer */
+ unsigned long ipitch); /* Increment between input lines in components */
void (* del)( /* Destructor */
struct _thscreens *t); /* Screening objects pointer */
@@ -68,7 +86,7 @@ thscreens *new_thscreens(
int exact, /* Return only exact matches */
int nplanes, /* Number of planes to screen */
double asp, /* Target aspect ratio (== dpiX/dpiY) */
- int size, /* Target size */
+ int size, /* Target screen size */
sc_iencoding ie, /* Input encoding - must be scie_16 */
int oebpc, /* Output encoding bits per component - must be 8 */
int oelev, /* Output encoding levels. Must be <= 2 ^ oebpc */
@@ -76,8 +94,12 @@ thscreens *new_thscreens(
/* Must be oelev entries. Default is 0 .. oelev-1 */
sc_oorder oo, /* Output bit ordering */
double overlap, /* Overlap between levels, 0 - 1.0 */
+ int mxwidth, /* max width in pixels of raster to be screened */
void **cntx, /* List of contexts for lookup table callback */
- double (**lutfunc)(void *cntx, double in) /* List of callback function, NULL if none */
+ double (**lutfunc)(void *cntx, double in), /* List of callback function, NULL if none */
+ int edif, /* nz if using error diffusion */
+ void (*quant)(void *qcntx, double *out, double *in), /* optional quantization func. for edif */
+ void *qcntx
);
/* ---------------------------- */
@@ -121,12 +143,12 @@ struct _thscreen {
struct _thscreen *t, /* Screening object pointer */
int width, int height, /* Width and height to screen in pixels */
int xoff, int yoff, /* Offset into screening pattern */
- unsigned char *in, /* Input pixel buffer */
- unsigned long ipinc, /* Increment between input pixels */
- unsigned long ipitch, /* Increment between input lines */
unsigned char *out, /* Output pixel buffer */
- unsigned long opinc, /* Increment between output pixels */
- unsigned long opitch); /* Increment between output lines */
+ unsigned long opinc, /* Increment between output pixels in components */
+ unsigned long opitch, /* Increment between output lines in components */
+ unsigned char *in, /* Input pixel buffer */
+ unsigned long ipinc, /* Increment between input pixels in components */
+ unsigned long ipitch); /* Increment between input lines in components */
void (* del)( /* Destructor */
struct _thscreen *t); /* Screening object pointer */
@@ -136,8 +158,8 @@ struct _thscreen {
/* Create a new thscreen object */
/* Return NULL on error */
thscreen *new_thscreen(
- int width, /* width in pixels */
- int height, /* Height in pixels */
+ int width, /* width in pixels of screen */
+ int height, /* Height in pixels of screen */
int xoff, int yoff, /* Pattern offsets into width & height (must be +ve) */
double asp, /* Aspect ratio (== dpiX/dpiY) */
int swap, /* Swap X & Y to invert aspect ratio */