casa
$Rev:20696$
|
00001 //# PSPixelCanvas.h: implementation of PixelCanvas for PostScript devices 00002 //# Copyright (C) 1999,2000,2001,2002,2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef TRIALDISPLAY_PSPIXELCANVAS_H 00029 #define TRIALDISPLAY_PSPIXELCANVAS_H 00030 00031 #include <casa/aips.h> 00032 #include <casa/Arrays/Vector.h> 00033 #include <casa/Arrays/Matrix.h> 00034 #include <display/Display/DisplayEnums.h> 00035 #include <display/DisplayEvents/PCMotionEH.h> 00036 #include <display/DisplayEvents/PCPositionEH.h> 00037 #include <display/DisplayEvents/PCRefreshEH.h> 00038 #include <display/Display/PCVGBuffer.h> 00039 #include <display/Display/PSPixelCanvasColorTable.h> 00040 #include <display/Display/PixelCanvas.h> 00041 #include <display/Display/DLFont.h> 00042 00043 namespace casa { //# NAMESPACE CASA - BEGIN 00044 00045 // <summary> 00046 // Implementation of the PixelCanvas for PostScript devices. 00047 // </summary> 00048 // 00049 // <prerequisite> 00050 // <ol> 00051 // <li> <linkto class="PixelCanvas">PixelCanvas</linkto> 00052 // <li> <linkto class="PSPixelCanvasColorTable">PSPixelCanvasColorTable</linkto> 00053 // <li> <linkto class="PSDriver">PSDriver</linkto> 00054 // </ol> 00055 // </prerequisite> 00056 // <use visibility=export> 00057 // 00058 // <etymology> 00059 // PSPixelCanvas is a mechanism for drawing on paper. 00060 // </etymology> 00061 // 00062 00063 // 00064 // <motivation> 00065 // </motivation> 00066 // 00067 // <synopsis> 00068 // PSPixelCanvas implements <linkto class="PixelCanvas">PixelCanvas</linkto> 00069 // for PostScript output. See 00070 // <linkto class="PSPixelCanvas#Example">Example</linkto> for example 00071 // usage. 00072 // </synopsis> 00073 00074 //<a name="Example"></a> 00075 // <example> 00076 // <ol> 00077 // <li> Create an output stream. 00078 // <li> Create a PSDriver choosing a page type (letter, A4, etc.). 00079 // (PSDriver can take a filename as an argument instead of an ostream). 00080 // See: <linkto class="PSDriver#Synopsis">PSDriver</linkto> for more on 00081 // creating PSDrivers.. 00082 // <li> Create PSPixelCanvasColorTable 00083 // <li> Create PSPixelCanvas 00084 // <li> Draw something pretty. 00085 // <li> Delete everything and close the stream. 00086 // <note role=tip>Neither PSPixelCanvasColorTable nor PSPixelCanvas delete 00087 // their PSDriver.</note> 00088 // </ol> 00089 // <srcblock> 00090 // 00091 // PSDriver *psd = new PSDriver("test.ps", PSDriver::LETTER); 00092 // PSPixelCanvasColorTable *pscct = new PSPixelCanvasColorTable(psd); 00093 // PSPixelCanvas psc = new PSPixelCanvas( psd, pscct); 00094 // ... (a miracle happens). 00095 // delete psc; 00096 // delete pscct; 00097 // delete psd; 00098 // </srcblock> 00099 // 00100 // <note role=tip>Since PostScript does not deal in in pixels, PSPixelCanvas 00101 // assumes an adjustable number of pixels per inch. (Currently 1200dpi). 00102 // Use the setResolution function to change this if the calling progam 00103 // can't handle a 128M pixel display.</note> 00104 // </example> 00105 // 00106 // <todo> 00107 // <ol> 00108 // <li> Lots of 'get' functions. Some don't make sense for PostScript. 00109 // Others haven't been done yet. 00110 // <li> Events. 00111 // <li> Partial support for X11 color names is hacked in. Doing it 00112 // 'correctly' would require changing the constructors. 00113 // <li> No display list support. 00114 // <li> Foreground/background/clear color support is in. However, these 00115 // and many other routines don't really support RGB mode yet. 00116 // <li> See: <linkto class="PSDriver#ToDo">PSDriver</linkto> for another list. 00117 // </ol> 00118 // </todo> 00119 class PSPixelCanvas : public PixelCanvas 00120 { 00121 public: 00122 PSPixelCanvas(PSDriver *ps, PSPixelCanvasColorTable * ); 00123 virtual ~PSPixelCanvas(); 00124 00125 // enabling/disabling of event tracking 00126 // <group> 00127 virtual void enableMotionEvents(); 00128 virtual void disableMotionEvents(); 00129 virtual void enablePositionEvents(); 00130 virtual void disablePositionEvents(); 00131 // </group> 00132 00133 // Does this canvas support cached display lists? The user of the 00134 // canvas should always check this, because undefined behaviour can 00135 // result when an attempt is made to use a list on a PixelCanvas 00136 // which does not support lists. 00137 virtual Bool supportsLists() 00138 { return False; } 00139 00140 // begin caching display commands - return list ID 00141 virtual uInt newList(); 00142 // end caching display commands 00143 virtual void endList(); 00144 // (Cacheable) recall cached display commands 00145 virtual void drawList(uInt list); 00146 // translate all lists 00147 virtual void translateAllLists(Int xt, Int yt); 00148 // translate the list 00149 virtual void translateList(uInt list, Int xt, Int yt); 00150 // remove list from cache 00151 virtual void deleteList(uInt list); 00152 // flush all lists from the cache 00153 virtual void deleteLists(); 00154 // return True if the list exists 00155 virtual Bool validList(uInt list); 00156 00157 // (Cacheable) Set the font to the PostScript font name and size. 00158 virtual Bool setFont(const String &fontName, const Int size); 00159 virtual Bool setFont(DLFont* font) { 00160 return setFont(font->getPSValue(), font->getSize()); 00161 } 00162 00163 // (Cacheable) Set the font to the PostScript font name. 00164 virtual Bool setFont(const String &fontName); 00165 // (Cacheable) Draw text using that font aligned in some way to the 00166 // position 00167 virtual void drawText(Int x, Int y, const String &text, 00168 Display::TextAlign alignment = Display::AlignCenter); 00169 virtual void drawText(Int x, Int y, const String &text, const Float& angle, 00170 Display::TextAlign alignment = Display::AlignCenter); 00171 // (Cacheable) Draw an array of 2D color data as a raster image for zoom = <1,1> 00172 // <group> 00173 virtual void drawImage(const Matrix<uInt> &data, Int x, Int y); 00174 virtual void drawImage(const Matrix<Int> &data, Int x, Int y); 00175 virtual void drawImage(const Matrix<uLong> &data, Int x, Int y); 00176 virtual void drawImage(const Matrix<Float> &data, Int x, Int y); 00177 virtual void drawImage(const Matrix<Double> &data, Int x, Int y); 00178 // </group> 00179 // <group> 00180 // Draw a 2D color image with masking. 00181 // (opaqueMask ignored; (unfortunately,) PSPixelcanvas always draws 00182 // _opaque_ masks). 00183 virtual void drawImage(const Int &x, const Int &y, 00184 const Matrix<uInt> &data, 00185 const Matrix<Bool> &mask, 00186 Bool opaqueMask=False); 00187 // </group> 00188 00189 // (Cacheable) Draw an array of 2D color data as a raster image for any positive integer zoom 00190 // <group> 00191 virtual void drawImage(const Matrix<uInt> &data, Int x, Int y, 00192 uInt xzoom, uInt yzoom); 00193 virtual void drawImage(const Matrix<Int> &data, Int x, Int y, 00194 uInt xzoom, uInt yzoom); 00195 virtual void drawImage(const Matrix<uLong> &data, Int x, Int y, 00196 uInt xzoom, uInt yzoom); 00197 virtual void drawImage(const Matrix<Float> &data, Int x, Int y, 00198 uInt xzoom, uInt yzoom); 00199 virtual void drawImage(const Matrix<Double> &data, Int x, Int y, 00200 uInt xzoom, uInt yzoom); 00201 // </group> 00202 00203 // (Cacheable) Draw a component of a multi-channel image, storing it 00204 // in buffers until flushComponentImages() is called. 00205 virtual void drawImage(const Matrix<uInt> &data, const Int &x, const Int &y, 00206 const Display::ColorComponent &colorcomponent); 00207 00208 // Fill one of the channel buffers. 00209 void bufferComponent(const Matrix<uInt> &data, 00210 const Int &x, const Int &y, 00211 const Display::ColorComponent &colorcomponent); 00212 00213 // (NOT CACHEABLE!) Flush the component buffers. 00214 void flushComponentBuffers(); 00215 00216 // (Cacheable) Draw a single point using current color 00217 // <group> 00218 virtual void drawPoint(Int x1, Int y1); 00219 virtual void drawPoint(Float x1, Float y1); 00220 virtual void drawPoint(Double x1, Double y1); 00221 // </group> 00222 00223 // (Cacheable) Draw N points specified as a Nx2 matrix 00224 // <group> 00225 virtual void drawPoints(const Matrix<Int> &verts); 00226 virtual void drawPoints(const Matrix<Float> &verts); 00227 virtual void drawPoints(const Matrix<Double> &verts); 00228 // </group> 00229 00230 // (Cacheable) Draw a bunch of points using current color 00231 // <group> 00232 virtual void drawPoints(const Vector<Int> &x1, const Vector<Int> &y1); 00233 virtual void drawPoints(const Vector<Float> &x1, const Vector<Float> &y1); 00234 virtual void drawPoints(const Vector<Double> &x1, 00235 const Vector<Double> &y1); 00236 // </group> 00237 00238 // (Cacheable) Draw a single line using current color 00239 // <group> 00240 virtual void drawLine(Int x1, Int y1, Int x2, Int y2); 00241 virtual void drawLine(Float x1, Float y1, Float x2, Float y2); 00242 virtual void drawLine(Double x1, Double y1, Double x2, Double y2); 00243 // </group> 00244 00245 // (Cacheable) Draw N/2 lines from an Nx2 matrix 00246 // <group> 00247 virtual void drawLines(const Matrix<Int> &verts); 00248 virtual void drawLines(const Matrix<Float> &verts); 00249 virtual void drawLines(const Matrix<Double> &verts); 00250 // </group> 00251 00252 // (Cacheable) Draw a bunch of unrelated lines using current color 00253 // <group> 00254 virtual void drawLines(const Vector<Int> &x1, const Vector<Int> &y1, 00255 const Vector<Int> &x2, const Vector<Int> &y2); 00256 virtual void drawLines(const Vector<Float> &x1, const Vector<Float> &y1, 00257 const Vector<Float> &x2, const Vector<Float> &y2); 00258 virtual void drawLines(const Vector<Double> &x1, const Vector<Double> &y1, 00259 const Vector<Double> &x2, const Vector<Double> &y2); 00260 // </group> 00261 00262 // (Cacheable) Draw a single connected line between the points given 00263 // <group> 00264 virtual void drawPolyline(const Vector<Int> &x1, const Vector<Int> &y1); 00265 virtual void drawPolyline(const Vector<Float> &x1, 00266 const Vector<Float> &y1); 00267 virtual void drawPolyline(const Vector<Double> &x1, 00268 const Vector<Double> &y1); 00269 // </group> 00270 // <group> 00271 virtual void drawPolylines(const Vector<Int> &x1, const Vector<Int> &y1, 00272 const int close=0, const int fill=0); 00273 virtual void drawPolylines(const Vector<Float> &x1, 00274 const Vector<Float> &y1, 00275 const int close=0, const int fill=0); 00276 virtual void drawPolylines(const Vector<Double> &x1, 00277 const Vector<Double> &y1, 00278 const int close=0, const int fill=0); 00279 // </group> 00280 00281 // (Cacheable) Draw N-1 connected lines from Nx2 matrix of vertices 00282 // <group> 00283 virtual void drawPolyline(const Matrix<Int> &verts); 00284 virtual void drawPolyline(const Matrix<Float> &verts); 00285 virtual void drawPolyline(const Matrix<Double> &verts); 00286 // </group> 00287 00288 // (Cacheable) Draw N-1 connected lines from Nx2 matrix of vertices 00289 // <group> 00290 virtual void drawPolylines(const Matrix<Int> &verts, 00291 const int close=0, const int fill=0); 00292 virtual void drawPolylines(const Matrix<Float> &verts, 00293 const int close=0, const int fill=0); 00294 virtual void drawPolylines(const Matrix<Double> &verts, 00295 const int close=0, const int fill=0); 00296 // </group> 00297 00298 // (Cacheable) Draw a closed polygon 00299 // <group> 00300 virtual void drawPolygon(const Vector<Int> &x1, const Vector<Int> &y1); 00301 virtual void drawPolygon(const Vector<Float> &x1, const Vector<Float> &y1); 00302 virtual void drawPolygon(const Vector<Double> &x1, 00303 const Vector<Double> &y1); 00304 // </group> 00305 00306 // (Cacheable) Draw and fill a closed polygon 00307 // <group> 00308 virtual void drawFilledPolygon(const Vector<Int> &x1, 00309 const Vector<Int> &y1); 00310 virtual void drawFilledPolygon(const Vector<Float> &x1, 00311 const Vector<Float> &y1); 00312 virtual void drawFilledPolygon(const Vector<Double> &x1, 00313 const Vector<Double> &y1); 00314 // </group> 00315 00316 // (Cacheable) Draw a closed N-sided polygon from Nx2 matrix of vertices 00317 // <group> 00318 virtual void drawPolygon(const Matrix<Int> &verts); 00319 virtual void drawPolygon(const Matrix<Float> &verts); 00320 virtual void drawPolygon(const Matrix<Double> &verts); 00321 // </group> 00322 00323 // (Cacheable) Draw a rectangle 00324 // <group> 00325 virtual void drawRectangle(Int x1, Int y1, Int x2, Int y2, const int fill); 00326 virtual void drawRectangle(Float x1, Float y1, Float x2, Float y2, 00327 const int fill); 00328 virtual void drawRectangle(Double x1, Double y1, Double x2, Double y2, 00329 const int fill); 00330 // </group> 00331 00332 // (Cacheable) Draw a rectangle 00333 // <group> 00334 virtual void drawRectangle(Int x1, Int y1, Int x2, Int y2); 00335 virtual void drawRectangle(Float x1, Float y1, Float x2, Float y2); 00336 virtual void drawRectangle(Double x1, Double y1, Double x2, Double y2); 00337 // </group> 00338 00339 // (Cacheable) Draw a filled rectangle 00340 // <group> 00341 virtual void drawFilledRectangle(Int x1, Int y1, Int x2, Int y2); 00342 virtual void drawFilledRectangle(Float x1, Float y1, Float x2, Float y2); 00343 virtual void drawFilledRectangle(Double x1, Double y1, Double x2, 00344 Double y2); 00345 // </group> 00346 00347 // (Cacheable) Draw a set of points, specifying a color per point to be drawn. 00348 // <group> 00349 virtual void drawColoredPoints(const Vector<Int> &x1, 00350 const Vector<Int> &y1, 00351 const Vector<uInt> &colors); 00352 virtual void drawColoredPoints(const Vector<Float> &x1, 00353 const Vector<Float> &y1, 00354 const Vector<uInt> &colors); 00355 virtual void drawColoredPoints(const Vector<Double> &x1, 00356 const Vector<Double> &y1, 00357 const Vector<uInt> &colors); 00358 virtual void drawColoredPoints(const Matrix<Int> &xy, 00359 const Vector<uInt> &colors); 00360 virtual void drawColoredPoints(const Matrix<Float> &xy, 00361 const Vector<uInt> &colors); 00362 virtual void drawColoredPoints(const Matrix<Double> &xy, 00363 const Vector<uInt> &colors); 00364 // </group> 00365 00366 // (Cacheable) Draw a set of lines, specifying a color per line to be drawn. 00367 // <group> 00368 virtual void drawColoredLines(const Vector<Int> &x1, 00369 const Vector<Int> &y1, 00370 const Vector<Int> &x2, 00371 const Vector<Int> &y2, 00372 const Vector<uInt> &colors); 00373 virtual void drawColoredLines(const Vector<Float> &x1, 00374 const Vector<Float> &y1, 00375 const Vector<Float> &x2, 00376 const Vector<Float> &y2, 00377 const Vector<uInt> &colors); 00378 virtual void drawColoredLines(const Vector<Double> &x1, 00379 const Vector<Double> &y1, 00380 const Vector<Double> &x2, 00381 const Vector<Double> &y2, 00382 const Vector<uInt> &colors); 00383 // </group> 00384 00385 // Set Graphics Attributes 00386 // Options for functions with enum argument 00387 // listed in <linkto class=Display>DisplayEnums</linkto> 00388 // <group> 00389 virtual void setDrawFunction(Display::DrawFunction function); 00390 virtual void setForeground(uLong color); 00391 virtual void setBackground(uLong color); 00392 //virtual void setLineWidth(uInt width); 00393 virtual void setLineWidth(Float width); 00394 void lineWidth(Float width); 00395 float lineWidth()const{return lineWidth_;} 00396 virtual void setLineStyle(Display::LineStyle style); 00397 virtual void setCapStyle(Display::CapStyle style); 00398 virtual void setJoinStyle(Display::JoinStyle style); 00399 virtual void setFillStyle(Display::FillStyle style); 00400 virtual void setFillRule(Display::FillRule rule); 00401 virtual void setArcMode(Display::ArcMode mode); 00402 // </group> 00403 00404 // Get Graphics Attributes 00405 // <group> 00406 virtual Display::DrawFunction getDrawFunction() const; 00407 virtual uLong getForeground() const; 00408 virtual uLong getBackground() const; 00409 //#virtual uInt getLineWidth() const; 00410 virtual Float getLineWidth() const; 00411 virtual Display::LineStyle getLineStyle() const; 00412 virtual Display::CapStyle getCapStyle() const; 00413 virtual Display::JoinStyle getJoinStyle() const; 00414 virtual Display::FillStyle getFillStyle() const; 00415 virtual Display::FillRule getFillRule() const; 00416 virtual Display::ArcMode getArcMode() const; 00417 // </group> 00418 00419 // (Cacheable) Option Control 00420 // Options listed in <linkto class=Display>DisplayEnums</linkto> 00421 // <group> 00422 virtual Bool enable(Display::Option option); 00423 virtual Bool disable(Display::Option option); 00424 // </group> 00425 00426 // Control the image-caching strategy 00427 virtual void setImageCacheStrategy(Display::ImageCacheStrategy strategy); 00428 virtual Display::ImageCacheStrategy imageCacheStrategy() const; 00429 00430 // (Cacheable) Setup the clip window. The clip window, when enabled, allows 00431 // a user to clip all graphics output to a rectangular region on 00432 // the screen. 00433 // Once set, it is only possible to REDUCE the size of the current clip 00434 // window, not increase it. 00435 // <group> 00436 virtual void setClipWindow(Int x1, Int y1, Int x2, Int y2); 00437 virtual void getClipWindow(Int &x1, Int &y1, Int &x2, Int &y2); 00438 // </group> 00439 00440 // (Not Cacheable) Redraw the window 00441 // <group> 00442 virtual void refresh(const Display::RefreshReason &reason = 00443 Display::UserCommand, 00444 const Bool &explicitrequest = True); 00445 // </group> 00446 00447 // Cause display to flush any graphics commands not yet drawn 00448 virtual void flush(); 00449 00450 // (Cacheable) Clear the window using the background color 00451 // <group> 00452 virtual void clear(); 00453 virtual void clear(Int x1, Int y1, Int x2, Int y2); 00454 // </group> 00455 00456 // (Cacheable) Set the color to use for clearing the display 00457 // <group> 00458 virtual void setClearColor(uInt colorIndex); 00459 virtual void setClearColor(const String &colorname); 00460 virtual void setClearColor(float r, float g, float b); 00461 // </group> 00462 00463 // (Not Cacheable) Get the current color to use for clearing the display. 00464 virtual uInt clearColor() const; 00465 virtual void getClearColor(float &r, float &g, float &b) const; 00466 00467 // Return the width of the PSPixelCanvas in pixels 00468 virtual uInt width() const; 00469 // Return the height of the PSPixelCanvas in pixels 00470 virtual uInt height() const; 00471 // Return the depth of the PSPixelCanvas in bits 00472 virtual uInt depth() const; 00473 00474 // Get the pixel density (in dots per inch [dpi]) of the PixelCanvas 00475 virtual void pixelDensity(Float &xdpi, Float &ydpi) const; 00476 00477 // (Cacheable) Set current color (works in RGB or colormap mode) 00478 // <group> 00479 virtual void setColor(uInt colorIndex); 00480 virtual void setColor(const String &colorname); 00481 virtual void setRGBColor(float r, float g, float b); 00482 virtual void setHSVColor(float h, float s, float v); 00483 // </group> 00484 00485 // (Not Cacheable) Returns the current color as a color index 00486 virtual uInt color() const; 00487 00488 // (Not Cacheable) Retuns the current color as an RGB triple 00489 virtual void getColor(float &r, float &g, float &b) const; 00490 virtual Bool getColorComponents(const String &colorname, 00491 Float &r, Float &g, Float &b); 00492 // (Not Cacheable) Get color index value (works in RGB or colormap mode) 00493 // <group> 00494 virtual Bool getColor(Int x, Int y, uInt &color); 00495 virtual Bool getRGBColor(Int x, Int y, float &r, float &g, float &b); 00496 virtual Bool getHSVColor(Int x, Int y, float &h, float &s, float &v); 00497 // </group> 00498 // Get/set the current foreground/background colors. These colors 00499 // should be used when the special Strings "foreground" and "background" 00500 // are given for a color. 00501 // <group> 00502 virtual void setDeviceForegroundColor(const String colorname); 00503 virtual String deviceForegroundColor() const; 00504 virtual void setDeviceBackgroundColor(const String colorname); 00505 virtual String deviceBackgroundColor() const; 00506 // </group> 00507 00508 // <group> 00509 // (Not Cacheable) resize request. returns true if window was resized. 00510 // Will refresh if doCallbacks is True. 00511 virtual Bool resize(uInt reqXSize, uInt reqYSize, Bool doCallbacks = True); 00512 00513 // (Not Cacheable) resize the colortable by requesting a new number of cells 00514 virtual Bool resizeColorTable(uInt newSize); 00515 00516 // (Not Cacheable) resize the colortable by requesting a new RGB/HSV cube 00517 virtual Bool resizeColorTable(uInt nReds, uInt nGreens, uInt nBlues); 00518 00519 // Need a mechanism to return the PSPixelCanvasColorTable so 00520 // drawing functions within classes can operate. 00521 virtual PixelCanvasColorTable * pcctbl() const; 00522 00523 virtual void setPcctbl(PixelCanvasColorTable * pcctbl); 00524 PSPixelCanvasColorTable *PSpcctbl()const{return pcct_;} 00525 // </group> 00526 00527 // save/restore the current translation. This is called pushMatrix because 00528 // eventually we may want scaling or rotation to play a modest 00529 // role here. 00530 // <group> 00531 virtual void pushMatrix(); 00532 virtual void popMatrix(); 00533 // </group> 00534 // zero the current translation 00535 virtual void loadIdentity(); 00536 00537 // translation functions 00538 // translate applies a relative translation to the current matrix and 00539 // can be used to position graphics. Together with pushMatrix and 00540 // popMatrix it can be used to build heirarchical scenes. 00541 // <group> 00542 virtual void translate(Int xt, Int yt); 00543 virtual void getTranslation(Int &xt, Int &yt) const; 00544 virtual Int xTranslation() const; 00545 virtual Int yTranslation() const; 00546 // </group> 00547 00548 // (Not cacheable) set the draw buffer 00549 // None of the buffer routines are supported. 00550 virtual void setDrawBuffer(Display::DrawBuffer buf); 00551 // buffer memory exchanges 00552 // (Not cacheable) 00553 // <group> 00554 virtual void copyBackBufferToFrontBuffer(); 00555 virtual void copyFrontBufferToBackBuffer(); 00556 virtual void swapBuffers(); 00557 // </group> 00558 00559 // partial buffer memory exchanges. (x1,y1 are blc, x2,y2 are trc) 00560 // <group> 00561 virtual void copyBackBufferToFrontBuffer(Int x1, Int y1, Int x2, Int y2); 00562 virtual void copyFrontBufferToBackBuffer(Int x1, Int y1, Int x2, Int y2); 00563 virtual void swapBuffers(Int x1, Int y1, Int x2, Int y2); 00564 // </group> 00565 00566 //# //////////////////////////////////////////////////////////////// 00567 // PSPixelCanvas specific misc. functions. 00568 00569 //# // Converts from "pixels" to points. 00570 //# //<group> 00571 //# inline float xToPoints(const double x)const{return (float)(x*xppp_);} 00572 //# inline float yToPoints(const double y)const{return (float)(y*yppp_);} 00573 //# //</group> 00574 //# // Convert from points to pixels. 00575 //# //<group> 00576 //# inline double pointsToX(const float x)const{return (double)(x/xppp_);} 00577 //# inline double pointsToY(const float y)const{return (double)(y/yppp_);} 00578 //# //</group> 00579 00580 // Draw a scaled image on PostScript canvas. 00581 void drawPSImage(const int x, const int y, 00582 const int iwidth, const int iheight, 00583 const float xzoom, const float yzoom, 00584 const uShort *data, const int bpc, 00585 const Display::ColorModel=Display::Index); 00586 // Set/get declared resolution in pixels per supplied dimension. 00587 //<group> 00588 void setResolution(const float xres, const float yres, 00589 const PSDriver::Dimension = PSDriver::INCHES); 00590 void getResolution(float &xres, float &yres, 00591 const PSDriver::Dimension = PSDriver::INCHES)const; 00592 //</group> 00593 // Whether to enable pixel interpolation for drawImage(). 00594 //<group> 00595 void smooth(const Bool smth){smooth_ = smth;} 00596 Bool smooth()const{return smooth_;} 00597 //</group> 00598 // Whether to put tracing comments in the output. 00599 //<group> 00600 Bool annotate()const{return annotate_;} 00601 void annotate(const Bool a){ annotate_ = a;} 00602 //</group> 00603 00604 virtual Float pixelScaling() const; 00605 00606 //# //////////////////////////////////////////////////////////////// 00607 00608 protected: 00609 00610 00611 private: 00612 void pspcinit(PSDriver *ps, PSPixelCanvasColorTable * ); 00613 void clearRectangle(const float x0, const float y0, 00614 const float x1, const float y1); 00615 // Used in annotating output file. 00616 //<group> 00617 void note(const char *); 00618 void note(const char *, const uLong); 00619 //</group> 00620 private: 00621 PSPixelCanvasColorTable *pcct_; 00622 PSDriver *ps; 00623 float xppp_, yppp_; // # Of points per pixel. 00624 float lineWidth_; 00625 Display::LineStyle lineStyle_; 00626 Display::CapStyle capStyle_; 00627 Display::JoinStyle joinStyle_; 00628 Display::FillStyle fillStyle_; 00629 Display::FillRule fillRule_; 00630 Display::ArcMode arcMode_; 00631 String defaultForegroundColorName_; 00632 String defaultBackgroundColorName_; 00633 // Color indexes the three colors we know about. 00634 uLong foreground_, background_, clearColor_; 00635 float xt_, yt_; 00636 float clipx0_, clipy0_, clipx1_, clipy1_; 00637 Bool haveClipInfo_; 00638 Bool clipEnabled_; 00639 Bool smooth_; 00640 Bool annotate_; 00641 // Component support 00642 Float itsComponentX, itsComponentY; 00643 uLong itsComponentWidth, itsComponentHeight; 00644 Int itsComponentBPC; 00645 uShort *itsComponents; // Length = 3*width*height. 00646 }; 00647 00648 00649 } //# NAMESPACE CASA - END 00650 00651 #endif