1 /* Copyright (C) 2001-2006 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, modified 8 or distributed except as expressly authorized under the terms of that 9 license. Refer to licensing information at http://www.artifex.com/ 10 or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, 11 San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information. 12 */ 13 14 /* $Id: gxstate.h 8022 2007-06-05 22:23:38Z giles $ */ 15 /* Internal graphics state API */ 16 17 #ifndef gxstate_INCLUDED 18 # define gxstate_INCLUDED 19 20 /* Opaque type for a graphics state */ 21 #ifndef gs_state_DEFINED 22 # define gs_state_DEFINED 23 typedef struct gs_state_s gs_state; 24 25 #endif 26 #include "gscspace.h" 27 28 29 /* 30 * The interfaces in this file are for internal use only, primarily by the 31 * interpreter. They are not guaranteed to remain stable from one release 32 * to another. 33 */ 34 35 /* Memory and save/restore management */ 36 gs_memory_t *gs_state_memory(const gs_state *); 37 gs_state *gs_state_saved(const gs_state *); 38 gs_state *gs_state_swap_saved(gs_state *, gs_state *); 39 gs_memory_t *gs_state_swap_memory(gs_state *, gs_memory_t *); 40 41 /* 42 * "Client data" interface for graphics states. 43 * 44 * As of release 4.36, the copy procedure is superseded by copy_for 45 * (although it will still be called if there is no copy_for procedure). 46 */ 47 typedef void *(*gs_state_alloc_proc_t) (gs_memory_t * mem); 48 typedef int (*gs_state_copy_proc_t) (void *to, const void *from); 49 typedef void (*gs_state_free_proc_t) (void *old, gs_memory_t * mem); 50 51 typedef enum { 52 copy_for_gsave, /* from = current, to = new(saved) */ 53 copy_for_grestore, /* from = saved, to = current */ 54 copy_for_gstate, /* from = current, to = new(copy) */ 55 copy_for_setgstate, /* from = stored, to = current */ 56 copy_for_copygstate, /* from & to are specified explicitly */ 57 copy_for_currentgstate /* from = current, to = stored */ 58 } gs_state_copy_reason_t; 59 60 /* Note that the 'from' argument of copy_for is not const. */ 61 /* This is deliberate -- some clients need this. */ 62 typedef int (*gs_state_copy_for_proc_t) (void *to, void *from, 63 gs_state_copy_reason_t reason); 64 typedef struct gs_state_client_procs_s { 65 gs_state_alloc_proc_t alloc; 66 gs_state_copy_proc_t copy; 67 gs_state_free_proc_t free; 68 gs_state_copy_for_proc_t copy_for; 69 } gs_state_client_procs; 70 void gs_state_set_client(gs_state *, void *, const gs_state_client_procs *, 71 bool client_has_pattern_streams); 72 73 /* gzstate.h redefines the following: */ 74 #ifndef gs_state_client_data 75 void *gs_state_client_data(const gs_state *); 76 #endif 77 78 /* Accessories. */ 79 gs_id gx_get_clip_path_id(gs_state *); 80 81 #endif /* gxstate_INCLUDED */ 82