mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 15:32:12 +08:00
OpenGL arc and pie drawing (Mmmmh, pie!)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11036 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+2
-2
@@ -388,9 +388,9 @@ protected:
|
|||||||
virtual void arc(double x, double y, double r, double start, double end);
|
virtual void arc(double x, double y, double r, double start, double end);
|
||||||
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
|
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
|
||||||
friend void fl_arc(int x, int y, int w, int h, double a1, double a2);
|
friend void fl_arc(int x, int y, int w, int h, double a1, double a2);
|
||||||
virtual void arc(int x, int y, int w, int h, double a1, double a2);
|
virtual void arc(int x, int y, int w, int h, double a1, double a2) = 0;
|
||||||
friend void fl_pie(int x, int y, int w, int h, double a1, double a2);
|
friend void fl_pie(int x, int y, int w, int h, double a1, double a2);
|
||||||
virtual void pie(int x, int y, int w, int h, double a1, double a2);
|
virtual void pie(int x, int y, int w, int h, double a1, double a2) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ const char *Fl_OpenGL_Display_Device::class_id = "Fl_OpenGL_Display_Device";
|
|||||||
|
|
||||||
#include "cfg_gfx/opengl_rect.cxx"
|
#include "cfg_gfx/opengl_rect.cxx"
|
||||||
#include "cfg_gfx/opengl_vertex.cxx"
|
#include "cfg_gfx/opengl_vertex.cxx"
|
||||||
|
#include "cfg_gfx/opengl_arci.cxx"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,11 @@ protected:
|
|||||||
void end_complex_polygon();
|
void end_complex_polygon();
|
||||||
void gap();
|
void gap();
|
||||||
void circle(double x, double y, double r);
|
void circle(double x, double y, double r);
|
||||||
|
// --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
|
||||||
|
// using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
|
||||||
|
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
|
||||||
|
void arc(int x, int y, int w, int h, double a1, double a2);
|
||||||
|
void pie(int x, int y, int w, int h, double a1, double a2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
//
|
||||||
|
// "$Id$"
|
||||||
|
//
|
||||||
|
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please report all bugs and problems on the following page:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/str.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_CFG_GFX_GDI_ARCI_CXX
|
||||||
|
#define FL_CFG_GFX_GDI_ARCI_CXX
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file gdi_arci.cxx
|
||||||
|
\brief Utility functions for drawing circles using integers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <FL/math.h>
|
||||||
|
|
||||||
|
void Fl_GDI_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
|
||||||
|
int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
|
||||||
|
int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
|
||||||
|
int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
|
||||||
|
if (fabs(a1 - a2) < 90) {
|
||||||
|
if (xa == xb && ya == yb) SetPixel(fl_gc, xa, ya, fl_RGB());
|
||||||
|
else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
||||||
|
} else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fl_GDI_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
if (a1 == a2) return;
|
||||||
|
int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
|
||||||
|
int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
|
||||||
|
int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
|
||||||
|
int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
|
||||||
|
SelectObject(fl_gc, fl_brush());
|
||||||
|
if (fabs(a1 - a2) < 90) {
|
||||||
|
if (xa == xb && ya == yb) {
|
||||||
|
MoveToEx(fl_gc, x+w/2, y+h/2, 0L);
|
||||||
|
LineTo(fl_gc, xa, ya);
|
||||||
|
SetPixel(fl_gc, xa, ya, fl_RGB());
|
||||||
|
} else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
||||||
|
} else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif FL_CFG_GFX_GDI_ARCI_CXX
|
||||||
|
|
||||||
|
//
|
||||||
|
// End of "$Id$".
|
||||||
|
//
|
||||||
@@ -86,6 +86,11 @@ public:
|
|||||||
void end_complex_polygon();
|
void end_complex_polygon();
|
||||||
void fixloop();
|
void fixloop();
|
||||||
void circle(double x, double y, double r);
|
void circle(double x, double y, double r);
|
||||||
|
// --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
|
||||||
|
// using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
|
||||||
|
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
|
||||||
|
void arc(int x, int y, int w, int h, double a1, double a2);
|
||||||
|
void pie(int x, int y, int w, int h, double a1, double a2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
//
|
||||||
|
// "$Id$"
|
||||||
|
//
|
||||||
|
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please report all bugs and problems on the following page:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/str.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_CFG_GFX_OPENGL_ARCI_CXX
|
||||||
|
#define FL_CFG_GFX_OPENGL_ARCI_CXX
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file opengl_arci.cxx
|
||||||
|
\brief Utility functions for drawing circles using integers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <FL/gl.h>
|
||||||
|
|
||||||
|
void Fl_OpenGL_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
while (a2<a1) a2 += 360.0; // TODO: write a sensible fmod angle alignment here
|
||||||
|
a1 = a1/180.0f*M_PI; a2 = a2/180.0f*M_PI;
|
||||||
|
double cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
||||||
|
double rMax; if (w<h) rMax = h/2; else rMax = w/2;
|
||||||
|
int nSeg = (int)(10 * sqrt(rMax))+1;
|
||||||
|
double incr = (a2-a1)/(double)nSeg;
|
||||||
|
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
for (int i=0; i<nSeg; i++) {
|
||||||
|
glVertex2d(cx+cos(a1)*rMax, cy-sin(a1)*rMax);
|
||||||
|
a1 += incr;
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fl_OpenGL_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
while (a2<a1) a2 += 360.0; // TODO: write a sensible fmod angle alignment here
|
||||||
|
a1 = a1/180.0f*M_PI; a2 = a2/180.0f*M_PI;
|
||||||
|
double cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
||||||
|
double rMax; if (w<h) rMax = h/2; else rMax = w/2;
|
||||||
|
int nSeg = (int)(10 * sqrt(rMax))+1;
|
||||||
|
double incr = (a2-a1)/(double)nSeg;
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
|
glVertex2d(cx, cy);
|
||||||
|
for (int i=0; i<nSeg+1; i++) {
|
||||||
|
glVertex2d(cx+cos(a1)*rMax, cy-sin(a1)*rMax);
|
||||||
|
a1 += incr;
|
||||||
|
}
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif FL_CFG_GFX_OPENGL_ARCI_CXX
|
||||||
|
|
||||||
|
//
|
||||||
|
// End of "$Id$".
|
||||||
|
//
|
||||||
@@ -104,6 +104,11 @@ protected:
|
|||||||
void end_complex_polygon();
|
void end_complex_polygon();
|
||||||
void gap();
|
void gap();
|
||||||
void circle(double x, double y, double r);
|
void circle(double x, double y, double r);
|
||||||
|
// --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
|
||||||
|
// using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
|
||||||
|
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
|
||||||
|
void arc(int x, int y, int w, int h, double a1, double a2);
|
||||||
|
void pie(int x, int y, int w, int h, double a1, double a2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
//
|
||||||
|
// "$Id$"
|
||||||
|
//
|
||||||
|
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 1998-2016 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please report all bugs and problems on the following page:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/str.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_CFG_GFX_QUARTZ_ARCI_CXX
|
||||||
|
#define FL_CFG_GFX_QUARTZ_ARCI_CXX
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file quartz_arci.cxx
|
||||||
|
\brief Utility functions for drawing circles using integers
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Fl_Quartz_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
|
||||||
|
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
||||||
|
CGContextSetShouldAntialias(fl_gc, true);
|
||||||
|
if (w!=h) {
|
||||||
|
CGContextSaveGState(fl_gc);
|
||||||
|
CGContextTranslateCTM(fl_gc, cx, cy);
|
||||||
|
CGContextScaleCTM(fl_gc, w-1.0f, h-1.0f);
|
||||||
|
CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
|
||||||
|
CGContextRestoreGState(fl_gc);
|
||||||
|
} else {
|
||||||
|
float r = (w+h)*0.25f-0.5f;
|
||||||
|
CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
|
||||||
|
}
|
||||||
|
CGContextStrokePath(fl_gc);
|
||||||
|
CGContextSetShouldAntialias(fl_gc, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fl_Quartz_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
|
||||||
|
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
||||||
|
CGContextSetShouldAntialias(fl_gc, true);
|
||||||
|
if (w!=h) {
|
||||||
|
CGContextSaveGState(fl_gc);
|
||||||
|
CGContextTranslateCTM(fl_gc, cx, cy);
|
||||||
|
CGContextScaleCTM(fl_gc, w, h);
|
||||||
|
CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
|
||||||
|
CGContextAddLineToPoint(fl_gc, 0, 0);
|
||||||
|
CGContextClosePath(fl_gc);
|
||||||
|
CGContextRestoreGState(fl_gc);
|
||||||
|
} else {
|
||||||
|
float r = (w+h)*0.25f;
|
||||||
|
CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
|
||||||
|
CGContextAddLineToPoint(fl_gc, cx, cy);
|
||||||
|
CGContextClosePath(fl_gc);
|
||||||
|
}
|
||||||
|
CGContextFillPath(fl_gc);
|
||||||
|
CGContextSetShouldAntialias(fl_gc, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif FL_CFG_GFX_QUARTZ_ARCI_CXX
|
||||||
|
|
||||||
|
//
|
||||||
|
// End of "$Id$".
|
||||||
|
//
|
||||||
@@ -93,6 +93,11 @@ protected:
|
|||||||
void end_complex_polygon();
|
void end_complex_polygon();
|
||||||
void gap();
|
void gap();
|
||||||
void circle(double x, double y, double r);
|
void circle(double x, double y, double r);
|
||||||
|
// --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed
|
||||||
|
// using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end);
|
||||||
|
// --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx
|
||||||
|
void arc(int x, int y, int w, int h, double a1, double a2);
|
||||||
|
void pie(int x, int y, int w, int h, double a1, double a2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
//
|
||||||
|
// "$Id$"
|
||||||
|
//
|
||||||
|
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
|
||||||
|
//
|
||||||
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
||||||
|
//
|
||||||
|
// This library is free software. Distribution and use rights are outlined in
|
||||||
|
// the file "COPYING" which should have been included with this file. If this
|
||||||
|
// file is missing or damaged, see the license at:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/COPYING.php
|
||||||
|
//
|
||||||
|
// Please report all bugs and problems on the following page:
|
||||||
|
//
|
||||||
|
// http://www.fltk.org/str.php
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FL_CFG_GFX_XLIB_ARCI_CXX
|
||||||
|
#define FL_CFG_GFX_XLIB_ARCI_CXX
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file xlib_arci.cxx
|
||||||
|
\brief Utility functions for drawing circles using integers
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Fl_Xlib_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
XDrawArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fl_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
XDrawArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
|
||||||
|
XFillArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif FL_CFG_GFX_XLIB_ARCI_CXX
|
||||||
|
|
||||||
|
//
|
||||||
|
// End of "$Id$".
|
||||||
|
//
|
||||||
+27
-82
@@ -32,95 +32,40 @@
|
|||||||
// 3/10/98: created
|
// 3/10/98: created
|
||||||
|
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
#include <FL/x.H>
|
|
||||||
#ifdef WIN32
|
|
||||||
# include <FL/math.h>
|
|
||||||
#endif
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include "config_lib.h"
|
||||||
|
|
||||||
void Fl_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
|
// -----------------------------------------------------------------------------
|
||||||
if (w <= 0 || h <= 0) return;
|
|
||||||
|
|
||||||
|
#ifdef FL_CFG_GFX_QUARTZ
|
||||||
|
|
||||||
|
# include "cfg_gfx/quartz_arci.cxx"
|
||||||
|
|
||||||
#if defined(USE_X11)
|
|
||||||
XDrawArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
|
|
||||||
#elif defined(WIN32)
|
|
||||||
int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
|
|
||||||
int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
|
|
||||||
int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
|
|
||||||
int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
|
|
||||||
if (fabs(a1 - a2) < 90) {
|
|
||||||
if (xa == xb && ya == yb) SetPixel(fl_gc, xa, ya, fl_RGB());
|
|
||||||
else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
|
||||||
} else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
|
||||||
#elif defined(__APPLE_QUARTZ__)
|
|
||||||
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
|
|
||||||
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
|
||||||
CGContextSetShouldAntialias(fl_gc, true);
|
|
||||||
if (w!=h) {
|
|
||||||
CGContextSaveGState(fl_gc);
|
|
||||||
CGContextTranslateCTM(fl_gc, cx, cy);
|
|
||||||
CGContextScaleCTM(fl_gc, w-1.0f, h-1.0f);
|
|
||||||
CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
|
|
||||||
CGContextRestoreGState(fl_gc);
|
|
||||||
} else {
|
|
||||||
float r = (w+h)*0.25f-0.5f;
|
|
||||||
CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
|
|
||||||
}
|
|
||||||
CGContextStrokePath(fl_gc);
|
|
||||||
CGContextSetShouldAntialias(fl_gc, false);
|
|
||||||
#elif defined(FL_PORTING)
|
|
||||||
# pragma message "FL_PORTING: implement arc drawing"
|
|
||||||
#else
|
|
||||||
# error unsupported platform
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
void Fl_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
|
|
||||||
if (w <= 0 || h <= 0) return;
|
|
||||||
|
|
||||||
#if defined(USE_X11)
|
// -----------------------------------------------------------------------------
|
||||||
XDrawArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
|
|
||||||
XFillArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
|
|
||||||
#elif defined(WIN32)
|
#ifdef FL_CFG_GFX_GDI
|
||||||
if (a1 == a2) return;
|
|
||||||
int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
|
# include "cfg_gfx/gdi_arci.cxx"
|
||||||
int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
|
|
||||||
int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
|
|
||||||
int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
|
|
||||||
SelectObject(fl_gc, fl_brush());
|
|
||||||
if (fabs(a1 - a2) < 90) {
|
|
||||||
if (xa == xb && ya == yb) {
|
|
||||||
MoveToEx(fl_gc, x+w/2, y+h/2, 0L);
|
|
||||||
LineTo(fl_gc, xa, ya);
|
|
||||||
SetPixel(fl_gc, xa, ya, fl_RGB());
|
|
||||||
} else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
|
||||||
} else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
|
|
||||||
#elif defined(__APPLE_QUARTZ__)
|
|
||||||
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
|
|
||||||
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
|
|
||||||
CGContextSetShouldAntialias(fl_gc, true);
|
|
||||||
if (w!=h) {
|
|
||||||
CGContextSaveGState(fl_gc);
|
|
||||||
CGContextTranslateCTM(fl_gc, cx, cy);
|
|
||||||
CGContextScaleCTM(fl_gc, w, h);
|
|
||||||
CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
|
|
||||||
CGContextAddLineToPoint(fl_gc, 0, 0);
|
|
||||||
CGContextClosePath(fl_gc);
|
|
||||||
CGContextRestoreGState(fl_gc);
|
|
||||||
} else {
|
|
||||||
float r = (w+h)*0.25f;
|
|
||||||
CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
|
|
||||||
CGContextAddLineToPoint(fl_gc, cx, cy);
|
|
||||||
CGContextClosePath(fl_gc);
|
|
||||||
}
|
|
||||||
CGContextFillPath(fl_gc);
|
|
||||||
CGContextSetShouldAntialias(fl_gc, false);
|
|
||||||
#elif defined(FL_PORTING)
|
|
||||||
# pragma message "FL_PORTING: implement pie drawing (mmmh, apple pie)"
|
|
||||||
#else
|
|
||||||
# error unsupported platform
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FL_CFG_GFX_XLIB
|
||||||
|
|
||||||
|
# include "cfg_gfx/xlib_arci.cxx"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
|
|||||||
Reference in New Issue
Block a user