ascmap.h File Reference

Go to the source code of this file.

Classes

struct  ASMappedColor
struct  ASSortedColorBucket
struct  ASSortedColorHash
struct  ASColormapEntry
struct  ASColormap

Defines

#define MAKE_INDEXED_COLOR3(red, green, blue)   ((((green&0x200)|(blue&0x100)|(red&0x80))<<14))
#define MAKE_INDEXED_COLOR6(red, green, blue)
#define MAKE_INDEXED_COLOR9(red, green, blue)
#define MAKE_INDEXED_COLOR12(red, green, blue)
#define MAKE_INDEXED_COLOR15(red, green, blue)
#define MAKE_INDEXED_COLOR18(red, green, blue)
#define MAKE_INDEXED_COLOR21(red, green, blue)
#define MAKE_INDEXED_COLOR24(red, green, blue)
#define INDEX_SHIFT_RED(r)   (r)
#define INDEX_SHIFT_GREEN(g)   ((g)<<2)
#define INDEX_SHIFT_BLUE(b)   ((b)<<1)
#define INDEX_UNSHIFT_RED(r)   (r)
#define INDEX_UNSHIFT_GREEN(g)   ((g)>>2)
#define INDEX_UNSHIFT_BLUE(b)   ((b)>>1)
#define INDEX_UNESHIFT_RED(r, e)   ((r)>>(e))
#define INDEX_UNESHIFT_GREEN(g, e)   ((g)>>(2+(e)))
#define INDEX_UNESHIFT_BLUE(b, e)   ((b)>>(1+(e)))
#define SLOTS_OFFSET24   15
#define SLOTS_MASK24   0x1FF
#define SLOTS_OFFSET21   12
#define SLOTS_MASK21   0x1FF
#define MAKE_INDEXED_COLOR   MAKE_INDEXED_COLOR21
#define SLOTS_OFFSET   9
#define SLOTS_MASK   0xFFF
#define MAX_COLOR_BUCKETS   4096

Functions

void add_index_color (ASSortedColorHash *index, CARD32 indexed, unsigned int slot, CARD32 red, CARD32 green, CARD32 blue)
void destroy_colorhash (ASSortedColorHash *index, Bool reusable)
unsigned int add_colormap_items (ASSortedColorHash *index, unsigned int start, unsigned int stop, unsigned int quota, unsigned int base, ASColormapEntry *entries)
void fix_colorindex_shortcuts (ASSortedColorHash *index)
int get_color_index (ASSortedColorHash *index, CARD32 indexed, unsigned int slot)
ASColormapcolor_hash2colormap (ASColormap *cmap, unsigned int max_colors)
int * colormap_asimage (ASImage *im, ASColormap *cmap, unsigned int max_colors, unsigned int dither, int opaque_threshold)
void destroy_colormap (ASColormap *cmap, Bool reusable)


Define Documentation

#define INDEX_SHIFT_BLUE ( b   )     ((b)<<1)

Definition at line 100 of file ascmap.h.

Referenced by colormap_asimage(), TASImage::Vectorize(), and vectorize_asimage().

#define INDEX_SHIFT_GREEN ( g   )     ((g)<<2)

Definition at line 99 of file ascmap.h.

Referenced by colormap_asimage(), TASImage::Vectorize(), and vectorize_asimage().

#define INDEX_SHIFT_RED ( r   )     (r)

Definition at line 98 of file ascmap.h.

Referenced by colormap_asimage(), TASImage::Vectorize(), and vectorize_asimage().

#define INDEX_UNESHIFT_BLUE ( b,
 )     ((b)>>(1+(e)))

Definition at line 108 of file ascmap.h.

Referenced by colormap_asimage().

#define INDEX_UNESHIFT_GREEN ( g,
 )     ((g)>>(2+(e)))

Definition at line 107 of file ascmap.h.

Referenced by colormap_asimage().

#define INDEX_UNESHIFT_RED ( r,
 )     ((r)>>(e))

Definition at line 106 of file ascmap.h.

Referenced by colormap_asimage().

#define INDEX_UNSHIFT_BLUE ( b   )     ((b)>>1)

Definition at line 104 of file ascmap.h.

Referenced by new_mapped_color().

#define INDEX_UNSHIFT_GREEN ( g   )     ((g)>>2)

Definition at line 103 of file ascmap.h.

Referenced by new_mapped_color().

#define INDEX_UNSHIFT_RED ( r   )     (r)

Definition at line 102 of file ascmap.h.

Referenced by new_mapped_color().

#define MAKE_INDEXED_COLOR   MAKE_INDEXED_COLOR21

Definition at line 116 of file ascmap.h.

#define MAKE_INDEXED_COLOR12 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR9(red,green,blue)| \
                                        (((green&0x40) |(blue&0x20) |(red&0x10))<<8 ))

Definition at line 78 of file ascmap.h.

Referenced by colormap_asimage().

#define MAKE_INDEXED_COLOR15 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR12(red,green,blue)| \
                                        (((green&0x20) |(blue&0x10) |(red&0x08))<<6 ))

Definition at line 82 of file ascmap.h.

Referenced by colormap_asimage().

#define MAKE_INDEXED_COLOR18 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR15(red,green,blue)| \
                                        (((green&0x10) |(blue&0x08) |(red&0x04))<<4 ))

Definition at line 86 of file ascmap.h.

Referenced by colormap_asimage().

#define MAKE_INDEXED_COLOR21 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR18(red,green,blue)| \
                                        (((green&0x08) |(blue&0x04) |(red&0x02))<<2 ))

Definition at line 90 of file ascmap.h.

Referenced by colormap_asimage().

#define MAKE_INDEXED_COLOR24 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR21(red,green,blue)| \
                                         ((green&0x04) |(blue&0x02) |(red&0x01)))

Definition at line 94 of file ascmap.h.

Referenced by colormap_asimage(), TASImage::Vectorize(), and vectorize_asimage().

#define MAKE_INDEXED_COLOR3 ( red,
green,
blue   )     ((((green&0x200)|(blue&0x100)|(red&0x80))<<14))

Definition at line 67 of file ascmap.h.

Referenced by colormap_asimage().

#define MAKE_INDEXED_COLOR6 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR3(red,green,blue)| \
                            (((green&0x100)|(blue&0x80) |(red&0x40))<<12))

Definition at line 70 of file ascmap.h.

Referenced by colormap_asimage().

#define MAKE_INDEXED_COLOR9 ( red,
green,
blue   ) 

Value:

(MAKE_INDEXED_COLOR6(red,green,blue)| \
                            (((green&0x80) |(blue&0x40) |(red&0x20))<<10))

Definition at line 74 of file ascmap.h.

Referenced by colormap_asimage().

#define MAX_COLOR_BUCKETS   4096

Definition at line 119 of file ascmap.h.

Referenced by colormap_asimage().

#define SLOTS_MASK   0xFFF

Definition at line 118 of file ascmap.h.

#define SLOTS_MASK21   0x1FF

Definition at line 114 of file ascmap.h.

#define SLOTS_MASK24   0x1FF

Definition at line 112 of file ascmap.h.

#define SLOTS_OFFSET   9

Definition at line 117 of file ascmap.h.

#define SLOTS_OFFSET21   12

Definition at line 113 of file ascmap.h.

#define SLOTS_OFFSET24   15

Definition at line 111 of file ascmap.h.


Function Documentation

unsigned int add_colormap_items ( ASSortedColorHash index,
unsigned int  start,
unsigned int  stop,
unsigned int  quota,
unsigned int  base,
ASColormapEntry entries 
)

Definition at line 242 of file ascmap.c.

References add_colormap_item(), ASMappedColor::count, entries, NULL, and total.

Referenced by color_hash2colormap().

void add_index_color ( ASSortedColorHash index,
CARD32  indexed,
unsigned int  slot,
CARD32  red,
CARD32  green,
CARD32  blue 
)

Definition at line 86 of file ascmap.c.

References ASSortedColorBucket::count, ASMappedColor::count, ASSortedColorBucket::head, ASMappedColor::indexed, new_mapped_color(), ASMappedColor::next, NULL, and ASSortedColorBucket::tail.

Referenced by colormap_asimage().

ASColormap* color_hash2colormap ( ASColormap cmap,
unsigned int  max_colors 
)

Definition at line 309 of file ascmap.c.

References add_colormap_items(), ASColormap::count, ASColormap::entries, ASColormap::hash, LOCAL_DEBUG_OUT, MIN, NULL, safemalloc, and total.

Referenced by colormap_asimage().

int* colormap_asimage ( ASImage im,
ASColormap cmap,
unsigned int  max_colors,
unsigned int  dither,
int  opaque_threshold 
)

Definition at line 407 of file ascmap.c.

References a, add_index_color(), ASScanline::alpha, ASFLAGS_EVERYTHING, b, blue, ASScanline::blue, ASSortedColorHash::buckets, ASSortedColorHash::buckets_num, ASImageDecoder::buffer, color_hash2colormap(), ASColormap::count, ASImageDecoder::decode_image_scanline, g, get_color_index(), green, ASScanline::green, ASColormap::has_opaque, ASColormap::hash, ASImage::height, INDEX_SHIFT_BLUE, INDEX_SHIFT_GREEN, INDEX_SHIFT_RED, INDEX_UNESHIFT_BLUE, INDEX_UNESHIFT_GREEN, INDEX_UNESHIFT_RED, LOCAL_DEBUG_OUT, MAKE_INDEXED_COLOR12, MAKE_INDEXED_COLOR15, MAKE_INDEXED_COLOR18, MAKE_INDEXED_COLOR21, MAKE_INDEXED_COLOR24, MAKE_INDEXED_COLOR3, MAKE_INDEXED_COLOR6, MAKE_INDEXED_COLOR9, MAX_COLOR_BUCKETS, NULL, print_asimage(), ASScanline::red, red, safecalloc, safemalloc, SCL_DO_ALL, SHOW_TIME, start_image_decoding(), START_TIME, stop_image_decoding(), True, ASImage::width, x, x07, and y.

Referenced by ASImage2gif(), ASImage2xpm(), ASImage2xpmRawBuff(), TASImage::Vectorize(), and vectorize_asimage().

void destroy_colorhash ( ASSortedColorHash index,
Bool  reusable 
)

Definition at line 133 of file ascmap.c.

References free(), and i.

Referenced by destroy_colormap().

void destroy_colormap ( ASColormap cmap,
Bool  reusable 
)

Definition at line 357 of file ascmap.c.

References destroy_colorhash(), ASColormap::entries, False, free(), and ASColormap::hash.

Referenced by ASImage2gif(), ASImage2xpm(), ASImage2xpmRawBuff(), TASImage::Vectorize(), and vectorize_asimage().

void fix_colorindex_shortcuts ( ASSortedColorHash index  ) 

Definition at line 180 of file ascmap.c.

References free(), and NULL.

int get_color_index ( ASSortedColorHash index,
CARD32  indexed,
unsigned int  slot 
)

Definition at line 371 of file ascmap.c.

References ASMappedColor::cmap_idx, ASSortedColorBucket::head, ASMappedColor::indexed, LOCAL_DEBUG_OUT, ASMappedColor::next, NULL, and ASSortedColorBucket::tail.

Referenced by colormap_asimage().


Generated on Tue Jul 5 15:57:44 2011 for ROOT_528-00b_version by  doxygen 1.5.1