Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

RageSurfaceUtils_Palettize.cpp File Reference

#include "global.h"
#include "RageSurfaceUtils_Palettize.h"
#include "RageSurface.h"
#include "RageSurfaceUtils.h"
#include "RageUtil.h"

Classes

struct  acolorhist_item
struct  acolorhist_list_item
struct  acolorhash_hash
struct  error_t
struct  box

Defines

#define PAM_GETR(p)   ((p)[0])
#define PAM_GETG(p)   ((p)[1])
#define PAM_GETB(p)   ((p)[2])
#define PAM_GETA(p)   ((p)[3])
#define PAM_ASSIGN(p, red, grn, blu, alf)   do { (p)[0] = (red); (p)[1] = (grn); (p)[2] = (blu); (p)[3] = (alf); } while (0)
#define PAM_EQUAL(p, q)   ((p)[0] == (q)[0] && (p)[1] == (q)[1] && (p)[2] == (q)[2] && (p)[3] == (q)[3])
#define PAM_DEPTH(newp, p, oldmaxval, newmaxval)
#define MAXCOLORS   32767
#define FS_SCALE   1024 /* Floyd-Steinberg scaling factor */
#define REP_AVERAGE_PIXELS
#define HASH_SIZE   20023
#define pam_hashapixel(p)

Typedefs

typedef uint8_t pixval
typedef uint8_t apixel [4]
typedef acolorhist_list_itemacolorhist_list
typedef boxbox_vector

Functions

acolorhist_itemmediancut (acolorhist_item *achv, int colors, int sum, int maxval, int newcolors)
bool redcompare (const acolorhist_item &ch1, const acolorhist_item &ch2)
bool greencompare (const acolorhist_item &ch1, const acolorhist_item &ch2)
bool bluecompare (const acolorhist_item &ch1, const acolorhist_item &ch2)
bool alphacompare (const acolorhist_item &ch1, const acolorhist_item &ch2)
acolorhist_itempam_computeacolorhist (const RageSurface *src, int maxacolors, int *acolorsP)
void pam_addtoacolorhash (acolorhash_hash &acht, const uint8_t acolorP[4], int value)
int pam_lookupacolor (const acolorhash_hash &acht, const uint8_t acolorP[4])
void pam_freeacolorhist (acolorhist_item *achv)
bool CompareBySumDescending (const box &b1, const box &b2)
bool pam_computeacolorhash (const RageSurface *src, int maxacolors, int *acolorsP, acolorhash_hash &hash)
acolorhist_itempam_acolorhashtoacolorhist (const acolorhash_hash &acht, int maxacolors)

Define Documentation

#define FS_SCALE   1024 /* Floyd-Steinberg scaling factor */
 

#define HASH_SIZE   20023
 

#define MAXCOLORS   32767
 

#define PAM_ASSIGN p,
red,
grn,
blu,
alf   )     do { (p)[0] = (red); (p)[1] = (grn); (p)[2] = (blu); (p)[3] = (alf); } while (0)
 

#define PAM_DEPTH newp,
p,
oldmaxval,
newmaxval   ) 
 

Value:

PAM_ASSIGN( (newp), \ ( (uint8_t) PAM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ ( (uint8_t) PAM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ ( (uint8_t) PAM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ ( (uint8_t) PAM_GETA(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) )

#define PAM_EQUAL p,
 )     ((p)[0] == (q)[0] && (p)[1] == (q)[1] && (p)[2] == (q)[2] && (p)[3] == (q)[3])
 

#define PAM_GETA  )     ((p)[3])
 

#define PAM_GETB  )     ((p)[2])
 

#define PAM_GETG  )     ((p)[1])
 

#define PAM_GETR  )     ((p)[0])
 

#define pam_hashapixel  ) 
 

Value:

( ( ( (long) PAM_GETR(p) * 33023 + \ (long) PAM_GETG(p) * 30013 + \ (long) PAM_GETB(p) * 27011 + \ (long) PAM_GETA(p) * 24007 ) \ & 0x7fffffff ) % HASH_SIZE )

#define REP_AVERAGE_PIXELS
 


Typedef Documentation

typedef struct acolorhist_list_item* acolorhist_list
 

typedef uint8_t apixel[4]
 

typedef struct box* box_vector
 

typedef uint8_t pixval
 


Function Documentation

bool alphacompare const acolorhist_item ch1,
const acolorhist_item ch2
[static]
 

bool bluecompare const acolorhist_item ch1,
const acolorhist_item ch2
[static]
 

bool CompareBySumDescending const box b1,
const box b2
[static]
 

bool greencompare const acolorhist_item ch1,
const acolorhist_item ch2
[static]
 

acolorhist_item * mediancut acolorhist_item achv,
int  colors,
int  sum,
int  maxval,
int  newcolors
[static]
 

acolorhist_item* pam_acolorhashtoacolorhist const acolorhash_hash acht,
int  maxacolors
[static]
 

void pam_addtoacolorhash acolorhash_hash acht,
const uint8_t  acolorP[4],
int  value
[static]
 

bool pam_computeacolorhash const RageSurface src,
int  maxacolors,
int acolorsP,
acolorhash_hash hash
[static]
 

acolorhist_item * pam_computeacolorhist const RageSurface src,
int  maxacolors,
int acolorsP
[static]
 

void pam_freeacolorhist acolorhist_item achv  )  [static]
 

int pam_lookupacolor const acolorhash_hash acht,
const uint8_t  acolorP[4]
[static]
 

bool redcompare const acolorhist_item ch1,
const acolorhist_item ch2
[static]
 


Generated on Thu Jan 27 20:57:58 2005 for StepMania by doxygen 1.3.7