home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 1.ddi / OOPWLD.ZIP / SHAPES / ELLIPSE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-11  |  712 b   |  29 lines

  1. // ELLIPSE.CPP : methods for ellipses and circles
  2. #include "ellipse.hpp"
  3.  
  4. Ellipse::Ellipse(int xc, int yc, int xrad, int yrad,
  5.         COLORS fc, fill_patterns fp,  COLORS lc)
  6.    : shape(xc, yc, xrad, yrad, fc, fp, lc),
  7.      xradius(xrad), yradius(yrad) {}
  8.  
  9. void Ellipse::draw() {
  10.   shape::draw();
  11.   fillellipse(xcoord, ycoord, xradius, yradius);
  12. }
  13.  
  14. void Ellipse::erase() {
  15.  shape::erase();
  16.  fillellipse(xcoord, ycoord, xradius, yradius);
  17. }
  18.  
  19. // Set the size based on the proportions:
  20. void Ellipse::setsize() {
  21.   xradius = x_proportion;
  22.   yradius = y_proportion;
  23. }
  24.  
  25. // Notice a circle's size only depends on x_proportion:
  26. void Circle::setsize() {
  27.   xradius = yradius = x_proportion;
  28. }
  29.