X11PixelCanvas.h

Classes

X11PixelCanvas -- Implementation of PixelCanvas for X11 devices. (full description)

class X11PixelCanvas : public PixelCanvas

Interface

Public Members
X11PixelCanvas()
X11PixelCanvas(Widget parent, X11PixelCanvasColorTable * xpcctbl, uInt width, uInt height)
virtual void enableMotionEvents()
virtual void disableMotionEvents()
virtual void enablePositionEvents()
virtual void disablePositionEvents()
virtual Bool supportsLists()
virtual uInt newList()
virtual void endList()
virtual void drawList(uInt list)
virtual void translateAllLists(Int xt, Int yt)
virtual void translateList(uInt list, Int xt, Int yt)
virtual void deleteList(uInt list)
virtual void deleteLists()
virtual Bool validList(uInt list)
virtual void refresh(const Display::RefreshReason &reason = Display::UserCommand, const Bool &explicitrequest = True)
Int textHeight(const String& text)
Int textWidth(const String& text)
Bool setFont(const String & font)
Bool setFont(DLFont* font)
Bool setFont(const String& font, const Int size)
void drawText(Int xoffset, Int yoffset, const String & text, Display::TextAlign alignment = Display::AlignCenter)
void drawText(Int xoffset, Int yoffset, const String & text, const Float& angle, Display::TextAlign alignment = Display::AlignCenter)
void drawImage(const Matrix<uInt> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<Int> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<uLong> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<Float> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<Double> & data, Int xoffset, Int yoffset)
virtual void drawImage(const Int &x, const Int &y, const Matrix<uInt> &data, const Matrix<Bool> &mask)
void drawImage(const Matrix<uInt> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<Int> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<uLong> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<Float> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<Double> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)
void initialiseComponents(const Int &x, const Int &y, const IPosition &shape)
Bool componentsInitialised()
void bufferComponent(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)
void flushComponentBuffers()
void drawPoint(Int x1, Int y1)
void drawPoint(Float x1, Float y1)
void drawPoint(Double x1, Double y1)
void drawPoints(const Vector<Int> & x1, const Vector<Int> & y1)
void drawPoints(const Vector<Float> & x1, const Vector<Float> & y1)
void drawPoints(const Vector<Double> & x1, const Vector<Double> & y1)
void drawPoints(const Matrix<Int> & verts)
void drawPoints(const Matrix<Float> & verts)
void drawPoints(const Matrix<Double> & verts)
void drawLine(Int x1, Int y1, Int x2, Int y2)
void drawLine(Float x1, Float y1, Float x2, Float y2)
void drawLine(Double x1, Double y1, Double x2, Double y2)
void drawLines(const Matrix<Int> & verts)
void drawLines(const Matrix<Float> & verts)
void drawLines(const Matrix<Double> & verts)
void drawLines(const Vector<Int> & x1, const Vector<Int> & y1, const Vector<Int> & x2, const Vector<Int> & y2)
void drawLines(const Vector<Float> & x1, const Vector<Float> & y1, const Vector<Float> & x2, const Vector<Float> & y2)
void drawLines(const Vector<Double> & x1, const Vector<Double> & y1, const Vector<Double> & x2, const Vector<Double> & y2)
void drawPolyline(const Matrix<Int> & verts)
void drawPolyline(const Matrix<Float> & verts)
void drawPolyline(const Matrix<Double> & verts)
void drawPolyline(const Matrix<Complex> & verts)
void drawPolyline(const Matrix<DComplex> & verts)
void drawPolyline(const Vector<Int> & x1, const Vector<Int> & y1)
void drawPolyline(const Vector<Float> & x1, const Vector<Float> & y1)
void drawPolyline(const Vector<Double> & x1, const Vector<Double> & y1)
void drawPolygon(const Matrix<Int> & verts)
void drawPolygon(const Matrix<Float> & verts)
void drawPolygon(const Matrix<Double> & verts)
void drawPolygon(const Vector<Int> & x1, const Vector<Int> & y1)
void drawPolygon(const Vector<Float> & x1, const Vector<Float> & y1)
void drawPolygon(const Vector<Double> & x1, const Vector<Double> & y1)
void drawFilledPolygon(const Vector<Int> & x1, const Vector<Int> & y1)
void drawFilledPolygon(const Vector<Float> & x1, const Vector<Float> & y1)
void drawFilledPolygon(const Vector<Double> & x1, const Vector<Double> & y1)
void drawRectangle(Int x1, Int y1, Int x2, Int y2)
void drawRectangle(Float x1, Float y1, Float x2, Float y2)
void drawRectangle(Double x1, Double y1, Double x2, Double y2)
void drawFilledRectangle(Int x1, Int y1, Int x2, Int y2)
void drawFilledRectangle(Float x1, Float y1, Float x2, Float y2)
void drawFilledRectangle(Double x1, Double y1, Double x2, Double y2)
void drawColoredPoints(const Vector<Int> & x1, const Vector<Int> & y1, const Vector<uInt> & colors)
void drawColoredPoints(const Vector<Float> & x1, const Vector<Float> & y1, const Vector<uInt> & colors)
void drawColoredPoints(const Vector<Double> & x1, const Vector<Double> & y1, const Vector<uInt> & colors)
virtual void drawColoredPoints(const Matrix<Int> &xy, const Vector<uInt> &colors)
virtual void drawColoredPoints(const Matrix<Float> &xy, const Vector<uInt> &colors)
virtual void drawColoredPoints(const Matrix<Double> &xy, const Vector<uInt> &colors)
void drawColoredLines(const Vector<Int> & x1, const Vector<Int> & y1, const Vector<Int> & x2, const Vector<Int> & y2, const Vector<uInt> & colors)
void drawColoredLines(const Vector<Float> & x1, const Vector<Float> & y1, const Vector<Float> & x2, const Vector<Float> & y2, const Vector<uInt> & colors)
void drawColoredLines(const Vector<Double> & x1, const Vector<Double> & y1, const Vector<Double> & x2, const Vector<Double> & y2, const Vector<uInt> & colors)
void setDrawFunction(Display::DrawFunction function)
void setForeground(uLong color)
void setBackground(uLong color)
void setLineWidth(Float width)
void setLineStyle(Display::LineStyle style)
void setCapStyle(Display::CapStyle style)
void setJoinStyle(Display::JoinStyle style)
void setFillStyle(Display::FillStyle style)
void setFillRule(Display::FillRule rule)
void setArcMode(Display::ArcMode mode)
Display::DrawFunction getDrawFunction() const
uLong getForeground() const
uLong getBackground() const
Float getLineWidth() const
Display::LineStyle getLineStyle() const
Display::CapStyle getCapStyle() const
Display::JoinStyle getJoinStyle() const
Display::FillStyle getFillStyle() const
Display::FillRule getFillRule() const
Display::ArcMode getArcMode() const
Bool enable(Display::Option option)
Bool disable(Display::Option option)
void setImageCacheStrategy(Display::ImageCacheStrategy strategy)
Display::ImageCacheStrategy imageCacheStrategy() const
Bool usePixmapImages() const
void setClipWindow(Int x1, Int y1, Int x2, Int y2)
void getClipWindow(Int & x1, Int & y1, Int & x2, Int & y2)
virtual void pushMatrix()
virtual void popMatrix()
virtual void loadIdentity()
virtual void translate(Int xt, Int yt)
virtual void getTranslation(Int & xt, Int & yt) const
virtual Int xTranslation() const
virtual Int yTranslation() const
void setDrawBuffer(Display::DrawBuffer buf)
void copyBackBufferToFrontBuffer()
void copyFrontBufferToBackBuffer()
void swapBuffers()
void copyBackBufferToFrontBuffer(Int x1, Int y1, Int x2, Int y2)
void copyFrontBufferToBackBuffer(Int x1, Int y1, Int x2, Int y2)
void swapBuffers(Int x1, Int y1, Int x2, Int y2)
virtual Bool refreshAllowed() const
virtual void clear()
virtual void clear(Int x1, Int y1, Int x2, Int y2)
virtual void flush()
virtual void setClearColor(uInt color)
virtual void setClearColor(const String & color)
virtual void setClearColor(float r, float g, float b)
virtual void setDeviceForegroundColor(const String colorname)
virtual String deviceForegroundColor() const
virtual void setDeviceBackgroundColor(const String colorname)
virtual String deviceBackgroundColor() const
virtual uInt clearColor() const
virtual void getClearColor(float & r, float & g, float & b) const
void setColor(const String& colorName)
void setColor(uInt ColorIndex)
void setColor(float c1, float c2, float c3)
void setRGBColor(float r, float g, float b)
void setHSVColor(float h, float s, float v)
Bool getColorComponents(const String &colorname, Float &r, Float &g, Float &b)
uInt color() const
void getColor(float & r, float & g, float & b) const
Bool getColor(int, int, uInt &)
Bool getRGBColor(int, int, float &, float &, float &)
static void handleEventsEH(Widget w, X11PixelCanvas * xpc, XEvent * ev, Boolean *)
void handleEvents(Widget w, XEvent * ev)
static void exposeCB(Widget , X11PixelCanvas * xpc, XtPointer callData)
static void positionEventCB(Widget, X11PixelCanvas * xpc, XtPointer callData)
static void colorTableResizeCB(PixelCanvasColorTable * pcctbl, uInt, X11PixelCanvas * xpc, Display::RefreshReason reason)
Bool resizeColorTable(uInt newSize)
Bool resizeColorTable(uInt nReds, uInt nGreens, uInt nBlues)
PixelCanvasColorTable * pcctbl() const
void setPcctbl(PixelCanvasColorTable * pcctbl)
virtual uInt width() const
virtual uInt height() const
virtual uInt depth() const
virtual void pixelDensity(Float &xdpi, Float &ydpi) const
Bool resize(uInt reqXSize, uInt reqYSize, Bool doCallbacks = True)
::XDisplay * display() const
Screen * screen() const
Visual * visual() const
Pixmap pixmap() const
Window drawWindow() const
GC gc() const
XColormap xcmap() const
X11PixelCanvasColorTable * xpcctbl() const
Display::DrawMode drawMode()
void * requestBuffer() const
Bool drawToPixmap() const
virtual Bool drawToWindow() const
void appendToDisplayList(X11PCDisplayListObject * obj)
virtual Bool writeXPixmap(const String &filename)
Private Members
Bool resize_()
void exposeHandler_()
Bool packDisplayList(String & str, PtrBlock<X11PCDisplayListObject *> * l, uInt count)
Bool applyConsecutiveLineOpt(String & s, PtrBlock<X11PCDisplayListObject *> * l)
Bool applyConsecutivePointOpt(String & s, PtrBlock<X11PCDisplayListObject *> * l)
Bool compactDisplayList(PtrBlock<X11PCDisplayListObject *> * l, uInt & count)
uInt pickListID()
void resizePixmap()

Description

Prerequisite

Etymology

X11PixelCanvas is an implementation of a pixel canvas using X11 or Xlib graphics library.

Synopsis

This class implements the specification of the PixelCanvas in terms of the X11 graphics system.

To create a X11PixelCanvas, you need a parent Widget and an X11PixelCanvasColorTable pointer.

Once constructed, drawing functions can be used to draw on the canvas and carry out other miscellaneous functions.

The X11PixelCanvas class should never be used directly after it has been constructed. Instead use a PixelCanvas pointer so your application will be more portable across different implementations of the PixelCanvas such as the future-planned classes W95PixelCanvas and OpenGLPixelCanvas.

Positions are defined ultimately in signed integer pixel values, with <0,0> representing the lower left corner pixel of the window. So for a canvas size of 320x240, the upper rightmost pixel is <319,239>. Integers are used because it is possible to perform drag operations outside the window using the mouse, so negative pixel values have meaning. The X11PixelCanvas operates in three different color modes: Index, RGB, and HSV. Presently RGB and HSV modes has not been completed. For details on how to use this class, please see the PixelCanvas instead for a detailed description of how to build applications with the PixelCanvas.

Now several examples follow on how to construct one or more X11PixelCanvases, with an explanation of the strategy involved and their implications.

  1. Example 1 - A single shared colortable:
        
        X11PixelCanvasColorTable pcct(xscreen, Display::Index, Display::Best, Display::System);
        PixelCanvas * canvas1 = new X11PixelCanvas(myParent, &pcct, 320u, 240u);
        PixelCanvas * canvas2 = new X11PixelCanvas(myParent, &pcct, 320u, 240u);
        ...
        
        
    This application has requested the best index map available on the system colormap.
  2. Example 2 - two colortables equally share the system X hardware colormap

        
        X11PixelCanvasColorTable pcct1(xscreen, Display::Index, Display::Percent, Display::System, 50);
        X11PixelCanvasColorTable pcct2(xscreen, Display::Index, Display::Best, Display::System);
        PixelCanvas * canvas1 = new X11PixelCanvas(myParent, &pcct1, 320u, 240u);
        PixelCanvas * canvas2 = new X11PixelCanvas(myParent, &pcct2, 320u, 240u);
        
        
    This application creates two colortables. The first allocates half of whatever colors are available in the System map, the second allocates the remaining half.
  3. Example 3 - two colortables equally share a private X hardware colormap

        
        X11PixelCanvasColorTable pcct1(xscreen, Display::Index, Display::Percent, Display::New, 50);
        X11PixelCanvasColorTable pcct2(xscreen, Display::Index, Display::Best, &pcct1);
        PixelCanvas * canvas1 = new X11PixelCanvas(myParent, &pcct1, 320u, 240u);
        PixelCanvas * canvas2 = new X11PixelCanvas(myParent, &pcct2, 320u, 240u);
        
        
    This application creates two colortables. The first allocates half of the new X colormap, and the second one allocates the remaining half.
  4. Example 4 - Private colormap for fixed-size colortable
        
        X11PixelCanvasColorTable pcct(xscreen, Display::Index, Display::Custom, Display::New, 128);
        PixelCanvas * canvas1 = new X11PixelCanvas(myParent, &pcct, 320u, 240u);
        PixelCanvas * canvas2 = new X11PixelCanvas(myParent, &pcct, 320u, 240u);
        
        
    This application creates a fixed-size private colormap for its windows.

Graphics are drawn onto an off-screen pixmap after which the pixmap is painted onto the screen. The refresh call will always update the pixmap.

Motivation

Needed solid foundation for a PixelCanvas

Example

see the examples in the Display/test directory

Member Description

X11PixelCanvas()

Default ctor needed for derivation of Tk canvases

X11PixelCanvas(Widget parent, X11PixelCanvasColorTable * xpcctbl, uInt width, uInt height)

virtual void enableMotionEvents()
virtual void disableMotionEvents()
virtual void enablePositionEvents()
virtual void disablePositionEvents()

enable/disable motion/position events

virtual Bool supportsLists()

Does this canvas support cached display lists? The user of the canvas should always check this, because undefined behaviour can result when an attempt is made to use a list on a PixelCanvas which does not support lists.

virtual uInt newList()

begin caching display commands - return list ID

virtual void endList()

end caching display commands

virtual void drawList(uInt list)

recall cached display commands

virtual void translateAllLists(Int xt, Int yt)

translate all lists

virtual void translateList(uInt list, Int xt, Int yt)

translate the list

virtual void deleteList(uInt list)

remove list from cache

virtual void deleteLists()

flush all lists from the cache

virtual Bool validList(uInt list)

return True if the list exists

virtual void refresh(const Display::RefreshReason &reason = Display::UserCommand, const Bool &explicitrequest = True)

trigger refresh callbacks with the specified reason.

Int textHeight(const String& text)

Fonts and text

Int textWidth(const String& text)

Bool setFont(const String & font)

Bool setFont(DLFont* font)

Set font via a DLFont object

Bool setFont(const String& font, const Int size)

void drawText(Int xoffset, Int yoffset, const String & text, Display::TextAlign alignment = Display::AlignCenter)

void drawText(Int xoffset, Int yoffset, const String & text, const Float& angle, Display::TextAlign alignment = Display::AlignCenter)

void drawImage(const Matrix<uInt> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<Int> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<uLong> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<Float> & data, Int xoffset, Int yoffset)
void drawImage(const Matrix<Double> & data, Int xoffset, Int yoffset)

Draw an array of 2D color data as a raster image for zoom = <1,1>

virtual void drawImage(const Int &x, const Int &y, const Matrix<uInt> &data, const Matrix<Bool> &mask)

(Cacheable) Draw an array of 2D color data as a raster image, taking note of the Bool mask.

void drawImage(const Matrix<uInt> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<Int> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<uLong> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<Float> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)
void drawImage(const Matrix<Double> & data, Int xoffset, Int yoffset, uInt xzoom, uInt yzoom)

Draw an array of 2D color data as a raster image for any positive integer zoom

void drawImage(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)

(Cacheable) Draw a component of a multi-channel image, storing it in buffers until flushComponentImages() is called.

void initialiseComponents(const Int &x, const Int &y, const IPosition &shape)

Initialise the channel buffers.

Bool componentsInitialised()

Are the channel buffers initialised?

void bufferComponent(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)

Fill one of the channel buffers.

void flushComponentBuffers()

(NOT CACHEABLE!) Flush the component buffers.

void drawPoint(Int x1, Int y1)
void drawPoint(Float x1, Float y1)
void drawPoint(Double x1, Double y1)

Draw a single point using current color

void drawPoints(const Vector<Int> & x1, const Vector<Int> & y1)
void drawPoints(const Vector<Float> & x1, const Vector<Float> & y1)
void drawPoints(const Vector<Double> & x1, const Vector<Double> & y1)

Draw a bunch of points using current color

void drawPoints(const Matrix<Int> & verts)
void drawPoints(const Matrix<Float> & verts)
void drawPoints(const Matrix<Double> & verts)

Draw a bunch of unrelated points using current color

void drawLine(Int x1, Int y1, Int x2, Int y2)
void drawLine(Float x1, Float y1, Float x2, Float y2)
void drawLine(Double x1, Double y1, Double x2, Double y2)

Draw a single line using current color

void drawLines(const Matrix<Int> & verts)
void drawLines(const Matrix<Float> & verts)
void drawLines(const Matrix<Double> & verts)

Draw a bunch of unrelated lines using current color

void drawLines(const Vector<Int> & x1, const Vector<Int> & y1, const Vector<Int> & x2, const Vector<Int> & y2)
void drawLines(const Vector<Float> & x1, const Vector<Float> & y1, const Vector<Float> & x2, const Vector<Float> & y2)
void drawLines(const Vector<Double> & x1, const Vector<Double> & y1, const Vector<Double> & x2, const Vector<Double> & y2)

Draw a bunch of unrelated lines using current color

void drawPolyline(const Matrix<Int> & verts)
void drawPolyline(const Matrix<Float> & verts)
void drawPolyline(const Matrix<Double> & verts)
void drawPolyline(const Matrix<Complex> & verts)
void drawPolyline(const Matrix<DComplex> & verts)

Draw a N-1 connected lines from Nx2 matrix of vertices

void drawPolyline(const Vector<Int> & x1, const Vector<Int> & y1)
void drawPolyline(const Vector<Float> & x1, const Vector<Float> & y1)
void drawPolyline(const Vector<Double> & x1, const Vector<Double> & y1)

Draw a single polyline or connected line between the points given

void drawPolygon(const Matrix<Int> & verts)
void drawPolygon(const Matrix<Float> & verts)
void drawPolygon(const Matrix<Double> & verts)

Draw an N-sided polygon from Nx2 matrix of vertices

void drawPolygon(const Vector<Int> & x1, const Vector<Int> & y1)
void drawPolygon(const Vector<Float> & x1, const Vector<Float> & y1)
void drawPolygon(const Vector<Double> & x1, const Vector<Double> & y1)

Draw a closed polygon

void drawFilledPolygon(const Vector<Int> & x1, const Vector<Int> & y1)
void drawFilledPolygon(const Vector<Float> & x1, const Vector<Float> & y1)
void drawFilledPolygon(const Vector<Double> & x1, const Vector<Double> & y1)

Draw and fill a closed polygon

void drawRectangle(Int x1, Int y1, Int x2, Int y2)
void drawRectangle(Float x1, Float y1, Float x2, Float y2)
void drawRectangle(Double x1, Double y1, Double x2, Double y2)

Draw a rectangle

void drawFilledRectangle(Int x1, Int y1, Int x2, Int y2)
void drawFilledRectangle(Float x1, Float y1, Float x2, Float y2)
void drawFilledRectangle(Double x1, Double y1, Double x2, Double y2)

Draw a filled rectangle

void drawColoredPoints(const Vector<Int> & x1, const Vector<Int> & y1, const Vector<uInt> & colors)
void drawColoredPoints(const Vector<Float> & x1, const Vector<Float> & y1, const Vector<uInt> & colors)
void drawColoredPoints(const Vector<Double> & x1, const Vector<Double> & y1, const Vector<uInt> & colors)
virtual void drawColoredPoints(const Matrix<Int> &xy, const Vector<uInt> &colors)
virtual void drawColoredPoints(const Matrix<Float> &xy, const Vector<uInt> &colors)
virtual void drawColoredPoints(const Matrix<Double> &xy, const Vector<uInt> &colors)

Draw a set of points, specifying a color per point to be drawn. Most efficient when points with same color are grouped into sequences.

void drawColoredLines(const Vector<Int> & x1, const Vector<Int> & y1, const Vector<Int> & x2, const Vector<Int> & y2, const Vector<uInt> & colors)
void drawColoredLines(const Vector<Float> & x1, const Vector<Float> & y1, const Vector<Float> & x2, const Vector<Float> & y2, const Vector<uInt> & colors)
void drawColoredLines(const Vector<Double> & x1, const Vector<Double> & y1, const Vector<Double> & x2, const Vector<Double> & y2, const Vector<uInt> & colors)

Draw a set of lines, specifying a color per line to be drawn. Most efficient when lines with same color are grouped into sequences

void setLineWidth(Float width)

Graphics Attributes

void setLineWidth(uInt width);

void setDrawFunction(Display::DrawFunction function)
void setForeground(uLong color)
void setBackground(uLong color)
void setLineStyle(Display::LineStyle style)
void setCapStyle(Display::CapStyle style)
void setJoinStyle(Display::JoinStyle style)
void setFillStyle(Display::FillStyle style)
void setFillRule(Display::FillRule rule)
void setArcMode(Display::ArcMode mode)

Graphics Attributes

Float getLineWidth() const

Get Graphics Attributes

uInt getLineWidth() const;

Display::DrawFunction getDrawFunction() const
uLong getForeground() const
uLong getBackground() const
Display::LineStyle getLineStyle() const
Display::CapStyle getCapStyle() const
Display::JoinStyle getJoinStyle() const
Display::FillStyle getFillStyle() const
Display::FillRule getFillRule() const
Display::ArcMode getArcMode() const

Get Graphics Attributes

Bool enable(Display::Option option)
Bool disable(Display::Option option)

Option control

void setImageCacheStrategy(Display::ImageCacheStrategy strategy)

Control the image-caching strategy

Display::ImageCacheStrategy imageCacheStrategy() const

Bool usePixmapImages() const

void setClipWindow(Int x1, Int y1, Int x2, Int y2)
void getClipWindow(Int & x1, Int & y1, Int & x2, Int & y2)

ClipWindow control

virtual void pushMatrix()
virtual void popMatrix()

save/restore the current translation.

virtual void loadIdentity()

zero the current translation

virtual void translate(Int xt, Int yt)
virtual void getTranslation(Int & xt, Int & yt) const
virtual Int xTranslation() const
virtual Int yTranslation() const

translation functions

void setDrawBuffer(Display::DrawBuffer buf)

set the draw buffer

void copyBackBufferToFrontBuffer()
void copyFrontBufferToBackBuffer()
void swapBuffers()

whole buffer memory exchanges

void copyBackBufferToFrontBuffer(Int x1, Int y1, Int x2, Int y2)
void copyFrontBufferToBackBuffer(Int x1, Int y1, Int x2, Int y2)
void swapBuffers(Int x1, Int y1, Int x2, Int y2)

partial buffer memory exchanges. (x1,y1 are blc, x2,y2 are trc)

virtual Bool refreshAllowed() const

return True if refresh is allowed, default impl is True always

virtual void clear()

Clear the window using the current clear color (default black)

virtual void clear(Int x1, Int y1, Int x2, Int y2)

virtual void flush()

Cause graphics commands to be flushed to the display

virtual void setClearColor(uInt color)
virtual void setClearColor(const String & color)
virtual void setClearColor(float r, float g, float b)

Set the color to use for clearing the display

virtual void setDeviceForegroundColor(const String colorname)
virtual String deviceForegroundColor() const
virtual void setDeviceBackgroundColor(const String colorname)
virtual String deviceBackgroundColor() const

Get/set the current foreground/background colors. These colors are used when the special Strings "foreground" and "background" are given for a color.

virtual uInt clearColor() const
virtual void getClearColor(float & r, float & g, float & b) const

return the color used for clearing the display

void setColor(const String& colorName)

Set the current color to a string recognized by XParseColor

void setColor(uInt ColorIndex)

Set the current color to a specified index

void setColor(float c1, float c2, float c3)

Set the current color using current colorspace All values must lie in the range of [0-1]

void setRGBColor(float r, float g, float b)

Set the current color using rgb colorspace All values must lie in the range of [0-1]

void setHSVColor(float h, float s, float v)

Set the current color to an hsv colorspace All values must lie in the range of [0-1]

Bool getColorComponents(const String &colorname, Float &r, Float &g, Float &b)

Get color components in range 0 to 1 without actually allocating the color. This is needed to set up other devices, for example PgPlot.

uInt color() const

Return the current color.

void getColor(float & r, float & g, float & b) const

Return the current color as an RGB triple;

Bool getColor(int, int, uInt &)

Return the color at some position

Bool getRGBColor(int, int, float &, float &, float &)

Return the RGB values of the color at some position

static void handleEventsEH(Widget w, X11PixelCanvas * xpc, XEvent * ev, Boolean *)
void handleEvents(Widget w, XEvent * ev)

Event Handling

static void exposeCB(Widget , X11PixelCanvas * xpc, XtPointer callData)

number returned depends on mode. virtual Bool getPixelValue(uInt xpos, uInt ypos, Vector &values);

ILColormap * makeColormap();

handle exposure callback

static void positionEventCB(Widget, X11PixelCanvas * xpc, XtPointer callData)

handle position callback

static void colorTableResizeCB(PixelCanvasColorTable * pcctbl, uInt, X11PixelCanvas * xpc, Display::RefreshReason reason)

handle colorTable resize

Bool resizeColorTable(uInt newSize)

resize the colortable by requesting a new number of cells

Bool resizeColorTable(uInt nReds, uInt nGreens, uInt nBlues)

resize the colortable by requesting a new color cube

PixelCanvasColorTable * pcctbl() const

return the pixel canvas color table

void setPcctbl(PixelCanvasColorTable * pcctbl)

set the pixel canvas color table

virtual uInt width() const
virtual uInt height() const
virtual uInt depth() const

Return the width, height, depth of the display

virtual void pixelDensity(Float &xdpi, Float &ydpi) const

Get the pixel density (in dots per inch [dpi]) of the PixelCanvas

Bool resize(uInt reqXSize, uInt reqYSize, Bool doCallbacks = True)

resize the PixelCanvas to a new size

::XDisplay * display() const
Screen * screen() const
Visual * visual() const
Pixmap pixmap() const
Window drawWindow() const
GC gc() const
XColormap xcmap() const
X11PixelCanvasColorTable * xpcctbl() const

Return some things peculiar to the X11 pixel canvas

Display::DrawMode drawMode()

draw mode - Display::Compile (build display list) or Display::Draw (immediate mode)

void * requestBuffer() const

Request buffer is used to batch requests to the X server

Bool drawToPixmap() const

Return True if drawing commands should be sent to the pixmap

virtual Bool drawToWindow() const

Return True if drawing commands should be sent to the window

void appendToDisplayList(X11PCDisplayListObject * obj)

Display list caching

virtual Bool writeXPixmap(const String &filename)

Write an X Pixmap (xpm) file of the current pixmap

Bool resize_()

test for resize of the pixel canvas dimensions, returning true if the size was changed.

void exposeHandler_()

Handle the X expose event. This is caught by the pixel canvas and forwarded as a refresh event only if the pixel canvas changed dimensions. If there was no size change, the pixel canvas simply copies its pixmap to the display without generating a refresh.

Bool packDisplayList(String & str, PtrBlock<X11PCDisplayListObject *> * l, uInt count)

Display list optimization

Strip empty dl entries and make a new list

Bool applyConsecutiveLineOpt(String & s, PtrBlock<X11PCDisplayListObject *> * l)

Display list optimization

replace sequences of line/lines with a single lines call

Bool applyConsecutivePointOpt(String & s, PtrBlock<X11PCDisplayListObject *> * l)

Display list optimization

replace sequences of point/points with a single point call

Bool compactDisplayList(PtrBlock<X11PCDisplayListObject *> * l, uInt & count)

Display list optimization

Entry point

uInt pickListID()

Select a list id for a new display list

void resizePixmap()

resize the pixmap to match the window size