[Top] [Prev] [Next] [Bottom]

6.2 Miscellaneous Functions

6.2.1 bytscl: Convert to Color Array

Calling Sequence

bytscl( z[, top=max_byte][, cmin=lower_cutoff]
[, cmax=upper_cutoff] )

Description

bytscl returns an unsigned char array of the same shape as z, with values linearly scaled to the range 0 to one less than the current palette size. If max_byte is specified, the scaled values will run from 0 to max_byte instead.

If lower_cutoff and/or upper_cutoff are specified, z values outside this range are mapped to the cutoff value; otherwise the linear scaling maps the extreme values of z to 0 and max_byte.

6.2.2 histeq_scale: Histogram Equalized Scaling

**** NOT YET IMPLEMENTED ****

Calling Sequence

histeq_scale(z[, top=top_value][, cmin=cmin][, cmax=cmax] )

Description

histeq_scale returns a byte-scaled version of the array z having the property that each byte occurs with equal frequency (z is histogram equalized). The result bytes range from 0 to top_value, which defaults to one less than the size of the current palette (or 255 if no pli, plf, or palette command has yet been issued).

If non-nil cmin and/or cmax is supplied, values of z beyond these cutoffs are not included in the frequency counts.

6.2.3 mesh_loc: Get Mesh Location

Calling Sequence

mesh_loc( y0, x0[, y, x[, ireg]] )

Description

mesh_loc returns the zone index (=i+imax*(j-1)) of the zone of the mesh (x,y) (with optional region number array ireg) containing the point (x0,y0). If (x0,y0) lies outside the mesh, returns 0. For example, ireg(mesh_loc(x0,y0,y,x,ireg)) is the region number of the region containing (x0,y0). If no mesh specified, uses default. x0 and y0 may be arrays as long as they are conformable.

6.2.4 mouse: Handle Mouse Click

This function is useful in developing interactive graphics applications.

Calling Sequence

result = mouse(system, style, prompt)

Description

mouse displays the specified prompt, then waits for a mouse button to be pressed, then released. It returns a tuple of length eleven:

result = [x_pressed, y_pressed, x_released, y_released,
xndc_pressed, yndc_pressed, xndc_released,
yndc_released, system, button, modifiers]

If system>=0, the first four coordinate values will be relative to that coordinate system. For system<0, the first four coordinate values will be relative to the coordinate system under the mouse when the button was pressed.

The second four coordinates are always normalized device coordinates, which start at (0,0) in the lower left corner of the 8.5x11 sheet of paper the picture will be printed on, with 0.0013 NDC unit being 1/72.27 inch (1.0 point). Look in the style sheet for the location of the viewport in NDC coordinates (see the style keyword).

If style is 0, there will be no visual cues that the mouse command has been called; this is intended for a simple click. If style is 1, a rubber band box will be drawn; if style is 2, a rubber band line will be drawn. These disappear when the button is released.

Clicking a second button before releasing the first cancels the mouse function, which will then return nil. Ordinary text input also cancels the mouse function, which again returns nil.

The left button reverses forground for background (by XOR) in order to draw the rubber band (if any). The middle and right buttons use other masks, in case the rubber band is not visible with the left button.

result[8] is the coordinate system in which the first four coordinates are to be interpreted.

result[9] is the button which was pressed, 1 for left, 2 for middle, and 3 for right (4 and 5 are also possible).

result[10] is a mask representing the modifier keys which were pressed during the operation: 1 for shift, 2 for shift lock, 4 for control, 8 for mod1 (alt or meta), 16 for mod2, 32 for mod3, 64 for mod4, and 128 for mod5.

6.2.5 moush: Mouse in a Mesh

Calling Sequence

moush( [y, x[, ireg]] )

Description

moush returns the 1-origin zone index for the point clicked in for the default mesh, or for the mesh (x,y) (region array ireg).

6.2.6 pause: Pause

Calling Sequence

pause( milliseconds )

Description

Pause for the specified number of milliseconds of wall clock time, or until input arrives from the keyboard. This is intended for use in creating animated sequences.

Examples

Description of example(s).

first line code
middle lines of code
last line of code

Whatever.



[Top] [Prev] [Next] [Bottom]

support@icf.llnl.gov
Copyright © 1997,Regents of the University of California. All rights reserved.