28 #ifndef TRIALDISPLAY_GLPIXELCANVAS_H
29 #define TRIALDISPLAY_GLPIXELCANVAS_H
34 #include <X11/Intrinsic.h>
35 #include <X11/Xutil.h>
46 class GLPCDisplayList;
47 class GLPCDisplayListEntry;
48 class GLPCDisplayListElement;
49 class GLPCTextureParams;
411 virtual void flush();
418 virtual void clear();
433 virtual void getClearColor(
float &r,
float &g,
float &b)
const;
465 virtual void setRGBColor(
float r,
float g,
float b);
480 virtual void getColor(
float &r,
float &g,
float &b)
const;
546 static void copyBuffer(GLenum from, GLenum to,
548 GLsizei width, GLsizei height);
589 GLsizei width, GLsizei height,
590 GLfloat xscale, GLfloat yscale,
591 GLenum format,
const GLushort *pixels,
595 GLsizei width, GLsizei height,
596 GLfloat xscale, GLfloat yscale,
597 GLenum format,
const GLushort *pixels);
599 static void drawPixels(GLfloat x, GLfloat y, GLfloat z,
600 GLsizei width, GLsizei height,
601 GLfloat xscale, GLfloat yscale,
602 GLenum format, GLenum
type,
603 const GLvoid *pixels);
607 GLsizei width, GLsizei height,
608 GLfloat xscale, GLfloat yscale,
609 GLenum format,
const GLushort *pixels);
680 XEvent * ev, Boolean *);
751 const char *
name=NULL);
753 const char *
name=NULL);
759 const char *
name=NULL);
761 const char *
name=NULL);
777 void pRWbuf(
const char *str=NULL,
int nspaces=0);
779 void warn(
const char *routine,
const char *msg,
780 const SourceLocation *where)
const;
781 void unimplemented(
const char *routine,
const SourceLocation *where)
const;
virtual void drawColoredLines(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1, const casacore::Vector< casacore::Int > &x2, const casacore::Vector< casacore::Int > &y2, const casacore::Vector< casacore::uInt > &colors)
(Cacheable) Draw a set of lines, specifying a color per line to be drawn.
virtual void setLineStyle(Display::LineStyle style)
void waitX()
Wait for X or GL commands to finish.
virtual Display::DrawFunction getDrawFunction() const
Get Graphics Attributes.
void drawImagePixels(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels)
casacore::String itsDeviceForegroundColor_
casacore::String itsDeviceBackgroundColor_
virtual void bufferComponent(const casacore::Matrix< casacore::uInt > &data, const casacore::Int &x, const casacore::Int &y, const Display::ColorComponent &colorcomponent)
Fill one of the channel buffers.
virtual void setForeground(casacore::uLong color)
Set Graphics Attributes Options for functions with enum argument listed in DisplayEnums.
Abstract interface to underlying graphics library's colortable.
virtual void setCapStyle(Display::CapStyle style)
virtual void setRGBColor(float r, float g, float b)
Caution: Calling setRGBColor when in Index mode ignores r, g & b and uses the current index value; ...
int glcheck(const char *msg=NULL, casacore::uInt nspaces=0)
Print any GL error messages.
virtual casacore::Bool getColorComponents(const casacore::String &colorname, casacore::Float &r, casacore::Float &g, casacore::Float &b)
Get color components in range 0 to 1 without actually allocating the color.
casacore::uLong itsComponentWidth_
void postString()
If an output string exists, copy it to an output stream if it exists.
virtual void refresh(const Display::RefreshReason &reason=Display::UserCommand, const casacore::Bool &explicitrequest=true)
virtual void swapBuffers()
void storeColorIndex(GLPCColorValue &v, casacore::uInt index)
If RGB mode, index is interpreted as an index into the virtual CT.
virtual void copyFrontBufferToBackBuffer()
void endListEntry()
Called to end caching.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
virtual Display::ArcMode getArcMode() const
virtual casacore::uLong getBackground() const
Unimplemented get Graphics Attributes.
Boolean handleResizeEvent(casacore::uInt w, casacore::uInt h)
virtual casacore::uInt depth() const
Return the depth of the GLPixelCanvas in bits.
void setPointSize(const casacore::uInt pointsize)
(cacheable) Change the size of the points (in pixels) drawn by drawPoints.
virtual casacore::Bool supportsLists()
Does this canvas support cached display lists? The user of the canvas should always check this...
void drawGLImage(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels)
Calls drawImagePixels if in indexed mode or drawTexturedImage if RGB.
void setCurrentColorIndex(casacore::uInt index, const char *name=NULL)
index is always treated as an index.
void redraw()
(Not Cacheable) Redraw the window
void warn(const char *routine, const char *msg, const SourceLocation *where) const
Routines to print warnings.
Option
PixelCanvas Options.
Holds parameters for setting glTexParameteri variables. <visibility=local>
casacore::uLong traceLevel_
casacore::uLong traceLevel() const
virtual void drawPolygon(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1)
(Cacheable) Draw a closed polygon
virtual Type type()
Return the type enum.
virtual void setArcMode(Display::ArcMode mode)
virtual Display::FillStyle getFillStyle() const
void makeCurrent()
Make this canvas's context current.
XVisualInfo * visualInfo_
GLPCColorValue clearColor_
Clear color.
DrawBuffer
PixelCanvas target drawing destination.
casacore::Float itsComponentScaleY_
void trace(Boolean trace)
Tracing support.
static void drawPixels(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, GLenum type, const GLvoid *pixels)
virtual casacore::Int yTranslation() const
virtual void drawColoredPoints(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1, const casacore::Vector< casacore::uInt > &colors)
(Cacheable) Draw a set of points, specifying a color per point to be drawn.
virtual void setImageCacheStrategy(Display::ImageCacheStrategy strategy)
Control the image-caching strategy.
virtual void drawPolyline3D(const casacore::Vector< casacore::Float > &x1, const casacore::Vector< casacore::Float > &y1, const casacore::Vector< casacore::Float > &z1)
virtual void copyBackBufferToFrontBuffer()
buffer memory exchanges (Not cacheable)
virtual void setJoinStyle(Display::JoinStyle style)
virtual void enablePositionEvents()
void drawPoints3D(const casacore::Matrix< casacore::Float > &verts)
virtual casacore::Bool disable(Display::Option option)
static void postToString(casacore::String *str=NULL)
Post messages to str for later use.
void exposeHandler()
Handle the X expose event.
GLPCDisplayList * createList(const char *name=NULL)
Internal handling of display lists.
virtual void drawLine(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)
(Cacheable) Draw a single line using current color
virtual Display::ImageCacheStrategy imageCacheStrategy() const
virtual casacore::Bool getRGBColor(casacore::Int x, casacore::Int y, float &r, float &g, float &b)
This should be removed since no one implements it.
FillRule
Fill Rule Xlib programming guide, pg.132.
void bufferZValue(const casacore::Float z=0.0)
Holds both a color index and RGBA values.
virtual void drawFilledPolygon(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1)
(Cacheable) Draw and fill a closed polygon
virtual void translateList(casacore::uInt list, casacore::Int xt, casacore::Int yt)
translate the list
virtual void flushComponentBuffers()
(NOT CACHEABLE!) Flush the component buffers.
GLPixelCanvas(Widget parent, GLPixelCanvasColorTable *glpcctbl, casacore::uInt width, casacore::uInt height)
Caution: Drawing can not take place until the window exists!
virtual void translate(casacore::Int xt, casacore::Int yt)
translation functions translate applies a relative translation to the current matrix and can be used ...
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void storeColorValue(GLPCColorValue &v, casacore::uLong value)
Store the new value in the struct.
virtual void setClearColor(casacore::uInt colorIndex)
(Cacheable) Set the color to use for clearing the display
casacore::uLong itsComponentHeight_
Boolean autoRefresh() const
Normally GLPixelCanvas repaints the window when it is damaged.
casacore::uInt listSize_
Display lists.
Base class for the various display list subclasses.
virtual void endList()
end caching display commands
static void colorTableResizeCB(PixelCanvasColorTable *pcctbl, casacore::uInt, GLPixelCanvas *xpc, Display::RefreshReason reason)
handle colorTable resize
virtual void drawPoint(casacore::Int x1, casacore::Int y1)
(Cacheable) Draw a single point using current color
GLPCDisplayListElement * currentElement_
virtual void loadIdentity()
zero the current translation
void handleEvents(Widget w, XEvent *ev)
Base class defining interface to pixel-based output devices.
virtual void pushMatrix()
save/restore the current translation.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
virtual casacore::String deviceForegroundColor() const
void setClearColorIndex(casacore::uInt index, const char *name=NULL)
CapStyle
Controls the appearance of thick lines near their endpoints.
reference point aligned to center of text
void setClearColorValue(casacore::uLong index, const char *name=NULL)
static void copyBuffer(GLenum from, GLenum to, GLint x, GLint y, GLsizei width, GLsizei height)
buffer memory exchanges (Not cacheable)
virtual void disablePositionEvents()
virtual void deleteList(casacore::uInt list)
remove list from cache
void cleanLists()
Go through the list of display lists removing any unused lists.
ColorComponent
Color components.
virtual void setDrawFunction(Display::DrawFunction function)
Set Graphics Attributes Options for functions with enum argument listed in DisplayEnums.
virtual void drawList(casacore::uInt list)
(Cacheable) recall cached display commands
Display::FillStyle fillStyle_
void autoRefresh(Boolean refresh)
virtual void deleteLists()
flush all lists from the cache
void pRWbuf(const char *str=NULL, int nspaces=0)
Boolean doubleBuffered() const
static void postToStream(casacore::Bool useStream=false)
Logging to standard AIPS++ disrupts trace formatting.
Boolean exposeHandlerFirstTime_
virtual void setDeviceForegroundColor(const casacore::String colorname)
Get/set the current foreground/background colors.
virtual void enableMotionEvents()
enabling/disabling of event tracking (unimplemented)
virtual casacore::Bool enable(Display::Option option)
(Cacheable) Option Control Options listed in DisplayEnums Only Display::ClipWindow is implemented...
virtual void drawPolyline(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1)
(Cacheable) Draw a single connected line between the given points.
virtual void drawText(casacore::Int x, casacore::Int y, const casacore::String &text, Display::TextAlign alignment=Display::AlignCenter)
(Cacheable) Draw text using that font aligned in some way to the position.
OpenGL implementation of PixelCanvas.
virtual casacore::Bool refreshAllowed() const
return true if refresh is allowed right now...
virtual casacore::Bool resize(casacore::uInt reqXSize, casacore::uInt reqYSize, casacore::Bool doCallbacks=true)
(Not Cacheable) resize request.
virtual casacore::Int xTranslation() const
virtual void drawLine3D(casacore::Float x1, casacore::Float y1, casacore::Float z1, casacore::Float x2, casacore::Float y2, casacore::Float z2)
virtual void drawPoint3D(casacore::Float x1, casacore::Float y1, casacore::Float z1)
virtual void setFillRule(Display::FillRule rule)
virtual casacore::Float getLineWidth() const
virtual casacore::uInt getLineWidth() const = 0;
virtual void setFillStyle(Display::FillStyle style)
virtual void drawFilledRectangle(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)
(Cacheable) Draw a filled rectangle
GLPCColorValue currentColor_
Current color.
virtual void getTranslation(casacore::Int &xt, casacore::Int &yt) const
Tip: get/x/yTranslation are not currently implemented;
virtual casacore::Bool resizeColorTable(casacore::uInt newSize)
(Not Cacheable) resize the colortable by requesting a new number of cells
casacore::uInt currentListID_
casacore::uInt makeList(const char *name=NULL)
Create a new display list and add to the list of lists.
bool Bool
Define the standard types used by Casacore.
virtual void translateAllLists(casacore::Int xt, casacore::Int yt)
translate all lists
void traceLevel(const casacore::uLong traceLevel)
Set trace level.
virtual Display::JoinStyle getJoinStyle() const
virtual void drawLines3D(const casacore::Matrix< casacore::Float > &verts)
virtual void setBackground(casacore::uLong color)
Unimplemented set graphics functions.
virtual void pixelDensity(casacore::Float &xdpi, casacore::Float &ydpi) const
Get the pixel density (in dots per inch [dpi]) of the GLPixelCanvas Tip: The X server is queried; It...
DisplayListElement that can contain lists of other DisplayListElements.
casacore::Bool doubleBuffered_
GL information.
virtual void setDeviceBackgroundColor(const casacore::String colorname)
void postToStream(casacore::Bool p=false)
virtual void drawRectangle(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)
(Cacheable) Draw a rectangle
void purgeLists()
Called when the window is resized or cleared.
casacore::Float itsComponentScaleX_
virtual casacore::Bool validList(casacore::uInt list)
return true if the list exists
virtual void drawLines(const casacore::Matrix< casacore::Int > &verts)
(Cacheable) Draw N/2 lines from an Nx2 matrix
virtual void setClipWindow(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)
(Cacheable) Setup the clip window.
virtual void flush()
Cause display to flush any graphics commands not yet drawn.
virtual void clear()
(Cacheable) Clear the window using the background color Tip: If you want to clear the window use cle...
void beginListEntry(const char *name=NULL)
Called to begin caching.
virtual Display::LineStyle getLineStyle() const
void postToString(casacore::String *s=NULL)
void setPcctbl(PixelCanvasColorTable *pcctbl)
casacore::Float itsComponentZ_
FillStyle
Controls fill style.
GLPixelCanvasColorTable * glpcctbl_
void GLPixelCanvas::drawIndexedImage(const casacore::Matrix< casacore::uInt > &data, casacore::Float x=0.0, casacore::Float y=0.0, casacore::Float z=0.0, casacore::Float xscl=1.0, casacore::Float yscl=1.0)
(Cacheable) Draw an image using color indexes.
virtual void getClearColor(float &r, float &g, float &b) const
Display::LineStyle lineStyle_
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
void repaint(const casacore::Bool redraw=false)
Just redraws window.
void traceCheck(const char *name, casacore::uLong traceLevel)
casacore::Float itsComponentX_
const Double e
e and functions thereof:
virtual void drawImage(const casacore::Matrix< casacore::uInt > &data, casacore::Int x, casacore::Int y)
(Cacheable) Draw an array of 2D color data as a raster image for zoom = <1,1>
virtual void drawPolygon3D(const casacore::Vector< casacore::Float > &x1, const casacore::Vector< casacore::Float > &y1, const casacore::Vector< casacore::Float > &z1)
void drawColoredPoints_(const char *Name, const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1, const casacore::Vector< casacore::uInt > &colors)
Internal versions of public functions.
void setCurrentColorValue(casacore::uLong value, const char *name=NULL)
virtual Display::FillRule getFillRule() const
virtual void setLineWidth(casacore::Float width)
virtual void setLineWidth(casacore::uInt width) = 0;
virtual void drawFilledPolygon3D(const casacore::Vector< casacore::Float > &x1, const casacore::Vector< casacore::Float > &y1, const casacore::Vector< casacore::Float > &z1)
void resizeList()
Grow the list.
String: the storage and methods of handling collections of characters.
virtual casacore::Bool setFont(const casacore::String &fontName)
(Cacheable) Set the font to the recognizable font name.
virtual casacore::uInt height() const
Return the height of the GLPixelCanvas in pixels.
void resizeHandler()
Called when window is resized.
virtual GLPixelCanvasColorTable * glpcctbl() const
Need a mechanism to return the GLPixelCanvasColorTable so drawing functions within classes can operat...
ImageCacheStrategy
How to cache images when displaying them on client-server graphics systems.
GLPCDisplayList ** dlists_
virtual casacore::String deviceBackgroundColor() const
DrawFunction
PixelCanvas Drawing Logical Functions.
virtual Display::CapStyle getCapStyle() const
virtual void getColor(float &r, float &g, float &b) const
(Not Cacheable) Retuns the current color as an RGB triple
void drawTexturedImage(GLfloat x, GLfloat y, GLfloat z, GLsizei width, GLsizei height, GLfloat xscale, GLfloat yscale, GLenum format, const GLushort *pixels, GLPCTextureParams *params=NULL)
Various ways to draw images.
virtual void setDrawBuffer(Display::DrawBuffer buf)
(Not cacheable) set the draw buffer Caution: The draw buffer is always set to BACK if double buffere...
virtual casacore::uInt width() const
Return the width of the GLPixelCanvas in pixels.
void note(const char *note)
Add a note entry to traced output.
GLLogIO adds tracing support to the AIPS++ casacore::LogIO object.
casacore::uShort * itsComponents_
Component / multi-channel buffers etc.
casacore::Float itsComponentY_
PixelCanvasColorTable * pcctbl() const
Return the pixel canvas color table.
void traceCheck(const char *name, casacore::uLong traceLevel, casacore::uInt nspaces)
Print <name> if tracing is turned on.
JoinStyle
Controls the appearance of two joined lines.
virtual casacore::uLong getForeground() const
Implemented get Graphics Attributes functions.
virtual casacore::uInt newList()
begin caching display commands - return list ID
virtual void setColor(casacore::uInt colorIndex)
(Cacheable) Set current color (works in RGB or colormap mode)
virtual void disableMotionEvents()
casacore::uInt BlackPixel_
virtual void drawPoints(const casacore::Matrix< casacore::Int > &verts)
(Cacheable) Draw N points specified as a Nx2 matrix
virtual casacore::uInt clearColor() const
(Not Cacheable) Get the current color to use for clearing the display.
static void handleEventsCB(Widget w, GLPixelCanvas *xpc, XEvent *ev, Boolean *)
Event Handling.
void pushAttrib(const GLbitfield attrib)
OpenGL's push/popAttrib functions.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void unimplemented(const char *routine, const SourceLocation *where) const
User told PixelCanvas to refresh via PixelCanvas refresh()
static int glCheck(const char *msg=NULL, casacore::uInt nspaces=0)
Boolean removeList(casacore::uInt listid)
Remove a display list from list of lists.
virtual void getClipWindow(casacore::Int &x1, casacore::Int &y1, casacore::Int &x2, casacore::Int &y2)
LineStyle
Style of line to use.
virtual casacore::uInt color() const
(Not Cacheable) Returns the current color as a color index Note: In RGB mode, this is only valid if ...