The "kwin" Package
These routines are meant to provide a high level mechanism to create and
manipulate pixel canvases. After creating a pixel canvas from some graphics
system primitive object, the canvas may be manipulated without the need to
use the underlying graphics system interface. This renders code much more
portable.
Library: karmagraphics
Link With: -lkarmagraphics
Functions
Prototype Functions
Tables
Functions
KPixCanvas
kwin_create_x (Display *display, Window window, GC gc,
int xoff, int yoff, int width, int height)
This routine will create a pixel canvas, ready for drawing, from
an X window. Note that the origin of a KPixCanvas is the upper-left corner.
Parameters:
- display :
The X display.
- window :
The window ID in which the canvas lies.
- gc :
The graphics context.
- xoff :
The horizontal offset of the canvas origin (upper-left corner)
relative to the parent window.
- yoff :
The vertical offset of the canvas origin (upper-left corner)
relative to the parent window.
- width :
The width (vertical extent) of the canvas.
- height :
The height (horizontal extent) of the canvas.
Returns: A pixel canvas on success, else NULL.
Multithreading Level: Unsafe
Note: - This routine is only available with the X window system.
void
kwin_set_gc_x (KPixCanvas canvas, GC gc)
This routine will register a new Graphics Context to be used
when drawing into the pixel canvas. Subsequent drawing operations will use
the new Graphics Context.
Parameters:
- canvas :
The canvas.
- gc :
The Graphics Context.
Returns: Nothing.
Multithreading Level: Unsafe
Note: - This routine is only available with the X window system.
GC
kwin_get_gc_x (KPixCanvas canvas)
This routine will get the Graphics Context used when drawing into
the pixel canvas. If the Graphics Context is modified, it should be
registered prior to drawing on the canvas by calling kwin_set_gc_x.
Parameters:
Returns: The Graphics Context.
Multithreading Level: Unsafe
Note: - This routine is only available with the X window system.
EXPERIMENTAL FUNCTION: subject to change without notice
KPixCanvas
kwin_create_generic (void *info, int xoff, int yoff,
int width, int height, unsigned int depth,
unsigned int visual, flag visible,
KPixFuncDrawPoint draw_point,
KPixFuncCreateChild create_child,
KPixFuncClearArea clear_area, ...)
This routine will create a pixel canvas. The interface to this
routine is generic. Note that the origin of a KPixCanvas is the upper-left
corner.
Parameters:
- info :
A pointer to canvas specific data.
- xoff :
The horizontal offset of the canvas origin (upper-left corner)
relative to the parent object.
- yoff :
The vertical offset of the canvas origin (upper-left corner)
relative to the parent object.
- width :
The width (vertical extent) of the canvas.
- height :
The height (horizontal extent) of the canvas.
- depth :
The depth (in bits) of the canvas.
- visual :
The visual type of the canvas.
- visible :
TRUE if the canvas is visible, else FALSE.
- draw_point :
The function that is called when a point is to be drawn to the
pixel canvas. The interface to this routine is as follows:
pre
flag draw_point (void *info, double x, double y, unsigned long pixel_value)
* [PURPOSE] This routine will draw a point onto a pixel canvas.
- info :
A pointer to the canvas specific data.
- x :
The horizontal offset of the point.
- y :
The vertical offset of the point.
- pixel_value :
The pixel value to use.
- create_child :
The function that is called when a child canvas is created.
The interface to this routine is as follows:
pre
void *create_child (void *parent, KPixCanvas child)
* [PURPOSE] This routine will create the graphics system specific child
canvas.
- parent :
A pointer to the parent canvas specific data.
- child :
The newly created child pixel canvas.
- clear_area :
The function that is called when the canvas is to be cleared.
The interface to this routine is as follows:
pre
flag clear_area (void *info, int x, int y, int width, int height)
* [PURPOSE] This routine will clear an area in a canvas.
- info :
A pointer to the canvas specific data.
- x :
The horizontal offset of the area.
- y :
The vertical offset of the area.
- width :
The width of the area.
- height :
The height of the area.
- ... :
The optional list of parameter attribute-key attribute-value
pairs must follow. See the header file for details on defined attributes.
This list must be terminated with the value KWIN_ATT_END .
Returns: A pixel canvas on success, else NULL.
Multithreading Level: Unsafe
KPixCanvas
kwin_create_child (KPixCanvas parent, int xoff, int yoff,
int width, int height, flag absorb_events)
This routine will create a pixel canvas, ready for drawing,
within an existing pixel canvas. The new pixel canvas is a child of the
parent pixel canvas. The child *does not* receive refresh events from the
parent, it *does* receive position events from the parent, provided these
events lie within the child's boundaries. For X-based graphics, a copy of
the Graphics Context is made for the child.
Note that the origin of a KPixCanvas is the upper-left corner.
Parameters:
- parent :
The parent pixel canvas.
- xoff :
The horizontal offset of the canvas origin (upper-left corner)
relative to the parent window.
- yoff :
The vertical offset of the canvas origin (upper-left corner)
relative to the parent window.
- width :
The width (vertical extent) of the canvas.
- height :
The height (horizontal extent) of the canvas.
- absorb_events :
If TRUE, any events passed from the parent canvas to the
child canvas and consumed by the registered event functions for the child
canvas are consumed from the parent canvas. If FALSE, the child canvas does
not consume events from the parent. Note that the parent events are still
*passed* to the child canvas.
Returns: A pixel canvas on success, else NULL.
Multithreading Level: Unsafe
KCallbackFunc
kwin_register_refresh_func (KPixCanvas canvas,
void (*refresh_func) (), void *info)
This routine will register a refresh function for a pixel canvas.
The refresh function will be called whenever the contents of the canvas
need to be redrawn. Many refresh functions may be registered per canvas.
The first function registered is the first function called upon refresh.
Parameters:
- canvas :
The pixel canvas.
- func :
The function that is called when the canvas is to be refreshed. The
prototype function is kwin_PROTO_refresh_func.
- info :
The initial arbitrary canvas information pointer.
Returns: A KCallbackFunc object.
Multithreading Level: Unsafe
KCallbackFunc
kwin_register_position_event_func (KPixCanvas canvas,
flag (*func) (), void *f_info)
This routine will register a position event function for a pixel
canvas. The position event function will be called whenever a position
event on the canvas has not been consumed. Many position event functions
may be registered per canvas. The first function registered is the first
function called upon a position event.
Parameters:
- canvas :
The pixel canvas.
- func :
The function that is called when a position event occurs. The
prototype function is kwin_PROTO_position_func.
- f_info :
The initial arbitrary function information pointer.
Returns: A KCallbackFunc object. On failure, the process aborts.
Multithreading Level: Unsafe
flag
kwin_resize (KPixCanvas canvas, flag clear, int xoff, int yoff,
int width, int height)
This routine will register a resize in the pixel canvas size.
This will cause any refresh routines registered for the canvas to be
called. This routine is meant to be called by an X event handler for the
underlying window, however the routine is available for all graphics
systems.
Parameters:
- canvas :
The canvas.
- clear :
If TRUE, the canvas is first cleared.
- xoff :
The horizontal offset of the canvas origin (upper-left corner)
relative to the parent window.
- yoff :
The vertical offset of the canvas origin (upper-left corner)
relative to the parent window.
- width :
The new width (horizontal extent) of the canvas. If this is less
than 1 canvas is not resized, it is only refreshed.
- height :
The new height (vertical extent) of the canvas. If this is less
than 1 canvas is not resized, it is only refreshed.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_refresh_if_visible (KPixCanvas canvas, flag clear)
Refresh a pixel canvas if it is visible.
Parameters:
- canvas :
The pixel canvas.
- clear :
If TRUE the canvas is cleared prior to refreshing.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_partial_refresh (KPixCanvas canvas, unsigned int num_areas,
KPixCanvasRefreshArea *areas, flag clear_all)
Perform a partial refresh of a pixel canvas.
Parameters:
- canvas :
The pixel canvas.
- num_areas :
The number of areas in the pixel canvas to refresh.
- areas :
The list of areas to refresh. The values here are updated to ensure
all points lie within the boundaries of the pixel canvas.
- clear_all :
If TRUE, each refreshed region is first cleared, else the
clear field of each area determines whether an area is cleared.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_process_position_event (KPixCanvas canvas, int x, int y, flag clip,
unsigned int event_code, void *event_info)
This routine will process (inject) a position event on the lower
level object (parent: i.e. X window) for a pixel canvas. This event is
processed with all position event consumer routines until one successfully
consumes the event.
Parameters:
- canvas :
The pixel canvas.
- x :
The horizontal position of the event, relative to the parent window.
- y :
The vertical position of the event, relative to the parent window.
- clip :
If the event is outside of the canvas boundary and this is TRUE,
the event co-ordinates are clipped to the nearest boundary and passed on to
the registered position event consumers. If the event is outside of the
canvas boundary and this is FALSE, the event is not consumed.
- event_code :
The arbitrary event code.
- event_info :
The arbitrary event information.
Returns: TRUE if the event was consumed, else FALSE.
Multithreading Level: Unsafe
void
kwin_get_attributes (KPixCanvas canvas, ...)
Get the attributes for a pixel canvas.
Parameters:
- canvas :
The pixel canvas.
- ... :
The optional list of parameter attribute-key attribute-value-ptr
pairs must follow. This list must be terminated with the value
KWIN_ATT_END. See kwin_ATTRIBUTES for the list of attributes.
Returns: Nothing.
Multithreading Level: Unsafe
void
kwin_set_attributes (KPixCanvas canvas, ...)
Set the attributes for a pixel canvas.
Parameters:
- canvas :
The pixel canvas.
- ... :
The optional list of parameter attribute-key attribute-value
pairs must follow. This list must be terminated with the value
KWIN_ATT_END. See kwin_ATTRIBUTES for the list of attributes.
Returns: Nothing.
Multithreading Level: Unsafe
flag
kwin_clear (KPixCanvas canvas, int x, int y, int width, int height)
Clear a rectangular portion of a pixel canvas.
Parameters:
- canvas :
The canvas.
- x :
The horizontal offset of the rectangle.
- y :
The vertical offset of the rectangle.
- width :
The width of the rectangle. If this is less than 0 the pixel canvas
is cleared to its right edge.
- height :
The height of the rectangle. If this is less than 0 the pixel
canvas is cleared to its bottom edge.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Note: - To clear the entire canvas, the following should be used:
kwin_clear (canvas, 0, 0, -1, -1);
flag
kwin_draw_pc_image (KPixCanvas canvas, int x_off, int y_off,
int x_pixels, int y_pixels,
CONST char *slice,
CONST uaddr *hoffsets, CONST uaddr *voffsets,
unsigned int width, unsigned int height,
unsigned int type, unsigned int conv_type,
unsigned int num_pixels, unsigned long *pixel_values,
unsigned long blank_pixel,unsigned long min_sat_pixel,
unsigned long max_sat_pixel,
double i_min, double i_max,
flag (*iscale_func) (), void *iscale_info,
KPixCanvasImageCache *cache_ptr)
This routine will draw a 2-dimensional slice of a Karma array
onto a pixel canvas. This slice may be tiled. The slice is a PseudoColour
image.
Parameters:
- canvas :
The pixel canvas.
- x_off :
The horizontal offset, relative to the top-left corner of the
canvas.
- y_off :
The vertical offset, relative to the top-left corner of the canvas.
- x_pixels :
The number of horizontal pixels to draw.
- y_pixels :
The number of vertical pixels to draw.
- slice :
The start of the slice image data.
- hoffsets :
The array of horizontal byte offsets.
- voffsets :
The array of vertical byte offsets.
- width :
The width of the input image (in values).
- height :
The height of the input image (in values).
- type :
The type of the slice image data.
- conv_type :
The input conversion type (when the input is complex).
- num_pixels :
The number of pixels in the pixel array.
- pixel_values :
The array of pixel values.
- blank_pixel :
The pixel value to be used when the intensity value is an
undefined value.
- min_sat_pixel :
The pixel value to be used when the intensity value is
below the minimum value.
- max_sat_pixel :
The pixel value to be used when the intensity value is
above the maximum value.
- i_min :
The minimum intensity value.
- i_max :
The maximum intensity value.
- iscale_func :
The function to be called when non-linear intensity scaling
is required. If NULL, linear intensity scaling is used. The prototype
function is kwin_PROTO_iscale_func.
- iscale_info :
A pointer to arbitrary information for iscale_func.
- cache_ptr :
Cache data is written here. The routine may produce cache data
which will vastly increase the speed of subsequent operations on this data.
Prior to process exit, a call MUST be made to kwin_free_cache_data,
otherwise shared memory segments could remain after the process exits.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.
flag
kwin_draw_rgb_image (KPixCanvas canvas, int x_off, int y_off,
int x_pixels, int y_pixels,
CONST unsigned char *red_slice,
CONST unsigned char *green_slice,
CONST unsigned char *blue_slice,
CONST uaddr *hoffsets, CONST uaddr *voffsets,
unsigned int width, unsigned int height,
KPixCanvasImageCache *cache_ptr)
This routine will draw a 2-dimensional slice of a Karma array
onto a pixel canvas. This slice may be tiled. The slice is a RGB image.
Parameters:
- canvas :
The pixel canvas.
- x_off :
The horizontal offset, relative to the top-left corner of the
canvas.
- y_off :
The vertical offset, relative to the top-left corner of the canvas.
- x_pixels :
The number of horizontal pixels to draw.
- y_pixels :
The number of vertical pixels to draw.
- red_slice :
The start of the red slice data.
- green_slice :
The start of the green slice data.
- blue_slice :
The start of the blue slice data.
- hoffsets :
The array of horizontal byte offsets.
- voffsets :
The array of vertical byte offsets.
- width :
The width of the input image (in values).
- height :
The height of the input image (in values).
- cache_ptr :
Cache data is written here. The routine may produce cache data
which will vastly increase the speed of subsequent operations on this data.
Prior to process exit, a call MUST be made to kwin_free_cache_data,
otherwise shared memory segments could remain after the process exits.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe.
Note: - The 3 colour components must be of type K_UBYTE .
flag
kwin_draw_cached_image (KPixCanvasImageCache cache, int x_off, int y_off)
This routine will draw a previously computed image cache data
(computed by kwin_draw_pc_image) onto the canvas on which the original
image was drawn.
Parameters:
- cache :
The cache data.
- x_off :
The horizontal offset, relative to the top-left corner of the
canvas.
- y_off :
The vertical offset, relative to the top-left corner of the canvas.
Returns: TRUE on success if there is valid cache data, else FALSE
indicating that the image must be recomputed and drawn using
kwin_draw_pc_image.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_draw_cached_subimages (KPixCanvasImageCache cache,
int x_off, int y_off,
unsigned int num_areas,
KPixCanvasRefreshArea *areas)
This routine will draw sections of a previously computed image
cache data (computed by kwin_draw_pc_image) onto the canvas on which
the original image was drawn.
Parameters:
- cache :
The cache data.
- x_off :
The horizontal offset, relative to the top-left corner of the
canvas, which corresponds to the image origin.
- y_off :
The vertical offset, relative to the top-left corner of the canvas,
which corresponds to the image origin.
- num_areas :
The number of image areas to draw.
- areas :
The list of image areas.
Returns: TRUE on success if there is valid cache data, else FALSE
indicating that the image must be recomputed and drawn using
kwin_draw_pc_image.
Multithreading Level: Unsafe
flag
kwin_draw_point (KPixCanvas canvas, double x, double y,
unsigned long pixel_value)
Draw a single point onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x :
The horizontal offset of the point.
- y :
The vertical offset of the point.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_points (KPixCanvas canvas, double *x_array, double *y_array,
unsigned int num_points, unsigned long pixel_value)
Draw multiple points onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x_array :
The horizontal co-ordinates of the points.
- y_array :
The vertical co-ordinates of the points.
- num_points :
The number of points.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_line (KPixCanvas canvas, double x0, double y0,
double x1, double y1, unsigned long pixel_value)
Draw a single line onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x0 :
The horizontal offset of the first point.
- y0 :
The vertical offset of the first point.
- x1 :
The horizontal offset of the second point.
- y1 :
The vertical offset of the second point.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_lines (KPixCanvas canvas, int *x_array, int *y_array,
int num_points, unsigned long pixel_value)
Draw multiple connected lines onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x_array :
The horizontal co-ordinates of the points.
- y_array :
The vertical co-ordinates of the points.
- num_points :
The number of points. The number of lines drawn is 1 less than
this value.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_fill_ellipse (KPixCanvas canvas,
double cx, double cy, double rx, double ry,
unsigned long pixel_value)
Draw a filled ellipse onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The horizontal co-ordinate of the centre of the ellipse.
- cy :
The vertical co-ordinate of the centre of the ellipse.
- rx :
The horizontal radius.
- ry :
The vertical radius.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_fill_polygon (KPixCanvas canvas, int *point_x, int *point_y,
unsigned int num_vertices, unsigned long pixel_value,
flag convex)
Draw a filled polygon onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- point_x :
The array of x co-ordinates of vertices of the polygon.
- point_y :
The array of y co-ordinates of vertices of the polygon.
- num_vertices :
The number of vertices in the polygon.
- pixel_value :
The pixel value to use.
- convex :
If TRUE, then the points must form a convex polygon.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_string (KPixCanvas canvas, double x, double y,
CONST char *string, unsigned long pixel_value,
flag clear_under)
This routine will draw a NULL terminated string onto a pixel
canvas, using the default font for the canvas.
Parameters:
- canvas :
The canvas.
- x :
The horizontal offset of the string origin.
- y :
The vertical offset of the string origin.
- string :
The string.
- pixel_value :
The pixel value to use.
- clear_under :
If TRUE, then the routine will draw both the foreground and
background of the characters.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_rectangle (KPixCanvas canvas, double x, double y,
double width, double height,
unsigned long pixel_value)
Draw a single rectangle onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x :
The horizontal offset of the rectangle.
- y :
The vertical offset of the rectangle.
- width :
The width of the rectangle. The point x + width is a vertex.
- height :
The height of the rectangle. The point y + height is a vertex.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_fill_rectangle (KPixCanvas canvas, double x, double y,
double width, double height,
unsigned long pixel_value)
Draw a single filled rectangle onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x :
The horizontal offset of the rectangle.
- y :
The vertical offset of the rectangle.
- width :
The width of the rectangle. The point x + width is a vertex.
- height :
The height of the rectangle. The point y + height is a vertex.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_draw_arc (KPixCanvas canvas, double cx, double cy,
double rx, double ry, double angle1, double angle2,
double rotation, unsigned long pixel_value, flag fill)
Draw an arc onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The horizontal co-ordinate of the centre of the ellipse.
- cy :
The vertical co-ordinate of the centre of the ellipse.
- rx :
The horizontal radius.
- ry :
The vertical radius.
- angle1 :
See XDrawArc. Units of degrees.
- angle2 :
See XDrawArc. Units of degrees.
- rotation :
The rotation of the arc, in degrees. A rotation of 0 degrees
corresponds to (x > 0, y = 0). A rotation of 90 degrees corresponds to
(x = 0, y > 0). In other words, the angle increases clockwise from the
right.
- pixel_value :
The pixel value to use.
- fill :
If TRUE, the arc is filled, else only the outside is drawn.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_ellipse (KPixCanvas canvas, double cx, double cy,
double rx, double ry, unsigned long pixel_value)
Draw an ellipse onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The horizontal co-ordinate of the centre of the ellipse.
- cy :
The vertical co-ordinate of the centre of the ellipse.
- rx :
The horizontal radius.
- ry :
The vertical radius.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_ellipses (KPixCanvas canvas, int *cx, int *cy, int *rx, int *ry,
int num_ellipses, unsigned long pixel_value)
Draw multiple ellipses onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The array of horizontal co-ordinate of the centre of the ellipse.
- cy :
The array of vertical co-ordinate of the centre of the ellipse.
- rx :
The array of horizontal radii.
- ry :
The array of vertical radii.
- num_ellipses :
The number of ellipses.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_ellipses_TRANSITION (KPixCanvas canvas, double *cx, double *cy,
double *rx, double *ry,
int num_ellipses,
unsigned long pixel_value)
Draw multiple ellipses onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The array of horizontal co-ordinate of the centre of the ellipse.
- cy :
The array of vertical co-ordinate of the centre of the ellipse.
- rx :
The array of horizontal radii.
- ry :
The array of vertical radii.
- num_ellipses :
The number of ellipses.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_fill_ellipses (KPixCanvas canvas, int *cx, int *cy, int *rx, int *ry,
int num_ellipses, unsigned long pixel_value)
Draw multiple filled ellipses onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The array of horizontal co-ordinate of the centre of the ellipse.
- cy :
The array of vertical co-ordinate of the centre of the ellipse.
- rx :
The array of horizontal radii.
- ry :
The array of vertical radii.
- num_ellipses :
The number of ellipses.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_fill_ellipses_TRANSITION (KPixCanvas canvas,
double *cx, double *cy,
double *rx, double *ry,
int num_ellipses,
unsigned long pixel_value)
Draw multiple filled ellipses onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- cx :
The array of horizontal co-ordinate of the centre of the ellipse.
- cy :
The array of vertical co-ordinate of the centre of the ellipse.
- rx :
The array of horizontal radii.
- ry :
The array of vertical radii.
- num_ellipses :
The number of ellipses.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
flag
kwin_draw_segments (KPixCanvas canvas, int *x0, int *y0, int *x1, int *y1,
int num_segments, unsigned long pixel_value)
Draw multiple disjoint lines onto a pixel canvas.
Parameters:
- canvas :
The canvas.
- x0 :
The horizontal start co-ordinates of the segments.
- y0 :
The vertical start co-ordinates of the segments.
- x1 :
The horizontal end co-ordinates of the segments.
- y1 :
The vertical end co-ordinates of the segments.
- num_segments :
The number of segments.
- pixel_value :
The pixel value to use.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
void
kwin_get_size (KPixCanvas canvas, int *width, int *height)
Get the size of a pixel canvas.
Parameters:
- width :
The number of horizontal pixel will be written here.
- height :
The number of vertical pixel will be written here.
Returns: Nothing.
Multithreading Level: Unsafe
void
kwin_free_cache_data (KPixCanvasImageCache cache)
Free some cache data allocated by kwin_draw_pc_image.
Parameters:
Returns: Nothing.
Multithreading Level: Unsafe
flag
kwin_convert_to_canvas_coord (KPixCanvas canvas, int xin, int yin,
int *xout, int *yout)
This routine will convert co-ordinates in a lower level object
(parent, ie. X window) to co-ordinates in a pixel canvas.
Parameters:
- canvas :
The canvas.
- xin :
The lower level horizontal co-ordinate.
- yin :
The lower level vertical co-ordinate.
- xout :
The horizontal canvas co-ordinate will be written here.
- yout :
The vertical canvas co-ordinate will be written here.
Returns: TRUE if the co-ordinate lies within the canvas boundaries, else
FALSE (although a conversion is still performed).
Multithreading Level: Unsafe
flag
kwin_convert_from_canvas_coord (KPixCanvas canvas, int xin, int yin,
int *xout, int *yout)
This routine will convert co-ordinates in a pixel canvas to
co-ordinates in a lower level object (parent, ie. X window).
Parameters:
- canvas :
The canvas.
- xin :
The horizontal canvas co-ordinate.
- yin :
The vertical canvas co-ordinate.
- xout :
The lower level horizontal co-ordinate will be written here.
- yout :
The lower level vertical co-ordinate will be written here.
Returns: TRUE if the co-ordinate lies within the canvas boundaries, else
FALSE (although a conversion is still performed).
Multithreading Level: Unsafe
flag
kwin_get_colour (KPixCanvas canvas, CONST char *colourname,
unsigned long *pixel_value, unsigned short *red,
unsigned short *green, unsigned short *blue)
Get (possibly allocate) a colourcell for a canvas.
Parameters:
- canvas :
The canvas.
- colourname :
The name of the colour to get.
- pixel_value :
The pixel value will be written here.
- red :
The red intensity in the hardware colourmap for the pixel will be
written here. If this is NULL, nothing is written here.
- green :
The green intensity in the hardware colourmap for the pixel will be
written here. If this is NULL, nothing is written here.
- blue :
The blue intensity in the hardware colourmap for the pixel will be
written here. If this is NULL, nothing is written here.
Returns: TRUE if the colourcell was allocated, else FALSE.
Multithreading Level: Unsafe
Note: - The pixel value is valid ONLY for this canvas. ALSO: the pixel value
becomes invalid EVERY time the canvas is refreshed/ resized. If the canvas
is refreshed/ resized, this routine MUST be called again.
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_get_pixel_RGB_values (KPixCanvas canvas, unsigned long *pixels,
unsigned short *reds,
unsigned short *greens,
unsigned short *blues,
unsigned int num_colours)
This routine will determine the RGB components of an array of
colourmap entries.
Parameters:
- canvas :
The pixel canvas.
- pixels :
The array of colourmap indices.
- reds :
The red components will be written to this array.
- greens :
The green components will be written to this array.
- blues :
The blue components will be written to this array.
- num_colours :
The number of colours in the arrays.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
KPixCanvasFont
kwin_load_font (KPixCanvas canvas, CONST char *fontname)
This routine will load a font which may be then used to draw text
onto a pixel canvas.
Parameters:
- canvas :
The pixel canvas for which the font is valid.
- fontname :
The name of the font.
Returns: A pixel font on success, else NULL.
Multithreading Level: Unsafe
flag
kwin_get_string_size (KPixCanvasFont font, CONST char *string, ...)
Determine the size of a string.
Parameters:
- font :
The font.
- string :
The string.
- ... :
The optional list of parameter attribute-key attribute-value-ptr
pairs must follow. This list must be terminated with the value
KWIN_STRING_END. See kwin_STRING_ATT for the list of attributes.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_hersey_draw_string (KPixCanvas canvas, CONST char *string,
double x, double y, double angle, double size,
unsigned long pixel_value,
double *width, double *height)
Draw string using Hershey (stroke) font.
Parameters:
- canvas :
The KPixCanvas to draw onto. If this is NULL nothing is drawn.
- string :
The string to draw.
- x :
The starting horizontal position of the string.
- y :
The starting vertical position of the string.
- angle :
The rotation angle of the string in degrees.
- size :
The size of the font (typically 12.8).
- pixel_value :
The pixel value to use when drawing the string.
- width :
The width of the string in pixels is written here. If this is NULL
nothing is written here.
- height :
The height of the string in pixels is written here. If this is
NULL nothing is written here.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_open_gl_test_available (Display *display)
Test if the GLX extension is supported for a display.
Parameters:
- display :
The X11 display handle.
Returns: TRUE if the GLX extension is supported, else FALSE.
Multithreading Level: Unsafe
EXPERIMENTAL FUNCTION: subject to change without notice
flag
kwin_open_gl_test_stereo (Display *display, XVisualInfo *visinfo)
Test if a particular visual can display stereo.
Parameters:
- display :
The X11 display handle.
- visinfo :
The XVisualInfo structure.
Returns: TRUE if stereo is available, else FALSE.
Multithreading Level: Unsafe
flag
kwin_write_ps (KPixCanvas canvas, PostScriptPage pspage)
This routine will refresh a pixel canvas, redirecting output to a
PostScriptPage object.
Parameters:
- canvas :
The pixel canvas.
- pspage :
The PostScriptPage object.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
unsigned int
kwin_xgl_test_stereo (Display *display, Window window)
This routine will determine if stereoscopic display is supported
using XGL on a particular display.
Parameters:
- display :
The X display.
- window :
The window ID of a window of the same class as the desired stereo
window.
Returns: A status code. See kwin_XGL_STATUS for a list of values.
Multithreading Level: Unsafe
Note: - This routine is only available with the X window system.
flag
kwin_xgl_create_stereo (Display *display, Window window,
int xoff, int yoff, int width, int height,
KPixCanvas *mono,
KPixCanvas *left, KPixCanvas *right)
This routine will create a stereo pixel canvas, ready for
drawing, from an X window, using the XGL library. Note that the origin of
a KPixCanvas is the upper-left corner.
Parameters:
- display :
The X display.
- window :
The window ID in which the canvas lies.
- gc :
The graphics context.
- xoff :
The horizontal offset of the canvas origin (upper-left corner)
relative to the parent window.
- yoff :
The vertical offset of the canvas origin (upper-left corner)
relative to the parent window.
- width :
The width (vertical extent) of the canvas.
- height :
The height (horizontal extent) of the canvas.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Note: - This routine is only available with the X window system.
Prototype Functions
void
kwin_PROTO_refresh_func (KPixCanvas canvas, int width, int height,
void **info, PostScriptPage pspage,
unsigned int num_areas,
KPixCanvasRefreshArea *areas,
flag *honoured_areas)
Process a refresh event for a pixel canvas.
Parameters:
- canvas :
The pixel canvas.
- width :
The width of the canvas in pixels.
- height :
The height of the canvas in pixels.
- info :
A pointer to the arbitrary canvas information pointer.
- pspage :
If not NULL, the PostScriptPage object the refresh is
redirected to.
- num_areas :
The number of areas that need to be refreshed. If this is
0 then the entire pixel canvas needs to be refreshed.
- areas :
The list of areas that need to be refreshed.
- honoured_areas :
If the value TRUE is written here it is assumed the
routine honoured the list of refresh areas and did not write outside
these areas and hence the list of areas will be passed to subsequent
registered refresh routines. If FALSE is written here (or nothing is
written here), implying the routine refreshed the entire pixel canvas,
subsequent refresh routines will be told to refresh the entire canvas.
Returns: Nothing.
Multithreading Level: Unsafe
flag
kwin_PROTO_position_func (KPixCanvas canvas, int x, int y,
unsigned int event_code, void *e_info,
void **f_info)
Process a position event on a pixel canvas.
Parameters:
- canvas :
The pixel canvas on which the event occurred.
- x :
The horizontal position of the event, relative to the canvas origin
- y :
The vertical position of the event, relative to the canvas origin.
- event_code :
The arbitrary event code.
- e_info :
A pointer to arbitrary event information.
- f_info :
A pointer to an arbitrary function information pointer.
Returns: TRUE if the event was consumed, else FALSE indicating that
the event is still to be processed.
Multithreading Level: Unsafe
flag
kwin_PROTO_iscale_func (double *out, unsigned int out_stride,
double *inp, unsigned int inp_stride,
unsigned int num_values,
double i_min, double i_max, void *info)
This routine will perform an arbitrary intensity scaling on
an array of values. This routine may be called many times to scale an
image.
Parameters:
- out :
The output array.
- out_stride :
The stride (in doubles) of the output array.
- inp :
The input array.
- inp_stride :
The stride (in doubles) of the input array.
- num_values :
The number of values to scale.
- i_min :
The minimum intensity value.
- i_max :
The maximum intensity value.
- info :
A pointer to arbitrary information.
Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Tables
kwin_ATTRIBUTES
Name | Get Type | Set Type | Meaning
|
|
KWIN_ATT_END | | | End of varargs list
|
KWIN_ATT_VISUAL | unsigned int * | | Visual type
|
KWIN_ATT_DEPTH | unsigned int * | | Depth of canvas
|
KWIN_ATT_VISIBLE | flag * | flag | Canvas is visible
|
KWIN_ATT_FONT | KPixCanvasFont * | KPixCanvasFont | Current font
|
KWIN_ATT_PIX_RED_MASK | unsigned long * | | Red pixel mask
|
KWIN_ATT_PIX_GREEN_MASK | unsigned long * | | Green pixel mask
|
KWIN_ATT_PIX_BLUE_MASK | unsigned long * | | Blue pixel mask
|
KWIN_ATT_IM_RED_MASK | unsigned long * | | Red image mask
|
KWIN_ATT_IM_GREEN_MASK | unsigned long * | | Green image mask
|
KWIN_ATT_IM_BLUE_MASK | unsigned long * | | Blue image mask
|
KWIN_ATT_IM_RED_OFFSET | uaddr * | | Red image offset
|
KWIN_ATT_IM_GREEN_OFFSET | uaddr * | | Green image offset
|
KWIN_ATT_IM_BLUE_OFFSET | uaddr * | | Blue image offset
|
KWIN_ATT_LOWER_HANDLE | void ** | | Lower handle
|
KWIN_ATT_USER_PTR | void ** | void * | User pointer
|
KWIN_ATT_LINEWIDTH | double * | double | Line width in pixels (0.0 = thin)
|
kwin_STRING_ATTRIBUTES
Name | Get Type | Meaning
|
|
KWIN_STRING_END | | End of varargs list
|
KWIN_STRING_WIDTH | int * | String width
|
KWIN_STRING_HEIGHT | int * | String height
|
KWIN_STRING_ASCENT | int * | String ascent
|
KWIN_STRING_DESCENT | int * | String descent
|
kwin_XGL_STATUS
Name | Meaning
|
|
KWIN_XGL_NOT_AVAILABLE | XGL is not supported
|
KWIN_XGL_STEREO_NOT_AVAILABLE | No stereo display hardware
|
KWIN_XGL_STEREO_AVAILABLE | Stereo available
|
Back to Karma Home Page
Contact: Richard Gooch
Web Development: Ariel Internet Services