Back to index

plt-scheme  4.2.1
Defines | Functions
Pen+Brush.cc File Reference
#include "wx.h"
#include "../wx_cairo.h"
#include <math.h>
#include "../../../wxcommon/Region.h"
#include "wx_types.h"
#include "../../../wxcommon/Region.cxx"

Go to the source code of this file.

Defines

#define Uses_XLib
#define Uses_wxPenBrush
#define Uses_wxBitmap
#define Uses_wxPostScriptDC
#define UseXtRegions

Functions

static XPoint * wxEllipseToPolygon (double width, double height, double x, double y, int *_npoints)

Define Documentation

#define Uses_wxBitmap

Definition at line 34 of file Pen+Brush.cc.

#define Uses_wxPenBrush

Definition at line 33 of file Pen+Brush.cc.

Definition at line 35 of file Pen+Brush.cc.

#define Uses_XLib

Definition at line 32 of file Pen+Brush.cc.

#define UseXtRegions

Definition at line 351 of file Pen+Brush.cc.


Function Documentation

static XPoint* wxEllipseToPolygon ( double  width,
double  height,
double  x,
double  y,
int _npoints 
) [static]

Definition at line 308 of file Pen+Brush.cc.

{
  int iwidth = (int)width + 2;
  int is_odd = iwidth & 0x1;
  int x_extent = (int)((iwidth + 1) / 2) + is_odd, i;
  double w2 = (x_extent - 1) * (x_extent - 1), dx, dy;
  XPoint *p;
  int npoints;

  npoints = (4 * x_extent) - (2 * is_odd);
  *_npoints = npoints;

#ifdef MZ_PRECISE_GC
  p = (XPoint *)GC_malloc_atomic(sizeof(XPoint) * npoints);
#else
  p = new WXGC_ATOMIC XPoint[npoints];
#endif

  dx = x + width / 2;
  dy = y + height / 2;
  
  for (i = 0; i < x_extent; i++) {
    double y = (height / width) * sqrt(w2 - (i * i));
    p[i].x = (int)floor(i + dx);
    p[i].y = (int)floor(y + dy);
    p[2 * x_extent - i - 1].x = (int)floor(i + dx);
    p[2 * x_extent - i - 1].y = (int)floor(-y + dy);
    p[2 * x_extent + i - is_odd].x = (int)floor(-i + dx);
    p[2 * x_extent + i - is_odd].y = (int)floor(-y + dy);
    if (i || !is_odd) {
      p[4 * x_extent - i - 1 - 2 * is_odd].x = (int)floor(-i + dx);
      p[4 * x_extent - i - 1 - 2 * is_odd].y = (int)floor(y + dy);
    }
  }

  return p;
}

Here is the caller graph for this function: