casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PixelCanvas.h
Go to the documentation of this file.
1 //# PixelCanvas.h: Base class defining interface to PixelCanvases
2 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef DISPLAY_PIXELCANVAS_H
29 #define DISPLAY_PIXELCANVAS_H
30 
31 #include <casa/aips.h>
32 #include <list>
36 #include <display/Display/DLFont.h>
37 
38 namespace casacore{
39 
40  template <class T> class Vector;
41  template <class T> class Matrix;
42 }
43 
44 namespace casa { //# NAMESPACE CASA - BEGIN
45 
46  class Colormap;
47  class PCMotionEH;
48  class PCPositionEH;
49  class PCRefreshEH;
50 
51 
52 // <summary>
53 // Base class defining interface to pixel-based output devices.
54 // </summary>
55 //
56 // <prerequisite>
57 // <li> <linkto class="Colormap">Colormap</linkto>
58 // <li> <linkto class="PixelCanvasColorTable">PixelCanvasColorTable</linkto>
59 // <li> <linkto class="PCMotionEH">PCMotionEH</linkto>
60 // <li> <linkto class="PCRefreshEH">PCRefreshEH</linkto>
61 // <li> <linkto class="PCPositionEH">PCPositionEH</linkto>
62 // </prerequisite>
63 //
64 // <etymology>
65 // PixelCanvas is the mechanism for drawing on the screen.
66 // </etymology>
67 //
68 // <synopsis>
69 // The philosophy of the PixelCanvas is to provide flexible fast interface to
70 // an underlying graphics system in terms of integer pixel positions and
71 // color values. The interface should be as simple as possible and not demand
72 // complicated structures on its interface.
73 //
74 // The PixelCanvas performs minimal management, leaving up to the derived classes
75 // for most of the work required to interface to the underlying graphics library.
77 //
78 // To make it flexible, the fundamental interface accepts pointers to arrays of all
79 // the scalar AIPS++ types. The casacore::Bool type is not acceptable at the PixelCanvas
80 // level because it cannot be used to represent a color index, as are the two
81 // complex number types.
82 //
83 // To make it fast, a caching mechanism is used to allow display lists to be
84 // created in the format native to the underlying graphics library.
85 // The caching works like OpenGL display lists.
86 //
87 // To create a display list:
88 //
89 // <ol>
90 // <li> Call the function newList() which will return a list id. You need to
91 // store the returned id somewhere so that it may be recalled later.
92 // <li> Perform some drawing commands. These commands are output-only commands
93 // that change the state of the PixelCanvas or draw some graphics or other
94 // function that affects the canvas.
95 // <li> Call the function endList()
96 // </ol>
97 //
98 // To recall the drawing commands:
99 //
100 // <ol>
101 // <li> Call drawList(), passing the list id as the parameter
102 // </ol>
103 //
104 // To delete the list, call deleteList(), with the id
105 //
106 // The PixelCanvas maintains a translation stack which may be driven by
107 // calls to translate and calls to pushMatrix, popMatrix.
108 //
109 // The translation stack is an effective way to draw the same graphic in different
110 // places:
111 // <srcblock>
112 //
113 // casacore::uInt myGraphic = newList();
114 // ...
115 // endList();
116 // casacore::Matrix m(n,2);
117 // for (casacore::uInt i = 0; i < n; i++)
118 // {
119 // pc->pushMatrix();
120 // pc->translate(m(i,0), m(i,1));
121 // pc->drawList(myGraphic);
122 // pc->popMatrix();
123 // }
124 //
125 // </srcblock>
126 //
127 // Images are most correctly drawn through the following sequence of operations
128 //
129 // <ol>
130 // <li> Obtain the size of the current colormap with getColormapSize()
131 // <li> scale your data to fit in the range of [0,size-1];
132 // <li> call mapToColor() to get a proper color image (which you may consider
133 // saving).
134 // <li> call drawImage()
135 // </ol>
136 //
137 // You may find that a class derived from
138 // <linkto class="WCDataScaleHandler">WCDataScaleHandler</linkto>, such as
139 // <linkto class="WCLinearScaleHandler">WCLinearScaleHandler</linkto>
140 // may be useful in step #2 above.
141 //
142 // mapToColor is also useful for transforming values that are associated with
143 // vector graphics as well (e.g., contour lines).
144 //
145 //
146 // The PixelCanvas layer is quite thin. Most functionality is implemented
147 // in the derived classes.
148 //
149 // </synopsis>
150 //
151 // <motivation>
152 // Want a generic interface to possibly a variety of graphics hardware types.
153 // Want base class to maintain callback lists
154 // </motivation>
155 //
156 // <example>
157 // see the Display test directory
158 // </example>
159 //
160 
161  class PixelCanvas {
162  public:
163  virtual ~PixelCanvas();
164 
165  // add event handlers
166  // <group>
167  void addRefreshEventHandler(const PCRefreshEH &eh);
168  void addMotionEventHandler(const PCMotionEH &eh);
169  void addPositionEventHandler(const PCPositionEH &eh);
170  // </group>
171 
172  // remove event handlers
173  // <group>
174  void removeRefreshEventHandler(const PCRefreshEH &eh);
175  void removeMotionEventHandler(const PCMotionEH &eh);
177  // </group>
178 
179  // call event handlers
180  // <group>
185  // </group>
186 
187  // enabling/disabling of event tracking
188  // <group>
189  virtual void enableMotionEvents() = 0;
190  virtual void disableMotionEvents() = 0;
191  virtual void enablePositionEvents() = 0;
192  virtual void disablePositionEvents() = 0;
193  // </group>
194 
195  // Does this canvas support cached display lists? The user of the
196  // canvas should always check this, because undefined behaviour can
197  // result when an attempt is made to use a list on a PixelCanvas
198  // which does not support lists.
199  virtual casacore::Bool supportsLists() = 0;
200 
201  // begin caching display commands - return list ID
202  virtual casacore::uInt newList() = 0;
203  // end caching display commands
204  virtual void endList() = 0;
205  // (Cacheable) recall cached display commands
206  virtual void drawList(casacore::uInt list) = 0;
207  // translate all lists
208  virtual void translateAllLists(casacore::Int xt, casacore::Int yt) = 0;
209  // translate the list
210  virtual void translateList(casacore::uInt list, casacore::Int xt, casacore::Int yt) = 0;
211  // remove list from cache
212  virtual void deleteList(casacore::uInt list) = 0;
213  // flush all lists from the cache
214  virtual void deleteLists() = 0;
215  // return true if the list exists
216  virtual casacore::Bool validList(casacore::uInt list) = 0;
217 
218  // (Cacheable) Set the font to the recognizable font name
219  virtual casacore::Bool setFont(const casacore::String &fontName) = 0;
220 
221  // TODO: These should become abstract
222  // Set the font via the DisplayLibrary Font class
223  virtual casacore::Bool setFont(DLFont* /*font*/) {
224  return false;
225  }
226 
227  // Set the font to font name / size
228  virtual casacore::Bool setFont(const casacore::String& /*fontName*/, const casacore::Int /*fontSize*/) {
229  return false;
230  }
231 
232  // (Cacheable) Draw text using that font aligned in some way to the
233  // position
234  virtual void drawText(casacore::Int x, casacore::Int y, const casacore::String &text,
235  Display::TextAlign alignment = Display::AlignCenter) = 0;
236 
237  // TODO This should become abstract - NYI in GLPixelCanvas currently
238  // Draw text at a specified angle.
239  virtual void drawText(casacore::Int /*x*/, casacore::Int /*y*/, const casacore::String &/*text*/,
240  const casacore::Float& /*angle*/,
242  { }
243 
244  // TODO : This should become abstract
245  // Determine the width / height of a string of text based on
246  // current settings.
247  // <group>
248  virtual casacore::Int textWidth(const casacore::String& /*text*/) {
249  return -1;
250  }
251  virtual casacore::Int textHeight(const casacore::String& /*text*/) {
252  return -1;
253  }
254  // </group>
255 
256  // (Cacheable) Draw an array of 2D color data as a raster image for zoom = <1,1>
257  // <group>
263  // </group>
264 
265  // (Cacheable) Draw an array of 2D color data as a raster image,
266  // taking note of the <src>casacore::Bool</src> mask.
267  // Set opaqueMask to true to draw masked pixels in the background color;
268  // otherwise they will be transparent (letting whatever was drawn
269  // previously at that point show through).
270  // <group>
271  virtual void drawImage(const casacore::Int &/*x*/, const casacore::Int &/*y*/,
272  const casacore::Matrix<casacore::uInt> &/*data*/,
273  const casacore::Matrix<casacore::Bool> &/*mask*/,
274  casacore::Bool /*opaqueMask*/=false) {
275  return;
276  }
277  // </group>
278 
279  // (Cacheable) Draw an array of 2D color data as a raster image for any positive integer zoom
280  // <group>
282  casacore::uInt xzoom, casacore::uInt yzoom) = 0;
284  casacore::uInt xzoom, casacore::uInt yzoom) = 0;
286  casacore::uInt xzoom, casacore::uInt yzoom) = 0;
288  casacore::uInt xzoom, casacore::uInt yzoom) = 0;
290  casacore::uInt xzoom, casacore::uInt yzoom) = 0;
291  // </group>
292 
293  // (Cacheable) Draw a component of a multi-channel image, storing it
294  // in buffers until flushComponentImages() is called.
295  virtual void drawImage(const casacore::Matrix<casacore::uInt> &data, const casacore::Int &x, const casacore::Int &y,
296  const Display::ColorComponent &colorcomponent) = 0;
297 
298  // Fill one of the channel buffers.
300  const casacore::Int &x, const casacore::Int &y,
302  &colorcomponent) = 0;
303 
304  // (NOT CACHEABLE!) Flush the component buffers.
305  virtual void flushComponentBuffers() = 0;
306 
307  // (Cacheable) Draw a single point using current color
308  // <group>
309  virtual void drawPoint(casacore::Int x1, casacore::Int y1) = 0;
310  virtual void drawPoint(casacore::Float x1, casacore::Float y1) = 0;
311  virtual void drawPoint(casacore::Double x1, casacore::Double y1) = 0;
312  // </group>
313 
314  // (Cacheable) Draw N points specified as a Nx2 matrix
315  // <group>
316  virtual void drawPoints(const casacore::Matrix<casacore::Int> &verts) = 0;
317  virtual void drawPoints(const casacore::Matrix<casacore::Float> &verts) = 0;
318  virtual void drawPoints(const casacore::Matrix<casacore::Double> &verts) = 0;
319  // </group>
320 
321  // (Cacheable) Draw a bunch of points using current color
322  // <group>
323  virtual void drawPoints(const casacore::Vector<casacore::Int> &x1, const casacore::Vector<casacore::Int> &y1) = 0;
324  virtual void drawPoints(const casacore::Vector<casacore::Float> &x1,
325  const casacore::Vector<casacore::Float> &y1) = 0;
326  virtual void drawPoints(const casacore::Vector<casacore::Double> &x1,
327  const casacore::Vector<casacore::Double> &y1) = 0;
328  // </group>
329 
330  // (Cacheable) Draw a single line using current color
331  // <group>
332  virtual void drawLine(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2) = 0;
335  // </group>
336 
337  // (Cacheable) Draw N/2 lines from an Nx2 matrix
338  // <group>
339  virtual void drawLines(const casacore::Matrix<casacore::Int> &verts) = 0;
340  virtual void drawLines(const casacore::Matrix<casacore::Float> &verts) = 0;
341  virtual void drawLines(const casacore::Matrix<casacore::Double> &verts) = 0;
342  // </group>
343 
344  // (Cacheable) Draw a bunch of unrelated lines using current color
345  // <group>
350  const casacore::Vector<casacore::Float> &y2) = 0;
353  const casacore::Vector<casacore::Double> &y2) = 0;
354  // </group>
355 
356  // (Cacheable) Draw a single connected line between the points given
357  // <group>
358  virtual void drawPolyline(const casacore::Vector<casacore::Int> &x1,
359  const casacore::Vector<casacore::Int> &y1) = 0;
360  virtual void drawPolyline(const casacore::Vector<casacore::Float> &x1,
361  const casacore::Vector<casacore::Float> &y1) = 0;
362  virtual void drawPolyline(const casacore::Vector<casacore::Double> &x1,
363  const casacore::Vector<casacore::Double> &y1) = 0;
364  // </group>
365 
366  // (Cacheable) Draw N-1 connected lines from Nx2 matrix of vertices
367  // <group>
368  virtual void drawPolyline(const casacore::Matrix<casacore::Int> &verts) = 0;
369  virtual void drawPolyline(const casacore::Matrix<casacore::Float> &verts) = 0;
370  virtual void drawPolyline(const casacore::Matrix<casacore::Double> &verts) = 0;
371  // </group>
372 
373  // Draw a "marker". See <linkto class="Display">Display</linkto>
374  // for a list of available markers.
375  // <group>
376  virtual void drawMarker(const casacore::Int& x1, const casacore::Int& y1,
377  const Display::Marker& marker,
378  const casacore::Int& pixelHeight);
379  virtual void drawMarker(const casacore::Float& x1, const casacore::Float& y1,
380  const Display::Marker& marker,
381  const casacore::Int& pixelHeight);
382  virtual void drawMarker(const casacore::Double& x1, const casacore::Double& y1,
383  const Display::Marker& marker,
384  const casacore::Int& pixelHeight);
385  // </group>
386 
387  // (Cacheable) Draw a closed polygon
388  // <group>
389  virtual void drawPolygon(const casacore::Vector<casacore::Int> &x1, const casacore::Vector<casacore::Int> &y1) = 0;
390  virtual void drawPolygon(const casacore::Vector<casacore::Float> &x1,
391  const casacore::Vector<casacore::Float> &y1) = 0;
392  virtual void drawPolygon(const casacore::Vector<casacore::Double> &x1,
393  const casacore::Vector<casacore::Double> &y1) = 0;
394  // </group>
395 
396  // (Cacheable) Draw and fill a closed polygon
397  // <group>
398  virtual void drawFilledPolygon(const casacore::Vector<casacore::Int> &x1,
399  const casacore::Vector<casacore::Int> &y1) = 0;
401  const casacore::Vector<casacore::Float> &y1) = 0;
403  const casacore::Vector<casacore::Double> &y1) = 0;
404  // </group>
405 
406  // (Cacheable) Draw a closed N-sided polygon from Nx2 matrix of vertices
407  // <group>
408  virtual void drawPolygon(const casacore::Matrix<casacore::Int> &verts) = 0;
409  virtual void drawPolygon(const casacore::Matrix<casacore::Float> &verts) = 0;
410  virtual void drawPolygon(const casacore::Matrix<casacore::Double> &verts) = 0;
411  // </group>
412 
413  // (Cacheable) Draw a rectangle
414  // <group>
415  virtual void drawRectangle(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2) = 0;
418  // </group>
419 
420  // (Cacheable) Draw a filled rectangle
421  // <group>
425  casacore::Double y2) = 0;
426  // </group>
427 
428  // (Cacheable) Draw a set of points, specifying a color per point to be drawn.
429  // <group>
430  virtual void drawColoredPoints(const casacore::Vector<casacore::Int> &x1,
432  const casacore::Vector<casacore::uInt> &colors) = 0;
435  const casacore::Vector<casacore::uInt> &colors) = 0;
438  const casacore::Vector<casacore::uInt> &colors) = 0;
440  const casacore::Vector<casacore::uInt> &colors) {
441  drawColoredPoints(xy.column(0), xy.column(1), colors);
442  }
444  const casacore::Vector<casacore::uInt> &colors) {
445  drawColoredPoints(xy.column(0), xy.column(1), colors);
446  }
448  const casacore::Vector<casacore::uInt> &colors) {
449  drawColoredPoints(xy.column(0), xy.column(1), colors);
450  }
451  // </group>
452 
453  // (Cacheable) Draw a set of lines, specifying a color per line to be drawn.
454  // <group>
455  virtual void drawColoredLines(const casacore::Vector<casacore::Int> &x1,
459  const casacore::Vector<casacore::uInt> &colors) = 0;
464  const casacore::Vector<casacore::uInt> &colors) = 0;
469  const casacore::Vector<casacore::uInt> &colors) = 0;
470  // </group>
471 
472  // Draw a single ellipse using the current pen (ie. color,
473  // thickness, style). The x and y location must be given, along
474  // with the semi-major and -minor axis lengths, and the position
475  // angle measured in degrees positive from the x axis in a
476  // counter-clockwise direction. If outline is false, the
477  // ellipse is solid filled, else it is just outlined.
478  // xstretch, ystretch should be left defaulted to 1 in most cases;
479  // see usage example in WorldCanvas::drawBeamEllipse(), where they are
480  // used to stretch a beam ellipse when the display is also linearly
481  // stretched away from the aspect ratio natural to the sky projection.
482  // They multiply the relative x and y screen coordinates of ellipse
483  // points, _before_ they are added to cx and cy. xstretch, ystretch
484  // can be negative (though smajor, sminor normally would not be).
485  virtual void drawEllipse(const casacore::Float &cx, const casacore::Float &cy,
486  const casacore::Float &smajor, const casacore::Float &sminor,
487  const casacore::Float &pangle, casacore::Bool outline = true,
488  casacore::Float xstretch = 1., casacore::Float ystretch = 1.);
489 
490  // Draw a set of colored ellipses, possibly with borders. The x and
491  // y locations must given, along with semi-major and semi-minor
492  // axes, and position angle measured in degrees positive from the x
493  // axis in a counter-clockwise direction. The size of the ellipses
494  // is globally scaled by the scale factor, and if <src>outline</src>
495  // is <src>true</src>, then each ellipse will have an outline in the
496  // current pen color. <group>
497  virtual void drawColoredEllipses(const casacore::Matrix<casacore::Float> &centres,
498  const casacore::Vector<casacore::Float> &smajor,
499  const casacore::Vector<casacore::Float> &sminor,
500  const casacore::Vector<casacore::Float> &pangle,
501  const casacore::Vector<casacore::uInt> &colors,
502  const casacore::Float &scale = 1.0,
503  const casacore::Bool &outline = true);
504  // </group>
505 
506  // vector primitive buffering
507  /*
508  void bufferPoint(casacore::Int x, casacore::Int y)
509  { vgbuf_.accumPoint(x,y); }
510  void bufferLine(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)
511  { vgbuf_.accumLine(x1,y1,x2,y2); }
512  void bufferPolylinePoint(casacore::Int x, casacore::Int y)
513  { vgbuf_.accumPolylinePoint(x,y); }
514  void bufferPolygonPoint(casacore::Int x, casacore::Int y)
515  { vgbuf_.accumPolygonPoint(x,y); }
516  */
518  vgbuf_.accumPoint(x,y);
519  }
521  vgbuf_.accumLine(x1,y1,x2,y2);
522  }
525  }
528  }
529  void flushBuffer() {
530  vgbuf_.flush();
531  }
532 
533  // Set Graphics Attributes
534  // Options for functions with enum argument
535  // listed in <linkto class=Display>DisplayEnums</linkto>
536  // <group>
537  virtual void setDrawFunction(Display::DrawFunction function) = 0;
538  virtual void setForeground(casacore::uLong color) = 0;
539  virtual void setBackground(casacore::uLong color) = 0;
540  //virtual void setLineWidth(casacore::uInt width) = 0;
541  virtual void setLineWidth(casacore::Float width) = 0;
542  virtual void setLineStyle(Display::LineStyle style) = 0;
543  virtual void setCapStyle(Display::CapStyle style) = 0;
544  virtual void setJoinStyle(Display::JoinStyle style) = 0;
545  virtual void setFillStyle(Display::FillStyle style) = 0;
546  virtual void setFillRule(Display::FillRule rule) = 0;
547  virtual void setArcMode(Display::ArcMode mode) = 0;
548  // </group>
549 
550  // Get Graphics Attributes
551  // <group>
552  virtual Display::DrawFunction getDrawFunction() const = 0;
553  virtual casacore::uLong getForeground() const = 0;
554  virtual casacore::uLong getBackground() const = 0;
555  //virtual casacore::uInt getLineWidth() const = 0;
556  virtual casacore::Float getLineWidth() const = 0;
557  virtual Display::LineStyle getLineStyle() const = 0;
558  virtual Display::CapStyle getCapStyle() const = 0;
559  virtual Display::JoinStyle getJoinStyle() const = 0;
560  virtual Display::FillStyle getFillStyle() const = 0;
561  virtual Display::FillRule getFillRule() const = 0;
562  virtual Display::ArcMode getArcMode() const = 0;
563  // </group>
564 
565  // (Cacheable) Option Control
566  // Options listed in <linkto class=Display>DisplayEnums</linkto>
567  // <group>
568  virtual casacore::Bool enable(Display::Option option) = 0;
569  virtual casacore::Bool disable(Display::Option option) = 0;
570  // </group>
571 
572  // Control the image-caching strategy
573  virtual void setImageCacheStrategy(Display::ImageCacheStrategy strategy) = 0;
575 
576  // (Cacheable) Setup the clip window. The clip window, when enabled, allows
577  // a user to clip all graphics output to a rectangular region on
578  // the screen.
579  // <group>
580  virtual void setClipWindow(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2) = 0;
581  virtual void getClipWindow(casacore::Int &x1, casacore::Int &y1, casacore::Int &x2, casacore::Int &y2) = 0;
582  // </group>
583 
584  // (Not Cacheable) Redraw the window
585  // <group>
586  void redraw() {
587  refresh();
588  }
589  virtual void refresh(const Display::RefreshReason &reason =
591  const casacore::Bool &explicitrequest = true) = 0;
592  // </group>
593 
594  // Cause display to flush any graphics commands not yet drawn
595  virtual void flush() = 0;
596 
597  // (Cacheable) Clear the window using the background color
598  // <group>
599  virtual void clear() = 0;
600  virtual void clear(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2) = 0;
601  // </group>
602 
603  // (Cacheable) Set the color to use for clearing the display
604  // <group>
605  virtual void setClearColor(casacore::uInt colorIndex) = 0;
606  virtual void setClearColor(const casacore::String &colorname) = 0;
607  virtual void setClearColor(float r, float g, float b) = 0;
608  // </group>
609 
610  // (Not Cacheable) Get the current color to use for clearing the display.
611  virtual casacore::uInt clearColor() const = 0;
612  virtual void getClearColor(float &r, float &g, float &b) const = 0;
613 
614  // Get/set the current foreground/background colors. These colors
615  // should be used when the special Strings "foreground" and "background"
616  // are given for a color.
617  // <group>
618  virtual void setDeviceForegroundColor(const casacore::String colorname) = 0;
619  virtual casacore::String deviceForegroundColor() const = 0;
620  virtual void setDeviceBackgroundColor(const casacore::String colorname) = 0;
621  virtual casacore::String deviceBackgroundColor() const = 0;
622  // </group>
623 
624  // Return the width of the PixelCanvas in pixels
625  virtual casacore::uInt width() const = 0;
626  // Return the height of the PixelCanvas in pixels
627  virtual casacore::uInt height() const = 0;
628  // Return the depth of the PixelCanvas in bits
629  virtual casacore::uInt depth() const = 0;
630  // Get the pixel density (in dots per inch [dpi]) of the PixelCanvas
631  virtual void pixelDensity(casacore::Float &xdpi, casacore::Float &ydpi) const = 0;
632 
633  // (Cacheable) Set current color (works in RGB or colormap mode)
634  // <group>
635  virtual void setColor(casacore::uInt colorIndex) = 0;
636  virtual void setColor(const casacore::String &colorname) = 0;
637  virtual void setRGBColor(float r, float g, float b) = 0;
638  virtual void setHSVColor(float h, float s, float v);
639  // </group>
640 
641  // Get color components in range 0 to 1 without actually
642  // allocating the color. This is needed to set up other
643  // devices, for example PgPlot.
645  casacore::Float &g, casacore::Float &b) = 0;
646 
647  // (Not Cacheable) Returns the current color as a color index
648  virtual casacore::uInt color() const = 0;
649 
650  // (Not Cacheable) Retuns the current color as an RGB triple
651  virtual void getColor(float &r, float &g, float &b) const = 0;
652 
653  // (Not Cacheable) Get color index value (works in RGB or colormap mode)
654  // <group>
656  virtual casacore::Bool getRGBColor(casacore::Int x, casacore::Int y, float &r, float &g, float &b) = 0;
657  virtual casacore::Bool getHSVColor(casacore::Int x, casacore::Int y, float &h, float &s, float &v);
658  // </group>
659 
660  // (Not Cacheable) resize request. returns true if window was resized.
661  // Will refresh if doCallbacks is true.
662  //#dk virtual casacore::Bool resize(casacore::uInt reqXSize, casacore::uInt reqYSize, casacore::Bool doCallbacks = true) = 0;
663  virtual casacore::Bool resize(casacore::uInt /*reqXSize*/, casacore::uInt /*reqYSize*/, casacore::Bool /*doCallbacks*/ = true) {
664  return false;
665  }
666 
667  // (Not Cacheable) resize the colortable by requesting a new number of cells
668  virtual casacore::Bool resizeColorTable(casacore::uInt newSize) = 0;
669 
670  // (Not Cacheable) resize the colortable by requesting a new RGB/HSV cube
671  virtual casacore::Bool resizeColorTable(casacore::uInt nReds, casacore::uInt nGreens, casacore::uInt nBlues) = 0;
672 
673  // Need a mechanism to return the PixelCanvasColorTable so
674  // drawing functions within classes can operate.
675  virtual PixelCanvasColorTable * pcctbl() const = 0;
676 
677  virtual void setPcctbl(PixelCanvasColorTable * pcctbl) = 0;
678 
679  // (Not Cacheable) set/get the current colormap. Undefined behavior results from
680  // setting the colormap to a map that is not registered. This cannot be cached
681  // because it affects the result of getColormapSize(). Remember that once data
682  // is mapped with mapToColor, it is no longer important to worry about which
683  // colormap is active for purposes of drawing the image or vectors.
684  // colormapRegistered() can be used to determine whether the currently set
685  // colormap() is indeed registered/installed (i.e., color cells have been
686  // allocated within the pcctbl).
687  // <group>
688  void setColormap(Colormap * map);
689  Colormap * colormap() const {
690  return colormap_;
691  }
693  return pcctbl()->member(colormap_);
694  }
695  // </group>
696 
697  // register a colormap to the pixelcanvas. Registration counts are
698  // remembered, so that map A is guaranteed to be available as long as
699  // the number of register(A)'s exceed the number of unregister(A)'s.
700  // Requests are forwarded to the PixelCanvas' PixelCanvasColorTable.
701  void registerColormap(Colormap * dcmap, casacore::Float weight = 1.0);
702 
703  // Register the <src>cmap</src> Colormap on the PixelCanvas,
704  // replacing the <src>cmapToReplace</src> Colormap if possible.
705  void registerColormap(Colormap *cmap, Colormap *cmapToReplace);
706 
707  // unregister a colormap from a pixelcanvas. Unregistering the
708  // current map may result in undefined behavior.
709  void unregisterColormap(Colormap * dcmap);
710 
711  // return the size of the current colormap
713  return pcctbl()->getColormapSize(colormap_);
714  }
715 
716  // map [0,N-1] into colorpixels, where N is the current colormap size
717  // The values are returned as unsigned integers in their respective
718  // array.
719  // <note role="tip">The choice of what type to use should be guided by
720  // the number of graphics bitplanes available. For most systems with
721  // 8-bit color, casacore::uChar is optimal. Some systems with 12 bits per pixel
722  // with an alpha channel may require using the uLong. </note>
723  //
724  // <note role="warning">casacore::uChar type may not have enough bits
725  // to hold the pixel index on some high-end graphics systems </note>
726  // <note role="warning">casacore::uShort type may not have enough bits
727  // to hold the pixel index on some high-end graphics systems </note>
728  // <group>
729 
731  const casacore::Array<casacore::uChar> &inArray, casacore::Bool rangeCheck = false) {
732  pcctbl()->mapToColor(colormap_, outArray, inArray, rangeCheck);
733  }
735  const casacore::Array<casacore::uShort> &inArray, casacore::Bool rangeCheck = false) {
736  pcctbl()->mapToColor(colormap_, outArray, inArray, rangeCheck);
737  }
739  const casacore::Array<casacore::uInt> &inArray, casacore::Bool rangeCheck = false) {
740  pcctbl()->mapToColor(colormap_, outArray, inArray, rangeCheck);
741  }
743  const casacore::Array<casacore::uLong> &inArray, casacore::Bool rangeCheck = false) {
744  pcctbl()->mapToColor(colormap_, outArray, inArray, rangeCheck);
745  }
746  // </group>
747 
748  // same as above except the matrix is operated on in place. Only unsigned
749  // values make sense here.
750  // <group>
751  void mapToColor(casacore::Array<casacore::uChar> &inOutArray, casacore::Bool rangeCheck = false) {
752  pcctbl()->mapToColor(colormap_, inOutArray, rangeCheck);
753  }
754  void mapToColor(casacore::Array<casacore::uShort> &inOutArray, casacore::Bool rangeCheck = false) {
755  pcctbl()->mapToColor(colormap_, inOutArray, rangeCheck);
756  }
757  void mapToColor(casacore::Array<casacore::uInt> &inOutArray, casacore::Bool rangeCheck = false) {
758  pcctbl()->mapToColor(colormap_, inOutArray, rangeCheck);
759  }
760  void mapToColor(casacore::Array<casacore::uLong> &inOutArray, casacore::Bool rangeCheck = false) {
761  pcctbl()->mapToColor(colormap_, inOutArray, rangeCheck);
762  }
763  // </group>
764 
765 
766 
768  const casacore::Array<casacore::uInt> &inArrayRed, const casacore::Array<casacore::uInt> &inArrayGreen, const casacore::Array<casacore::uInt>& inArrayBlue) {
769  pcctbl()->mapToColorRGB(colormap_, outArray, inArrayRed, inArrayGreen, inArrayBlue);
770  }
771 
772 
773  // Multi-Channel functions that combine separate array channels into
774  // a single array of output colors for use with functions that take
775  // color values.
776  // These two functions accept color values from [0-1] for each channel.
777  // The colorModel is compared with the model of the PixelCanvasColorTable
778  // and is used to perform the correct mapping.
779  // <group>
781  const casacore::Array<casacore::Float> &chan1in,
782  const casacore::Array<casacore::Float> &chan2in,
783  const casacore::Array<casacore::Float> &chan3in);
785  const casacore::Array<casacore::Double> &chan1in,
786  const casacore::Array<casacore::Double> &chan2in,
787  const casacore::Array<casacore::Double> &chan3in);
788  // </group>
789 
790  // This one maps values between 0 and the integer maximum value for
791  // each channel into a single output image suitable for
792  // PixelCanvas::drawImage.
793  // <group>
795  const casacore::Array<casacore::uInt> &chan1in,
796  const casacore::Array<casacore::uInt> &chan2in,
797  const casacore::Array<casacore::uInt> &chan3in);
798  // </group>
799 
800 
801  // save/restore the current translation. This is called pushMatrix because
802  // eventually we may want scaling or rotation to play a modest
803  // role here.
804  // <group>
805  virtual void pushMatrix() = 0;
806  virtual void popMatrix() = 0;
807  // </group>
808  // zero the current translation
809  virtual void loadIdentity() = 0;
810 
811  // translation functions
812  // translate applies a relative translation to the current matrix and
813  // can be used to position graphics. Together with pushMatrix and
814  // popMatrix it can be used to build heirarchical scenes.
815  // <group>
816  virtual void translate(casacore::Int xt, casacore::Int yt) = 0;
817  virtual void getTranslation(casacore::Int &xt, casacore::Int &yt) const = 0;
818  virtual casacore::Int xTranslation() const = 0;
819  virtual casacore::Int yTranslation() const = 0;
820  // </group>
821 
822  // return the drawing buffer, the target destination for graphics
824  return drawBuffer_;
825  }
826  // (Not cacheable) set the draw buffer
827  virtual void setDrawBuffer(Display::DrawBuffer buf) = 0;
828  // buffer memory exchanges
829  // (Not cacheable)
830  // <group>
831  virtual void copyBackBufferToFrontBuffer() = 0;
832  virtual void copyFrontBufferToBackBuffer() = 0;
833  virtual void swapBuffers() = 0;
834  // </group>
835 
836  // partial buffer memory exchanges. (x1,y1 are blc, x2,y2 are trc)
837  // <group>
840  virtual void swapBuffers(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2) = 0;
841  // </group>
842 
843  // return the drawmode (Compile or Draw)
844  // Compile drawmode means that a display list is currently being built
845  // Draw drawmode means that drawing commands are not cached but
846  // instead are sent to the display. This command is controlled by
847  // the caching state using newList()
849  return drawMode_;
850  }
851 
852  // return the colorModel used for multichannel color
854  return colorModel_;
855  }
856  // Set the input color model for multichannel color
858 
859 
860  // return true if the refresh is active (Added for X11PixelCanvas DefaultBuffer)
862  return refreshActive_;
863  }
864 
865  // return true if refresh is allowed right now...
866  virtual casacore::Bool refreshAllowed() const {
867  return true;
868  }
869 
870  virtual casacore::Float pixelScaling() const {
871  return 1.0;
872  }
873 
874  protected:
875 
876  // Abstract base class idiom
877  PixelCanvas();
878  PixelCanvas( const PixelCanvas * );
880 
881  // Only allowed by derived classes
883  drawMode_ = mode;
884  }
885 
886  // Also allowed only by derived classes
888  drawBuffer_ = buf;
889  }
890 
891  // true if the PixelCanvas was the one who
892  // registered the existing colortable
894 
895  private:
897 
898  // This is the current colormap.
900 
901 
902  // This is the current drawing mode
904 
905  // The current drawing buffer
907 
908  // The current color cube model to be used for all
909  // multichannel color mapping.
911 
912  // true if refresh is active
914 
915  // Number of colormaps registered by external clients
917 
918  // This is the list of registered refresh EventHandlers
919  std::list<void *> refreshEHList_;
920  // This is the list of registered motion EventHandlers
921  std::list<void *> motionEHList_;
922  // This is the list of registered position EventHandlers
923  std::list<void *> positionEHList_;
924 
925  // The PCVGBuffer is used to accumulate lines and points until
926  // flushed (or the buffer is full)
928  };
929 
930 
931 } //# NAMESPACE CASA - END
932 
933 #endif
934 
935 
Display::DrawBuffer drawBuffer() const
return the drawing buffer, the target destination for graphics
Definition: PixelCanvas.h:823
virtual void setDrawFunction(Display::DrawFunction function)=0
Set Graphics Attributes Options for functions with enum argument listed in DisplayEnums.
virtual casacore::Bool validList(casacore::uInt list)=0
return true if the list exists
virtual void setHSVColor(float h, float s, float v)
std::list< void * > motionEHList_
This is the list of registered motion EventHandlers.
Definition: PixelCanvas.h:921
virtual void drawColoredPoints(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1, const casacore::Vector< casacore::uInt > &colors)=0
(Cacheable) Draw a set of points, specifying a color per point to be drawn.
virtual Display::JoinStyle getJoinStyle() const =0
A class designed to manage several representations of the same font.
Definition: DLFont.h:70
int Int
Definition: aipstype.h:50
virtual void getClipWindow(casacore::Int &x1, casacore::Int &y1, casacore::Int &x2, casacore::Int &y2)=0
std::vector< double > Vector
Definition: ds9context.h:24
virtual casacore::Bool setFont(const casacore::String &fontName)=0
(Cacheable) Set the font to the recognizable font name
Vector< T > column(size_t j)
Returns a reference to the j&#39;th column.
Abstract interface to underlying graphics library&#39;s colortable.
virtual casacore::Bool disable(Display::Option option)=0
virtual void setPcctbl(PixelCanvasColorTable *pcctbl)=0
void removePositionEventHandler(const PCPositionEH &eh)
virtual casacore::Bool getHSVColor(casacore::Int x, casacore::Int y, float &h, float &s, float &v)
WorldCanvas Event Handler for managing events.
Definition: PCRefreshEH.h:76
void mapToColor(casacore::Array< casacore::uLong > &inOutArray, casacore::Bool rangeCheck=false)
Definition: PixelCanvas.h:760
virtual void swapBuffers()=0
virtual void translateList(casacore::uInt list, casacore::Int xt, casacore::Int yt)=0
translate the list
virtual casacore::Bool getRGBColor(casacore::Int x, casacore::Int y, float &r, float &g, float &b)=0
virtual void drawPolyline(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1)=0
(Cacheable) Draw a single connected line between the points given
virtual void drawRectangle(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)=0
(Cacheable) Draw a rectangle
virtual void enablePositionEvents()=0
virtual void setDeviceForegroundColor(const casacore::String colorname)=0
Get/set the current foreground/background colors.
virtual void setColor(casacore::uInt colorIndex)=0
(Cacheable) Set current color (works in RGB or colormap mode)
virtual casacore::uLong getForeground() const =0
virtual Display::FillRule getFillRule() const =0
virtual void drawImage(const casacore::Matrix< casacore::uInt > &data, casacore::Int x, casacore::Int y)=0
(Cacheable) Draw an array of 2D color data as a raster image for zoom = &lt;1,1&gt;
virtual casacore::Bool setFont(const casacore::String &, const casacore::Int)
Set the font to font name / size.
Definition: PixelCanvas.h:228
virtual Display::ArcMode getArcMode() const =0
virtual void setForeground(casacore::uLong color)=0
TextAlign
Text Alignment.
Definition: DisplayEnums.h:181
virtual void copyFrontBufferToBackBuffer()=0
virtual void setCapStyle(Display::CapStyle style)=0
Option
PixelCanvas Options.
Definition: DisplayEnums.h:290
virtual ~PixelCanvas()
virtual void setBackground(casacore::uLong color)=0
virtual Display::DrawFunction getDrawFunction() const =0
Get Graphics Attributes.
virtual casacore::Bool refreshAllowed() const
return true if refresh is allowed right now...
Definition: PixelCanvas.h:866
virtual Display::CapStyle getCapStyle() const =0
Display::ColorModel colorModel_
The current color cube model to be used for all multichannel color mapping.
Definition: PixelCanvas.h:910
virtual void translateAllLists(casacore::Int xt, casacore::Int yt)=0
translate all lists
casacore::uInt getColormapSize(const Colormap *cmap) const
Return the allocation size of some Colormap.
virtual void getTranslation(casacore::Int &xt, casacore::Int &yt) const =0
virtual casacore::Bool enable(Display::Option option)=0
(Cacheable) Option Control Options listed in DisplayEnums
DrawBuffer
PixelCanvas target drawing destination.
Definition: DisplayEnums.h:211
casacore::Bool refreshActive() const
return true if the refresh is active (Added for X11PixelCanvas DefaultBuffer)
Definition: PixelCanvas.h:861
virtual casacore::Int yTranslation() const =0
virtual void clear()=0
(Cacheable) Clear the window using the background color
virtual PixelCanvasColorTable * pcctbl() const =0
Need a mechanism to return the PixelCanvasColorTable so drawing functions within classes can operate...
virtual void drawFilledRectangle(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)=0
(Cacheable) Draw a filled rectangle
casacore::Matrix< casacore::Float > getMarker(const Display::Marker &marker, const casacore::Float &pixelHeight)
virtual void setArcMode(Display::ArcMode mode)=0
virtual void drawList(casacore::uInt list)=0
(Cacheable) recall cached display commands
FillRule
Fill Rule Xlib programming guide, pg.132.
Definition: DisplayEnums.h:165
virtual void translate(casacore::Int xt, casacore::Int yt)=0
translation functions translate applies a relative translation to the current matrix and can be used ...
Display::ColorModel colorModel() const
return the colorModel used for multichannel color
Definition: PixelCanvas.h:853
virtual void deleteList(casacore::uInt list)=0
remove list from cache
void callRefreshEventHandlers(Display::RefreshReason reason)
call event handlers
virtual void copyBackBufferToFrontBuffer()=0
buffer memory exchanges (Not cacheable)
casacore::Bool refreshActive_
true if refresh is active
Definition: PixelCanvas.h:913
virtual void drawImage(const casacore::Int &, const casacore::Int &, const casacore::Matrix< casacore::uInt > &, const casacore::Matrix< casacore::Bool > &, casacore::Bool=false)
(Cacheable) Draw an array of 2D color data as a raster image, taking note of the casacore::Bool mask...
Definition: PixelCanvas.h:271
virtual casacore::Bool resize(casacore::uInt, casacore::uInt, casacore::Bool=true)
(Not Cacheable) resize request.
Definition: PixelCanvas.h:663
virtual void disablePositionEvents()=0
virtual casacore::Int textWidth(const casacore::String &)
TODO : This should become abstract Determine the width / height of a string of text based on current ...
Definition: PixelCanvas.h:248
void mapToColor(casacore::Array< casacore::uInt > &outArray, const casacore::Array< casacore::uInt > &inArrayRed, const casacore::Array< casacore::uInt > &inArrayGreen, const casacore::Array< casacore::uInt > &inArrayBlue)
Definition: PixelCanvas.h:767
virtual void disableMotionEvents()=0
virtual void getClearColor(float &r, float &g, float &b) const =0
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
void bufferPolygonPoint(casacore::Float x, casacore::Float y)
Definition: PixelCanvas.h:526
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
CapStyle
Controls the appearance of thick lines near their endpoints.
Definition: DisplayEnums.h:130
reference point aligned to center of text
Definition: DisplayEnums.h:183
virtual Display::LineStyle getLineStyle() const =0
casacore::uInt nRegisteredColormaps_
Number of colormaps registered by external clients.
Definition: PixelCanvas.h:916
std::list< void * > positionEHList_
This is the list of registered position EventHandlers.
Definition: PixelCanvas.h:923
ColorComponent
Color components.
Definition: DisplayEnums.h:84
void mapToColor(casacore::Array< casacore::uChar > &outArray, const casacore::Array< casacore::uChar > &inArray, casacore::Bool rangeCheck=false)
map [0,N-1] into colorpixels, where N is the current colormap size The values are returned as unsigne...
Definition: PixelCanvas.h:730
void mapToColor(casacore::Array< casacore::uChar > &inOutArray, casacore::Bool rangeCheck=false)
same as above except the matrix is operated on in place.
Definition: PixelCanvas.h:751
virtual casacore::String deviceForegroundColor() const =0
virtual void setDrawBuffer(Display::DrawBuffer buf)=0
(Not cacheable) set the draw buffer
virtual casacore::Bool resizeColorTable(casacore::uInt newSize)=0
(Not Cacheable) resize the colortable by requesting a new number of cells
virtual void pixelDensity(casacore::Float &xdpi, casacore::Float &ydpi) const =0
Get the pixel density (in dots per inch [dpi]) of the PixelCanvas.
void mapToColor(casacore::Array< casacore::uInt > &inOutArray, casacore::Bool rangeCheck=false)
Definition: PixelCanvas.h:757
virtual void getColor(float &r, float &g, float &b) const =0
(Not Cacheable) Retuns the current color as an RGB triple
virtual casacore::uInt newList()=0
begin caching display commands - return list ID
virtual Display::FillStyle getFillStyle() const =0
void bufferLine(casacore::Float x1, casacore::Float y1, casacore::Float x2, casacore::Float y2)
Definition: PixelCanvas.h:520
Display::DrawMode drawMode() const
return the drawmode (Compile or Draw) Compile drawmode means that a display list is currently being b...
Definition: PixelCanvas.h:848
PixelCanvas()
Abstract base class idiom.
void addPositionEventHandler(const PCPositionEH &eh)
std::list< void * > refreshEHList_
This is the list of registered refresh EventHandlers.
Definition: PixelCanvas.h:919
void setColormap(Colormap *map)
(Not Cacheable) set/get the current colormap.
double Double
Definition: aipstype.h:55
virtual casacore::uLong getBackground() const =0
void callPositionEventHandlers(Display::KeySym keysym, casacore::Bool keystate, casacore::Int x, casacore::Int y, casacore::uInt state)
virtual void drawText(casacore::Int, casacore::Int, const casacore::String &, const casacore::Float &, Display::TextAlign=Display::AlignCenter)
TODO This should become abstract - NYI in GLPixelCanvas currently Draw text at a specified angle...
Definition: PixelCanvas.h:239
void setDrawBuffer_(Display::DrawBuffer buf)
Also allowed only by derived classes.
Definition: PixelCanvas.h:887
void bufferPolylinePoint(casacore::Float x, casacore::Float y)
Definition: PixelCanvas.h:523
Display::DrawMode drawMode_
This is the current drawing mode.
Definition: PixelCanvas.h:903
virtual void drawPoint(casacore::Int x1, casacore::Int y1)=0
(Cacheable) Draw a single point using current color
virtual void setRGBColor(float r, float g, float b)=0
virtual void loadIdentity()=0
zero the current translation
void removeMotionEventHandler(const PCMotionEH &eh)
virtual void setFillRule(Display::FillRule rule)=0
virtual void popMatrix()=0
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void unregisterColormap(Colormap *dcmap)
unregister a colormap from a pixelcanvas.
virtual void setImageCacheStrategy(Display::ImageCacheStrategy strategy)=0
Control the image-caching strategy.
virtual void drawLines(const casacore::Matrix< casacore::Int > &verts)=0
(Cacheable) Draw N/2 lines from an Nx2 matrix
virtual void setFillStyle(Display::FillStyle style)=0
casacore::uInt getColormapSize() const
return the size of the current colormap
Definition: PixelCanvas.h:712
PixelCanvas Event Handler for managing keyboard and mouse button events.
Definition: PCPositionEH.h:74
void mapToColor(casacore::Array< casacore::uShort > &inOutArray, casacore::Bool rangeCheck=false)
Definition: PixelCanvas.h:754
virtual void setClipWindow(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)=0
(Cacheable) Setup the clip window.
void removeRefreshEventHandler(const PCRefreshEH &eh)
remove event handlers
float Float
Definition: aipstype.h:54
virtual void bufferComponent(const casacore::Matrix< casacore::uInt > &data, const casacore::Int &x, const casacore::Int &y, const Display::ColorComponent &colorcomponent)=0
Fill one of the channel buffers.
virtual casacore::Int xTranslation() const =0
virtual void drawFilledPolygon(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1)=0
(Cacheable) Draw and fill a closed polygon
casacore::Bool defaultColormapActive_
true if the PixelCanvas was the one who registered the existing colortable
Definition: PixelCanvas.h:893
void mapToColor(casacore::Array< casacore::uShort > &outArray, const casacore::Array< casacore::uShort > &inArray, casacore::Bool rangeCheck=false)
Definition: PixelCanvas.h:734
virtual casacore::Float getLineWidth() const =0
virtual casacore::uInt getLineWidth() const = 0;
virtual void drawColoredEllipses(const casacore::Matrix< casacore::Float > &centres, const casacore::Vector< casacore::Float > &smajor, const casacore::Vector< casacore::Float > &sminor, const casacore::Vector< casacore::Float > &pangle, const casacore::Vector< casacore::uInt > &colors, const casacore::Float &scale=1.0, const casacore::Bool &outline=true)
Draw a set of colored ellipses, possibly with borders.
virtual void endList()=0
end caching display commands
void addMotionEventHandler(const PCMotionEH &eh)
unsigned long uLong
Definition: aipstype.h:53
virtual void setLineWidth(casacore::Float width)=0
virtual void setLineWidth(casacore::uInt width) = 0;
void bufferPoint(casacore::Float x, casacore::Float y)
vector primitive buffering
Definition: PixelCanvas.h:517
FillStyle
Controls fill style.
Definition: DisplayEnums.h:152
virtual void drawMarker(const casacore::Int &x1, const casacore::Int &y1, const Display::Marker &marker, const casacore::Int &pixelHeight)
Draw a &quot;marker&quot;.
void mapToColor(casacore::Array< casacore::uLong > &outArray, const casacore::Array< casacore::uLong > &inArray, casacore::Bool rangeCheck=false)
Definition: PixelCanvas.h:742
void accumPolylinePoint(casacore::Float x, casacore::Float y)
add point to polyline
void registerColormap(Colormap *dcmap, casacore::Float weight=1.0)
register a colormap to the pixelcanvas.
void mapToColor3(casacore::Array< casacore::uLong > &out, const casacore::Array< casacore::Float > &chan1in, const casacore::Array< casacore::Float > &chan2in, const casacore::Array< casacore::Float > &chan3in)
Multi-Channel functions that combine separate array channels into a single array of output colors for...
casacore::Bool colormapRegistered()
Definition: PixelCanvas.h:692
RefreshReason
Callback reasons for PCRefreshEvent and WCRefreshEvent.
Definition: DisplayEnums.h:267
Describes a method of generating a table of colors.
Definition: Colormap.h:104
virtual void drawPoints(const casacore::Matrix< casacore::Int > &verts)=0
(Cacheable) Draw N points specified as a Nx2 matrix
DrawMode
PixelCanvas Drawing Modes.
Definition: DisplayEnums.h:203
virtual casacore::uInt height() const =0
Return the height of the PixelCanvas in pixels.
void flush()
flush the buffer
virtual void deleteLists()=0
flush all lists from the cache
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)=0
(Cacheable) Draw a set of lines, specifying a color per line to be drawn.
virtual Display::ImageCacheStrategy imageCacheStrategy() const =0
virtual void setJoinStyle(Display::JoinStyle style)=0
Colormap * colormap() const
Definition: PixelCanvas.h:689
virtual void refresh(const Display::RefreshReason &reason=Display::UserCommand, const casacore::Bool &explicitrequest=true)=0
casacore::Bool member(const Colormap *cmap) const
Return whether or not a data colormap is used by this pixel canvas.
virtual void mapToColor(const Colormap *map, casacore::Array< casacore::uChar > &outArray, const casacore::Array< casacore::uChar > &inArray, casacore::Bool rangeCheck=true) const =0
map [0,N-1] into colorpixels, where N is the current colormap size The values are returned as unsigne...
virtual void drawPolygon(const casacore::Vector< casacore::Int > &x1, const casacore::Vector< casacore::Int > &y1)=0
(Cacheable) Draw a closed polygon
Display::DrawBuffer drawBuffer_
The current drawing buffer.
Definition: PixelCanvas.h:906
ArcMode
Arc Mode.
Definition: DisplayEnums.h:173
virtual void drawLine(casacore::Int x1, casacore::Int y1, casacore::Int x2, casacore::Int y2)=0
(Cacheable) Draw a single line using current color
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void setColorModel(Display::ColorModel colorModel)
Set the input color model for multichannel color.
PCVGBuffer vgbuf_
The PCVGBuffer is used to accumulate lines and points until flushed (or the buffer is full) ...
Definition: PixelCanvas.h:927
virtual void setLineStyle(Display::LineStyle style)=0
Colormap * colormap_
This is the current colormap.
Definition: PixelCanvas.h:899
virtual void drawColoredPoints(const casacore::Matrix< casacore::Double > &xy, const casacore::Vector< casacore::uInt > &colors)
Definition: PixelCanvas.h:447
virtual void setDeviceBackgroundColor(const casacore::String colorname)=0
void mapToColor(casacore::Array< casacore::uInt > &outArray, const casacore::Array< casacore::uInt > &inArray, casacore::Bool rangeCheck=false)
Definition: PixelCanvas.h:738
ImageCacheStrategy
How to cache images when displaying them on client-server graphics systems.
Definition: DisplayEnums.h:297
virtual void flushComponentBuffers()=0
(NOT CACHEABLE!) Flush the component buffers.
virtual void setClearColor(casacore::uInt colorIndex)=0
(Cacheable) Set the color to use for clearing the display
void accumPolygonPoint(casacore::Float x, casacore::Float y)
add point to polygon
virtual casacore::Int textHeight(const casacore::String &)
Definition: PixelCanvas.h:251
virtual void enableMotionEvents()=0
enabling/disabling of event tracking
DrawFunction
PixelCanvas Drawing Logical Functions.
Definition: DisplayEnums.h:227
virtual void mapToColorRGB(const Colormap *map, casacore::Array< casacore::uInt > &outArray, const casacore::Array< casacore::uInt > &inArrayRed, const casacore::Array< casacore::uInt > &inArrayGreen, const casacore::Array< casacore::uInt > &inArrayBlue) const
PixelCanvas Event Handler for managing pointer motion events.
Definition: PCMotionEH.h:72
virtual void drawColoredPoints(const casacore::Matrix< casacore::Float > &xy, const casacore::Vector< casacore::uInt > &colors)
Definition: PixelCanvas.h:443
virtual casacore::Bool getColorComponents(const casacore::String &colorname, casacore::Float &r, casacore::Float &g, casacore::Float &b)=0
Get color components in range 0 to 1 without actually allocating the color.
KeySym
Keysyms for PixelCanvas keyboard events.
Definition: DisplayEnums.h:412
void setDrawMode(Display::DrawMode mode)
Only allowed by derived classes.
Definition: PixelCanvas.h:882
void accumPoint(casacore::Float x, casacore::Float y)
add point
void accumLine(casacore::Float x1, casacore::Float y1, casacore::Float x2, casacore::Float y2)
add line
virtual casacore::uInt width() const =0
Return the width of the PixelCanvas in pixels.
void redraw()
(Not Cacheable) Redraw the window
Definition: PixelCanvas.h:586
JoinStyle
Controls the appearance of two joined lines.
Definition: DisplayEnums.h:142
void callMotionEventHandlers(casacore::Int x, casacore::Int y, casacore::uInt state)
virtual casacore::Bool supportsLists()=0
Does this canvas support cached display lists? The user of the canvas should always check this...
virtual void flush()=0
Cause display to flush any graphics commands not yet drawn.
virtual void drawText(casacore::Int x, casacore::Int y, const casacore::String &text, Display::TextAlign alignment=Display::AlignCenter)=0
(Cacheable) Draw text using that font aligned in some way to the position
void addRefreshEventHandler(const PCRefreshEH &eh)
add event handlers
virtual void drawColoredPoints(const casacore::Matrix< casacore::Int > &xy, const casacore::Vector< casacore::uInt > &colors)
Definition: PixelCanvas.h:439
ColorModel
Different ways of handling color on the display.
Definition: DisplayEnums.h:74
virtual casacore::uInt depth() const =0
Return the depth of the PixelCanvas in bits.
virtual void pushMatrix()=0
save/restore the current translation.
virtual casacore::uInt color() const =0
(Not Cacheable) Returns the current color as a color index
virtual casacore::Bool setFont(DLFont *)
TODO: These should become abstract Set the font via the DisplayLibrary Font class.
Definition: PixelCanvas.h:223
virtual casacore::uInt clearColor() const =0
(Not Cacheable) Get the current color to use for clearing the display.
unsigned int uInt
Definition: aipstype.h:51
User told PixelCanvas to refresh via PixelCanvas refresh()
Definition: DisplayEnums.h:269
LineStyle
Style of line to use.
Definition: DisplayEnums.h:119
virtual void drawEllipse(const casacore::Float &cx, const casacore::Float &cy, const casacore::Float &smajor, const casacore::Float &sminor, const casacore::Float &pangle, casacore::Bool outline=true, casacore::Float xstretch=1., casacore::Float ystretch=1.)
Draw a single ellipse using the current pen (ie.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
virtual casacore::Float pixelScaling() const
Definition: PixelCanvas.h:870
virtual casacore::String deviceBackgroundColor() const =0