824N/A/*
824N/A * dosXpreview.h
824N/A *
824N/A * (c) Copyright 1990-1994 Adobe Systems Incorporated.
824N/A * All rights reserved.
824N/A *
824N/A * Permission to use, copy, modify, distribute, and sublicense this software
824N/A * and its documentation for any purpose and without fee is hereby granted,
824N/A * provided that the above copyright notices appear in all copies and that
824N/A * both those copyright notices and this permission notice appear in
824N/A * supporting documentation and that the name of Adobe Systems Incorporated
824N/A * not be used in advertising or publicity pertaining to distribution of the
824N/A * software without specific, written prior permission. No trademark license
824N/A * to use the Adobe trademarks is hereby granted. If the Adobe trademark
824N/A * "Display PostScript"(tm) is used to describe this software, its
824N/A * functionality or for any other purpose, such use shall be limited to a
824N/A * statement that this software works in conjunction with the Display
824N/A * PostScript system. Proper trademark attribution to reflect Adobe's
824N/A * ownership of the trademark shall be given whenever any such reference to
824N/A * the Display PostScript system is made.
824N/A *
824N/A * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
824N/A * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
824N/A * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
824N/A * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
824N/A * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
824N/A * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
824N/A * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
824N/A * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
824N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
824N/A * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
824N/A *
824N/A * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
824N/A * Incorporated which may be registered in certain jurisdictions
824N/A *
824N/A * Author: Adobe Systems Incorporated
824N/A */
824N/A/* $XFree86$ */
824N/A
824N/A#ifndef DPS_X_PREVIEW_H
824N/A#define DPS_X_PREVIEW_H
824N/A
824N/A#include <DPS/dpsXcommon.h>
824N/A
824N/Atypedef struct {
824N/A long startPos;
824N/A int nestingLevel;
824N/A unsigned long binaryCount;
824N/A Bool continuedLine;
824N/A} XDPSPosition;
824N/A
824N/A#if defined(__cplusplus) || defined(c_plusplus)
824N/Aextern "C" {
824N/A#endif
824N/A
824N/A/* The rewind function should set the file pointer to the beginning of an
824N/A area of interest.
824N/A*/
824N/A
824N/Atypedef void (*XDPSRewindFunction)(FILE *f,
824N/A DPSPointer clientData);
824N/A
824N/A/* The gets function should duplicate the behavior of the fgets function,
824N/A but it may return NULL to indicate that the area of interest is over
824N/A even if the end of file is not yet reached.
824N/A*/
824N/A
824N/Atypedef char *(*XDPSGetsFunction)(char *buf,
824N/A int n,
824N/A FILE *f,
824N/A DPSPointer clientData);
824N/A
824N/A/* XDPSSetFileFunctions defines the functions XDPSCreatePixmapForEPSF and
824N/A XDPSImageFileIntoDrawable will use to reset the file to its beginning
824N/A and to read the next line of the file.
824N/A*/
824N/A
824N/Aextern int XDPSSetFileFunctions(XDPSRewindFunction rewindFunction,
824N/A DPSPointer rewindClientData,
824N/A XDPSGetsFunction getsFunction,
824N/A DPSPointer getsClientData);
824N/A
824N/A/* The following two functions expect NULL as client data and are appropriate
824N/A for dealing with a separate EPSF file. They are the default rewind and
824N/A gets functions, and may be used to reset the functions after changing them.
824N/A*/
824N/A
824N/Aextern void XDPSFileRewindFunc(FILE *f,
824N/A DPSPointer data);
824N/A
824N/Aextern char *XDPSFileGetsFunc(char *buf,
824N/A int n,
824N/A FILE *f,
824N/A DPSPointer data);
824N/A
824N/A/* The following two functions expect the address of an XDPSPosition
824N/A structure as client data and are appropriate for dealing with an ESPF
824N/A file embedded in another file. The 2.0 document structuring conventions
824N/A %%BeginDocument and %%EndDocument are used to detect the end of the
824N/A included file and to identify any embedded files. The startPos
824N/A in the XDPSPosition structure should be the first character of the
824N/A embedded file (as found by, for example, ftell). It must *not* include
824N/A the initial %%BeginDocument comment for this document. The nestingLevel,
824N/A continuedLine, and binaryCount fields are used internally by the functions
824N/A and should not be modified. After calling XDPSImageFileIntoDrawable,
824N/A startPos will be modified to be the first character after the complete
824N/A EPSF file, or -1 if the EPSF ended with end-of-file.
824N/A*/
824N/A
824N/Aextern void XDPSEmbeddedEPSFRewindFunc(FILE *f,
824N/A DPSPointer data);
824N/A
824N/Aextern char *XDPSEmbeddedGetsFunc(char *buf, int n, FILE *f, DPSPointer data);
824N/A
824N/Aextern char *XDPSEmbeddedEPSFGetsFunc(char *buf,
824N/A int n,
824N/A FILE *f,
824N/A DPSPointer data);
824N/A
824N/A/* XDPSCreatePixmapForEPSF creates a pixmap for use on the specified screen.
824N/A The size of the pixmap is determined by reading the %%BoundingBox comment
824N/A in the file, scaled by the pixelsPerPoint value. The size of the
824N/A pixmap is returned in pixelSize (x and y will be zero) and the bounding
824N/A box (in points) is returned in bbox. The context parameter may be NULL,
824N/A in which case the shared context for the display will be used. If a real
824N/A context is passed, it must be registered with XDPSRegisterContext.
824N/A*/
824N/A
824N/Aextern int XDPSCreatePixmapForEPSF(DPSContext context,
824N/A Screen *screen,
824N/A FILE *epsf,
824N/A int depth,
824N/A double pixelsPerPoint,
824N/A Pixmap *p,
824N/A XRectangle *pixelSize,
824N/A XRectangle *bbox);
824N/A
824N/A/* XDPSPixelsPerPoint returns the number of pixels in one point on the given
824N/A screen. Note that if the server lies about the resolution of the screen
824N/A (as it often does) the lie will be repeated here. */
824N/A
824N/Aextern double XDPSPixelsPerPoint(Screen *screen);
824N/A
824N/A/* XDPSImageFileIntoDrawable images a PostScript file into a drawable.
824N/A The imaging will be offset by the xOffset and yOffset values, these
824N/A must be in points. If the clear parameter is True, the area defined
824N/A by the bbox will be cleared to white before imaging. If createMask is
824N/A True, the drawable must be 1 bit deep and it will end up containing a
824N/A 1 bit everywhere that the PostScript file images, if clear is also True
824N/A any untouched bits will be 0. If the drawable is a pixmap, the result
824N/A is suitable for use as a mask in X drawing call. The context parameter
824N/A may be NULL, in which case the shared context for the display will
824N/A be used. If a real context is passed, it must be registered with
824N/A XDPSRegisterContext.
824N/A
824N/A If waitForCompletion is True, XDPSImageFileIntoDrawable
824N/A will wait for the imaging to be finished before returning. If
824N/A waitForCompletion parameter is False, XDPSImageFileIntoDrawable will wait
824N/A for a time as specified by the XDPSSetImagingTimeout before returning
824N/A dps_status_imaging_incomplete. The caller checks for the completion of
824N/A the imaging by calling XDPSCheckImagingResults periodically.
824N/A
824N/A Partial imaging may be stopped by destroying the context with
824N/A XDPSDestroySharedContext or both DPSDestroyContext and
824N/A XDPSUnregisterContext. Doing anything with a context between the time
824N/A XDPSImageFileIntoDrawable returns dps_status_imaging_incomplete and the
824N/A time XDPSCheckImagingResults returns other than
824N/A dps_status_imaging_incomplete will yield incorrect imaging
824N/A results and leave the context in an undefined state, don't do it.
824N/A
824N/A If the display does not support the DPS extension, the image area as
824N/A determined by the bbox parameter will be filled with a 50% gray stipple
824N/A pattern, or set to solid 1's if createMask is True.
824N/A
824N/A The context parameter may be NULL, in which case the shared context
824N/A for the display will be used. If a real context is passed, it must
824N/A be registered with XDPSRegisterContext.
824N/A*/
824N/A
824N/Aextern int XDPSImageFileIntoDrawable(DPSContext context,
824N/A Screen *screen,
824N/A Drawable dest,
824N/A FILE *file,
824N/A int drawableHeight,
824N/A int drawableDepth,
824N/A XRectangle *bbox,
824N/A int xOffset,
824N/A int yOffset,
824N/A double pixelsPerPoint,
824N/A Bool clear,
824N/A Bool createMask,
824N/A Bool waitForCompletion,
824N/A Bool *doneFlag);
824N/A
824N/A/* XDPSCheckImagingResults checks the status of the imaging on the context.
824N/A If the imaging is not done, it returns dps_status_imaging_incomplete, if
824N/A it is done, it returns dps_status_success or dps_status_postscript_error,
824N/A if the context is not currently involved in imaging it returns
824N/A dps_status_illegal_value.
824N/A
824N/A The context parameter may be NULL, in which case the shared context
824N/A for the display will be used. If a real context is passed, it must
824N/A be registered with XDPSRegisterContext.
824N/A*/
824N/A
824N/Aextern int XDPSCheckImagingResults(DPSContext context,
824N/A Screen *screen);
824N/A
824N/A/* XDPSSetImagingTimeout determines how long XDPSImageFileIntoDrawable will
824N/A wait before returning after an incomplete imaging, in milliseconds.
824N/A XDPSImageFileIntoDrawable will start by waiting the timeout and will
824N/A repeatedly double the wait until the imaging is complete or until
824N/A maxDoublings have occurred. */
824N/A
824N/Aextern void XDPSSetImagingTimeout(int timeout,
824N/A int maxDoublings);
824N/A
824N/A#if defined(__cplusplus) || defined(c_plusplus)
824N/A}
824N/A#endif
824N/A
824N/A#endif /* DPS_X_PREVIEW_H */