1 /* Copyright (C) 1999 artofcode LLC. All rights reserved. 2 3 This program is free software; you can redistribute it and/or modify it 4 under the terms of the GNU General Public License as published by the 5 Free Software Foundation; either version 2 of the License, or (at your 6 option) any later version. 7 8 This program is distributed in the hope that it will be useful, but 9 WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along 14 with this program; if not, write to the Free Software Foundation, Inc., 15 59 Temple Place, Suite 330, Boston, MA, 02111-1307. 16 17 */ 18 19 /*$Id: gxdevbuf.h,v 1.2.6.1.2.1 2003/01/17 00:49:03 giles Exp $ */ 20 /* Definitions for device buffer management */ 21 22 #ifndef gxdevbuf_INCLUDED 23 # define gxdevbuf_INCLUDED 24 25 #include "gxrplane.h" /* for _buf_device procedures */ 26 27 /* 28 * Define the procedures for managing rendering buffers. These are 29 * currently associated with printer and/or banded devices, but they 30 * might have broader applicability in the future. 31 * 32 * For "async" devices, size_buf_device may be called by either the 33 * writer or the reader thread; the other procedures may be called only 34 * by the reader thread. 35 */ 36 37 #ifndef gx_device_DEFINED 38 # define gx_device_DEFINED 39 typedef struct gx_device_s gx_device; 40 #endif 41 42 /* Define the structure for returning buffer space requirements. */ 43 typedef struct gx_device_buf_space_s { 44 ulong bits; 45 ulong line_ptrs; 46 uint raster; 47 } gx_device_buf_space_t; 48 49 typedef struct gx_device_buf_procs_s { 50 51 /* 52 * Create the buffer device(s) for the pixels or a plane of a page 53 * or band. We use 'buf' instead of buffer because VMS limits 54 * procedure names to 31 characters. Note that the client must 55 * fully initialize the render_plane using gx_render_plane_init. 56 * 57 * If mem is NULL, *pbdev must already point to a gx_device_memory, 58 * and this procedure must initialize it. If this isn't possible 59 * (e.g., if render_plane calls for a single plane), 60 * create_buf_device must return an error. 61 */ 62 63 #define dev_proc_create_buf_device(proc)\ 64 int proc(P5(gx_device **pbdev, gx_device *target,\ 65 const gx_render_plane_t *render_plane, gs_memory_t *mem,\ 66 bool for_band)) 67 68 dev_proc_create_buf_device((*create_buf_device)); 69 70 /* 71 * Return the amount of buffer space needed by setup_buf_device. 72 */ 73 74 #define dev_proc_size_buf_device(proc)\ 75 int proc(P5(gx_device_buf_space_t *space, gx_device *target,\ 76 const gx_render_plane_t *render_plane,\ 77 int height, bool for_band)) 78 79 dev_proc_size_buf_device((*size_buf_device)); 80 81 /* 82 * Set up the buffer device with a specific buffer. 83 * If line_ptrs is not NULL, it points to an allocated area for 84 * the scan line pointers of an eventual memory device. 85 * 86 * Note that this procedure is used for two different purposes: 87 * setting up a full band buffer for rendering, and setting up a 88 * partial-band buffer device for reading out selected scan lines. 89 * The latter case requires that we also pass the full height of the 90 * buffer, for multi-planar memory devices; in the former case, 91 * y = 0 and setup_height = full_height. 92 */ 93 94 #define dev_proc_setup_buf_device(proc)\ 95 int proc(P7(gx_device *bdev, byte *buffer, int bytes_per_line,\ 96 byte **line_ptrs /*[height]*/, int y, int setup_height,\ 97 int full_height)) 98 99 dev_proc_setup_buf_device((*setup_buf_device)); 100 101 /* 102 * Destroy the buffer device and all associated structures. 103 * Note that this does *not* destroy the buffered data. 104 */ 105 106 #define dev_proc_destroy_buf_device(proc)\ 107 void proc(P1(gx_device *bdev)) 108 109 dev_proc_destroy_buf_device((*destroy_buf_device)); 110 111 } gx_device_buf_procs_t; 112 113 /* Define default buffer device management procedures. */ 114 dev_proc_create_buf_device(gx_default_create_buf_device); 115 dev_proc_size_buf_device(gx_default_size_buf_device); 116 dev_proc_setup_buf_device(gx_default_setup_buf_device); 117 dev_proc_destroy_buf_device(gx_default_destroy_buf_device); 118 119 #endif /* gxdevbuf_INCLUDED */ 120