GLPixelCanvas.h
Classes
- GLPixelCanvas -- OpenGL implementation of PixelCanvas. (full description)
Interface
- Public Members
- GLPixelCanvas(Widget parent, GLPixelCanvasColorTable * glpcctbl, uInt width, uInt height)
- virtual ~GLPixelCanvas()
- 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 Bool setFont(const String &fontName)
- virtual void drawText(Int x, Int y, const String &text, Display::TextAlign alignment = Display::AlignCenter)
- virtual void drawImage(const Matrix<uInt> &data, Int x, Int y)
- virtual void drawImage(const Matrix<Int> &data, Int x, Int y)
- virtual void drawImage(const Matrix<uLong> &data, Int x, Int y)
- virtual void drawImage(const Matrix<Float> &data, Int x, Int y)
- virtual void drawImage(const Matrix<Double> &data, Int x, Int y)
- void GLPixelCanvas::drawIndexedImage( const Matrix<uInt> &data, Float x=0.0, Float y=0.0, Float z=0.0, Float xscl=1.0, Float yscl=1.0)
- virtual void drawImage(const Int &x, const Int &y, const Matrix<uInt> &data, const Matrix<Bool> &mask)
- virtual void drawImage(const Matrix<uInt> &data, Int x, Int y, uInt xzoom, uInt yzoom)
- virtual void drawImage(const Matrix<Int> &data, Int x, Int y, uInt xzoom, uInt yzoom)
- virtual void drawImage(const Matrix<uLong> &data, Int x, Int y, uInt xzoom, uInt yzoom)
- virtual void drawImage(const Matrix<Float> &data, Int x, Int y, uInt xzoom, uInt yzoom)
- virtual void drawImage(const Matrix<Double> &data, Int x, Int y, uInt xzoom, uInt yzoom)
- virtual void drawImage(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)
- virtual void bufferComponent(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)
- virtual void flushComponentBuffers()
- virtual void drawPoint(Int x1, Int y1)
- virtual void drawPoint(Float x1, Float y1)
- virtual void drawPoint3D(Float x1, Float y1, Float z1)
- virtual void drawPoint(Double x1, Double y1)
- virtual void drawPoints(const Matrix<Int> &verts)
- virtual void drawPoints(const Matrix<Float> &verts)
- void drawPoints3D(const Matrix<Float> &verts)
- virtual void drawPoints(const Matrix<Double> &verts)
- virtual void drawPoints(const Vector<Int> &x1, const Vector<Int> &y1)
- virtual void drawPoints(const Vector<Float> &x1, const Vector<Float> &y1)
- virtual void drawPoints3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
- virtual void drawPoints(const Vector<Double> &x1, const Vector<Double> &y1)
- void setPointSize(const uInt pointsize)
- virtual void drawLine(Int x1, Int y1, Int x2, Int y2)
- virtual void drawLine(Float x1, Float y1, Float x2, Float y2)
- virtual void drawLine3D(Float x1, Float y1, Float z1, Float x2, Float y2, Float z2)
- virtual void drawLine(Double x1, Double y1, Double x2, Double y2)
- virtual void drawLines(const Matrix<Int> &verts)
- virtual void drawLines(const Matrix<Float> &verts)
- virtual void drawLines3D(const Matrix<Float> &verts)
- virtual void drawLines(const Matrix<Double> &verts)
- virtual void drawLines(const Vector<Int> &x1, const Vector<Int> &y1, const Vector<Int> &x2, const Vector<Int> &y2)
- virtual void drawLines(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &x2, const Vector<Float> &y2)
- virtual void drawLines(const Vector<Double> &x1, const Vector<Double> &y1, const Vector<Double> &x2, const Vector<Double> &y2)
- virtual void drawPolyline(const Vector<Int> &x1, const Vector<Int> &y1)
- virtual void drawPolyline(const Vector<Float> &x1, const Vector<Float> &y1)
- virtual void drawPolyline3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
- virtual void drawPolyline(const Vector<Double> &x1, const Vector<Double> &y1)
- virtual void drawPolyline(const Matrix<Int> &verts)
- virtual void drawPolyline(const Matrix<Float> &verts)
- virtual void drawPolyline(const Matrix<Double> &verts)
- virtual void drawPolygon(const Vector<Int> &x1, const Vector<Int> &y1)
- virtual void drawPolygon(const Vector<Float> &x1, const Vector<Float> &y1)
- virtual void drawPolygon3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
- virtual void drawPolygon(const Vector<Double> &x1, const Vector<Double> &y1)
- virtual void drawFilledPolygon(const Vector<Int> &x1, const Vector<Int> &y1)
- virtual void drawFilledPolygon(const Vector<Float> &x1, const Vector<Float> &y1)
- virtual void drawFilledPolygon3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
- virtual void drawFilledPolygon(const Vector<Double> &x1, const Vector<Double> &y1)
- virtual void drawPolygon(const Matrix<Int> &verts)
- virtual void drawPolygon(const Matrix<Float> &verts)
- virtual void drawPolygon3D(const Matrix<Float> &verts)
- virtual void drawPolygon(const Matrix<Double> &verts)
- virtual void drawRectangle(Int x1, Int y1, Int x2, Int y2)
- virtual void drawRectangle(Float x1, Float y1, Float x2, Float y2)
- virtual void drawRectangle(Double x1, Double y1, Double x2, Double y2)
- virtual void drawFilledRectangle(Int x1, Int y1, Int x2, Int y2)
- virtual void drawFilledRectangle(Float x1, Float y1, Float x2, Float y2)
- virtual void drawFilledRectangle(Double x1, Double y1, Double x2, Double y2)
- virtual void drawColoredPoints(const Vector<Int> &x1, const Vector<Int> &y1, const Vector<uInt> &colors)
- virtual void drawColoredPoints(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<uInt> &colors)
- virtual 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)
- virtual void drawColoredLines(const Vector<Int> &x1, const Vector<Int> &y1, const Vector<Int> &x2, const Vector<Int> &y2, const Vector<uInt> &colors)
- virtual void drawColoredLines(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &x2, const Vector<Float> &y2, const Vector<uInt> &colors)
- virtual void drawColoredLines(const Vector<Double> &x1, const Vector<Double> &y1, const Vector<Double> &x2, const Vector<Double> &y2, const Vector<uInt> &colors)
- virtual void setForeground(uLong color)
- virtual void setLineWidth(Float width)
- virtual void setLineStyle(Display::LineStyle style)
- virtual void setFillStyle(Display::FillStyle style)
- virtual void setDrawFunction(Display::DrawFunction function)
- virtual void setBackground(uLong color)
- virtual void setCapStyle(Display::CapStyle style)
- virtual void setJoinStyle(Display::JoinStyle style)
- virtual void setFillRule(Display::FillRule rule)
- virtual void setArcMode(Display::ArcMode mode)
- virtual uLong getForeground() const
- virtual Float getLineWidth() const
- virtual Display::LineStyle getLineStyle() const
- virtual Display::FillStyle getFillStyle() const
- virtual Display::DrawFunction getDrawFunction() const
- virtual uLong getBackground() const
- virtual Display::CapStyle getCapStyle() const
- virtual Display::JoinStyle getJoinStyle() const
- virtual Display::FillRule getFillRule() const
- virtual Display::ArcMode getArcMode() const
- virtual Bool enable(Display::Option option)
- virtual Bool disable(Display::Option option)
- virtual void setImageCacheStrategy(Display::ImageCacheStrategy strategy)
- virtual Display::ImageCacheStrategy imageCacheStrategy() const
- virtual void setClipWindow(Int x1, Int y1, Int x2, Int y2)
- virtual void getClipWindow(Int &x1, Int &y1, Int &x2, Int &y2)
- void redraw()
- virtual void refresh(const Display::RefreshReason &reason = Display::UserCommand, const Bool &explicitrequest = True)
- void repaint(const Bool redraw=False)
- virtual void flush()
- virtual void clear()
- virtual void clear(Int x1, Int y1, Int x2, Int y2)
- virtual void setClearColor(uInt colorIndex)
- virtual void setClearColor(const String &colorname)
- virtual void setClearColor(float r, float g, float b)
- virtual uInt clearColor() const
- virtual void getClearColor(float &r, float &g, float &b) const
- virtual void setDeviceForegroundColor(const String colorname)
- virtual String deviceForegroundColor() const
- virtual void setDeviceBackgroundColor(const String colorname)
- virtual String deviceBackgroundColor() const
- virtual uInt width() const
- virtual uInt height() const
- virtual uInt depth() const
- virtual void pixelDensity(Float &xdpi, Float &ydpi) const
- virtual void setColor(uInt colorIndex)
- virtual void setColor(const String &colorname)
- virtual void setRGBColor(float r, float g, float b)
- virtual Bool getColorComponents(const String &colorname, Float &r, Float &g, Float &b)
- virtual uInt color() const
- virtual void getColor(float &r, float &g, float &b) const
- virtual Bool getColor(Int x, Int y, uInt &color)
- virtual Bool getRGBColor(Int x, Int y, float &r, float &g, float &b)
- virtual Bool resize(uInt reqXSize, uInt reqYSize, Bool doCallbacks = True)
- virtual Bool resizeColorTable(uInt newSize)
- virtual Bool resizeColorTable(uInt nReds, uInt nGreens, uInt nBlues)
- virtual GLPixelCanvasColorTable * glpcctbl() const
- PixelCanvasColorTable * pcctbl() const
- void setPcctbl(PixelCanvasColorTable * pcctbl)
- 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
- virtual void setDrawBuffer(Display::DrawBuffer buf)
- static void copyBuffer(GLenum from, GLenum to, GLint x, GLint y, GLsizei width, GLsizei height)
- void copyBuffer(GLenum from, GLenum to)
- virtual void copyBackBufferToFrontBuffer()
- virtual void copyFrontBufferToBackBuffer()
- virtual void swapBuffers()
- virtual void copyBackBufferToFrontBuffer(Int x1, Int y1, Int x2, Int y2)
- virtual void copyFrontBufferToBackBuffer(Int x1, Int y1, Int x2, Int y2)
- virtual void swapBuffers(Int x1, Int y1, Int x2, Int y2)
- virtual Bool refreshAllowed() const
- void makeCurrent()
- void waitX()
- void waitGL()
- int glcheck(const char *msg=NULL, uInt nspaces=0)
- static int glCheck(const char *msg=NULL, uInt nspaces=0)
- void drawTexturedImage(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels, GLPCTextureParams *params = NULL)
- void drawImagePixels( GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels)
- static void drawPixels(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, GLenum type, const GLvoid *pixels)
- void drawGLImage(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels)
- void bufferZValue(const Float z=0.0)
- void trace(Boolean trace)
- Boolean tracing()const
- void traceLevel(const uLong traceLevel)
- uLong traceLevel()const
- void postToStream(Bool p=False)
- void postToString(String *s=NULL)
- void postString()
- void note(const char *note)
- Boolean autoRefresh()const
- void autoRefresh(Boolean refresh)
- void pushAttrib(const GLbitfield attrib)
- void popAttrib()
- Boolean doubleBuffered()const
- Boolean isRGB()const
- Private Members
- void exposeHandler()
- void resizeHandler()
- static void handleEventsCB(Widget w, GLPixelCanvas * xpc, XEvent * ev, Boolean *)
- void handleEvents(Widget w, XEvent * ev)
- Boolean handleResizeEvent(uInt w, uInt h)
- static void colorTableResizeCB(PixelCanvasColorTable * pcctbl, uInt, GLPixelCanvas * xpc, Display::RefreshReason reason)
- void initComponents()
- GLPCDisplayList *createList(const char *name=NULL)
- uInt makeList(const char *name=NULL)
- void resizeList()
- void cleanLists()
- void purgeLists()
- Boolean removeList(uInt listid)
- void beginListEntry(const char *name=NULL)
- void beginListEntry(GLPCDisplayListElement *e)
- void endListEntry()
- void traceCheck(const char *name, uLong traceLevel, uInt nspaces)
- void traceCheck(const char *name, uLong traceLevel)
- Public Members
- void storeColorValue(GLPCColorValue &v, uLong value)
- void storeColorIndex(GLPCColorValue &v, uInt index)
- void storeColorValue(GLPCColorValue &v, Float r, Float g, Float b)
- void storeColorValue(GLPCColorValue &v, Float r, Float g, Float b, Float a)
- void setCurrentColorIndex(uInt index, const char *name=NULL)
- void setCurrentColorValue(uLong value, const char *name=NULL)
- void setCurrentColorValue(Float r, Float g, Float b, const char *name=NULL)
- void setCurrentColorValue(Float r, Float g, Float b, Float a, const char *name=NULL)
- void setCurrentColorValue(const GLPCColorValue &v, const char *name=NULL)
- void setClearColorIndex(uInt index, const char *name=NULL)
- void setClearColorValue(uLong index, const char *name=NULL)
- void setClearColorValue(Float r, Float g, Float b, const char *name=NULL)
- void setClearColorValue(Float r, Float g, Float b, Float a, const char *name=NULL)
- void setClearColorValue(const GLPCColorValue &v, const char *name=NULL)
- void drawColoredPoints_(const char *Name, const Vector<Int> &x1, const Vector<Int> &y1, const Vector<uInt> &colors)
- void drawColoredPoints_(const char *Name, const Vector<Float> &x1, const Vector<Float> &y1, const Vector<uInt> &colors)
- void drawColoredPoints_(const char *Name, const Vector<Double> &x1, const Vector<Double> &y1, const Vector<uInt> &colors)
- void pRWbuf(const char *str=NULL, int nspaces=0)
- void warn(const char *routine, const char *msg, const SourceLocation *where)const
- void unimplemented(const char *routine, const SourceLocation *where)const
Prerequisite
Synopsis
Implementation of PixelCanvas for OpenGL. Most, but not all of the
PixelCanvas functions are available. There is very little support for
3D.
Thrown Exceptions
To Do
Member Description
GLPixelCanvas(Widget parent, GLPixelCanvasColorTable * glpcctbl, uInt width, uInt height)
Drawing can not take place until the window exists!
enabling/disabling of event tracking (unimplemented)
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)
(Cacheable) recall cached display commands
translate all lists
virtual void translateList(uInt list, Int xt, Int yt)
translate the list
virtual void deleteList(uInt list)
remove list from cache
flush all lists from the cache
virtual Bool validList(uInt list)
return True if the list exists
virtual Bool setFont(const String &fontName)
(Cacheable) Set the font to the recognizable font name. (unimplemented)
virtual void drawText(Int x, Int y, const String &text, Display::TextAlign alignment = Display::AlignCenter)
(Cacheable) Draw text using that font aligned in some way to the
position. (unimplemented)
virtual void drawImage(const Matrix<uInt> &data, Int x, Int y)
virtual void drawImage(const Matrix<Int> &data, Int x, Int y)
virtual void drawImage(const Matrix<uLong> &data, Int x, Int y)
virtual void drawImage(const Matrix<Float> &data, Int x, Int y)
virtual void drawImage(const Matrix<Double> &data, Int x, Int y)
(Cacheable) Draw an array of 2D color data as a raster image for zoom = <1,1>
void GLPixelCanvas::drawIndexedImage( const Matrix<uInt> &data, Float x=0.0, Float y=0.0, Float z=0.0, Float xscl=1.0, Float yscl=1.0)
(Cacheable) Draw an image using color indexes. If in RGB mode,
the virtual colortable is used.
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.
virtual void drawImage(const Matrix<uInt> &data, Int x, Int y, uInt xzoom, uInt yzoom)
virtual void drawImage(const Matrix<Int> &data, Int x, Int y, uInt xzoom, uInt yzoom)
virtual void drawImage(const Matrix<uLong> &data, Int x, Int y, uInt xzoom, uInt yzoom)
virtual void drawImage(const Matrix<Float> &data, Int x, Int y, uInt xzoom, uInt yzoom)
virtual void drawImage(const Matrix<Double> &data, Int x, Int y, uInt xzoom, uInt yzoom)
(Cacheable) Draw an array of 2D color data as a raster image for any positive integer zoom
virtual 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.
virtual void bufferComponent(const Matrix<uInt> &data, const Int &x, const Int &y, const Display::ColorComponent &colorcomponent)
Fill one of the channel buffers.
(NOT CACHEABLE!) Flush the component buffers.
virtual void drawPoint(Int x1, Int y1)
virtual void drawPoint(Float x1, Float y1)
virtual void drawPoint3D(Float x1, Float y1, Float z1)
virtual void drawPoint(Double x1, Double y1)
(Cacheable) Draw a single point using current color
virtual void drawPoints(const Matrix<Int> &verts)
virtual void drawPoints(const Matrix<Float> &verts)
void drawPoints3D(const Matrix<Float> &verts)
virtual void drawPoints(const Matrix<Double> &verts)
(Cacheable) Draw N points specified as a Nx2 matrix
virtual void drawPoints(const Vector<Int> &x1, const Vector<Int> &y1)
virtual void drawPoints(const Vector<Float> &x1, const Vector<Float> &y1)
virtual void drawPoints3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
virtual void drawPoints(const Vector<Double> &x1, const Vector<Double> &y1)
(Cacheable) Draw a bunch of points using current color
void setPointSize(const uInt pointsize)
(cacheable) Change the size of the points (in pixels) drawn by drawPoints.
virtual void drawLine(Int x1, Int y1, Int x2, Int y2)
virtual void drawLine(Float x1, Float y1, Float x2, Float y2)
virtual void drawLine3D(Float x1, Float y1, Float z1, Float x2, Float y2, Float z2)
virtual void drawLine(Double x1, Double y1, Double x2, Double y2)
(Cacheable) Draw a single line using current color
virtual void drawLines(const Matrix<Int> &verts)
virtual void drawLines(const Matrix<Float> &verts)
virtual void drawLines3D(const Matrix<Float> &verts)
virtual void drawLines(const Matrix<Double> &verts)
(Cacheable) Draw N/2 lines from an Nx2 matrix
virtual void drawLines(const Vector<Int> &x1, const Vector<Int> &y1, const Vector<Int> &x2, const Vector<Int> &y2)
virtual void drawLines(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &x2, const Vector<Float> &y2)
virtual void drawLines(const Vector<Double> &x1, const Vector<Double> &y1, const Vector<Double> &x2, const Vector<Double> &y2)
(Cacheable) Draw a bunch of unrelated lines using current color
virtual void drawPolyline(const Vector<Int> &x1, const Vector<Int> &y1)
virtual void drawPolyline(const Vector<Float> &x1, const Vector<Float> &y1)
virtual void drawPolyline3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
virtual void drawPolyline(const Vector<Double> &x1, const Vector<Double> &y1)
(Cacheable) Draw a single connected line between the given points.
(Cacheable) Draw N-1 connected lines from Nx2 matrix of vertices
virtual void drawPolygon(const Vector<Int> &x1, const Vector<Int> &y1)
virtual void drawPolygon(const Vector<Float> &x1, const Vector<Float> &y1)
virtual void drawPolygon3D(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &z1)
virtual void drawPolygon(const Vector<Double> &x1, const Vector<Double> &y1)
(Cacheable) Draw a closed polygon
(Cacheable) Draw and fill a closed polygon
(Cacheable) Draw a closed N-sided polygon from Nx2 matrix of vertices
virtual void drawRectangle(Int x1, Int y1, Int x2, Int y2)
virtual void drawRectangle(Float x1, Float y1, Float x2, Float y2)
virtual void drawRectangle(Double x1, Double y1, Double x2, Double y2)
(Cacheable) Draw a rectangle
virtual void drawFilledRectangle(Int x1, Int y1, Int x2, Int y2)
virtual void drawFilledRectangle(Float x1, Float y1, Float x2, Float y2)
virtual void drawFilledRectangle(Double x1, Double y1, Double x2, Double y2)
(Cacheable) Draw a filled rectangle
(Cacheable) Draw a set of points, specifying a color per point to be drawn.
virtual void drawColoredLines(const Vector<Int> &x1, const Vector<Int> &y1, const Vector<Int> &x2, const Vector<Int> &y2, const Vector<uInt> &colors)
virtual void drawColoredLines(const Vector<Float> &x1, const Vector<Float> &y1, const Vector<Float> &x2, const Vector<Float> &y2, const Vector<uInt> &colors)
virtual void drawColoredLines(const Vector<Double> &x1, const Vector<Double> &y1, const Vector<Double> &x2, const Vector<Double> &y2, const Vector<uInt> &colors)
(Cacheable) Draw a set of lines, specifying a color per line to be drawn.
Set Graphics Attributes
Options for functions with enum argument
listed in DisplayEnums
Unimplemented set graphics functions.
Implemented get Graphics Attributes functions.
Unimplemented get Graphics Attributes.
virtual Bool enable(Display::Option option)
virtual Bool disable(Display::Option option)
(Cacheable) Option Control
Options listed in DisplayEnums
Only Display::ClipWindow is implemented.
Control the image-caching strategy. (Ignored)
virtual void setClipWindow(Int x1, Int y1, Int x2, Int y2)
virtual void getClipWindow(Int &x1, Int &y1, Int &x2, Int &y2)
(Cacheable) Setup the clip window. The clip window, when enabled, allows
a user to clip all graphics output to a rectangular region on
the screen.
void repaint(const Bool redraw=False)
(Not Cacheable) Redraw the window
Just redraws window. (If redraw is T, the window will be redrawn. If
F, it will only be redrawn if autoRefresh is T.
void redraw()
virtual void refresh(const Display::RefreshReason &reason = Display::UserCommand, const Bool &explicitrequest = True)
(Not Cacheable) Redraw the window
virtual void flush()
Cause display to flush any graphics commands not yet drawn
virtual void clear()
virtual void clear(Int x1, Int y1, Int x2, Int y2)
(Cacheable) Clear the window using the background color
If you want to clear the window use clear(),
not clear(IIII).
(Cacheable) Set the color to use for clearing the display
Setting named colors for Index mode isn't implemented.
virtual void setClearColor(uInt colorIndex)
virtual void setClearColor(float r, float g, float b)
(Cacheable) Set the color to use for clearing the display
virtual uInt clearColor() const
(Not Cacheable) Get the current color to use for clearing the display.
virtual void getClearColor(float &r, float &g, float &b) const
Get/set the current foreground/background colors. These colors
should be used when the special Strings "foreground" and "background"
are given for a color.
virtual uInt width() const
Return the width of the GLPixelCanvas in pixels
virtual uInt height() const
Return the height of the GLPixelCanvas in pixels
virtual uInt depth() const
Return the depth of the GLPixelCanvas in bits
virtual void pixelDensity(Float &xdpi, Float &ydpi) const
Get the pixel density (in dots per inch [dpi]) of the GLPixelCanvas
The X server is queried. It may or may not have the
correct answer.
virtual void setColor(uInt colorIndex)
(Cacheable) Set current color (works in RGB or colormap mode)
setColor(colorIndex) when called in RGB mode gets the
RGB values from the virtual color table. setForeground assumes the
value is a packed pixel.
virtual void setRGBColor(float r, float g, float b)
(Cacheable) Set current color (works in RGB or colormap mode)
Calling setRGBColor when in Index mode ignores
r, g & b and uses the current index value.
virtual void setColor(const String &colorname)
(Cacheable) Set current color (works in RGB or colormap mode)
virtual 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.
virtual uInt color() const
(Not Cacheable) Returns the current color as a color index
In RGB mode, this is only valid if setColor(index) has
been called.
virtual void getColor(float &r, float &g, float &b) const
(Not Cacheable) Retuns the current color as an RGB triple
virtual Bool getRGBColor(Int x, Int y, float &r, float &g, float &b)
(Not Cacheable) Get color index value (works in RGB or colormap mode)
Don't bother. No existing canvas implements these.
This should be removed since no one implements it.
virtual Bool getColor(Int x, Int y, uInt &color)
(Not Cacheable) Get color index value (works in RGB or colormap mode)
Don't bother. No existing canvas implements these.
virtual Bool resize(uInt reqXSize, uInt reqYSize, Bool doCallbacks = True)
(Not Cacheable) resize request. returns true if window was resized.
Will refresh if doCallbacks is True.
(Not Cacheable) resize the colortable by requesting a new number of cells
virtual Bool resizeColorTable(uInt nReds, uInt nGreens, uInt nBlues)
(Not Cacheable) resize the colortable by requesting a new RGB/HSV cube
Need a mechanism to return the GLPixelCanvasColorTable so
drawing functions within classes can operate.
Return the pixel canvas color table
save/restore the current translation. This is called pushMatrix because
eventually we may want scaling or rotation to play a modest
role here.
GLPixelCanvas uses OpenGL's push/pop matrix.
zero the current translation
virtual void getTranslation(Int &xt, Int &yt) const
translation functions
translate applies a relative translation to the current matrix and
can be used to position graphics. Together with pushMatrix and
popMatrix it can be used to build heirarchical scenes.
get/x/yTranslation are not currently implemented.
virtual void translate(Int xt, Int yt)
virtual Int xTranslation() const
virtual Int yTranslation() const
translation functions
translate applies a relative translation to the current matrix and
can be used to position graphics. Together with pushMatrix and
popMatrix it can be used to build heirarchical scenes.
(Not cacheable) set the draw buffer
The draw buffer is always set to BACK if double
buffered and FRONT if single buffered.
static void copyBuffer(GLenum from, GLenum to, GLint x, GLint y, GLsizei width, GLsizei height)
buffer memory exchanges
(Not cacheable)
Of this group, only swapbuffers() works.
buffer memory exchanges
(Not cacheable)
virtual void copyBackBufferToFrontBuffer(Int x1, Int y1, Int x2, Int y2)
virtual void copyFrontBufferToBackBuffer(Int x1, Int y1, Int x2, Int y2)
virtual void swapBuffers(Int x1, Int y1, Int x2, Int y2)
partial buffer memory exchanges. (x1,y1 are blc, x2,y2 are trc)
None of these are implemented.
return True if refresh is allowed right now...
Make this canvas's context current.
This must be called when switching between
GLPixelCanvases or else drawing will go to the wrong canvas. It is
not needed unless more than one GLPixelCanvas is active at a time.
Wait for X or GL commands to finish. Usually not needed.
int glcheck(const char *msg=NULL, uInt nspaces=0)
static int glCheck(const char *msg=NULL, uInt nspaces=0)
Print any GL error messages.
if msg is non NULL, it is printed first if there is an error.
nspaces is the number of spaces to indent the text.
Returns the number of errors. Usually only used internally.
void drawGLImage(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels)
Various ways to draw images. Used internally.
Calls drawImagePixels if in indexed mode or drawTexturedImage if RGB.
void drawTexturedImage(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels, GLPCTextureParams *params = NULL)
void drawImagePixels( GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels)
static void drawPixels(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, GLenum type, const GLvoid *pixels)
Various ways to draw images. Used internally.
void trace(Boolean trace)
Tracing support. May be useful when debugging graphics code.
Turn tracing on/off.
void traceLevel(const uLong traceLevel)
Tracing support. May be useful when debugging graphics code.
Set trace level. (actually a mask). default is GLTraceNormal.
NOT fully implemented.
void note(const char *note)
Tracing support. May be useful when debugging graphics code.
Add a note entry to traced output.
Tracing support. May be useful when debugging graphics code.
Normally GLPixelCanvas repaints the window when it is damaged. If
the user wishes to handle this, turn off auto refreshing.
void pushAttrib(const GLbitfield attrib)
OpenGL's push/popAttrib functions
Boolean isRGB()const
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.
Called when window is resized.
Event Handling
handle colorTable resize
static void handleEventsCB(Widget w, GLPixelCanvas * xpc, XEvent * ev, Boolean *)
void handleEvents(Widget w, XEvent * ev)
Boolean handleResizeEvent(uInt w, uInt h)
Event Handling
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Return a pointer to a new GLPC display list.
uInt makeList(const char *name=NULL)
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Create a new display list and add to the list of lists.
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Grow the list.
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Go through the list of display lists removing any unused lists.
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Called when the window is resized or cleared. Deletes the repaint
list.
Boolean removeList(uInt listid)
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Remove a display list from list of lists. Returns True if list
was removed. False if listid is invalid or list has already been removed.
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Called to begin caching.
void traceCheck(const char *name, uLong traceLevel, uInt nspaces)
void traceCheck(const char *name, uLong traceLevel)
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Print if tracing is turned on.
Most user callable drawing routines call this.
void storeColorIndex(GLPCColorValue &v, uInt index)
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
If RGB mode, index is interpreted as an index into the virtual CT.
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
index is always treated as an index. (In RGB mode, the virtual
color table is used.
void setClearColorValue(const GLPCColorValue &v, const char *name=NULL)
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Tell OpenGL to use the given color index or RGB value depending
on whether we're in Index or RGB mode. If name is not NULL,
wrap the call in the usual begin/endListEntry, tracecheck.
void drawColoredPoints_(const char *Name, const Vector<Int> &x1, const Vector<Int> &y1, const Vector<uInt> &colors)
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Internal versions of public functions
void warn(const char *routine, const char *msg, const SourceLocation *where)const
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.
Routines to print warnings.
void endListEntry()
void storeColorValue(GLPCColorValue &v, uLong value)
void storeColorValue(GLPCColorValue &v, Float r, Float g, Float b)
void storeColorValue(GLPCColorValue &v, Float r, Float g, Float b, Float a)
void setCurrentColorValue(uLong value, const char *name=NULL)
void setCurrentColorValue(Float r, Float g, Float b, const char *name=NULL)
void setCurrentColorValue(Float r, Float g, Float b, Float a, const char *name=NULL)
void setCurrentColorValue(const GLPCColorValue &v, const char *name=NULL)
void setClearColorIndex(uInt index, const char *name=NULL)
void setClearColorValue(uLong index, const char *name=NULL)
void setClearColorValue(Float r, Float g, Float b, const char *name=NULL)
void setClearColorValue(Float r, Float g, Float b, Float a, const char *name=NULL)
void drawColoredPoints_(const char *Name, const Vector<Float> &x1, const Vector<Float> &y1, const Vector<uInt> &colors)
void drawColoredPoints_(const char *Name, const Vector<Double> &x1, const Vector<Double> &y1, const Vector<uInt> &colors)
void pRWbuf(const char *str=NULL, int nspaces=0)
void unimplemented(const char *routine, const SourceLocation *where)const
Internal handling of display lists.
There is a list of GLPCDisplayLists. Item 0 always exists and is used
to redraw the window after expose events. Any other entries are
created in response to newList() calls.