Software: Apache/2.2.3 (CentOS). PHP/5.1.6 uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/doc/ghostscript-8.15/ drwxr-xr-x |
Viewing file: Lib.htm (32.07 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | The Ghostscript LibraryTable of contentsFor other information, see the Ghostscript overview. The Ghostscript libraryThis document describes the Ghostscript library, a set of procedures to implement the graphics and filtering capabilities that are primitive operations in the PostScript language and in Adobe Portable Document Format (PDF). Ghostscript is actually two programs: a language interpreter, and a graphics library. The library provides, in the form of C procedures, all the graphics functions of the language, that is, approximately those facilities listed in section 8.1 of the PostScript Language Reference Manual, starting with the graphics state operators. In addition, the library provides some lower-level graphics facilities that offer higher performance in exchange for less generality. PostScript operator APIThe highest level of the library, which is the one that most clients will use, directly implements the PostScript graphics operators with procedures named gs_XXX, for instance gs_moveto and gs_fill. Nearly all of these procedures take graphics state objects as their first arguments, such as int gs_moveto(gs_state *, double, double); Nearly every procedure returns an integer code which is >= 0 for a successful return or <0 for a failure. The failure codes correspond directly to PostScript errors, and are defined in gserrors.h. The library implements all the operators in the following sections of the PostScript Language Reference Manual, with the indicated omissions and with the APIs defined in the indicated .h files. A header of the form A.h(B.h) indicates that A.h is included in B.h, so A.h need not be included explicitly if B.h is included. Operators marked with * in the "omissions" column are not implemented directly; the library provides lower-level procedures that can be used to implement the operator. There are slight differences in the operators that return multiple values, since C's provisions for this are awkward. Also, the control structure for the operators involving callback procedures (pathforall, image, colorimage, imagemask) is partly inverted: the client calls a procedure to set up an enumerator object, and then calls another procedure for each iteration. The ...show operators, charpath, and stringwidth also use an inverted control structure.
The following procedures from the list above operate differently from their PostScript operator counterparts, as explained here:
This level of the library also implements the following operators from other sections of the Manual:
In order to obtain the full PostScript Level 2 functionality listed above, FEATURE_DEVS must be set in the makefile to include at least the following: FEATURE_DEVS=patcore.dev cmykcore.dev psl2core.dev dps2core.dev ciecore.dev path1core.dev hsbcore.dev The *lib.mak makefiles mentioned below do not always include all of these features. Files named gs*.c implement the higher level of the graphics library. As might be expected, all procedures, variables, and structures available at this level begin with "gs_". Structures that appear in these interfaces, but whose definitions may be hidden from clients, also have names beginning with "gs_", that is, the prefix, not the implementation, reflects at what level the abstraction is made available. PatternsPatterns are the most complicated PostScript language objects that the library API deals with. As in PostScript, defining a pattern color and using the color are two separate operations. gs_makepattern defines a pattern color. Its arguments are as follows:
The gs_client_pattern structure defined in gscolor2.h corresponds to the Pattern dictionary that is the argument to the PostScript language makepattern operator. This structure has one extra member, void *client_data, which is a place for clients to store a pointer to additional data for the PaintProc; this provides the same functionality as putting additional keys in the Pattern dictionary at the PostScript language level. The PaintProc is an ordinary C procedure that takes as parameters a gs_client_color *, which is the Pattern color that is being used for painting, and a gs_state *, which is the same graphics state that would be presented to the PaintProc in PostScript. Currently the gs_client_color * is always the current color in the graphics state, but the PaintProc should not rely on this. The PaintProc can retrieve the gs_client_pattern * from the gs_client_color * with the gs_getpattern procedure, also defined in gscolor2.h, and from there, it can retrieve the client_data pointer. The normal way to set a Pattern color is to call gs_setpattern with the graphics state and with the gs_client_color returned by gs_makepattern. After that, one can use gs_setcolor to set further Pattern colors (colored, or uncolored with the same underlying color space); the rules are the same as those in PostScript. Note that for gs_setpattern, the paint.values in the gs_client_color must be filled in for uncolored patterns; this corresponds to the additional arguments for the PostScript setpattern operator in the uncolored case. There is a special procedure gs_makebitmappattern for creating bitmap-based patterns. Its API is documented in gscolor2.h; its implementation, in gspcolor.c, may be useful as an example of a pattern using a particularly simple PaintProc. Lower-level APIFiles named gx*.c implement the lower level of the graphics library. The interfaces at the gx level are less stable, and expose more of the implementation detail, than those at the gs level: in particular, the gx interfaces generally use device coordinates in an internal fixed-point representation, as opposed to the gs interfaces that use floating point user coordinates. Named entities at this level begin with gx_. Files named gz*.c and gz*.h are internal to the Ghostscript implementation, and are not designed to be called by clients. Visual Trace instructionsVisual Trace instructions may be inserted in code to provide debug output in a graphical form. Graphics Library doesn't provide a rasterisation of the output, because it is platform dependent. Instead this, client application shpuld set vd_trace0 external variable to Graphics Library, passing a set of callbacks which provide the rasterization. Visual Trace instructions are defined in vdtrace.h. Debug output must be opened with vd_get_dc instruction, which obtains a drawing context for the debug output, and must be closed with vd_release_dc instruction. After opening the output, scale, origin and shift to be set for mapping the debugee coordinate space to window coordinate space. Than painting instructions to be used. Painting may be either immediate or indirect. Indirect painting uses vd_beg_path before line output and vd_end_path after line output, to store a path into a temporary storage. After this vd_stroke may be used for stroking the path, or vd_fill may be used for filling the region inside the path. Immediate painting happens when path construction instructions are involved without vd_beg_path and vd_end_path. In this case lines and curves are being drawed immediately, when a path construction instruction is executed. The following table explains the semantics of Visual Trace instructions.
Graphics Library doesn't provide a rasterization of the debug output. Instead it calls callbacks, which are specified by a client, and which may have a platform dependent implementation. The implementation must not use Graphics Library to exclude recursive calls to it from Visual Trace instructions. The callbacks and auxiliary data are collected in the structure vd_trace_interface, explained in the table below.
A full exampleThe file gslib.c in the Ghostscript fileset is a complete example program that initializes the library and produces output using it; files named *lib.mak (such as ugcclib.mak and bclib.mak) are makefiles using gslib.c as the main program. The following annotated excerpts from this file are intended to provide a roadmap for applications that call the library. /* Capture stdin/out/err before gs.h redefines them. */ #include <stdio.h> static FILE *real_stdin, *real_stdout, *real_stderr; static void get_real(void) { real_stdin = stdin, real_stdout = stdout, real_stderr = stderr; } Any application using Ghostscript should include the fragment above at the very beginning of the main program. #include "gx.h" The gx.h header includes a wealth of declarations related to the Ghostscript memory manager, portability machinery, debugging framework, and other substrate facilities. Any application file that calls any Ghostscript API functions should probably include gx.h. /* Configuration information imported from gconfig.c. */ extern gx_device *gx_device_list[]; /* Other imported procedures */ /* from gsinit.c */ extern void gs_lib_init(P1(FILE *)); extern void gs_lib_finit(P2(int, int)); /* from gsalloc.c */ extern gs_ref_memory_t *ialloc_alloc_state(P2(gs_memory_t *, uint)); The externs above are needed for initializing the library. gs_ref_memory_t *imem; #define mem ((gs_memory_t *)imem) gs_state *pgs; gx_device *dev = gx_device_list[0]; gp_init(); get_real(); gs_stdin = real_stdin; gs_stdout = real_stdout; gs_stderr = real_stderr; gs_lib_init(stdout); .... imem = ialloc_alloc_state(&gs_memory_default, 20000); imem->space = 0; .... pgs = gs_state_alloc(mem); The code above initializes the library and its memory manager. pgs now points to the graphics state that will be passed to the drawing routines in the library. gs_setdevice_no_erase(pgs, dev); /* can't erase yet */ { gs_point dpi; gs_screen_halftone ht; gs_dtransform(pgs, 72.0, 72.0, &dpi); ht.frequency = min(fabs(dpi.x), fabs(dpi.y)) / 16.001; ht.angle = 0; ht.spot_function = odsf; gs_setscreen(pgs, &ht); } The code above initializes the default device and sets a default halftone screen. (For brevity, we have omitted the definition of odsf, the spot function.) /* gsave and grestore (among other places) assume that */ /* there are at least 2 gstates on the graphics stack. */ /* Ensure that now. */ gs_gsave(pgs); The call above completes initializing the graphics state. When the program is finished, it should execute: gs_lib_finit(0, 0); Copyright © 1996, 1997, 1998 Aladdin Enterprises. 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 the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861. Ghostscript version 8.15, 22 September 2004 |
:: Command execute :: | |
:: Shadow's tricks :D :: | |
Useful Commands
|
:: Preddy's tricks :D :: | |
Php Safe-Mode Bypass (Read Files)
|
--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0083 ]-- |