Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
2.  DPS Features and Enhancements DPS Compositing Operators Operator Descriptions  Previous   Contents   Next 
   
 

Figure 2-3 shows the result of the compositing operations.

Figure 2-3 Results of Compositing Operations

compositerect destx desty width height op compositerect -

In general, this operator is the same as the composite operator except that there is no real source image. The destination is in the current graphics state; destx, desty, width, and height describe the destination image in that graphics state's current coordinate system. The effect on the destination is as if there were a source image filled with the color and coverage specified by the graphics state's current color and coverage parameters. op has the same meaning as the op operand of the composite operator; however, one additional operation, Highlight, is allowed.

Highlight turns every white pixel in the destination rectangle to light gray and every light gray pixel to white, regardless of the pixel's coverage value. Light gray is defined as 2/3. Repeating the same operation reverses the effect. (On monochrome displays, Highlight inverts each pixel so that white becomes black, black becomes white.)


Note - The Highlight operation doesn't change the value of a pixel's coverage component. To ensure that the pixel's color and coverage combination remains valid, Highlight operations should be temporary and should be reversed before any further compositing.


For compositerect, the pixels included in the destination are those that the outline of the specified rectangle encloses or enters. The destination image is clipped to the frame rectangle and clipping path of the window in the current graphics state.

Errors rangecheck, stackunderflow, typecheck

See also composite, setalpha, setgray, sethsbcolor, setrbgcolor

dissolve srcx srcy width height srcgstate destx desty delta dissolve -

The effect of this operation is a blending of a source and a destination image. The first seven arguments choose source and destination pixels as they do for composite. The exact fraction of the blend is specified by delta, which is a floating-point number between 0.0 and 1.0. The resulting image is:

delta * source + (1-delta) * destination

If srcgstate is null, the current graphics state is assumed.

Errors stackunderflow, typecheck

See also composite

The values of the composite op are available for applications in the PostScript systemdict. The definitions are as follows:

/Clear 0 def

/Copy 1 def

/Sover 2 def

/Sin 3 def

/Sout 4 def

/Satop 5 def

/Dover 6 def

/Din 7 def

/Dout 8 def

/Datop 9 def

/Xor 10 def

/PlusD 11 def

/Highlight 12 def

/PlusL 13 def

Implementation Notes and Limitations

Partially Transparent Alpha

Alpha values that are not completely opaque (1) or completely transparent (0) should be used with caution. Compositing operations with partial transparency yield the highest image quality only when a large number of colors are available in the DPS color cube and gray ramp. That is, image quality is best with a 24-bit TrueColor or 8-bit StaticGray visual, and image quality will be poor with an 8-bit PseudoColor visual. In addition, the performance of compositing operations is greatly reduced for partially transparent pixels due to the extra computation required in these cases.

Indexed Color Visuals

For best results with the Highlight op, the number of colors in the DPS context's gray ramp should be such that

fract(((float) numgrays - 1)* 2. / 3.) == 0

In other words, (numgrays = 4, 7, 6, 8, 16, ....). This ensures that the color 2/3 gray is not halftoned.

Given the limited number of colors usually available in the DPS color cube and gray ramp, images with alpha values that are not completely opaque (1) or completely transparent (0) should be avoided to obtain best image quality.

Compositing operations are only defined for pixels values that are in the gray ramp or color cube specified by the gstate. Compositing pixels with values outside the color cube and gray ramp may not yield expected results.

Monochrome Displays

The results of compositing operations for 1-bit drawables that have alpha values that are not equal to 0 or 1 is undefined.

The op Highlight inverts the color of the pixel on a 1-bit drawable.

Interaction with X Drawing Operations

Drawables that have been rendered to with non-opaque alpha have additional pixel storage associated with them, called the alpha channel. X Window system operations do not affect the alpha channel, with the following exceptions:

  • When windows with alpha channel are exposed, if the window has an X background defined (background != None), when the background is painted, the alpha component of the exposed pixels is painted with alpha = 1.

  • When a window is resized, the alpha channel storage is resized.

Destroying the Alpha Channel

The erasepage operator paints the current drawable of the graphics state with opaque white. Thus, the alpha values for all pixels in the drawable are equal to 1, and the alpha channel storage is destroyed.

Drawables with Unequal Depths

Compositing drawables with unequal depths is undefined.

 
 
 
  Previous   Contents   Next