Classes | Functions | Variables

ut_color.cpp File Reference

#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>


struct  colorToRGBMapping


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)


static struct colorToRGBMapping s_Colors []

Function Documentation

static int color_compare ( const void *  a,
const void *  b 
) [static]
static int parseColorToNextDelim ( const char *  p,
UT_uint32 index 
) [static]
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.
An RGB hexadecimal string or an empty string if szColor is empty

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]
void UT_parseColor ( const char *  p,
UT_RGBColor c 
static void UT_parseGrayColor ( const char *  p,
UT_RGBColor c 
) [static]
void UT_setColor ( UT_RGBColor col,
unsigned char  r,
unsigned char  g,
unsigned char  b,
bool  bTransparent 
static int x_hexDigit ( char  c  )  [static]


Referenced by UT_HashColor::rgb().

Variable Documentation

struct colorToRGBMapping s_Colors[] [static]