1 /* Copyright (C) 2001 artofcode LLC. 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: gdevp14.h,v 1.4 2005/03/14 18:08:36 dan Exp $ */ 18 /* Definitions and interface for PDF 1.4 rendering device */ 19 20 #ifndef gdevp14_INCLUDED 21 # define gdevp14_INCLUDED 22 23 typedef enum { 24 DeviceGray = 0, 25 DeviceRGB = 1, 26 DeviceCMYK = 2 27 } pdf14_default_colorspace_t; 28 29 typedef struct pdf14_buf_s pdf14_buf; 30 typedef struct pdf14_ctx_s pdf14_ctx; 31 32 struct pdf14_buf_s { 33 pdf14_buf *saved; 34 35 bool isolated; 36 bool knockout; 37 byte alpha; 38 byte shape; 39 gs_blend_mode_t blend_mode; 40 41 bool has_alpha_g; 42 bool has_shape; 43 44 gs_int_rect rect; 45 /* Note: the traditional GS name for rowstride is "raster" */ 46 47 /* Data is stored in planar format. Order of planes is: pixel values, 48 alpha, shape if present, alpha_g if present. */ 49 50 int rowstride; 51 int planestride; 52 int n_chan; /* number of pixel planes including alpha */ 53 int n_planes; /* total number of planes including alpha, shape, alpha_g */ 54 byte *data; 55 56 byte *transfer_fn; 57 58 gs_int_rect bbox; 59 }; 60 61 struct pdf14_ctx_s { 62 pdf14_buf *stack; 63 pdf14_buf *maskbuf; 64 gs_memory_t *memory; 65 gs_int_rect rect; 66 bool additive; 67 int n_chan; 68 }; 69 70 typedef struct pdf14_device_s { 71 gx_device_forward_common; 72 73 pdf14_ctx *ctx; 74 float opacity; 75 float shape; 76 float alpha; /* alpha = opacity * shape */ 77 gs_blend_mode_t blend_mode; 78 const gx_color_map_procs *(*save_get_cmap_procs)(const gs_imager_state *, 79 const gx_device *); 80 gx_device_color_info saved_clist_color_info; 81 } pdf14_device; 82 83 int gs_pdf14_device_push(gs_memory_t *mem, gs_imager_state * pis, 84 gx_device * * pdev, gx_device * target); 85 86 int send_pdf14trans(gs_imager_state * pis, gx_device * dev, 87 gx_device * * pcdev, gs_pdf14trans_params_t * pparams, gs_memory_t * mem); 88 89 #endif /* gdevp14_INCLUDED */ 90