[ Previous | Next | Contents | Glossary | Home | Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference

UMSXWindow Object

The UMSXWindow object is an Ultimedia Services Version 2 feature and does not apply to Ultimedia Services Version 1.2.1.

This class inherits from the UMSObject class.

UMSXWindow object provides an interface to the X Windowing System. Its purpose is to gather X Windowing System related methods into a single object for other objects to use. The object knows about StaticGray, TrueColor, GrayScale, PseudoColor, and DirectColor visuals. It does not know how to deal with the StaticColor visual. It can only handle specific depths and color orders of the visuals it knows about.

To learn more about the UMSXWindow object, see:

For introductory information, see Image Window and Negotiator Objects.

Preferred Sequence of Operations

In general the set_display_ptr() method must be called before other methods do anything besides return an error. Usually the method is called by the superclass.

After the display, image format, and window have been set these methods can be used: put_image().

If the set_screen() method is not called, then the default screen is used.

If the set_colormap_id() method is not called then the colormap ID is found from the window.

If the colormap associated with the window does not match the colormap set with the set_colormap_id() method, then the object changes the window colormap.

The set_colormap_attributes() and set_colormap() methods are only used with the RGB8Dither image format.

If the image format is RGB8Dither and set_colormap_attributes() and set_colormap() are not called to set the colors, then the colormap is used as it is.

If set_colormap_attributes() and set_colormap() are called without calling set_colormap_id(), then the object uses the default colormap returned by DefaultColormap().

The application must manage colormaps itself if the colormap for the window is different from the top level window of the application. The application should participate in installing or uninstalling the colormap at the proper times and/or set the WM_COLORMAP_WINDOWS window manager hint.

Note: Many window managers do not pay attention to WM_COLORMAP_WINDOWS but hopefully other window managers do.

Sharing Colormaps

Sharing colormaps means having several XWindow objects use the same colormap.

The non-writable colormaps are easy to share because the values cannot be set to something other than what the object expects. These visual types are StaticGray and TrueColor.

If the application owns a colormap and it needs several objects to use it and the visual type is StaticGray or TrueColor, then all it needs to do is call the set_colormap_id() method for each.

If the application owns a colormap and it needs several objects to use it and the visual type is PseudoColor and the application has already allocated the colors, then all it needs to do is call the set_colormap_id() method for each. As long as the set_colormap_attributes() and set_colormap() methods are not called the objects do not attempt to allocate any color cells.

If the application owns a colormap and it needs several objects to use it and the visual type is PseudoColor and the application has NOT allocated the colors, then it needs to do two things. It needs to call the set_colormap_id() method for each object. In addition it needs to call the set_colormap_attributes() and set_colormap() methods on only one of the objects. The other objects use the same colormap but do not attempt to allocate any color cells.

Not Sharing Colormaps

Not Sharing colormaps means having several XWindow objects each use a different colormap.

For the non-writable colormaps, StaticGray and TrueColor, not sharing is pointless.

For not sharing PseudoColor there is little change from shared. The object uses the colormap set with the set_colormap_id() method. The application can allocate colors as it needs them or call set_colormap_attributes() and set_colormap() to allocate the colors.

Enumeration Lists

To avoid name collision on defines, integer values have been captured as enumerated lists. The detailed method descriptions describe the valid or possible values for the specific use. The enumerated lists that are defined for this object are:

enum ReturnCode {
   Success, 
   Failure,
   UnsupportedVisual,   /* set_window() */
   NullPointer,
   InvalidArgument,
   ValueChanged
   };

Method Descriptions

ReturnCode set_display_ptr(in Display *x_display)

Description

This method does not work with DSOM. The display must be set before doing any other operation. Changing the display requires resetting all the other values: image format, window, and colormap.

Arguments
in Display *x_display The argument is of type (Display *).
Return Values

Success

Failure

UnsupportedVisual

ReturnCode get_display_ptr(out Display *x_display)

Description

This method does not work with DSOM.

Arguments
out Display *x_display The argument is of type (Display *).
Return Values

Success

Failure

NullPointer

ReturnCode set_screen(in unsigned long x_screen)

Description

If this method is not called the default screen is used. Changing this value requires resetting all the other values: image format, window, and colormap.

Arguments
in unsigned long x_screen The screen number to use.
Return Values

Success

Failure

ReturnCode get_screen(out unsigned long x_screen)

Description

This method returns the current screen number being used by the object.

Arguments
out unsigned long x_screen The screen number being used
Return Values

Success

Failure

NullPointer

ReturnCode set_window(in unsigned long x_window)

Description

Determines visual class of passed in window, can return UnsupportedVisual.

Attention: If the window has been created recently then flush your display with the XFlush() function before calling this method.
Arguments
in unsigned long x_window (X type Window) The window to be used.
Return Values

Success

Failure

UnsupportedVisual

ReturnCode get_window(out unsigned long x_window)

Description

This method returns the window set with set_window();

Arguments
out unsigned long x_window The value to be returned.
Return Values

Success

Failure

NullPointer

ReturnCode set_colormap_id(in unsigned long x_colormap_id)

Description

The argument is of type (Colormap). A colormap is required in order to create a window that has a visual that is different than the parent window. In that case this method can be called so that the colormap is used. If this method is called it should be done before calling set_window().

Arguments
in unsigned long x_colormap_id The colormap ID to use.
Return Values

Success

Failure

ReturnCode get_colormap_id(out unsigned long x_colormap_id)

Description

The argument is of type (Colormap).

Arguments
out unsigned long x_colormap_id The colormap ID being used.
Return Values

Success

Failure

NullPointer

ReturnCode set_colormap_attributes(in boolean allow_new_colormap, in unsigned long base_index, in unsigned long size, out unsigned long actual_base_index, out unsigned long actual_size, out unsigned long colormap_id)

Description

This method is called to indicate which colormap cells should be used. It might use the colormap associated with the window; it might create a new colormap. The actual colormap that is used is returned. Calling this method causes the currently saved colormap to be freed. The caller has to call set_colormap() to fill in the colormap. This method only applies when the image format is RGB8Dither.

Arguments
in boolean allow_new_colormap If true the object is free to create a new colormap. The colormap is deallocated when the object is deallocated.
in long unsigned base_index The start index of the colors to be used. This is the index of the first cell in the colormap to be used.
in long unsigned long size This is the number of cells in the colormap to be used.
out long unsigned long actual_base_index This is the value of base_index that the object can support. The return value is ValueChanged if this is not the same.
out long unsigned long actual_size This is the value of size that the object can support. The return value is ValueChanged if this is not the same.
out unsigned long colormap_id This is the current colormap being used by the object.
Return Values

Success

Failure

ValueChanged

NullPointer

ReturnCode get_colormap_attributes(out long index, out long size)

Description

This method returns the values set with set_colormap_attributes(). This method only applies when the image format is RGB8Dither.

Arguments
out long index The start index of the colors to be used. This is the index of the first cell in the colormap to be used.
out long size This is the number of cells in the colormap to be used.
Return Values
Success If no error is found.
Failure If an error is found that is not described by any other return code.
NullPointer If a null pointer is passed instead of &index and &size.

ReturnCode set_colormap(in sequence<octet> map_maybe, out sequence<octet> map_really)

Description

This method allows the values of the colormap cells to be set. The values should only be the ones specified by the set_colormap_attributes() method. The set_colormap_attributes() method must be called before calling this method. The caller should pass the address of the sequence structure for map_really. The format of the data is one byte of pad, one byte of red, one byte of green, one byte of blue. Each colormap cell is represented by a total of four bytes. If map_really->_maximum, map_really->_length, and map_really->_buffer are all zero (NULL) then this method allocates the buffer using SOMMalloc() for the return value. If they are not zero (NULL) then this method just copies the value into the sequence. This method only applies when the image format is RGB8Dither.

Arguments
in sequence<octet> map_maybe These are the values that the caller wants the colormap cells to be set to.
out sequence<octet> map_really These are the values that the object was able to set the colormap cells to. The return value is ValueChanged if this is different from map_maybe.
Return Values

Success

Failure

ValueChanged

NullPointer

ReturnCode get_colormap(out sequence<octet> map)

Description

For any application that wants to bind another window to the same colormap. The values returned are only the ones specified by the set_colormap_attributes() method. The caller should pass the address of the sequence structure for map. The format of the data is one byte of pad, one byte of red, one byte of green, one byte of blue. Each colormap cell is represented by a total of four bytes. If map->_maximum, map->_length, and map->_buffer are all zero (NULL) then this method allocates the buffer using SOMMalloc() for the return value. If they are not zero (NULL) then this method just copies the value into the sequence. This method only applies when the image format is RGB8Dither.

Arguments
out sequence<octet> map The sequence inside which to return the values of the current colormap.
Return Values

Success

Failure

NullPointer

ReturnCode recommend_visual_id(in string format, out unsigned long x_visual_id)

Description

This method returns the X visual ID that works with the format specified. The x_visual_id is of type (VisualID).

Arguments
in string format The image format the caller wants to use.
out unsigned long x_visual_id The X visual ID that the object can use on the current display.
Return Values

Success

Failure

NullPointer

InvalidArgument

UnsupportedVisual

ReturnCode set_image_format(in string image_format)

Description

Changing the image format can require a call to set_window() with a new window that matches the new visual required to handle the new format.

Arguments
in string image_format This is the format of the images the caller wants to send to a window.
Return Values

Success

Failure

InvalidArgument

UnsupportedVisual

ReturnCode get_image_format(out string image_format)

Description

This method allows the caller to get the current image_format.

Arguments
out string image_format The current image format.
Return Values

Success

Failure

NullPointer

ReturnCode put_image(in sequence<octet> image, in long width, in long height, in long x, in long y)

Description

This method does an XPutImage() to the window.

Arguments
in sequence<octet> image The image.
in long width The width in pixels of the image.
in long height The height in pixels of the image.
in long x The X location in the window of the upper-left corner of the image.
in long y The Y location in the window of the upper-left corner of the image.
Return Values

Success

Failure

NullPointer

ReturnCode is_remote(out unsigned long result)

Description

This method determines if the display on a remote machine.

Arguments
out unsigned long result This return value is zero (false) if the display is local. This value is nonzero (true) if the display is remote.
Return Values

Success

Failure

NullPointer

ReturnCode has_xv(in string adaptor_name, out unsigned long result)

Description

This method determines if the current display supports the XV extension. If adaptor_name is null, it returns true if the server has the XV extension. If the adaptor_name is not null, it returns true if the server has the XV extension and one of the supported adapters' XvAdaptorInfo.name matches adaptor_name.

Arguments
in string adaptor_name Either a NULL pointer or the name of an XV supported adapter on the display.
out unsigned long result If adaptor_name is NULL then this return value is zero (false) if the display does not have the XV extension. This value is nonzero (true) if the display does have the XV extension. If adaptor_name is non-null, then the result is true only if the XV extension is present and the adapter is supported.
Return Values

Success

Failure

NullPointer

ReturnCode get_gc(out GC x_gc)

Description

This method returns the X GC created inside the object. The caller should not change the GC values. And it cannot be used after the object is freed (because the object frees it). If the caller would like to change the GC values or keep it after the object has been freed then use the X function XCopyGC(). This method does not return success unless the set_window() method has been called.

Arguments
out GC x_gc The graphics context from the object.
Return Values

Success

Failure

NullPointer

ReturnCode query_colormap(in unsigned long colormap_id, in unsigned long base, in unsigned long size, out sequence<octet> colormap)

Description

This method allows the values of the colormap cells to be queried. The format of the data is one byte of pad, one byte of red, one byte of green, one byte of blue. Each colormap cell is represented by a total of four bytes. This method allocates the buffer using SOMMalloc() for the return value. This method works independent of the other colormap methods.

Arguments
in unsigned long colormap_id The ID of the colormap to query.
in unsigned long base The value of the first pixel to query.
in unsigned long size The number of contiguous pixels to query.
out sequence<octet> colormap The place to return the values as described in the description above.
Return Values

Success

Failure

NullPointer

For introductory information, see Image Window and Negotiator Objects.


[ Previous | Next | Contents | Glossary | Home | Search ]