2 |
- |
1 |
/* Copyright (C) 1995, 1996, 1998 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: gsrop.c,v 1.4 2002/02/21 22:24:52 giles Exp $ */
|
|
|
18 |
/* RasterOp / transparency accessing for library */
|
|
|
19 |
#include "gx.h"
|
|
|
20 |
#include "gserrors.h"
|
|
|
21 |
#include "gzstate.h"
|
|
|
22 |
#include "gsrop.h"
|
|
|
23 |
|
|
|
24 |
/* setrasterop */
|
|
|
25 |
int
|
|
|
26 |
gs_setrasterop(gs_state * pgs, gs_rop3_t rop)
|
|
|
27 |
{
|
|
|
28 |
if (pgs->in_cachedevice)
|
|
|
29 |
return_error(gs_error_undefined);
|
|
|
30 |
pgs->log_op = (rop & rop3_1) | (pgs->log_op & ~rop3_1);
|
|
|
31 |
return 0;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
/* currentrasterop */
|
|
|
35 |
gs_rop3_t
|
|
|
36 |
gs_currentrasterop(const gs_state * pgs)
|
|
|
37 |
{
|
|
|
38 |
return lop_rop(pgs->log_op);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
/* setsourcetransparent */
|
|
|
42 |
int
|
|
|
43 |
gs_setsourcetransparent(gs_state * pgs, bool transparent)
|
|
|
44 |
{
|
|
|
45 |
if (pgs->in_cachedevice)
|
|
|
46 |
return_error(gs_error_undefined);
|
|
|
47 |
pgs->log_op =
|
|
|
48 |
(transparent ? pgs->log_op | lop_S_transparent :
|
|
|
49 |
pgs->log_op & ~lop_S_transparent);
|
|
|
50 |
return 0;
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
/* currentsourcetransparent */
|
|
|
54 |
bool
|
|
|
55 |
gs_currentsourcetransparent(const gs_state * pgs)
|
|
|
56 |
{
|
|
|
57 |
return (pgs->log_op & lop_S_transparent) != 0;
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
/* settexturetransparent */
|
|
|
61 |
int
|
|
|
62 |
gs_settexturetransparent(gs_state * pgs, bool transparent)
|
|
|
63 |
{
|
|
|
64 |
if (pgs->in_cachedevice)
|
|
|
65 |
return_error(gs_error_undefined);
|
|
|
66 |
pgs->log_op =
|
|
|
67 |
(transparent ? pgs->log_op | lop_T_transparent :
|
|
|
68 |
pgs->log_op & ~lop_T_transparent);
|
|
|
69 |
return 0;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
/* currenttexturetransparent */
|
|
|
73 |
bool
|
|
|
74 |
gs_currenttexturetransparent(const gs_state * pgs)
|
|
|
75 |
{
|
|
|
76 |
return (pgs->log_op & lop_T_transparent) != 0;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
/* Save/restore logical operation. (For internal use only.) */
|
|
|
80 |
int
|
|
|
81 |
gs_set_logical_op(gs_state * pgs, gs_logical_operation_t lop)
|
|
|
82 |
{
|
|
|
83 |
pgs->log_op = lop;
|
|
|
84 |
return 0;
|
|
|
85 |
}
|
|
|
86 |
gs_logical_operation_t
|
|
|
87 |
gs_current_logical_op(const gs_state * pgs)
|
|
|
88 |
{
|
|
|
89 |
return pgs->log_op;
|
|
|
90 |
}
|