00001 #ifndef OVAL_IMPLEMENTATION_FILE
00002 #define OVAL_IMPLEMENTATION_FILE
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "oval.h"
00019 #include "wp_implementation.h"
00020
00021 using namespace geometric;
00022
00023 oval::oval(canvas &to_draw_on, const ellipse &init, const color &f, bool attach)
00024 : ellipse(init),
00025 paintable(to_draw_on, init.center(), f, attach)
00026 {}
00027
00028 c_rectangle oval::dimensions() const
00029 {
00030 return c_rectangle
00031 (center() - c_point(width_from_center(), height_from_center()),
00032 center() + c_point(width_from_center(), height_from_center()));
00033 }
00034
00035 void oval::plot(const color &plot_in)
00036 {
00037 #ifdef __XWINDOWS__
00038 color to_plot_in = plot_in;
00039 if (to_plot_in.index() < 0)
00040 target().colormap().add(to_plot_in);
00041 XSetForeground(target().display(), target().details()._gc,
00042 to_plot_in.index());
00043 c_rectangle bounder(target().world_to_device(dimensions()));
00044 c_point devo(bounder.vertex_1());
00045 c_point devsiz(bounder.width(), bounder.height());
00046 if (filled()) XFillArc
00047 (target().display(), target().window(), target().details()._gc,
00048 int(devo.x()), int(devo.y()), int(devsiz.x()), int(devsiz.y()),
00049 0, 64 * 360);
00050 else XDrawArc
00051 (target().display(), target().window(), target().details()._gc,
00052 int(devo.x()), int(devo.y()), int(devsiz.x()), int(devsiz.y()),
00053 0, 64 * 360);
00054 #elif defined(MS_WINDOWS)
00055 #elif defined(OS_2)
00056 #endif
00057 }
00058
00059 ellipse oval::base() const { return *this; }
00060
00061 void oval::base(const ellipse &to_set) { *(ellipse *)this = to_set; }
00062
00063 #endif //OVAL_IMPLEMENTATION_FILE
00064