summaryrefslogtreecommitdiff
path: root/gs/base/gsalpha.c
diff options
context:
space:
mode:
Diffstat (limited to 'gs/base/gsalpha.c')
-rw-r--r--gs/base/gsalpha.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gs/base/gsalpha.c b/gs/base/gsalpha.c
new file mode 100644
index 000000000..07784c6e6
--- /dev/null
+++ b/gs/base/gsalpha.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2001-2006 Artifex Software, Inc.
+ All Rights Reserved.
+
+ This software is provided AS-IS with no warranty, either express or
+ implied.
+
+ This software is distributed under license and may not be copied, modified
+ or distributed except as expressly authorized under the terms of that
+ license. Refer to licensing information at http://www.artifex.com/
+ or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
+ San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
+*/
+
+/* $Id$ */
+/* Graphics state alpha value access */
+#include "gx.h"
+#include "gsalpha.h"
+#include "gxdcolor.h"
+#include "gzstate.h"
+
+/* setalpha */
+int
+gs_setalpha(gs_state * pgs, floatp alpha)
+{
+ pgs->alpha =
+ (gx_color_value) (alpha < 0 ? 0 : alpha > 1 ? gx_max_color_value :
+ alpha * gx_max_color_value);
+ gx_unset_dev_color(pgs);
+ return 0;
+}
+
+/* currentalpha */
+float
+gs_currentalpha(const gs_state * pgs)
+{
+ return (float)pgs->alpha / gx_max_color_value;
+}