/*****************************************************************************\
*                                                                             *
*  Name   : old drawing algorithms                                            *
*  Author : Chris Koeritz                                                     *
*                                                                             *
*******************************************************************************
* Copyright (c) 1991-$now By Author.  This program is free software; you can  *
* redistribute it and/or modify it under the terms of the GNU General Public  *
* License as published by the Free Software Foundation; either version 2 of   *
* the License or (at your option) any later version.  This is online at:      *
*     http://www.fsf.org/copyleft/gpl.html                                    *
* Please send any updates to: fred@gruntose.com                               *
\*****************************************************************************/

#include "wp_implementation.h"

/*  void draw_line(GC gc, double x1, double y1, double x2, double y2);
    // Draw a line in 2D floating point 'world coordinates'

  void draw_rectangle(GC gc, double x, double y, double width, double height,
		      boolean fill = false);

  void draw_ellipse(GC gc, double x, double y, double width, double height,
		    boolean fill = false);

  void draw_filled_ellipse
    (GC gc, double x, double y, double width, double height);

void canvas::draw_line(GC gc, double x1, double y1, double x2, double y2)
{
  int dcX1, dcY1, dcY2,  dcX2;  // device coordinates. 

  world_to_device(width, height, x1, y1, dcX1, dcY1);
  world_to_device(width, height, x2, y2, dcX2, dcY2);

  XDrawLine(XtDisplay(*this), XtWindow(*this), gc, 
	    dcX1, dcY1, dcX2, dcY2);
}

void canvas::draw_rectangle(GC gc, double x, double y, double width,
			    double height, boolean fill)
{
  int dcX, dcY, dcWidth, dcHeight;

  world_to_device(int(width), int(height), x, y, dcX, dcY);
  world_to_device(int(width), int(height), x+width, y+height,
		  dcWidth, dcHeight);
  dcWidth = dcWidth - dcX;
  dcHeight = dcY - dcHeight;

  // Specify top left corner instead of bottom left
  dcY = dcY - dcHeight;

  if (!fill)
    XDrawRectangle(XtDisplay(*this), XtWindow(*this), gc, dcX, dcY, dcWidth, dcHeight);
  else XFillRectangle
    (XtDisplay(*this), XtWindow(*this), gc, dcX, dcY, dcWidth, dcHeight);
}

void canvas::draw_ellipse(GC gc, double x, double y, double width,
			  double height, boolean fill)
{
  int dcX, dcY, dcWidth, dcHeight;

  world_to_device(int(width), int(height), x, y, dcX, dcY);
  world_to_device(int(width), int(height), x+width, y+height,
		  dcWidth, dcHeight);
  dcWidth = dcWidth - dcX;
  dcHeight = -(dcHeight - dcY);

  // Specify top left corner instead of bottom left 
  dcY = dcY - dcHeight;

  if (!fill) XDrawArc
    (XtDisplay(*this), XtWindow(*this), gc, dcX, dcY, dcWidth, dcHeight,
     0, XS_FULL_CIRCLE_ANGLE);
  else XFillArc
    (XtDisplay(*this), XtWindow(*this), gc, dcX, dcY, dcWidth, dcHeight,
     0, XS_FULL_CIRCLE_ANGLE);
}
*/

