Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1999 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: gxdevbuf.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */
18
/* Definitions for device buffer management */
19
 
20
#ifndef gxdevbuf_INCLUDED
21
#  define gxdevbuf_INCLUDED
22
 
23
#include "gxrplane.h"		/* for _buf_device procedures */
24
 
25
/*
26
 * Define the procedures for managing rendering buffers.  These are
27
 * currently associated with printer and/or banded devices, but they
28
 * might have broader applicability in the future.
29
 *
30
 * For "async" devices, size_buf_device may be called by either the
31
 * writer or the reader thread; the other procedures may be called only
32
 * by the reader thread.
33
 */
34
 
35
#ifndef gx_device_DEFINED
36
#  define gx_device_DEFINED
37
typedef struct gx_device_s gx_device;
38
#endif
39
 
40
/* Define the structure for returning buffer space requirements. */
41
typedef struct gx_device_buf_space_s {
42
    ulong bits;
43
    ulong line_ptrs;
44
    uint raster;
45
} gx_device_buf_space_t;
46
 
47
typedef struct gx_device_buf_procs_s {
48
 
49
    /*
50
     * Create the buffer device(s) for the pixels or a plane of a page
51
     * or band.  We use 'buf' instead of buffer because VMS limits
52
     * procedure names to 31 characters.  Note that the client must
53
     * fully initialize the render_plane using gx_render_plane_init.
54
     *
55
     * If mem is NULL, *pbdev must already point to a gx_device_memory,
56
     * and this procedure must initialize it.  If this isn't possible
57
     * (e.g., if render_plane calls for a single plane),
58
     * create_buf_device must return an error.
59
     */
60
 
61
#define dev_proc_create_buf_device(proc)\
62
  int proc(gx_device **pbdev, gx_device *target,\
63
	   const gx_render_plane_t *render_plane, gs_memory_t *mem,\
64
	   bool for_band)
65
 
66
    dev_proc_create_buf_device((*create_buf_device));
67
 
68
    /*
69
     * Return the amount of buffer space needed by setup_buf_device.
70
     */
71
 
72
#define dev_proc_size_buf_device(proc)\
73
  int proc(gx_device_buf_space_t *space, gx_device *target,\
74
	   const gx_render_plane_t *render_plane,\
75
	   int height, bool for_band)
76
 
77
    dev_proc_size_buf_device((*size_buf_device));
78
 
79
    /*
80
     * Set up the buffer device with a specific buffer.
81
     * If line_ptrs is not NULL, it points to an allocated area for
82
     * the scan line pointers of an eventual memory device.
83
     *
84
     * Note that this procedure is used for two different purposes:
85
     * setting up a full band buffer for rendering, and setting up a
86
     * partial-band buffer device for reading out selected scan lines.
87
     * The latter case requires that we also pass the full height of the
88
     * buffer, for multi-planar memory devices; in the former case,
89
     * y = 0 and setup_height = full_height.
90
     */
91
 
92
#define dev_proc_setup_buf_device(proc)\
93
  int proc(gx_device *bdev, byte *buffer, int bytes_per_line,\
94
	   byte **line_ptrs /*[height]*/, int y, int setup_height,\
95
	   int full_height)
96
 
97
    dev_proc_setup_buf_device((*setup_buf_device));
98
 
99
    /*
100
     * Destroy the buffer device and all associated structures.
101
     * Note that this does *not* destroy the buffered data.
102
     */
103
 
104
#define dev_proc_destroy_buf_device(proc)\
105
  void proc(gx_device *bdev)
106
 
107
    dev_proc_destroy_buf_device((*destroy_buf_device));
108
 
109
} gx_device_buf_procs_t;
110
 
111
/* Define default buffer device management procedures. */
112
dev_proc_create_buf_device(gx_default_create_buf_device);
113
dev_proc_size_buf_device(gx_default_size_buf_device);
114
dev_proc_setup_buf_device(gx_default_setup_buf_device);
115
dev_proc_destroy_buf_device(gx_default_destroy_buf_device);
116
 
117
#endif /* gxdevbuf_INCLUDED */