# color.c File Reference

`#include "magick/studio.h"`
`#include "magick/blob.h"`
`#include "magick/cache-view.h"`
`#include "magick/color.h"`
`#include "magick/color-private.h"`
`#include "magick/client.h"`
`#include "magick/configure.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/gem.h"`
`#include "magick/geometry.h"`
`#include "magick/image-private.h"`
`#include "magick/memory_.h"`
`#include "magick/monitor.h"`
`#include "magick/option.h"`
`#include "magick/pixel-private.h"`
`#include "magick/quantize.h"`
`#include "magick/quantum.h"`
`#include "magick/semaphore.h"`
`#include "magick/string_.h"`
`#include "magick/token.h"`
`#include "magick/utility.h"`
`#include "magick/xml-tree.h"`

## Data Structures

struct | _NodeInfo
struct | _Nodes
struct | _CubeInfo

## Defines

#define | ColorFilename "colors.xml"
#define | MaxTreeDepth 8
#define | NodesInAList 1536
#define | EvaluateImageColorsText " Compute image colors... "
#define | SVGCompliant(component)
#define | HistogramImageTag "Histogram/Image"
#define | MaximumUniqueColors 1024
#define | SearchImageText " Searching image... "
#define | UniqueColorsImageTag "UniqueColors/Image"

## Typedefs

typedef struct _NodeInfo | NodeInfo
typedef struct _Nodes | Nodes
typedef struct _CubeInfo | CubeInfo

## Functions

static CubeInfo * | GetCubeInfo (void)
static NodeInfo * | GetNodeInfo (CubeInfo *, const unsigned long)
static MagickBooleanType | InitializeColorList (ExceptionInfo *)
static MagickBooleanType | LoadColorLists (const char *, ExceptionInfo *)
static void | DestroyColorCube (const Image *, NodeInfo *)
static unsigned long | ColorToNodeId (const Image *image, const MagickPixelPacket *pixel, unsigned long index)
static CubeInfo * | ClassifyImageColors (const Image *image, ExceptionInfo *exception)
MagickExport void | ConcatenateColorComponent (const MagickPixelPacket *pixel, const ChannelType channel, const ComplianceType compliance, char *tuple)
static void | DefineImageHistogram (const Image *image, NodeInfo *node_info, ColorPacket **histogram)
static void * | DestroyColorElement (void *color_info)
MagickExport void | DestroyColorList (void)
static CubeInfo * | DestroyCubeInfo (const Image *image, CubeInfo *cube_info)
MagickExport const ColorInfo * | GetColorInfo (const char *name, ExceptionInfo *exception)
static int | ColorInfoCompare (const void *x, const void *y)
MagickExport const ColorInfo ** | GetColorInfoList (const char *pattern, unsigned long *number_colors, ExceptionInfo *exception)
static int | ColorCompare (const void *x, const void *y)
MagickExport char ** | GetColorList (const char *pattern, unsigned long *number_colors, ExceptionInfo *exception)
static void | ConcatentateHexColorComponent (const MagickPixelPacket *pixel, const ChannelType channel, char *tuple)
MagickExport void | GetColorTuple (const MagickPixelPacket *pixel, const MagickBooleanType hex, char *tuple)
MagickExport ColorPacket * | GetImageHistogram (const Image *image, unsigned long *number_colors, ExceptionInfo *exception)
static int | HistogramCompare (const void *x, const void *y)
MagickExport unsigned long | GetNumberColors (const Image *image, FILE *file, ExceptionInfo *exception)
static double | MagickMax (const double x, const double y)
MagickExport MagickBooleanType | IsColorSimilar (const Image *image, const PixelPacket *p, const PixelPacket *q)
MagickExport MagickBooleanType | IsGrayImage (const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType | IsHistogramImage (const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType | IsImageSimilar (const Image *image, const Image *target_image, long *x_offset, long *y_offset, ExceptionInfo *exception)
MagickExport MagickBooleanType | IsMagickColorSimilar (const MagickPixelPacket *p, const MagickPixelPacket *q)
MagickExport MagickBooleanType | IsMonochromeImage (const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType | IsOpacitySimilar (const Image *image, const PixelPacket *p, const PixelPacket *q)
MagickExport MagickBooleanType | IsOpaqueImage (const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType | IsPaletteImage (const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType | ListColorInfo (FILE *file, ExceptionInfo *exception)
static MagickBooleanType | LoadColorList (const char *xml, const char *filename, const unsigned long depth, ExceptionInfo *exception)
static double | MagickMin (const double x, const double y)
MagickExport MagickBooleanType | QueryColorDatabase (const char *name, PixelPacket *color, ExceptionInfo *exception)
MagickExport MagickBooleanType | QueryColorname (const Image *image, const PixelPacket *color, const ComplianceType compliance, char *name, ExceptionInfo *exception)
MagickExport MagickBooleanType | QueryMagickColor (const char *name, MagickPixelPacket *color, ExceptionInfo *exception)
MagickExport MagickBooleanType | QueryMagickColorname (const Image *image, const MagickPixelPacket *color, const ComplianceType compliance, const MagickBooleanType hex, char *name, ExceptionInfo *exception)
static void | UniqueColorsToImage (Image *image, CubeInfo *cube_info, const NodeInfo *node_info, ExceptionInfo *exception)
MagickExport Image * | UniqueImageColors (const Image *image, ExceptionInfo *exception)

## Variables

static const char * | ColorMap
static LinkedListInfo * | color_list = (LinkedListInfo *) NULL
static SemaphoreInfo * | color_semaphore = (SemaphoreInfo *) NULL
static volatile MagickBooleanType | instantiate_color = MagickFalse

## Define Documentation

#define ColorFilename "colors.xml"

#define EvaluateImageColorsText " Compute image colors... "

#define HistogramImageTag "Histogram/Image"

#define MaximumUniqueColors 1024

#define MaxTreeDepth 8

#define NodesInAList 1536

#define SearchImageText " Searching image... "

#define SVGCompliant | ( | component |  | ) |

Value:

    ((MagickRealType) \
       ScaleCharToQuantum(ScaleQuantumToChar(RoundToQuantum(component))));

#define UniqueColorsImageTag "UniqueColors/Image"

## Typedef Documentation

typedef struct _CubeInfo CubeInfo

typedef struct _NodeInfo NodeInfo

typedef struct _Nodes Nodes

## Function Documentation

static CubeInfo* ClassifyImageColors | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

static int ColorCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static int ColorInfoCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static unsigned long ColorToNodeId | ( | const Image * | image,
|  | const MagickPixelPacket * | pixel,
|  | unsigned long | index |
| ) |  |  | `[inline, static]`

MagickExport void ConcatenateColorComponent | ( | const MagickPixelPacket * | pixel,
|  | const ChannelType | channel,
|  | const ComplianceType | compliance,
|  | char * | tuple |
| ) |  |  |

static void ConcatentateHexColorComponent | ( | const MagickPixelPacket * | pixel,
|  | const ChannelType | channel,
|  | char * | tuple |
| ) |  |  | `[static]`

static void DefineImageHistogram | ( | const Image * | image,
|  | NodeInfo * | node_info,
|  | ColorPacket ** | histogram |
| ) |  |  | `[static]`

static void DestroyColorCube | ( | const Image * | image,
|  | NodeInfo * | node_info |
| ) |  |  | `[static]`

static void* DestroyColorElement | ( | void * | color_info | ) | `[static]`

MagickExport void DestroyColorList | ( | void |  | ) |

static CubeInfo* DestroyCubeInfo | ( | const Image * | image,
|  | CubeInfo * | cube_info |
| ) |  |  | `[static]`

MagickExport const ColorInfo* GetColorInfo | ( | const char * | name,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport const ColorInfo** GetColorInfoList | ( | const char * | pattern,
|  | unsigned long * | number_colors,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport char** GetColorList | ( | const char * | pattern,
|  | unsigned long * | number_colors,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport void GetColorTuple | ( | const MagickPixelPacket * | pixel,
|  | const MagickBooleanType | hex,
|  | char * | tuple |
| ) |  |  |

static CubeInfo * GetCubeInfo | ( | void |  | ) | `[static]`

MagickExport ColorPacket* GetImageHistogram | ( | const Image * | image,
|  | unsigned long * | number_colors,
|  | ExceptionInfo * | exception |
| ) |  |  |

static NodeInfo * GetNodeInfo | ( | CubeInfo * | cube_info,
|  | const unsigned long | level |
| ) |  |  | `[static]`

MagickExport unsigned long GetNumberColors | ( | const Image * | image,
|  | FILE * | file,
|  | ExceptionInfo * | exception |
| ) |  |  |

static int HistogramCompare | ( | const void * | x,
|  | const void * | y |
| ) |  |  | `[static]`

static MagickBooleanType InitializeColorList | ( | ExceptionInfo * | exception | ) | `[static]`

MagickExport MagickBooleanType IsColorSimilar | ( | const Image * | image,
|  | const PixelPacket * | p,
|  | const PixelPacket * | q |
| ) |  |  |

MagickExport MagickBooleanType IsGrayImage | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType IsHistogramImage | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType IsImageSimilar | ( | const Image * | image,
|  | const Image * | target_image,
|  | long * | x_offset,
|  | long * | y_offset,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType IsMagickColorSimilar | ( | const MagickPixelPacket * | p,
|  | const MagickPixelPacket * | q |
| ) |  |  |

MagickExport MagickBooleanType IsMonochromeImage | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType IsOpacitySimilar | ( | const Image * | image,
|  | const PixelPacket * | p,
|  | const PixelPacket * | q |
| ) |  |  |

MagickExport MagickBooleanType IsOpaqueImage | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType IsPaletteImage | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType ListColorInfo | ( | FILE * | file,
|  | ExceptionInfo * | exception |
| ) |  |  |

static MagickBooleanType LoadColorList | ( | const char * | xml,
|  | const char * | filename,
|  | const unsigned long | depth,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

static MagickBooleanType LoadColorLists | ( | const char * | filename,
|  | ExceptionInfo * | exception |
| ) |  |  |

static double MagickMax | ( | const double | x,
|  | const double | y |
| ) |  |  | `[inline, static]`

static double MagickMin | ( | const double | x,
|  | const double | y |
| ) |  |  | `[inline, static]`

MagickExport MagickBooleanType QueryColorDatabase | ( | const char * | name,
|  | PixelPacket * | color,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType QueryColorname | ( | const Image * | image,
|  | const PixelPacket * | color,
|  | const ComplianceType | compliance,
|  | char * | name,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType QueryMagickColor | ( | const char * | name,
|  | MagickPixelPacket * | color,
|  | ExceptionInfo * | exception |
| ) |  |  |

MagickExport MagickBooleanType QueryMagickColorname | ( | const Image * | image,
|  | const MagickPixelPacket * | color,
|  | const ComplianceType | compliance,
|  | const MagickBooleanType | hex,
|  | char * | name,
|  | ExceptionInfo * | exception |
| ) |  |  |

static void UniqueColorsToImage | ( | Image * | image,
|  | CubeInfo * | cube_info,
|  | const NodeInfo * | node_info,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

MagickExport Image* UniqueImageColors | ( | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  |

## Variable Documentation

LinkedListInfo* color_list = (LinkedListInfo *) NULL`[static]`

SemaphoreInfo* color_semaphore = (SemaphoreInfo *) NULL`[static]`

const char* ColorMap`[static]`

volatile MagickBooleanType instantiate_color = MagickFalse`[static]`