From 25fe8425db613e4eaeff7898e803dd0f68fe57a5 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 26 Aug 2004 00:18:43 +0000 Subject: Quartz implementation for FLTK 1.1: - added very crude font support - added line drawing support - added line color support - added filled shapes support - added some arc and circle support (no ovals) - attempt at getting the clipping working, however the stack oriented design of Quartz is starting to become a real hassle git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3784 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_color_mac.cxx | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'src/fl_color_mac.cxx') diff --git a/src/fl_color_mac.cxx b/src/fl_color_mac.cxx index f7ff589d7..d05d5f986 100644 --- a/src/fl_color_mac.cxx +++ b/src/fl_color_mac.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_color_mac.cxx,v 1.1.2.7 2004/08/25 00:20:26 matthiaswm Exp $" +// "$Id: fl_color_mac.cxx,v 1.1.2.8 2004/08/26 00:18:43 matthiaswm Exp $" // // MacOS color functions for the Fast Light Tool Kit (FLTK). // @@ -28,17 +28,14 @@ // changes can be made. Not to be confused with the X colormap, which // I try to hide completely. -// MacOS - matt: the macintosh port does not support colormaps +// matt: Neither Quartz nor Quickdraw support colormaps in this implementation +// matt: Quartz support done #include #include #include #include -#ifdef __APPLE_QUARTZ__ -#warning quartz -#endif - static unsigned fl_cmap[256] = { #include "fl_cmap.h" // this is a file produced by "cmap.cxx": }; @@ -67,20 +64,40 @@ void fl_color(Fl_Color i) { g = c>>16; b = c>> 8; } +#ifdef __APPLE_QD__ RGBColor rgb; rgb.red = (r<<8)|r; rgb.green = (g<<8)|g; rgb.blue = (b<<8)|b; RGBForeColor(&rgb); +#elif defined(__APPLE_QUARTZ__) + float fr = r/255.0f; + float fg = g/255.0f; + float fb = b/255.0f; + CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f); + CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f); +#else +# error : neither Quickdraw nor Quartz defined +#endif } void fl_color(uchar r, uchar g, uchar b) { - RGBColor rgb; fl_color_ = fl_rgb_color(r, g, b); +#ifdef __APPLE_QD__ + RGBColor rgb; rgb.red = (r<<8)|r; rgb.green = (g<<8)|g; rgb.blue = (b<<8)|b; RGBForeColor(&rgb); +#elif defined(__APPLE_QUARTZ__) + float fr = r/255.0f; + float fg = g/255.0f; + float fb = b/255.0f; + CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f); + CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f); +#else +# error : neither Quickdraw nor Quartz defined +#endif } void Fl::set_color(Fl_Color i, unsigned c) { @@ -90,5 +107,5 @@ void Fl::set_color(Fl_Color i, unsigned c) { } // -// End of "$Id: fl_color_mac.cxx,v 1.1.2.7 2004/08/25 00:20:26 matthiaswm Exp $". +// End of "$Id: fl_color_mac.cxx,v 1.1.2.8 2004/08/26 00:18:43 matthiaswm Exp $". // -- cgit v1.2.3