#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include "ut_color.h"
#include "ut_assert.h"
#include "ut_string.h"
#include "ut_debugmsg.h"
#include <limits.h>
Classes | |
struct | colorToRGBMapping |
Functions | |
static int | color_compare (const void *a, const void *b) |
static int | x_hexDigit (char c) |
static int | parseColorToNextDelim (const char *p, UT_uint32 &index) |
static void | UT_parseGrayColor (const char *p, UT_RGBColor &c) |
static void | UT_parseCMYKColor (const char *p, UT_RGBColor &c) |
void | UT_setColor (UT_RGBColor &col, unsigned char r, unsigned char g, unsigned char b, bool bTransparent) |
void | UT_parseColor (const char *p, UT_RGBColor &c) |
std::string | UT_colorToHex (const char *szColor, bool bPrefix) |
Variables | |
static struct colorToRGBMapping | s_Colors [] |
static int color_compare | ( | const void * | a, | |
const void * | b | |||
) | [static] |
References colorToRGBMapping::m_name.
Referenced by UT_HashColor::lookupNamedColor().
static int parseColorToNextDelim | ( | const char * | p, | |
UT_uint32 & | index | |||
) | [static] |
Referenced by UT_parseCMYKColor(), and UT_parseGrayColor().
std::string UT_colorToHex | ( | const char * | szColor, | |
bool | bPrefix | |||
) |
This function takes in a color string of any form (e.g. "red", "CMYK()", "#000000", "000000", etc.) and returns an RGB hexadecimal string.
szColor | The incoming string to parse | |
bPrefix | The return string will be prefixed with a '#' if bPrefix is true. Defaults to false. |
WARNING: Will return 000000 or #000000 if an invalid color is passed in
References UT_RGBColor::m_blu, UT_RGBColor::m_grn, UT_RGBColor::m_red, UT_HashColor::setColor(), UT_parseColor(), and UT_return_val_if_fail.
Referenced by IE_Exp_HTML_Listener::_makeStylesheet(), IE_Exp_HTML_Listener::_openSpan(), ODe_Style_Style::GraphicProps::fetchAttributesFromAbiProps(), ODe_Style_Style::CellProps::fetchAttributesFromAbiProps(), ODe_Style_Style::TableProps::fetchAttributesFromAbiProps(), ODe_Style_Style::TextProps::fetchAttributesFromAbiProps(), ODe_Style_Style::ParagraphProps::fetchAttributesFromAbiProps(), ODe_Style_PageLayout::fetchAttributesFromAbiSection(), IE_Exp_HTML_StyleTree::IE_Exp_HTML_StyleTree(), IE_Exp_OpenXML::setBackgroundColor(), IE_Exp_OpenXML::setTableBorder(), and IE_Exp_OpenXML::setTextColor().
static void UT_parseCMYKColor | ( | const char * | p, | |
UT_RGBColor & | c | |||
) | [static] |
References UT_RGBColor::m_blu, UT_RGBColor::m_grn, UT_RGBColor::m_red, parseColorToNextDelim(), and UT_DEBUGMSG.
Referenced by UT_parseColor().
void UT_parseColor | ( | const char * | p, | |
UT_RGBColor & | c | |||
) |
References UT_RGBColor::m_bIsTransparent, UT_RGBColor::m_blu, UT_RGBColor::m_grn, UT_RGBColor::m_red, UT_HashColor::rgb(), UT_HashColor::setColor(), UT_HashColor::setHashIfValid(), UT_ASSERT, UT_DEBUGMSG, UT_NOT_IMPLEMENTED, UT_parseCMYKColor(), and UT_parseGrayColor().
Referenced by AP_UnixDialog_Background::_constructWindowContents(), fp_TabRun::_draw(), fp_FieldRun::_lookupProperties(), fp_TabRun::_lookupProperties(), fl_TableLayout::_lookupProperties(), AP_Win32Dialog_Options_General::_onCommand(), XAP_Win32Dialog_FontChooser::_onInitDialog(), s_KWord_1_Listener::_openSpan(), AP_Dialog_Styles::_populateAbiPreview(), FV_View::_prefsListener(), IE_Exp_RTF::_write_rtf_header(), XAP_Preview_FontPreview::draw(), AP_FormatTable_preview::draw(), AP_FormatFrame_preview::draw(), AP_Border_Shading_preview::draw(), fp_Run::drawDecors(), AP_UnixDialog_Options::event_ChooseTransparentColor(), FV_View::FV_View(), FV_View::getColorSelBackground(), PP_PropertyTypeColor::PP_PropertyTypeColor(), XAP_Win32Dialog_FontChooser::runModal(), XAP_UnixDialog_FontChooser::runModal(), XAP_CocoaDialog_FontChooser::runModal, AP_Win32Dialog_Background::runModal(), s_background_properties(), s_border_properties(), s_border_properties_cell(), UT_RGBColor::setColor(), AP_Dialog_Background::setColor(), UT_colorToHex(), UT_Xpm2Bmp(), and XAP_Preview_FontPreview::XAP_Preview_FontPreview().
static void UT_parseGrayColor | ( | const char * | p, | |
UT_RGBColor & | c | |||
) | [static] |
References UT_RGBColor::m_blu, UT_RGBColor::m_grn, UT_RGBColor::m_red, parseColorToNextDelim(), and UT_DEBUGMSG.
Referenced by UT_parseColor().
void UT_setColor | ( | UT_RGBColor & | col, | |
unsigned char | r, | |||
unsigned char | g, | |||
unsigned char | b, | |||
bool | bTransparent | |||
) |
static int x_hexDigit | ( | char | c | ) | [static] |
References UT_ASSERT, and UT_SHOULD_NOT_HAPPEN.
Referenced by UT_HashColor::rgb().
struct colorToRGBMapping s_Colors[] [static] |