xref: /plan9/sys/src/cmd/gs/src/gsipar3x.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 2000 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gsipar3x.h,v 1.7 2002/06/16 08:45:42 lpd Exp $ */
18 /* Extended ImageType 3 ("3x") image parameter definition */
19 
20 #ifndef gsipar3x_INCLUDED
21 #  define gsipar3x_INCLUDED
22 
23 #include "gsiparam.h"
24 #include "gsiparm3.h"		/* for interleave types */
25 
26 /*
27  * An ImageType 3x image is the transparency-capable extension of an
28  * ImageType 3 image.  Instead of a MaskDict, it has an OpacityMaskDict
29  * and/or a ShapeMaskDict, whose depths may be greater than 1.  It also
30  * has an optional Matte member, defining a pre-mixed background color.
31  *
32  * Since ImageTypes must be numeric, we assign the number 103 for this
33  * type of image; however, this is defined in only one place, namely here.
34  */
35 #define IMAGE3X_IMAGETYPE 103
36 
37 /*
38  * If InterleaveType is 3, the data source(s) for the mask(s) *precede* the
39  * data sources for the pixel data, with opacity preceding shape.  For
40  * InterleaveType 3, the client is responsible for always providing mask
41  * data before the pixel data that it masks.  (The implementation does not
42  * currently check this, but it should.)  For this type of image,
43  * InterleaveType 2 (interleaved scan lines) is not allowed.
44  */
45 typedef struct gs_image3x_mask_s {
46     int InterleaveType;
47     float Matte[GS_CLIENT_COLOR_MAX_COMPONENTS];
48     bool has_Matte;
49     /*
50      * Note that the ColorSpaces in the MaskDicts are ignored.
51      * Note also that MaskDict.BitsPerComponent may be zero, which
52      * indicates that the given mask is not supplied.
53      */
54     gs_data_image_t MaskDict;
55 } gs_image3x_mask_t;
56 typedef struct gs_image3x_s {
57     gs_pixel_image_common;	/* DataDict */
58     gs_image3x_mask_t Opacity, Shape; /* ...MaskDict */
59 } gs_image3x_t;
60 
61 /* As noted above, the ColorSpaces in the MaskDicts are ignored. */
62 #define private_st_gs_image3x()	/* in gximag3x.c */\
63   gs_private_st_suffix_add0(st_gs_image3x, gs_image3x_t, "gs_image3x_t",\
64     image3x_enum_ptrs, image3x_reloc_ptrs, st_gs_pixel_image)
65 
66 /*
67  * Initialize an ImageType 3x image.
68  */
69 void gs_image3x_t_init(gs_image3x_t *pim, const gs_color_space *color_space);
70 
71 #endif /* gsipar3x_INCLUDED */
72