home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-07 | 59.2 KB | 1,282 lines |
- Newsgroups: comp.sources.x
- From: jch@okimicro.oki.com (Jan Hardenbergh)
- Subject: v20i011: pexdraw - A PEX drawing program, Part01/14
- Message-ID: <csx-v20i011=pexdraw.095954@sparky.IMD.Sterling.COM>
- X-Md4-Signature: dd54a9f29bf8f9af6eeeff44ef45c02c
- Sender: chris@sparky.imd.sterling.com (Chris Olson)
- Organization: Sterling Software
- Date: Tue, 8 Jun 1993 15:00:18 GMT
- Approved: chris@sparky.imd.sterling.com
-
- Submitted-by: jch@okimicro.oki.com (Jan Hardenbergh)
- Posting-number: Volume 20, Issue 11
- Archive-name: pexdraw/part01
- Environment: X11R5, PEX
-
- [ I could not test this program (no PEX) and it did not have a man page ]
- [ Chris ]
-
- pexdraw is a drawing and exploring program for PEX & PEXlib.
-
- I have used it to explore application issues and at times as a test
- vehicle. It also serves as a base of examples for a book to be
- published by Prentice Hall. "Building Applications with PEXlib".
-
- It will run best on a 5.1 PEX server, but will also run on a 5.0 server
- with the Workstation resource.
- ------------------------------------------------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README XMU util util/Imakefile util/pexutcmap.h
- # Wrapped by chris@sparky on Tue Jun 8 09:46:30 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 14)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(6441 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- X =S+H= @(#)README 1.5 Oki 93/05/25
- XMAY-93
- X
- Xpexdraw README.
- X
- Xpexdraw is a drawing and exploring program for PEX & PEXlib.
- X
- XI have used it to explore application issues and at times as a test
- Xvehicle. It also serves as a base of examples for a book to be
- Xpublished by Prentice Hall. "Building Applications with PEXlib".
- X
- XIt will run best on a 5.1 PEX server, but will also run on a 5.0 server
- Xwith the Workstation resource.
- X
- X
- XThis distribution consists of:
- X
- X-rw-r-----1005/100 4957 May 25 01:53 1993 README
- X-r--r-----1005/100 66040 May 24 14:55 1993 pexdraw.c
- X-r--r-----1005/100 12694 May 24 14:55 1993 pexdraw.h
- X-r--r-----1005/100 113725 May 24 14:55 1993 pexdraw.uil
- X-rw-r-----1005/100 3809 May 25 12:53 1993 Imakefile
- X-r--r-----1005/100 20761 May 24 14:55 1993 rdr.c
- X-r--r-----1005/100 15095 May 24 14:55 1993 wks.c
- X-r--r-----1005/100 27419 May 24 14:55 1993 fb.c
- X-r--r-----1005/100 43663 May 24 14:55 1993 ui.c
- X-r--r-----1005/100 11454 May 24 14:55 1993 ui_x.c
- X-r--r-----1005/100 13341 May 11 13:43 1993 init.c
- X-rw-r--r--1005/100 17902 May 4 10:48 1993 util/HP.PEXUt
- X-r--r-----1005/100 4510 May 25 12:24 1993 rgbc.c
- X-r--r-----1005/100 12619 May 25 12:45 1993 plcube.c
- X-r--r-----1005/100 3911 May 25 12:25 1993 sofas.c
- X-r--r-----1005/100 119825 May 25 12:24 1993 teapot.c
- X-r--r-----1005/100 13664 May 25 13:53 1993 plogo.c
- Xdrwxr-xr-x1005/1 0 Apr 25 23:50 1993 XMU/std cmap stuff.
- X
- X
- XTO BUILD:
- X=========
- X
- XHopefully you have xmkmf, else use imake. Since I have included the
- XHP DB utilities, you need to make Makefiles, too.
- X
- XStep 1 make the makefiles:
- X If you have Motif installed, do this:
- X % imake -I/usr/lib/X11/config -DMOTIF -DUseInstalled
- X Otherwise:
- X % imake -I/usr/lib/X11/config -DNO_MOTIF -DUseInstalled
- X
- X In either case:
- X % make Makefiles
- X
- X %make pexdraw ( or pxd, if no Motif )
- X
- XTO USE:
- X=======
- X
- Xpexdraw is compose of several tools and several forms. The tools allow
- Xfor direct manipulation of the geometry and viewing paramters.
- X
- X Left Button Middle Button Right Button
- X
- XPointer pickOne* translateSelected stretchSelected
- XLine line line rotateView
- XTriStrip add point finish TriStrip rotateView
- XNURBCurve add point finish NURBCurve rotateView
- XText insert text .. rotateView
- XPolygon add point finish Polygon rotateView
- XCircle circle .. rotateView
- Xview rotateView .. rotateView
- Xzoom zoomWindow resetWindow rotateView
- XmodelClip add model clip nothing rotateView
- X
- XTo walk through the features of pexdraw.
- X- use button 1 to sketch in one line. It is selected
- X- sketch in a second line, the first is deselected
- X- Pick up the Pointer tool, select the first line
- X- Use the button 2 to translate
- X- Use the button 3 to stretch
- X- Pull down the Edit Menu and delete it
- X- Insert a TriStrip - use the SurfaceAttrs Form to make it solid (must Apply)
- X- select the Set view item in the Options (Options) menu.
- X set various view paramters and press apply.
- X- use the view tool (two circles)
- X- Start spinning slowly (this will spin the struct of the selected object, or
- X if not is selected the structure being created)
- X- Stop spinning slowly, by hitting the same menu button
- X- Use the Execute menu under File to execute a structure generating
- X client - plcube, plogo, sofas, rgbc. This will use the UNIX system() call.
- X Select the red line and set the surface properties & spin slow.
- X [ You can now have several objects spinning independently, keep selecting
- X and using the menu, if an object is spinning the menu will turn it off ]
- X- Use the execute menu again and insert something else. Select that red line
- X and start spinning. Now use the Spin Option menu items to bring up the
- X spin form. You can change a bunch of stuff about how it is spinning.
- X- Delete All
- X
- X
- X- Delete All
- X- use the sphere item in the Options menu to insert a sphere.
- X (sphere alternates between a triStrip Cuboctohedron & a ration NURB surf)
- X- pick the blue line
- X- select the surfaceAttrs menu, this brings up a form
- X- set various attributes
- X
- X- use the NURBSCurve tool.
- X- Use the Change Color option to bring up a RGB slider form.
- X- Use the MC tool to insert a model clip plane.
- X- You can execute a structure from another structure.
- X - delete all, Execute sofas, select it, stat it spinning, bring up
- X spin form. Change spin point to -1, -1, -1.
- X - Execute rgbc, now, use the Execute Strux menu item and click on red
- X line of rgbc. Now there are two rgbc . click on the rgbc line again
- X and start it spinning. now change the spin point to -1,-1,-1 and the
- X offset to 1.5, 1.5, 1.5. If you have a fast machine, turn on solid
- X & Gouraud. Now Unpost Strux. the SOAFS is orbitting the end of the
- X line and the RGBC is orbitting the center of the SOFAS. It's fun.
- X
- X
- XIf you are running on a PEX 5.1 server you can do a "draw through" select
- Xto change colors of objects. This uses the PickAll features.
- X
- XAll of the lines, tristrips, NURBSCurve & Text obey the translate &
- Xstretch. Ideally, stretch would change the character height & expansion
- Xattributes of the test...
- X
- Xpexdraw expects structures to be in a certan form - see InitStrux.
- X
- XYou can build a version of pexdraw that does not use Motif, "make pxd".
- XThis will use the file ui_x.c instead of ui.c. ui_x.c is not totally up
- Xto date with ui.c, but it will give you something to play with.
- X
- XCrCmap.c is included due to bugfixes. If you have problems with pexdraw
- Xhanging when running against TrueColor or DirectColor visual, build an
- Xlink CrCmap.c - If your libXmu is up to date with the patches you should
- Xnot need to worry about them. If you are running against 24 bit servers
- Xand you hang, then you need to compile & link the files in XMU
- XThese were released in public patch # 20. export.lcs.mit.edu pub/R5/fixes.
- XIT WOULD BE BETTER TO GET THIS FROM AN UP TO DATE SOURCE.
- X
- Xutil/ contains the HP.PEXUt utilities. These are still in flux and you
- Xshould get the latest from export.lcs.mit.edu in /contrib/PEXlib.
- X
- X
- X-Jan "YON" Hardenbergh jch@oki.com / jch@world.std.com (508)-624-7000
- XOki Advanced Products Division, 100 Nickerson Road, Marlborough, MA 01752
- X
- X"Whatever you can do, or dream you can do, begin it.
- X Boldness has genius, power and magic in it." w h murray.
- END_OF_FILE
- if test 6441 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test ! -d 'XMU' ; then
- echo shar: Creating directory \"'XMU'\"
- mkdir 'XMU'
- fi
- if test ! -d 'util' ; then
- echo shar: Creating directory \"'util'\"
- mkdir 'util'
- fi
- if test -f 'util/Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/Imakefile'\"
- else
- echo shar: Extracting \"'util/Imakefile'\" \(136 characters\)
- sed "s/^X//" >'util/Imakefile' <<'END_OF_FILE'
- XINCLUDES = -I. -I$(TOP) -I$(TOP)/X11/extensions
- X
- XOBJS = pexutdb.o pexutdbint.o pexutcmap.o pexutcmapint.o pexutcmaphp.o
- X
- Xall:: $(OBJS)
- END_OF_FILE
- if test 136 -ne `wc -c <'util/Imakefile'`; then
- echo shar: \"'util/Imakefile'\" unpacked with wrong size!
- fi
- # end of 'util/Imakefile'
- fi
- if test -f 'util/pexutcmap.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/pexutcmap.h'\"
- else
- echo shar: Extracting \"'util/pexutcmap.h'\" \(49034 characters\)
- sed "s/^X//" >'util/pexutcmap.h' <<'END_OF_FILE'
- X#ifndef PEXUTCMAP_H /* { */
- X#define PEXUTCMAP_H
- X
- X/******************************************************************************/
- X/* */
- X/* (c) Copyright Hewlett-Packard Company, 1992, Fort Collins, Colorado */
- X/* */
- X/* All Rights Reserved */
- X/* */
- X/* Permission to use, copy, modify, and distribute this software and its */
- X/* documentation for any purpose and without fee is hereby granted, */
- X/* provided that the above copyright notices appear in all copies and that */
- X/* both the copyright notices and this permission notice appear in */
- X/* supporting documentation, and that the name of Hewlett-Packard not be */
- X/* used in advertising or publicity pertaining to distribution of the */
- X/* software without specific, written prior permission. */
- X/* */
- X/* HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS */
- X/* SOFTWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
- X/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard */
- X/* shall not be liable for errors contained herein or direct, indirect, */
- X/* special, incidental or consequential damages in connection with the */
- X/* furnishing, performance or use of this software. */
- X/* */
- X/******************************************************************************/
- X
- X/******************************************************************************/
- X/* */
- X/* $Source: /BE700/9.0/gtd/R903/wbuild/PEX5/head/RCS/pexutcmap.h,v $ */
- X/* $Date: 93/03/17 14:14:23 $ */
- X/* $Revision: 500.1.200.1 $ */
- X/* */
- X/* Description: */
- X/* Interface header file for PEXUt colormap/visual utilities. */
- X/* */
- X/* Notes: */
- X/* */
- X/******************************************************************************/
- X
- X
- X#ifndef NeedFunctionPrototypes
- X#if defined(FUNCPROTO) || defined(__STDC__) || \
- X defined(__cplusplus) || defined(c_plusplus)
- X#define NeedFunctionPrototypes 1
- X#else
- X#define NeedFunctionPrototypes 0
- X#endif /* FUNCPROTO, __STDC__, __cplusplus, c_plusplus */
- X#endif /* NeedFunctionPrototypes */
- X
- X
- X#ifdef __cplusplus /* do not leave open across includes */
- Xextern "C" { /* for C++ V2.0 */
- X#endif
- X
- X
- X/*
- X The following structure type is used to specify criteria for
- X selecting a Visual. The fields are used as follows:
- X
- X hard_criteria_mask a mask of bits for "hard" criteria; that is,
- X for criteria that MUST be met by the Visual;
- X the supported bits are defined below.
- X
- X soft_criteria_mask a mask of bits for "soft" criteria, i.e.
- X criteria that are not required to be met but
- X are "preferred"; supported bits are defined
- X below.
- X
- X depth the criterion value for PEXUtDepth; allowed
- X value is any reasonable Visual depth.
- X
- X min_colors criterion value for PEXUtMinColors; specifies
- X the minimum number of distinct colors the
- X Visual must support. Values less than two
- X are illogical, as even monochrome systems have
- X two colors. The way in which the available
- X number of colors is computed depends
- X on the Visual class. When a standard colormap
- X property entry is used, the number of available
- X colors is based on the ramp described in the
- X property.
- X
- X min_red criterion value for (PEXUtMinRed,PEXUtMinGreen,
- X min_green PEXUtMinBlue) respectively; specify the
- X min_blue minimum number of (red,green,blue) levels the
- X Visual must support. Allowed values are
- X integer greater than one.
- X
- X visual_class criterion value for PEXUtVisualClass; specifies
- X the X Visual class (one of StaticColor,
- X PseudoColor, StaticGray, GrayScale,
- X TrueColor, DirectColor).
- X
- X layer criterion value for PEXUtLayer; one of
- X PEXUtOverlay or PEXUtImage.
- X
- X standard_colormap_property criterion value for
- X PEXUtStandardColormapProperty; one of True
- X or False. If True, the Visual must be named
- X in an entry in a standard colormap property
- X in order to satisfy the criterion.
- X
- X sharable_colormap criterion value for PEXUtSharableColormap;
- X one of True or False. If True, the Visual
- X must be named in a standard colormap property,
- X and furthermore, such Visuals will be favored
- X over Visuals that have higher color resolution.
- X
- X double_buffering_capability criterion value for
- X PEXUtDoubleBufferingCapability; one of
- X PEXUtDbufferNone, PEXUtDbufferPEX, or
- X PEXUtDbufferPEXAndX. Note that specifying
- X PEXUtDbufferNone "hard" may cause the "best"
- X Visual for PEX rendering to be rejected, since
- X it is likely to be double-buffering-capable.
- X
- X color_approx_type criterion value for PEXUtColorApproxType;
- X one of PEXColorSpace or PEXColorRange.
- X Typically this criterion is only specified if
- X it is PEXColorRange, since most applications
- X need PEXColorSpace. If specified, the
- X Visual must be capable of the specifed
- X approximation type.
- X*/
- X
- X
- Xtypedef struct {
- X unsigned int hard_criteria_mask;
- X unsigned int soft_criteria_mask;
- X unsigned int depth;
- X int min_colors;
- X int min_red;
- X int min_green;
- X int min_blue;
- X int visual_class;
- X int layer;
- X int standard_colormap_property;
- X int sharable_colormap;
- X int double_buffering_capability;
- X PEXEnumTypeIndex color_approx_type;
- X} PEXUtVisualCriteria;
- X
- X/*
- X Mask bits for the criteria.
- X*/
- X
- X#define PEXUtDepth (1L<<0)
- X#define PEXUtMinColors (1L<<1)
- X#define PEXUtMinRed (1L<<2)
- X#define PEXUtMinGreen (1L<<3)
- X#define PEXUtMinBlue (1L<<4)
- X#define PEXUtVisualClass (1L<<5)
- X#define PEXUtLayer (1L<<6)
- X#define PEXUtStandardColormapProperty (1L<<7)
- X#define PEXUtSharableColormap (1L<<8)
- X#define PEXUtDoubleBufferingCapability (1L<<9)
- X#define PEXUtColorApproxType (1L<<10)
- X#define PEXUtAllCriteria ( \
- X PEXUtDepth |\
- X PEXUtMinColors |\
- X PEXUtMinRed |\
- X PEXUtMinGreen |\
- X PEXUtMinBlue |\
- X PEXUtVisualClass |\
- X PEXUtLayer |\
- X PEXUtStandardColormapProperty |\
- X PEXUtSharableColormap |\
- X PEXUtDoubleBufferingCapability |\
- X PEXUtColorApproxType \
- X )
- X
- X
- X/*
- X Values for the layer criterion.
- X*/
- X
- X#define PEXUtOverlay 1
- X#define PEXUtImage 2
- X
- X
- X/*
- X Values for the double_buffering_capability crierion.
- X*/
- X
- X#define PEXUtDbufferNone 0
- X#define PEXUtDbufferPEX 1
- X#define PEXUtDbufferPEXAndX 2
- X
- X
- X/*
- X Values for the integer error codes
- X returned by the various utilities.
- X*/
- X
- X#define PEXUtModifiedResource 1
- X#define PEXUtUnmodifiedResource 0
- X#define PEXUtQualifiedSuccess 1
- X#define PEXUtSuccess 0
- X#define PEXUtCriteriaFailure -1
- X#define PEXUtXFailure -2
- X#define PEXUtPEXFailure -3
- X#define PEXUtAllocFailure -4
- X
- X
- X
- X/*
- X The following structure type is used to specify window size,
- X location, title, and other attributes needed for window
- X creation. The fields are used as follows:
- X
- X attr_mask mask indicating which attribute values in
- X the attrs substructure are to be used;
- X basically the same attribute mask that
- X would be passed into XCreateWindow, i.e. the
- X bits are CWColormap, CWBorderPixel, etc.
- X
- X attrs attribute values corresponding to attr_mask
- X bits. Used the same as in XCreateWindow,
- X with the following restrictions:
- X
- X PEXUtCreateWindow requires the colormap
- X field to be set, and CWColormap to be present
- X in attr_mask. PEXUtCreateWindowAndColormap
- X ignores any colormap since it finds or
- X creates one.
- X
- X Background_pixel and border_pixel are
- X signficant to PEXUtCreateWindow, but if not
- X present, that utility will look up color values
- X from the Colormap for the window.
- X PEXUtCreateWindowAndColormap always looks up
- X colors so these fields are ignored.
- X
- X Background_pixmap and border_pixmap are
- X effective, but may not be compatible with a
- X Colormap that is appropriate for PEX.
- X
- X Backing store fields should be used with
- X caution, since many PEX implementations
- X do not support backing store for PEX rendering.
- X
- X title a character string to be assigned as
- X the title of the window.
- X
- X size_hints a structure specfying the size and position
- X of the window, both used in a call to
- X XCreateWindow and passed on to the window
- X manager via XSetNormalHints. Fields x, y,
- X width, and height should be specified.
- X
- X parent identifier of the parent window.
- X
- X border_width width of the window border in pixels.
- X
- X background_color_name a character string naming a color in the
- X X color database. This name will be looked
- X up to derive a background color. If
- X CWBackgroundPixel is specified to
- X PEXUtCreateWindow, that pixel value will be
- X used instead. PEXUtCreateWindowAndColormap
- X always looks up the color.
- X
- X border_color_name similar to background_color_name except it
- X specifies the border color of the Window.
- X*/
- X
- Xtypedef struct {
- X unsigned long attr_mask;
- X XSetWindowAttributes attrs;
- X char *title;
- X XSizeHints size_hints;
- X Window parent;
- X unsigned int border_width;
- X char *background_color_name;
- X char *border_color_name;
- X} PEXUtWindowSpecification;
- X
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtFindVisual -- choose a Visual for PEX and return color setup info
- X *
- X * Description:
- X * This function attempts to find the "best" Visual supported by a PEX server
- X * that meets a set of criteria specified by the caller. If it successfully
- X * finds a Visual, it returns colormap and color approximation information
- X * that is predicted to be compatible with the Visual and the PEX
- X * implementation. However, in some cases the compatibility is not known in
- X * advance. PEXUtVerifyColorApproximation (q.v.) can be used to check for
- X * support, but may also be unable to determine server support for a
- X * particular color approximation setup. The choice of what is "best" is
- X * a policy decision that cannot be controlled by the caller; it is determined
- X * by the ordering of Renderer targets and by PEX interoperability convention.
- X *
- X * Criteria for Visual selection are specified in the PEXUtVisualCriteria
- X * structure. Criteria can be "hard" or "soft". Hard criteria must be met
- X * in order for a Visual to be considered as a candidate; if no Visual meets
- X * all hard criteria, the function returns a failure status. Soft criteria
- X * are considered when choosing among several candidate Visuals that meet
- X * all the hard criteria. There is an implicit hard criterion that PEX
- X * supports the Visual as a target (this can only be checked on 5.1 and later
- X * servers). There is an implicit soft criterion of significant weight:
- X * when several Visuals are qualifed by hard criteria, the utility prefers
- X * the Visual that appears earlier in the target list returned
- X * PEXMatchRenderingTargets (5.1 and later), or earlier in any other list
- X * established by interoperability convention. (Currently, an earlier
- X * appearance in one of the standard colormap properties that may be
- X * searched increases the likelihood of selection.)
- X *
- X * Please see the on-line manual page for a complete description of how
- X * to use the criteria structure.
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if it is completely
- X * successful in finding a Visual that meets all hard and soft criteria.
- X * PEXUtQualifiedSuccess is returned if the chosen Visual meets all hard
- X * criteria but not all soft criteria.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtCriteriaFailure means that no Visual was found that meets all
- X * the hard criteria.
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtPEXFailure means that an error occurred during a PEXlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * screen is the screen number for which to choose a Visual.
- X *
- X * criteria is a pointer to a structure describing the criteria
- X * to be used in Visual selection.
- X *
- X * On Exit:
- X * vis_info_return points to storage allocated by the caller that has
- X * been written with a description of the chosen Visual.
- X *
- X * cmap_info_return points to storage allocated by the caller that has
- X * been written with a description of an RGB color map
- X * that might be appropriate for PEX rendering. If a
- X * standard colormap property was used to guide selection,
- X * this is a copy of the entry from the property that
- X * guided the choice, including any Colormap ID that was
- X * present. Otherwise, it is a description "synthesized"
- X * from the description of the Visual.
- X *
- X * capx_info_return points to storage allocated by the caller that has
- X * been written with a PEX color approximation entry
- X * that is compatible with the Visual and the criteria.
- X * If no color approximation type was specified as a
- X * a criterion, this is typically a PEXColorSpace setup
- X * that matches the cmap_info_return data. If a color
- X * approximation type was specified, this is an entry
- X * of the appropriate type.
- X *
- X * unmet_criteria_return
- X * points to storage allocated by the caller that has
- X * been written with a combined mask of all hard and
- X * soft criteria that were not met by the chosen Visual.
- X * This parameter is valid when successful or when
- X * PEXUtCriteriaFailure is returned; it may not valid
- X * for failure returns.
- X *
- X * std_prop_atom_return
- X * points to storage allocated by the caller that has
- X * been written with the Atom for the name of the
- X * standard colormap property that was used in Visual
- X * selection, or None if no property was used.
- X *
- X * Restrictions:
- X * This function assumes that PEXInitialize has been called for the
- X * specified display argument.
- X *
- X * The ability of this procedure to verify that criteria are met depends
- X * on information available from the PEX server, including its support for
- X * various interoperability conventions. In general, if a hard criterion
- X * cannot be determined to have been satisfied or not, it is considered to
- X * have not been met; if a soft criterion cannot be verified, the utility
- X * acts as though it had been met but still returns the corresponding bit
- X * in unmet_criteria_return.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtFindVisual (
- X#if NeedFunctionPrototypes
- X Display *display,
- X int screen,
- X PEXUtVisualCriteria *criteria,
- X XVisualInfo *vis_info_return,
- X XStandardColormap *cmap_info_return,
- X PEXColorApproxEntry *capx_info_return,
- X unsigned int *unmet_criteria_return,
- X Atom *std_prop_atom_return
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtGetStandardColormap -- retrieve or generate PEX color information
- X * for a specified Visual
- X *
- X * Description:
- X * This function is intended to be used by applications that choose a
- X * Visual by means other than PEXUtFindVisual, but that wish to make use
- X * of PEXUt functions for initializing Colormaps and/or creating Windows.
- X *
- X * Given a Visual chosen by the caller, and presumed to support PEX,
- X * this function attempts to fetch color map and PEX color approximation
- X * information using standard colormap properties as prescribed by PEX
- X * interoperability conventions. If it cannot find any such information,
- X * it "synthesizes" the information from the Visual description.
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if it succeeds in
- X * finding or generating the color information.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * vis_info is a pointer to a structure describing the Visual.
- X *
- X * On Exit:
- X * cmap_info_return points to storage allocated by the caller that has
- X * been written with a description of an RGB color map
- X * that might be appropriate for PEX rendering. If a
- X * standard colormap property entry was found,
- X * this is a copy of the entry from the property,
- X * including any shared Colormap ID that was
- X * present. Otherwise, it is a description "synthesized"
- X * from the description of the Visual.
- X *
- X * capx_info_return points to storage allocated by the caller that has
- X * been written with a PEX color approximation entry
- X * that is compatible with the Visual. This is typically
- X * a PEXColorSpace setup that matches the cmap_info_return
- X * data. If a color approximation type was specified,
- X * this is an entry of the appropriate type.
- X *
- X * std_prop_atom_return
- X * points to storage allocated by the caller that has
- X * been written with the Atom for the name of the
- X * standard colormap property that was found, if any,
- X * or None if no property entry was found.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtGetStandardColormapInfo (
- X#if NeedFunctionPrototypes
- X Display *display,
- X XVisualInfo *vis_info,
- X XStandardColormap *cmap_info_return,
- X PEXColorApproxEntry *capx_info_return,
- X Atom *std_prop_atom_return
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtVerifyColorApproximation -- determine PEX server support for a
- X * particular color approximation entry
- X *
- X * Description:
- X * This function attempts to verify that a specified PEX color approximation
- X * table entry is supported by the PEX server on a specified Visual.
- X * It uses information about color approximation provided according to
- X * interoperability conventions to make this determination. (PEX 5.1 has
- X * no inquiries that are sufficient to make the determination.)
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if it is completely
- X * successful in determining that the color approximation entry is
- X * supported. PEXUtQualifiedSuccess is returned if support/non-support
- X * cannot be determined.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtCriteriaFailure means that the utility was able to determine
- X * that the approximation entry is definitely not supported.
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtPEXFailure means that an error occurred during a PEXlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * capx_info is a pointer to the PEXColorApproxEntry of interest.
- X *
- X * vis_info is a pointer to a structure describing the Visual.
- X *
- X * Restrictions:
- X * This function assumes that PEXInitialize has been called for the
- X * specified display argument.
- X *
- X * The ability of this procedure to verify that criteria are met depends
- X * on information available from the PEX server, including its support for
- X * various interoperability conventions. If support cannot be determined,
- X * PEXUtQualifiedSuccess is returned so that the application can choose
- X * to go on to attempt a call to PEXSetTableEntries. The application should
- X * be prepared for an error to be returned during that call in case the
- X * color approximation entry is, in fact, not supported.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtVerifyColorApproximation (
- X#if NeedFunctionPrototypes
- X Display *display,
- X PEXColorApproxEntry *capx_info,
- X XVisualInfo *vis_info
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtCreateWriteableColormap -- create a read-write Colormap and
- X * initialize it for use with a PEX
- X * color approximation entry
- X *
- X * Description:
- X * This function creates a private X Colormap. The region of the Colormap
- X * that is described in a specified PEX color approximation entry is
- X * initialized according to the entry; cells outside the region are left
- X * with their default values, in order to reduce color flashing of X clients
- X * that are already using those cells when the new Colormap is installed.
- X * In the case of a PEXColorRange entry, the region is initialized to a
- X * gray ramp. All cells in the Colormap are read-write for the caller.
- X *
- X * This function should be used by applications that plan to modify cells
- X * in the Colormap, either inside or outside the color approximation region.
- X * For example, if a PEXColorRange entry is to be used, it may be that the
- X * application needs to replace the gray ramp with another set of colors.
- X * If the application only needs to set up a Colormap to match a PEXColorSpace
- X * entry and will not be changing the Colormap contents, it is recommended
- X * that PEXUtCreateColormap be used instead, because it improves the chances
- X * of XAllocColor succeeding on the Colormap.
- X *
- X * Note that some implementations of PEX may require additional adjustments
- X * to the Colormap contents for some configurations. It is recommended that
- X * PEXUtModifyColormapForVendorDependencies be called after all changes to
- X * the color approximation region are completed.
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if the Colormap is
- X * successfully allocated and initialized.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use.
- X *
- X * vis_info is a pointer to a structure describing the Visual.
- X *
- X * capx_info is a pointer to the PEXColorApproxEntry of interest.
- X *
- X * On Exit:
- X * colormap_id_return points to storage allocated by the caller that has
- X * been written with the new Colormap ID.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtCreateWriteableColormap (
- X#if NeedFunctionPrototypes
- X Display *display,
- X XVisualInfo *vis_info,
- X PEXColorApproxEntry *capx_info,
- X Colormap *colormap_id_return
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtModifyColormapForVendorDependencies -- adjust Colormap contents for
- X * vendor, device, and configuration idiosyncrasies
- X *
- X * Description:
- X * This procedure determines if the Visual, PEX color approximation entry,
- X * and vendor-dependent server and device form a combination that requires
- X * adjustment to the Colormap contents after it has been initialized
- X * according to the standard and interoperability conventions. Code for
- X * this procedure is expected to be composed of sections contributed by
- X * vendors that have such combinations, so that interoperability is
- X * well-supported. If the combination requires adjustment, this procedure
- X * directly modifies the Colormap. Therefore, the Colormap cells must be
- X * writeable for this client on entry.
- X *
- X * It is recommended that this utility always be called after initialization
- X * of a Colormap to match a color approximation entry, in order to support
- X * interoperability of applications.
- X *
- X * Returns:
- X * The function returns a value of PEXUtUnmodifiedResource if it did not
- X * need to change the Colormap in any way. It returns PEXUtModifiedResource
- X * if some adjustments were made.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtPEXFailure means that an error occurred during a PEXlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * colormap_id is the identifier of the Colormap to adjust; all cells
- X * in the color approximation region are expected to be
- X * writeable.
- X *
- X * vis_info a pointer to a structure describing the Visual.
- X *
- X * capx_info is a pointer to the PEXColorApproxEntry of interest.
- X *
- X * On Exit:
- X * The contents of the Colormap may have been altered.
- X *
- X * Restrictions:
- X * This function assumes that PEXInitialize has been called for the
- X * specified display argument.
- X *
- X * This function may be a no-op for some vendors' servers. In such cases
- X * it always returns PEXUtUnmodifiedResource.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtModifyColormapForVendorDependencies (
- X#if NeedFunctionPrototypes
- X Display *display,
- X Colormap colormap_id,
- X XVisualInfo *vis_info,
- X PEXColorApproxEntry *capx_info
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtCopyColormapAsReadOnly -- create a new Colormap that is a copy of
- X * an existing one, but usable with XAllocColor
- X *
- X * Description:
- X * This utility creates a Colormap that is a copy of an existing one that
- X * is assumed to have been initialized for use with a specified PEX color
- X * approximation entry. As many cells as practical are read-only or
- X * unallocated in the new Colormap, to improve the chances that XAllocColor
- X * will work with the Colormap. However, the integrity of the color
- X * approximation region is protected to ensure that no unallocated cells
- X * exist inside the region, since a later XAllocColor could "corrupt" the
- X * region.
- X *
- X * The source Colormap is not freed by this utility. The caller may choose
- X * to free it if only the new copy will be used.
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if the new Colormap is
- X * successfully created and initialized.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * source_cmap_id is the identifier of the source Colormap to adjust.
- X * It is expected to have been initialized to match
- X * the color approximation entry, and any vendor-dependent
- X * adjustments to have already been made.
- X *
- X * vis_info a pointer to a structure describing the Visual.
- X *
- X * capx_info is a pointer to the PEXColorApproxEntry for which the
- X * source Colormap is initialized.
- X *
- X * On Exit:
- X * cmap_id_return points to storage allocated by the caller that has
- X * been written with the new Colormap ID.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtCopyColormapAsReadOnly (
- X#if NeedFunctionPrototypes
- X Display *display,
- X Colormap source_cmap_id,
- X XVisualInfo *vis_info,
- X PEXColorApproxEntry *capx_info,
- X Colormap *cmap_id_return
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtCreateColormap -- create a Colormap and initialize it for
- X * use with a PEX color approximation entry
- X *
- X * Description:
- X * This function creates a private X Colormap. The region of the Colormap
- X * that is described in a specified PEX color approximation entry is
- X * initialized according to the entry; cells outside the region are left
- X * with their default values, in order to reduce color flashing of X clients
- X * that are already using those cells when the new Colormap is installed.
- X * In the case of a PEXColorRange entry, the region is initialized to a
- X * gray ramp. As many cells in the Colormap are left read-only or unallocated
- X * as possible, while preserving the integrity of the color approximation
- X * region. This allows XAllocColor to be used with some success on the
- X * Colormap, although some colors still will not be found by that routine.
- X *
- X * This function is approximately equivalent to the following sequence
- X * of calls:
- X *
- X * PEXUtCreateWriteableColormap (...,&writeable_cmap_id);
- X * PEXUtModifyColormapForVendorDependencies (...,writeable_cmap_id,...).
- X * PEXUtCopyColormapAsReadOnly (..,writeable_cmap_id,..,&readonly_cmap_id).
- X * XFreeColormap (...,writeable_cmap_id);
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if the Colormap is
- X * successfully allocated and initialized.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use.
- X *
- X * vis_info is a pointer to a structure describing the Visual.
- X *
- X * capx_info is a pointer to the PEXColorApproxEntry of interest.
- X *
- X * On Exit:
- X * colormap_id_return points to storage allocated by the caller that has
- X * been written with the new Colormap ID.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtCreateColormap (
- X#if NeedFunctionPrototypes
- X Display *display,
- X XVisualInfo *vis_info,
- X PEXColorApproxEntry *capx_info,
- X Colormap *colormap_id_return
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtCreateWindow -- create a Window using specifed attributes
- X *
- X * Description:
- X * This function creates a Window in the specified Visual using a
- X * specified set of attributes. The window is not mapped; the application
- X * must take that action when appropriate. It is intended for use by
- X * applications that already have chosen a Visual and created a Colormap,
- X * and only need window creation. A typical use might be to create
- X * additional windows after PEXUtCreateWindowAndColormap has been used to
- X * create the first one; the windows would all share the same Colormap.
- X *
- X * The attributes are specified in a PEXUtWindowSpecification structure.
- X * For the most part, they are specified and used in the same way as the
- X * corresponding parameters of XCreateWindow. However, several restrictions
- X * are imposed. Please see the on-line manual page for a complete
- X * description of how to use the structure.
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if it is successful
- X * in creating the Window.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * screen is the screen number on which to creation a Window.
- X *
- X * window_info is a pointer to a structure describing the attributes
- X * to be used in Window creation.
- X *
- X * vis_info is a pointer to a structure describing the Visual.
- X *
- X * On Exit:
- X * window_return points to storage allocated by the caller that has
- X * been written with the identifier of the created Window.
- X *
- X * background_color_return
- X * points to storage allocated by the caller that has
- X * been written with an XColor structure describing
- X * the color that was chosen for the window background.
- X * (The background color is specified in the
- X * window_info structure as a color name, which is
- X * looked up in the Colormap specified in
- X * window_info->attr.colormap. This allows a newly
- X * created Colormap to be used for the Window.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtCreateWindow (
- X#if NeedFunctionPrototypes
- X Display *display,
- X int screen,
- X PEXUtWindowSpecification *window_info,
- X XVisualInfo *vis_info,
- X Window *window_return,
- X XColor *background_color_return
- X#endif
- X );
- X
- X
- X/******************************************************************************
- X *
- X * Function:
- X * PEXUtCreateWindowAndColormap -- choose a Visual, create a Colormap,
- X * and create a Window that is ready for
- X * PEX rendering
- X *
- X * Description:
- X * This function attempts to find the "best" Visual supported by a PEX server
- X * that meets a set of criteria specified by the caller. If it successfully
- X * finds a Visual, it determines a color approximation entry to use based
- X * on the criteria and the selected Visual. It creates a Colormap in
- X * the Visual and initializes it to support the color approximation entry,
- X * unless a standard colormap property was found that contains a Colormap ID
- X * AND the sharable_colormap criterion was specified, in which case the.
- X * shared colormap is used. Then it creates a Window in the Visual
- X * using the chosen Colormap.
- X *
- X * The choice of what is the "best" Visual is a policy decision that
- X * cannot be controlled by the caller; it is determined by the ordering
- X * of Renderer targets and by PEX interoperability convention.
- X *
- X * Criteria for Visual selection are specified in the PEXUtVisualCriteria
- X * structure. Criteria can be "hard" or "soft". Hard criteria must be met
- X * in order for a Visual to be considered as a candidate; if no Visual meets
- X * all hard criteria, the function returns a failure status. Soft criteria
- X * are considered when choosing among several candidate Visuals that meet
- X * all the hard criteria. There is an implicit hard criterion that PEX
- X * supports the Visual as a target (this can only be checked on 5.1 and later
- X * servers). There is an implicit soft criterion of significant weight:
- X * when several Visuals are qualifed by hard criteria, the utility prefers
- X * the Visual that appears earlier in the target list returned
- X * PEXMatchRenderingTargets (5.1 and later), or earlier in any other list
- X * established by interoperability convention. (Currently, an earlier
- X * appearance in one of the standard colormap properties that may be
- X * searched increases the likelihood of selection.)
- X *
- X * Window attributes are specified in a PEXUtWindowSpecification structure.
- X * For the most part, they are specified and used in the same way as the
- X * corresponding parameters of XCreateWindow. However, several restrictions
- X * are imposed. The Window has been mapped when the function returns.
- X *
- X * Any created Colormap has as many cells left read-only or unallocated as
- X * possible, while still preserving the integrity of the color approximation
- X * region. This allows XAllocColor to be used with the Colormap. Typically,
- X * shared Colormaps also allow use of this function.
- X *
- X * Please see the on-line manual page for a complete description of how
- X * to use the criteria and window attributes structures.
- X *
- X * Returns:
- X * The function returns a value of PEXUtSuccess if it is completely
- X * successful in finding a Visual that meets all hard and soft criteria,
- X * and in creating the Colormap and Window. PEXUtQualifiedSuccess is
- X * returned if the chosen Visual meets all hard criteria but not all
- X * soft criteria.
- X *
- X * A negative return value indicates failure:
- X *
- X * PEXUtCriteriaFailure means that no Visual was found that meets all
- X * the hard criteria.
- X *
- X * PEXUtXFailure means that an error was encountered in an Xlib call.
- X *
- X * PEXUtPEXFailure means that an error occurred during a PEXlib call.
- X *
- X * PEXUtAllocFailure means that the utility ran out of memory.
- X *
- X * On Entry:
- X * display indicates the X connection to use; it is assumed that
- X * PEXInitialize has already been called.
- X *
- X * screen is the screen number for which to choose a Visual.
- X *
- X * criteria is a pointer to a structure describing the criteria
- X * to be used in Visual selection.
- X *
- X * window_info is a pointer to a structure describing the attributes
- X * to be used in Window creation.
- X *
- X * On Exit:
- X * window_return points to storage allocated by the caller that has
- X * been written with the identifier of the created Window.
- X *
- X * vis_info_return points to storage allocated by the caller that has
- X * been written with a description of the chosen Visual.
- X *
- X * cmap_info_return points to storage allocated by the caller that has
- X * been written with a description of an RGB color map
- X * that might be appropriate for PEX rendering. If a
- X * standard colormap property was used to guide selection,
- X * this is a copy of the entry from the property that
- X * guided the choice. Otherwise, it is a description
- X * "synthesized" from the description of the Visual.
- X * The identifier of the Colormap attached to the Window
- X * is in cmap_info_return->colormap.
- X *
- X * capx_info_return points to storage allocated by the caller that has
- X * been written with a PEX color approximation entry
- X * that is compatible with the Visual and the criteria,
- X * and has been used to initialize any new Colormap.
- X * If no color approximation type was specified as a
- X * a criterion, this is typically a PEXColorSpace setup
- X * that matches the cmap_info_return data. If a color
- X * approximation type was specified, this is an entry
- X * of the appropriate type.
- X *
- X * unmet_criteria_return
- X * points to storage allocated by the caller that has
- X * been written with a combined mask of all hard and
- X * soft criteria that were not met by the chosen Visual.
- X * This parameter is valid when successful or when
- X * PEXUtCriteriaFailure is returned; it may not valid
- X * for failure returns.
- X *
- X * std_prop_atom_return
- X * points to storage allocated by the caller that has
- X * been written with the Atom for the name of the
- X * standard colormap property that was used in Visual
- X * selection, or None if no property was used.
- X *
- X * background_color_return
- X * points to storage allocated by the caller that has
- X * been written with an XColor structure describing
- X * the color that was chosen for the window background.
- X * (The background color is specified in the
- X * window_info structure as a color name, which is
- X * looked up in the Colormap specified in
- X * window_info->attr.colormap. This allows a newly
- X * created Colormap to be used for the Window.
- X *
- X * Restrictions:
- X * This function assumes that PEXInitialize has been called for the
- X * specified display argument.
- X *
- X * The ability of this procedure to verify that criteria are met depends
- X * on information available from the PEX server, including its support for
- X * various interoperability conventions. In general, if a hard criterion
- X * cannot be determined to have been satisfied or not, it is considered to
- X * have not been met; if a soft criterion cannot be verified, the utility
- X * acts as though it had been met but still returns the corresponding bit
- X * in unmet_criteria_return.
- X *
- X ******************************************************************************/
- X
- Xextern int PEXUtCreateWindowAndColormap (
- X#if NeedFunctionPrototypes
- X Display *display,
- X int screen,
- X PEXUtVisualCriteria *criteria,
- X PEXUtWindowSpecification *window_info,
- X Window *window_return,
- X XVisualInfo *vis_info_return,
- X XStandardColormap *cmap_info_return,
- X PEXColorApproxEntry *capx_info_return,
- X unsigned int *unmet_criteria_return,
- X Atom *std_prop_atom_return,
- X XColor *background_color_return
- X#endif
- X );
- X
- X#ifdef __cplusplus
- X} /* for C++ V2.0 */
- X#endif
- X
- X#endif /* } PEXUTCMAP_H */
- END_OF_FILE
- if test 49034 -ne `wc -c <'util/pexutcmap.h'`; then
- echo shar: \"'util/pexutcmap.h'\" unpacked with wrong size!
- fi
- # end of 'util/pexutcmap.h'
- fi
- echo shar: End of archive 1 \(of 14\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 14 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- echo "concatentating pexdraw.c ..."
- cat pexdrawc.? > pexdraw.c
- rm pexdrawc.?
- echo "concatentating pexdraw.uil ..."
- cat pexdrawu.? > pexdraw.uil
- rm pexdrawu.?
- echo "concatentating teapot.c ..."
- cat teapotc.? > teapot.c
- rm teapotc.?
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- // chris@IMD.Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! | sources-x@imd.sterling.com
- "It's intuitively obvious to the |
- most casual observer..." | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
-