summaryrefslogtreecommitdiff
path: root/src/fl_color.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-03-21 08:26:40 +0000
committerManolo Gouy <Manolo>2010-03-21 08:26:40 +0000
commitc5d7f42a2297f3eb4edec61ced79057bedbbb8b9 (patch)
tree76938078ec42c45de06a6913c9f5cdeec7da6765 /src/fl_color.cxx
parenta8c583a49e50a366b6f9d1021217d907bd168414 (diff)
Completed Doxygen documentation of Fl_Device, Fl_Abstract_Printer, Fl_Printer classes.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7310 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_color.cxx')
-rw-r--r--src/fl_color.cxx59
1 files changed, 20 insertions, 39 deletions
diff --git a/src/fl_color.cxx b/src/fl_color.cxx
index 33f92478d..735757427 100644
--- a/src/fl_color.cxx
+++ b/src/fl_color.cxx
@@ -124,6 +124,26 @@ Fl_XColor fl_xmap[1][256];
# define fl_overlay 0
# endif
+/** Current color for drawing operations */
+Fl_Color fl_color_;
+
+void Fl_Device::color(Fl_Color i) {
+ if (i & 0xffffff00) {
+ unsigned rgb = (unsigned)i;
+ fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
+ } else {
+ fl_color_ = i;
+ if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
+ XSetForeground(fl_display, fl_gc, fl_xpixel(i));
+ }
+}
+
+void Fl_Device::color(uchar r,uchar g,uchar b) {
+ fl_color_ = fl_rgb_color(r, g, b);
+ if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
+ XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b));
+}
+
/** \addtogroup fl_attributes
@{ */
////////////////////////////////////////////////////////////////
@@ -161,22 +181,6 @@ ulong fl_xpixel(uchar r,uchar g,uchar b) {
) >> fl_extrashift;
}
-/**
- Set the color for all subsequent drawing operations.
- The closest possible match to the RGB color is used.
- The RGB color is used directly on TrueColor displays.
- For colormap visuals the nearest index in the gray
- ramp or color cube is used.
- If no valid graphical context (fl_gc) is available,
- the foreground is not set for the current window.
- \param[in] r,g,b color components
-*/
-void Fl_Device::color(uchar r,uchar g,uchar b) {
- fl_color_ = fl_rgb_color(r, g, b);
- if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
- XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b));
-}
-
////////////////////////////////////////////////////////////////
// Get a color out of the fltk colormap. Again for truecolor
// visuals this is easy. For colormap this actually tries to allocate
@@ -316,29 +320,6 @@ ulong fl_xpixel(Fl_Color i) {
# endif
}
-/** Current color for drawing operations */
-Fl_Color fl_color_;
-
-/**
- Sets the color for all subsequent drawing operations.
- For colormapped displays, a color cell will be allocated out of
- \p fl_colormap the first time you use a color. If the colormap fills up
- then a least-squares algorithm is used to find the closest color.
- If no valid graphical context (fl_gc) is available,
- the foreground is not set for the current window.
- \param[in] i color
-*/
-void Fl_Device::color(Fl_Color i) {
- if (i & 0xffffff00) {
- unsigned rgb = (unsigned)i;
- fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
- } else {
- fl_color_ = i;
- if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
- XSetForeground(fl_display, fl_gc, fl_xpixel(i));
- }
-}
-
/**
Free color \p i if used, and clear mapping table entry.
\param[in] i color index