@ -59,10 +59,18 @@ void fl_rect(int x, int y, int w, int h) {
LineTo ( fl_gc , x , y + h - 1 ) ;
LineTo ( fl_gc , x , y + h - 1 ) ;
LineTo ( fl_gc , x , y ) ;
LineTo ( fl_gc , x , y ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGRect rect = CGRectMake ( x , y , w - 1 , h - 1 ) ;
CGRect rect = CGRectMake ( x , y , w - 1 , h - 1 ) ;
CGContextStrokeRect ( fl_gc , rect ) ;
CGContextStrokeRect ( fl_gc , rect ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -81,10 +89,18 @@ void fl_rectf(int x, int y, int w, int h) {
rect . right = x + w ; rect . bottom = y + h ;
rect . right = x + w ; rect . bottom = y + h ;
FillRect ( fl_gc , & rect , fl_brush ( ) ) ;
FillRect ( fl_gc , & rect , fl_brush ( ) ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGRect rect = CGRectMake ( x , y , w - 1 , h - 1 ) ;
CGRect rect = CGRectMake ( x , y , w - 1 , h - 1 ) ;
CGContextFillRect ( fl_gc , rect ) ;
CGContextFillRect ( fl_gc , rect ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -99,11 +115,19 @@ void fl_xyline(int x, int y, int x1) {
# elif defined(WIN32)
# elif defined(WIN32)
MoveToEx ( fl_gc , x , y , 0L ) ; LineTo ( fl_gc , x1 + 1 , y ) ;
MoveToEx ( fl_gc , x , y , 0L ) ; LineTo ( fl_gc , x1 + 1 , y ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -125,12 +149,20 @@ void fl_xyline(int x, int y, int x1, int y2) {
LineTo ( fl_gc , x1 , y ) ;
LineTo ( fl_gc , x1 , y ) ;
LineTo ( fl_gc , x1 , y2 ) ;
LineTo ( fl_gc , x1 , y2 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y2 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -155,13 +187,21 @@ void fl_xyline(int x, int y, int x1, int y2, int x3) {
LineTo ( fl_gc , x1 , y2 ) ;
LineTo ( fl_gc , x1 , y2 ) ;
LineTo ( fl_gc , x3 , y2 ) ;
LineTo ( fl_gc , x3 , y2 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x3 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x3 , y2 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -178,11 +218,19 @@ void fl_yxline(int x, int y, int y1) {
else y1 + + ;
else y1 + + ;
MoveToEx ( fl_gc , x , y , 0L ) ; LineTo ( fl_gc , x , y1 ) ;
MoveToEx ( fl_gc , x , y , 0L ) ; LineTo ( fl_gc , x , y1 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x , y1 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -204,12 +252,20 @@ void fl_yxline(int x, int y, int y1, int x2) {
LineTo ( fl_gc , x , y1 ) ;
LineTo ( fl_gc , x , y1 ) ;
LineTo ( fl_gc , x2 , y1 ) ;
LineTo ( fl_gc , x2 , y1 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y1 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -234,13 +290,21 @@ void fl_yxline(int x, int y, int y1, int x2, int y3) {
LineTo ( fl_gc , x2 , y1 ) ;
LineTo ( fl_gc , x2 , y1 ) ;
LineTo ( fl_gc , x2 , y3 ) ;
LineTo ( fl_gc , x2 , y3 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y3 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y3 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -259,11 +323,19 @@ void fl_line(int x, int y, int x1, int y1) {
// functions will not draw the last point ("it's a feature!"...)
// functions will not draw the last point ("it's a feature!"...)
SetPixel ( fl_gc , x1 , y1 , fl_RGB ( ) ) ;
SetPixel ( fl_gc , x1 , y1 , fl_RGB ( ) ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -287,12 +359,20 @@ void fl_line(int x, int y, int x1, int y1, int x2, int y2) {
// functions will not draw the last point ("it's a feature!"...)
// functions will not draw the last point ("it's a feature!"...)
SetPixel ( fl_gc , x2 , y2 , fl_RGB ( ) ) ;
SetPixel ( fl_gc , x2 , y2 , fl_RGB ( ) ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -315,11 +395,17 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {
LineTo ( fl_gc , x2 , y2 ) ;
LineTo ( fl_gc , x2 , y2 ) ;
LineTo ( fl_gc , x , y ) ;
LineTo ( fl_gc , x , y ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextClosePath ( fl_gc ) ;
CGContextClosePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -344,12 +430,18 @@ void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
LineTo ( fl_gc , x3 , y3 ) ;
LineTo ( fl_gc , x3 , y3 ) ;
LineTo ( fl_gc , x , y ) ;
LineTo ( fl_gc , x , y ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x3 , y3 ) ;
CGContextAddLineToPoint ( fl_gc , x3 , y3 ) ;
CGContextClosePath ( fl_gc ) ;
CGContextClosePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -371,11 +463,17 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {
SelectObject ( fl_gc , fl_brush ( ) ) ;
SelectObject ( fl_gc , fl_brush ( ) ) ;
Polygon ( fl_gc , p , 3 ) ;
Polygon ( fl_gc , p , 3 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextClosePath ( fl_gc ) ;
CGContextClosePath ( fl_gc ) ;
CGContextFillPath ( fl_gc ) ;
CGContextFillPath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -398,12 +496,18 @@ void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
SelectObject ( fl_gc , fl_brush ( ) ) ;
SelectObject ( fl_gc , fl_brush ( ) ) ;
Polygon ( fl_gc , p , 4 ) ;
Polygon ( fl_gc , p , 4 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextMoveToPoint ( fl_gc , x , y ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x1 , y1 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x2 , y2 ) ;
CGContextAddLineToPoint ( fl_gc , x3 , y3 ) ;
CGContextAddLineToPoint ( fl_gc , x3 , y3 ) ;
CGContextClosePath ( fl_gc ) ;
CGContextClosePath ( fl_gc ) ;
CGContextFillPath ( fl_gc ) ;
CGContextFillPath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -418,11 +522,19 @@ void fl_point(int x, int y) {
# elif defined(WIN32)
# elif defined(WIN32)
SetPixel ( fl_gc , x , y , fl_RGB ( ) ) ;
SetPixel ( fl_gc , x , y , fl_RGB ( ) ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# endif
CGContextMoveToPoint ( fl_gc , x - .5 , y ) ; // Quartz needs a line that is one pixel long, or it will not draw anything
CGContextMoveToPoint ( fl_gc , x - .5 , y ) ; // Quartz needs a line that is one pixel long, or it will not draw anything
CGContextAddLineToPoint ( fl_gc , x + .5 , y ) ;
CGContextAddLineToPoint ( fl_gc , x + .5 , y ) ;
CGContextStrokePath ( fl_gc ) ;
CGContextStrokePath ( fl_gc ) ;
# ifdef __APPLE_COCOA__
if ( fl_quartz_line_width_ > 1.5f ) CGContextSetShouldAntialias ( fl_gc , false ) ;
# else
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
if ( fl_quartz_line_width_ = = 1.0f ) CGContextSetShouldAntialias ( fl_gc , true ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -467,6 +579,16 @@ void fl_restore_clip() {
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
if ( fl_window ) // clipping for a true window
if ( fl_window ) // clipping for a true window
{
{
# ifdef __APPLE_COCOA__
Fl_X : : q_clear_clipping ( ) ;
Fl_X : : q_fill_context ( ) ; //flip coords and translate if subwindow
//apply window's clip
CGContextClipToRects ( fl_gc , fl_window_region - > rects , fl_window_region - > count ) ;
//apply additional program clip
if ( r ) {
CGContextClipToRects ( fl_gc , r - > rects , r - > count ) ;
}
# else
GrafPtr port = GetWindowPort ( fl_window ) ;
GrafPtr port = GetWindowPort ( fl_window ) ;
if ( port ) {
if ( port ) {
RgnHandle portClip = NewRgn ( ) ;
RgnHandle portClip = NewRgn ( ) ;
@ -479,6 +601,7 @@ void fl_restore_clip() {
Fl_X : : q_fill_context ( ) ;
Fl_X : : q_fill_context ( ) ;
DisposeRgn ( portClip ) ;
DisposeRgn ( portClip ) ;
}
}
# endif
} else if ( fl_gc ) { // clipping for an offscreen drawing world (CGBitmap)
} else if ( fl_gc ) { // clipping for an offscreen drawing world (CGBitmap)
Rect portRect ;
Rect portRect ;
portRect . top = 0 ;
portRect . top = 0 ;
@ -486,8 +609,13 @@ void fl_restore_clip() {
portRect . bottom = CGBitmapContextGetHeight ( fl_gc ) ;
portRect . bottom = CGBitmapContextGetHeight ( fl_gc ) ;
portRect . right = CGBitmapContextGetWidth ( fl_gc ) ;
portRect . right = CGBitmapContextGetWidth ( fl_gc ) ;
Fl_X : : q_clear_clipping ( ) ;
Fl_X : : q_clear_clipping ( ) ;
if ( r )
if ( r ) {
# ifdef __APPLE_COCOA__
CGContextClipToRects ( fl_gc , r - > rects , r - > count ) ;
# else
ClipCGContextToRegion ( fl_gc , & portRect , r ) ;
ClipCGContextToRegion ( fl_gc , & portRect , r ) ;
# endif
}
Fl_X : : q_fill_context ( ) ;
Fl_X : : q_fill_context ( ) ;
}
}
# else
# else
@ -534,19 +662,33 @@ void fl_push_clip(int x, int y, int w, int h) {
# elif defined(WIN32)
# elif defined(WIN32)
CombineRgn ( r , r , current , RGN_AND ) ;
CombineRgn ( r , r , current , RGN_AND ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
XDestroyRegion ( r ) ;
r = MacRectRegionIntersect ( current , x , y , w , h ) ;
# else
SectRgn ( r , current , r ) ;
SectRgn ( r , current , r ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
}
}
# if defined(__APPLE_QUARTZ__)
else {
r = XRectangleRegion ( x , y , w , h ) ;
}
# endif
} else { // make empty clip region:
} else { // make empty clip region:
# if defined(USE_X11)
# if defined(USE_X11)
r = XCreateRegion ( ) ;
r = XCreateRegion ( ) ;
# elif defined(WIN32)
# elif defined(WIN32)
r = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
r = CreateRectRgn ( 0 , 0 , 0 , 0 ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
r = NULL ;
# else
r = NewRgn ( ) ;
r = NewRgn ( ) ;
SetEmptyRgn ( r ) ;
SetEmptyRgn ( r ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -604,9 +746,18 @@ int fl_not_clipped(int x, int y, int w, int h) {
return RectInRegion ( r , & rect ) ;
return RectInRegion ( r , & rect ) ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
if ( ! r ) return 1 ;
if ( ! r ) return 1 ;
# ifdef __APPLE_COCOA__
CGRect arg = CGRectMake ( x , y , w - 1 , h - 1 ) ;
for ( int i = 0 ; i < r - > count ; i + + ) {
CGRect test = CGRectIntersection ( r - > rects [ i ] , arg ) ;
if ( ! CGRectIsEmpty ( test ) ) return 1 ;
}
return 0 ;
# else
Rect rect ;
Rect rect ;
rect . left = x ; rect . top = y ; rect . right = x + w ; rect . bottom = y + h ;
rect . left = x ; rect . top = y ; rect . right = x + w ; rect . bottom = y + h ;
return RectInRgn ( & rect , r ) ;
return RectInRgn ( & rect , r ) ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif
@ -673,6 +824,24 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
DeleteObject ( rr ) ;
DeleteObject ( rr ) ;
return ret ;
return ret ;
# elif defined(__APPLE_QUARTZ__)
# elif defined(__APPLE_QUARTZ__)
# ifdef __APPLE_COCOA__
CGRect arg = CGRectMake ( x , y , w - 1 , h - 1 ) ;
CGRect u = CGRectMake ( 0 , 0 , 0 , 0 ) ;
CGRect test ;
for ( int i = 0 ; i < r - > count ; i + + ) {
test = CGRectIntersection ( r - > rects [ i ] , arg ) ;
if ( ! CGRectIsEmpty ( test ) ) {
if ( CGRectIsEmpty ( u ) ) u = test ;
else u = CGRectUnion ( u , test ) ;
}
}
X = u . origin . x ;
Y = u . origin . y ;
W = u . size . width ;
H = u . size . height ;
if ( CGRectIsEmpty ( u ) ) W = H = 0 ;
return ! CGRectEqualToRect ( arg , u ) ;
# else
RgnHandle rr = NewRgn ( ) ;
RgnHandle rr = NewRgn ( ) ;
SetRectRgn ( rr , x , y , x + w , y + h ) ;
SetRectRgn ( rr , x , y , x + w , y + h ) ;
SectRgn ( r , rr , rr ) ;
SectRgn ( r , rr , rr ) ;
@ -685,6 +854,7 @@ int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
if ( H = = 0 ) return 2 ;
if ( H = = 0 ) return 2 ;
if ( h = = H & & w = = W ) return 0 ;
if ( h = = H & & w = = W ) return 0 ;
return 0 ;
return 0 ;
# endif
# else
# else
# error unsupported platform
# error unsupported platform
# endif
# endif