mrcontrast__define.pro
mrcontrast
Methods:
Constructor
mrContrast::init : constructor, part II
General
mrContrast::display : (re-)display contrast bars on screen
mrContrast::setSensitivity : sensitivity to mouse movements
mrContrast::mode : returns 0 for center/width changes, 1 for gamma
mrContrast::setMode : set to 0 for center/width, to 1 for gamma changes
Event handling
mrContrast::selfregister : register with a display object
mrContrast::unregister : unregister
Private
mrContrast::reset : reset contrast to full width and center
mrContrast::update : update internal status from image information
mrContrast::mrdisplayEvtHandler : the event handler and broker for mr*display
mrContrast::imgChangeEvt : handling image change events
mrContrast::buttonDblClickEvt : handling of double clicks
mrContrast::buttonPressEvt : handling of button presses
mrContrast::buttonReleaseEvt : handling of button release
mrContrast::buttonMotionEvt : handling of motion while button pressed
mrContrast__define : constructor, part I
mrContrast::cleanup : destructor
Description:
Plugin to be used with mrdisplay and mrmultidisplay to change
center/width or gamma value of the displayed images upon mouse movements.
Option /bordermode of the selfregister method allows to have both on
the same mouse button. Double click will reset C/W or gamma, respectively.
/bordermode doesn't really work well with mrmultidisplay - see below.
Example code:
display = obj_new('mrdisplay')
contrast = obj_new('mrcontrast')
contrast->selfregister, display, button=3
display->activate
mrContrast::init
Syntax:
obj = obj_new('mrcontrast', parent, /vertical, /gamma, colbars=2, xsize=100, ysize=300 )
Arguments:
parent
id of the parent widget. If not provided, no colorbars are displayed
xsize
size in x of the colorbar drawing window (default: 100)
ysize
size in y of the colorbar drawing window (default: 300)
vertical
If set, the colorbars are displayed vertically, default is horizontal
The default values for xsize and ysize are exchanged in that case.
colbars
Colorbars to display. Possible values:
0 : display constant range colorbar only
1 : display adaptive range colorbar only
2 : display both colorbars
gamma
If set, mouse movements don't change center/width, but the gamma value
sensitivity
Float value, describting the sensitivity to mouse movements. Default is 0. (=auto)
color
[r,g,b] integer array for the foreground color
bgcolor
[r,g,b] integer array for the background color
Description:
Reasonable sensitivity values lie around 1./canvasSize in pixels. By default
mrcontrast tries to set a reasonable value when registering with the
display object - this is however only possible if the window is already
mapped to the screen when registering.
mrContrast::cleanup
Type:
Private Procedure
Description:
the destructor
mrContrast::setSensitivity
Type:
Procedure
Arguments:
float sensitivity
Description:
How sensitive should the contrast react to mouse movements? Reasonable
values lie around 1./canvas size in pixels
A value of '0.' sets sensitivity to 1./min(canvas size in x and y)
mrContrast::mode
Syntax:
mode = obj->mode()
Return value:
'0', if mouse movement changes center/width, '1' for gamma change
mrContrast::setMode
Syntax:
mode = obj->mode()
Return value:
'0', if mouse movement changes center/width, '1' for gamma change
'2', for C/W in center of screen and gamma when mouse is in right 15%
mrContrast::reset
Type:
Procedure
Description:
reset contrast to full width and center center. Will cause a call
to mr*display->display and redisplay mrcontrast colorbars.
mrContrast::display
Type:
Procedure
Description:
Redraw the colorbars
mrContrast::update
Type:
Procedure
Description:
Update the color bar scale values according to stored center and
width values. Called from image and palette change events.
Does not redisplay!
mrContrast::selfregister
Syntax:
obj->selfregister, display, button=int, /bordermode
Arguments:
display
An object of class mrdisplay or mrmultidisplay with which to register
button
The button number to use: left=1, middle=2, right=3 (def)
bordermode
If set, beginning a mouse button in the right 15% of the display object
will cause a change in gamma, otherwise center and width are changed.
Unluckily the 15% refer to the total canvas size, which might be
considerably larger than the displayed canvas size. I.e. when using
scroll bars, /bordermode might not be such a good option.
Description:
The contrast objects signs in for Button-press, -release and -motion
events with the specified display object.
To switch off interactive contrast change, set button to '0'.
mrContrast::unregister
Description:
unregisters with a mr*display object. It is a good idea to unregister
before destroying the mr*display object.
mrContrast::mrdisplayEvtHandler
Arguments:
*mrdisplayEvt event
Description:
Event dispatcher
mrContrast::imgChangeEvt
Arguments:
Calls:
Description:
Event handler for image change events.
mrContrast::buttonDblClickEvt
Arguments:
Calls:
Description:
Event handler for button double click events resets center and width
or gamma, depending on mode and (for mode = 2) mouse position
mrContrast::buttonPressEvt
Arguments:
Calls:
Description:
Event handler for button press events
Displays the current contrast scaling vals
mrContrast::buttonReleaseEvt
Arguments:
Description:
Event handler for button release events
Remove center/width values from display object
mrContrast::buttonMotionEvt
Arguments:
Calls:
Description:
Event handler for motion events while button is pressed
A bit unclean right now as we use low/high and center/width
simultaneously - this part needs some cleanup. Later.
mrContrast__define
Type:
Private procedure
Description:
The constructor