home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xhyper10.zip / XHyper_v1.0 / src / docsup / Figure.h < prev    next >
C/C++ Source or Header  |  1992-12-08  |  4KB  |  153 lines

  1. /*
  2.  * Copyright (c) 1991 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * planar figures
  25.  */
  26.  
  27. #ifndef Figure_defined
  28. #define Figure_defined
  29.  
  30. #include <InterViews/glyph.h>
  31.  
  32. class Brush;
  33. class Color;
  34.  
  35. class Figure : public Glyph {
  36. public:
  37.     virtual void request(Requisition&) const;
  38.     virtual void allocate(Canvas*, const Allocation&, Extension&);
  39.     virtual void draw(Canvas*, const Allocation&) const;
  40. protected:
  41.     Figure (
  42.         const Brush* brush, const Color* stroke, const Color* fill,
  43.         boolean closed, boolean curved, int coords
  44.     );
  45.     virtual ~Figure ();
  46.  
  47.     void add_point (Coord x, Coord y);
  48.     void add_curve (Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2);
  49.     void Bspline_move_to (
  50.         Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2
  51.     );
  52.     void Bspline_curve_to (
  53.         Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2
  54.     );
  55.  
  56.     const Brush* _brush;
  57.     const Color* _stroke;
  58.     const Color* _fill;
  59.  
  60.     boolean _closed;
  61.     boolean _curved;
  62.     int _count;
  63.     Coord* _x;
  64.     Coord* _y;
  65.  
  66.     Coord _xmin;
  67.     Coord _xmax;
  68.     Coord _ymin;
  69.     Coord _ymax;
  70. };
  71.  
  72. class Line : public Figure {
  73. public:
  74.     Line (
  75.         const Brush* brush, const Color* stroke, const Color* fill,
  76.         Coord x1, Coord y1, Coord x2, Coord y2
  77.     );
  78. protected:
  79.     virtual ~Line ();
  80. };
  81.  
  82. class Rectangle : public Figure {
  83. public:
  84.     Rectangle (
  85.         const Brush* brush, const Color* stroke, const Color* fill,
  86.         Coord l, Coord b, Coord r, Coord t
  87.     );
  88. protected:
  89.     virtual ~Rectangle ();
  90. };
  91.  
  92. class Circle : public Figure {
  93. public:
  94.     Circle (
  95.         const Brush* brush, const Color* stroke, const Color* fill,
  96.         Coord x, Coord y, Coord r
  97.     );
  98. protected:
  99.     virtual ~Circle ();
  100. };
  101.  
  102. class Ellipse : public Figure {
  103. public:
  104.     Ellipse (
  105.         const Brush* brush, const Color* stroke, const Color* fill,
  106.         Coord x, Coord y, Coord rx, Coord ry
  107.     );
  108. protected:
  109.     virtual ~Ellipse ();
  110. };
  111.  
  112. class Open_BSpline : public Figure {
  113. public:
  114.     Open_BSpline (
  115.         const Brush* brush, const Color* stroke, const Color* fill,
  116.         Coord* x, Coord* y, int count
  117.     );
  118. protected:
  119.     virtual ~Open_BSpline ();
  120. };
  121.  
  122. class Closed_BSpline : public Figure {
  123. public:
  124.     Closed_BSpline (
  125.         const Brush* brush, const Color* stroke, const Color* fill,
  126.         Coord* x, Coord* y, int count
  127.     );
  128. protected:
  129.     virtual ~Closed_BSpline ();
  130. };
  131.  
  132. class Polyline : public Figure {
  133. public:
  134.     Polyline (
  135.         const Brush* brush, const Color* stroke, const Color* fill,
  136.         Coord* x, Coord* y, int count
  137.     );
  138. protected:
  139.     virtual ~Polyline ();
  140. };
  141.  
  142. class Polygon : public Figure {
  143. public:
  144.     Polygon (
  145.         const Brush* brush, const Color* stroke, const Color* fill,
  146.         Coord* x, Coord* y, int count
  147.     );
  148. protected:
  149.     virtual ~Polygon ();
  150. };
  151.  
  152. #endif
  153.