Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  DPS Features and Enhancements DPS Security Issues Secure Context Creation  Previous   Contents   Next 
   
 

When DPS Encounters Internal Errors

DPS conducts consistency checks during execution. In the rare event that it encounters internal errors, DPS applications will not be able to connect to the server. If this happens, you must restart the Solaris environment. If a client tries to connect to a server with the DPS extension in this state, the following error message sometimes appears:

XError:

130 Request Major code 129

(Adobe-DPS_Extension)

How To Access Information From Adobe

The following information is readily available from Adobe's public access file server: source code examples, Adobe Metric Font (AMF) files, documentation, PostScript printer description (PPP) files, and press releases. You can obtain this information if you have access to the Internet or UUCP electronic mail.

If you have access to the Internet, use the file transfer protocol (ftp) program to download files from the ftp.mv.us.adobe.com machine. Read the README.first file for information on the archived files. For details on obtaining information from Adobe by electronic mail, see the "Public Access File Server" section in the preface of Programming the Display PostScript System with X.

DPS Compositing Operators


Caution - The operators defined in this section are extensions to the Display PostScript language. They are not part of the standard DPS and thus are not available in all DPS implementations. An application that depends on these operators is not portable and cannot display on servers that do not support these operators.


Compositing is an OpenStep™ extension to the Display PostScript system. Compositing enables separately rendered images to be combined into a final image. It encompasses a wide range of imaging capabilities:

  • It provides a means for simply copying an image as is from one place to another with PostScript.

  • It allows two images to be added together so that both appear in the composite superimposed on each other.

  • It defines a number of operations that take advantage of transparency in one or both images that are combined. When the images are composited, the transparency of one image can let parts of the other image show through.

Compositing can be used for copying within the same window, as during scrolling, or for taking an image rendered in one drawable and transferring it to another. In OpenStep applications, images are often stored in pixmaps and composited into windows as they are needed.

When images are partially transparent, they can be composited so that the transparent sections of one image determine what the viewer sees of the other. Each compositing operation uses transparency in a different way. In a typical operation, one image provides a background or foreground for the other. When parts of an image are transparent, it can be composited over an opaque background, which will show though transparent "holes" in the image on top. In other operations, transparent sections of one image can be used to "erase" matching sections of the images it is composited with. In most operations, the composite is calculated from the transparency of both images.

Compositing with transparency can achieve a variety of interesting visual effects. A partially transparent, uniformly gray area can be used like a pale wash to darken the image it is composited with. Patches of partially transparent gray can add shadows to another image. Repeated compositing while slowly altering the transparency of two images can dissolve one into another. Or an animated figure can be composited over a fixed background.

Before images can be composited, they must be rendered. To take advantage of transparency when compositing, at least one of the images needs to be rendered with transparent paint.

The following PostScript program fragment shows the use of the compositing operators. The program creates two simple images and composites them. The first image, the destination, is a 0.8 gray triangle on a white background; the second, the source, is a 0.6 gray triangle on a transparent background.

% 
Create the Destination triangle

% Make the background of the source transparent  0

0.8 setgray  100 100 moveto  100 0 rlineto  0 -100 rlineto  fill  

setalpha  0 0 100 100 rectfill  % Draw the Source triangle

1 setalpha  0.6 setgray  0 0 moveto  0 100 rlineto  100 0 rlineto  fill  

% Compute the result 

0 0 100 100 null 100 0 Sover composite 

The eighth operand to the composite operator, Sover, defines how the source and destination pixels are combined. In the example, the opaque parts of the source image are placed over the destination image. The resulting image looks like Figure 2-2.

Figure 2-2 Compositing Operator Example Program

Operator Descriptions

This section describes the new DPS operators. The information is provided in the format used in the PostScript manuals PostScript Language Reference Manual and Programming the Display PostScript System with X.

setalpha coverage setalpha

Sets the coverage parameter in the current graphics state to coverage. coverage should be a number between 0 and 1, with 0 corresponding to transparent, 1 corresponding to opaque, and intermediate values corresponding to partial coverage. The default value is 1. This establishes how much background shows through for purposes of compositing. If the coverage value is less than 0, the coverage parameter is set to 0. If the value is greater than 1, the coverage parameter is set to 1.

The coverage value affects the color painted by PostScript marking operations. The current color is pre-multiplied by the alpha value before rendering. This multiplication occurs after the current color has been transformed to RGB space.

Errors stackunderflow, typecheck

See also composite, currentalpha

currentalpha -currentalpha coverage

Returns the coverage parameter of the current graphics state.

Errors None

See also composite, setalpha

composite srcx srcy width height srcgstate destx desty op composite

Performs the compositing operation specified by op between pairs of pixels in two images, a source and a destination. The source pixels are in the drawable referred to by the srcgstate graphics state, and the destination pixels are in the drawable specified by the current graphics state. If srcgstate is NULL, the current graphics state is assumed.

The rectangle specified by srcx, srcy, width, and height defines the source image. The outline of the rectangle may cross pixel boundaries due to fractional coordinates, scaling, or rotated axes. The pixels included in the source are all those that the outline of the rectangle encloses or enters.

The destination image has the same size, shape, and orientation as the source; destx and desty give destination's location image compared to the source. Even if the two graphic states have different orientations, the images will not; composite will not rotate images.

Both images are clipped to the frame rectangles of the respective drawables. The destination image is further clipped to the clipping path of the current graphics state. The result of a composite operation replaces the destination image.

op specifies the compositing operation. The color of each destination image pixel (alpha value) after the operation, dst' (dstA'), is given by:

	dst' = src *

Fs(srcA, dstA, op) + dst * Fd(srcA, dstA, op)
	dstA' = srcA *

Fs(srcA, dstA, op) + dstA * Fs(srcA, dstA, op)

where src and srcA are the source color and alpha values, dst and dstA are the destination color and alpha values, and Fs and Fd are the functions given in Table 2-2.

The choices for the composite op are given in Table 2-2. See Figure 2-3for the result of each operation.

Errors rangecheck, stackunderflow, typecheck

See also compositerect, setalpha, setgray, sethsbcolor, setrgbcolor

Table 2-2 Factors of the Compositing Equation

Op

Fs

Fd

Clear

0

0

Copy

1

0

Sover

1

1 - srcA

Sin

dstA

0

Sout

1 - dstA

0

Satop

dstA

1 - srcA

Dover

1 - dstA

1

Din

0

srcA

Dout

0

1 - srcA

Datop

1 - dstA

srcA

Xor

1 - dstA

1 - srcA

PlusD1

N/A

N/A

PlusL2

1

1

1 PlusD does not follow the general equation. The equation is dst'=(1-dst)+(1-src). If the result is less than 0 (black), then the result is 0.

2 For PlusL, the addition asturates. That is, if (src+dst) > white), the result is white.

 
 
 
  Previous   Contents   Next