ImageOverlay

[ XITE Reference Manual | XITE home ]

Contents


Name

ImageOverlay, ImageOverlayColor, ImageOverlayCopyImageOverlayPart, ImageOverlayCopyImagePart, ImageOverlayCopyResources, ImageOverlayGetResources, ImageOverlayDisplay, ImageOverlayDrawBox, ImageOverlayDrawLine, ImageOverlayDrawOrigo, ImageOverlayDrawPoint, ImageOverlayDrawRectangle, ImageOverlayFill, ImageOverlayPosXYtoAdr, ImageOverlayProtect, ImageOverlayRedisplay, ImageOverlayScreenXYtoAdr, - XITE X11 image overlay widget

Application header file

<xite/ImageOverlay.h>

Class header file

<xite/ImageOverlayP.h>

Class

imageOverlayWidgetClass

Class Name

ImageOverlay

Superclass

Image

Description

The ImageOverlay widget is part of the XITE (X-based Image Processing Tools and Environment) software. It is used by some of the display programs supplied with XITE.

Most of the functionality is taken care of by the superclass Image widget (see Image(3) for information on this).

The ImageOverlay widget provides two extra facilities over the Image widget. They are the ability to display an overlay image and the ability to manipulate a region of interest (ROI).

See the documentation on the main XITE display program xshow(1) as well as the XITE ximage toolkit ximage(3) for more information on how this widget can be used in an application.

Resources

Apart from the resources of the superclass:

XtNoverlay (class XtCOverlay)
Type: Pointer, Default: NULL

This refers to the complete data structure for the band/channel of the overlay image. It does not necessarily refer to the first pixel (unless the data structure only consists of the pixels with no header information).

XtNprotectOverlay (class XtCProtectOverlay)
Type: Boolean, Default: "false"

Whether or not to protect the overlay from being changed.

XtNdisplayOverlay (class XtCDisplayOverlay)
Type: Boolean, "true"

Whether or not to show the overlay.

XtNoverlaytab (class XtCOverlaytab)
Type: int, Default: -1

An index into an array of colortables. This resource identifies which colortable (in the array of colortables) is active for the image overlay part. The array is not local to the image widget, but must be supplied by the application.

The default value (of -1) will make the widget Initialize method choose the value 0.

XtNoverlayColorCells (class XtCOverlayColorCells)
Type: int, Default: -1

Number of colors actually used to display the overlay image. This will typically be different from the length of the X colormap used by the window, because the non-overlay part of the image will probably be using more colors than the overlay image.

The default value (of -1) will make the widget Initialize method calculate a legal value based on the XtNdisplayMethod resource. Currently the only value used is 32.

XtNoverlayColorPtr (class XtCOverlayColorPtr)
Type: Pointer, Default: NULL

A reference to an integer array of XtNoverlayColorCells elements.

Each overlay pixel value is transformed into a new value before it is sent to the pixmap (which will be shown in a screen window). The original pixel value is used as an index into an integer array. The value in the array cell becomes the pixel value in the pixmap.

The integer transformation array (which always has 256 elements) is identical to the XtNoverlayColorPtr array for the first XtNoverlayColorCells elements. If XtNoverlayColorCells < 256, then the XtNoverlayColorPtr array is repeated in the transformation array.

With e.g. XtNoverlayColorCells equal to 32 and XtNoverlayColorPtr an array from 192 to 223, the integer transformation array contains the 256 values 192,...223,192,...,223,.... The overlay pixelvalues will then be transformed (by the first 32 elements) into the range 192,...,223.

The default value (NULL) will make the widget Initialize method determine a value for this resource. With the XtNdisplayMethod set to give "reduced-color" display, then this array will be a 32-element array with values from 192 to 223.

XtNdrawColor (class XtCDrawColor)
Type: int, Default: NULL

The color used to draw the overlay.

XtNdrawProc (class XtCDrawProc)
Type: XtCallbackList, Default: NULL

The functions on this callback list will be called by the draw action function described below.

XtNroiProc (class XtCRoiProc)
Type: XtCallbackList, Default: NULL

The functions on this callback list will be called by the roi action function when the first action-function argument is one of StartDrag, ExtendDrag, StopDrag, StopMove, Move, Drag.

XtNroiActivated (class XtCRoiActivated)
Type: int, Default: NULL

True if a ROI is active (being changed).

XtNroiX (class XtCRoiX)
Type: int, Default: NULL

Horizontal position of ROI, relative to screen.

XtNroiY (class XtCRoiY)
Type: int, Default: NULL

Vertical position of ROI, relative to screen.

XtNroiWidth (class XtCRoiWidth)
Type: int, Default: NULL

Horizontal width of ROI, relative to screen.

XtNroiHeight (class XtCRoiHeight)
Type: int, Default: NULL

Vertical height of ROI, relative to screen.

XtNroiZoomPan (class XtCRoiZoomPan)
Type: Boolean, Default: "false"

Whether or not ROI is to zoom and pan with the image.

XtNroiDisplay (class XtCRoiDisplay)
Type: int, Default: NULL

Whether or not to show ROI.

XtNroiPermanent (class XtCRoiPermanent)
Type: int, Default: NULL

Whether ROI should be permanently displayed (or only while being made).

XtNroiFill (class XtCRoiFill)
Type: int, Default: NULL

Whether the inside of the ROI rectangle should be filled.

XtNroiXaspect (class XtCRoiXaspect)
Type: int, Default: NULL

Nonzero if ROI should be square.

XtNroiYaspect (class XtCRoiYaspect)
Type: int, Default: NULL

Nonzero if ROI should be square.

ImageOverlay actions

draw

Draw graphics in the overlay image. Some basic drawing routines are available:

draw(origo [, on/off])
Toggle origo (or on/off).

draw(point [, size])
Draw a point, or a cross of size "size".

draw(line)
Draw line from origo

draw(rectangle)
Draw rectancle from origo

draw(box)
Draw filled rectancle from origo

draw(fill)
Fill region (4-neighbour)

draw(clear)
Clear region (8-neighbour)

draw(graphic [, on/off])
Toggle overlay plane (or on/off)

draw(protect [, on/off])
Toggle protect switch (or on/off)

draw(color [, newval])
Increase draw color index by one (or set to newval).

roi
Draw inverted region of interest. The available routines are

roi(StartDrag)
Set first corner of ROI

roi(Drag)
Move second corner of ROI

roi(StopDrag)
Set second corner of ROI

roi(StartMove)
Notify ROI

roi(Move)
Move ROI

roi(StopDrag)
Notify stop Move

roi(ExtendDrag)
Keep first corner of an existing ROI

WMColormap
WMColormap informs the window manager about desired colormaps. This will enable a visible menubar and visible popup menus in an image window also when the image is displayed with some combination of DirectColor visual and non-reduced-color mode display.

WMColormap(Enter)
Mouse pointer enters image.

WMColormap(Leave)
Mouse pointer leaves image.

The draw and roi action functions assign values to the attributes of the ImageOverlayCallbackRec structure and invoke the callback functions on the XtNdrawProc and XtNroiProc callback-lists respectively, with a reference to the ImageOverlayCallbackRec structure.

The attributes of the ImageOverlayCallbackRec structure are

reason
An integer with a value indicating which draw action was desired.

event
An "XEvent *" reference to the event which triggered the action function.

img
A "struct imagestruct *" reference to the XtNimageImage resource of the widget in which the event took place.

band
A "struct bandstruct *" reference to the XtNimageBand resource of the widget in which the event took place.

overlay
A "struct bandstruct *" reference to the XtNimageOverlay resource of the widget in which the event took place.

value
An integer with the color index used to draw the overlay plane.

x, y
Two integers which represent the coordinates where one of the events ButtonPress, ButtonRelease or MotionNotify took place (or else where the previous event took place).

width, height
Always zero.

xorigo, yorigo
The private imageoverlay widget variabels xorigo and yorigo.

Default translation bindings

 <Key>Q:          kill()
 <Key>C:          draw(color)
 <Key>P:          draw(protect)
 <Key>G:          draw(graphic)
 <EnterWindow>:   WMColormap(Enter)
 <LeaveWindow>:   WMColormap(Leave)
 None<Key>Left:   zoom_pan(+0, -4, +0)
 None<Key>Right:  zoom_pan(+0, +4, +0)
 None<Key>Up:     zoom_pan(+0, +0, -4)
 None<Key>Down:   zoom_pan(+0, +0, +4)
 Shift<Key>Left:  zoom_pan(+0, -16, +0)
 Shift<Key>Right: zoom_pan(+0, +16, +)
 Shift<Key>Up:    zoom_pan(+0, +0, -16)
 Shift<Key>Down:  zoom_pan(+0, +0, +16)
 Ctrl<Key>Left:   zoom_pan(+0, -256, +0)
 Ctrl<Key>Right:  zoom_pan(+0, +256, +0)
 Ctrl<Key>Up:     zoom_pan(+0, +0, -256)
 Ctrl<Key>Down:   zoom_pan(+0, +0, +256)
 Shift Ctrl <Btn1Down>:
        zoom_pan(*8, MousePosC, MousePosC)
 Shift Ctrl <Btn2Down>:
        zoom_pan(1, MousePosC, MousePosC)
 Shift Ctrl <Btn3Down>:
        zoom_pan(/8, MousePosC, MousePosC)
 Ctrl <Btn1Down>: zoom_pan(*2, MousePosC, MousePosC)
 Ctrl <Btn2Down>: zoom_pan(0, MousePosC, MousePosC)
 Ctrl <Btn3Down>: zoom_pan(/2, MousePosC, MousePosC)
 None <Btn2Up>:   notify()
 None <Btn3Up>:   notify()
 <MouseMoved>:    notify()

ImageOverlay callbacks

There are two callback lists, identified by the resources XtNdrawProc and XtNroiProc. See the description of these resources.

Predefined pixeltype

Apart from the pixeltypes defined by the superclass:

overlaypixel

 pixelname : ImageOverlayPixel,
 pixelsize : 1,
 resize    : ImageOverlayResize,
 printf    : ImageOverlayPrintf,
 txtlen    : 3,
 scaletype : SCALE_NONE,
 scalea    : 0.0,
 scaleb    : 0.0,

Convenience routines

Routines for coordinates of image and screen window.

ImageOverlayScreenXYtoAdr

 ImageData ImageOverlayScreenXYtoAdr(
    ImageOverlayWidget wid, int x, int y,
    int option );

ImageOverlayScreenXYtoAdr returns a pointer to the pixel which has screen window coordinates (x,y). option is not used.

ImageOverlayPosXYtoAdr

 ImageData ImageOverlayPosXYtoAdr(
    ImageOverlayWidget wid, int x, int y,
    int option );

ImageOverlayPosXYtoAdr returns a pointer to the pixel which has image coordinates (x,y). option is not used.

Routines for drawing in the overlay

ImageOverlayProtect

 int ImageOverlayProtect(
    ImageOverlayWidget wid, int state );

Set new protect status of overlay plane. state may be OVERLAY_CLEAR, OVERLAY_SET or OVERLAY_TOGGLE.

ImageOverlayFill

 int ImageOverlayFill( ImageOverlayWidget wid,
    int x, int y, int search, int fill, int nc,
    int mode, update_status update );

Fill an area with the pixelvalue fill. Start in position (x,y). Follow nc. nc = 4 (4 connected neighbours) or nc = 8 (8 connected neighbours).

 'mode' = 0, border fill.
             while (pix != search) fill;
 'mode' = 1, flood fill.
             while (pix == search) fill;

update = TRUE will activate ImageRedisplayArea.

ImageOverlayDrawRectangle

 int ImageOverlayDrawRectangle(
    ImageOverlayWidget wid, int x1, int y1,
    int x2, int y2, int value,
    update_status update );

Draw a filled rectangle in the overlay image at image coordinates (x,y) with size (width, height). The rectangle is filled with value pixels. The special value -1 is used for drawing by inverting the pixels. update = TRUE will activate ImageRedisplayArea.

ImageOverlayDrawPoint

 int ImageOverlayDrawPoint(
    ImageOverlayWidget wid, int x, int y,
    int size, int value,
    update_status update );

Draw a point in the overlay image at image coordinates (x,y). If size > 1, the point is written as a cross of size size. The point is filled with value pixels. The special value -1 is used for drawing by inverting the pixels. update = TRUE will activate ImageRedisplayArea.

ImageOverlayDrawOrigo

 int ImageOverlayDrawOrigo(
    ImageOverlayWidget wid, int origo, int x,
    int y );

Set Boolean value origo and the coordinates to (x,y). Draw functions which need an origo will draw only if origo is true.

ImageOverlayDrawLine

 int ImageOverlayDrawLine(
    ImageOverlayWidget wid, int x1, int y1,
    int x2, int y2, int value,
    update_status update );

Draw a line in the overlay image from image coordinates (x1,y1) to (x2,y2). The line is written with value pixels. The special value -1 is used for drawing by inverting the pixels. update = TRUE will activate ImageRedisplayArea.

ImageOverlayDrawBox

 int ImageOverlayDrawBox(
    ImageOverlayWidget wid, int x1, int y1,
    int x2, int y2, int value,
    update_status update );

Draw a filled rectangle in the overlay image at image coordinates (x1,y1) to (x2, y2). The rectangle is filled with value pixels. The special value -1 is used for drawing by inverting the pixels. update = TRUE will activate ImageRedisplayArea.

ImageOverlayColor

 int ImageOverlayColor( ImageOverlayWidget wid,
    int col );

Set new overlay color.

ImageOverlayDisplay

 int ImageOverlayDisplay(
    ImageOverlayWidget wid,
    update_status update );

Set new display status of overlay plane. state may be OVERLAY_CLEAR, OVERLAY_SET or OVERLAY_TOGGLE. This determines whether or not the overlay image should be shown.

Miscellaneous routines:

ImageOverlayRedisplay

 void ImageOverlayRedisplay( Widget wid,
    update_status update );

If update is nonzero, sets the private widget variable update equal to update. Calls the resize and expose methods. For the expose method, the region and event arguments are NULL.

ImageOverlayCopyImagePart

 void ImageOverlayCopyImagePart(
    ImageOverlayWidget widto,
    ImageOverlayWidget widfrom );

Sets the XtNimageImage resource in widto equal to the XtNimageImage resource in widfrom. No resizing or exposure is done.

ImageOverlayCopyImageOverlayPart

 void ImageOverlayCopyImageOverlayPart(
    ImageOverlayWidget widto,
    ImageOverlayWidget widfrom );

Sets the image_overlay part of widto equal to the image_overlay part of widfrom. No resizing or exposure is done.

ImageOverlayCopyResources

 void ImageOverlayCopyResources(
    ImageOverlayWidget widto,
    ImageOverlayWidget widfrom );

Sets the resources of the ImageOverlayPart of widto equal to the resources of the ImageOverlayPart of widfrom.

ImageOverlayGetResources

 void ImageOverlayGetResources(
    ImageOverlayWidget wid,
    ArgList *args, Cardinal *num_args );

Returns a list of resource-value pairs for all the resources of wid. If the function is called before the class is initialized, the resource list as specified in the class record is returned. If it is called after the class has been initialized, the returned list also contains the superclass resources.

ImageOverlayGetImageOverlayResources

 void ImageOverlayGetImageOverlayResources(
    ImageOverlayWidget wid, ArgList *args,
    Cardinal *num_args );

Returns a list of resource-value pairs for the resources which are specific for an ImageOverlay widget (not including super-class resources).

See also

Image(3), ImageFormat(3), xshow(1), ximage(3)

Author

Otto Milvang

Revised

Svein Bøe

Doc

Svein Bøe