summaryrefslogtreecommitdiff
path: root/src/fl_color_mac.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2004-08-26 00:18:43 +0000
committerMatthias Melcher <fltk@matthiasm.com>2004-08-26 00:18:43 +0000
commit25fe8425db613e4eaeff7898e803dd0f68fe57a5 (patch)
treedcf668b3037121a193e825b5ffa4d6721b733dfe /src/fl_color_mac.cxx
parent8327822026ac50dc9e20823988b0f53bc143b7ba (diff)
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
Diffstat (limited to 'src/fl_color_mac.cxx')
-rw-r--r--src/fl_color_mac.cxx33
1 files changed, 25 insertions, 8 deletions
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 <config.h>
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/fl_draw.H>
-#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 $".
//