Преглед на файлове

* cucul_get_dither_brightness() is no longer a stub.

* Implemented missing cucul_get_dither_contrast().
tags/v0.99.beta14
Sam Hocevar sam преди 17 години
родител
ревизия
49f230f863
променени са 1 файла, в които са добавени 31 реда и са изтрити 7 реда
  1. +31
    -7
      cucul/dither.c

+ 31
- 7
cucul/dither.c Целия файл

@@ -125,7 +125,9 @@ struct cucul_dither
int rleft, gleft, bleft, aleft; int rleft, gleft, bleft, aleft;
void (*get_hsv)(cucul_dither_t *, char *, int, int); void (*get_hsv)(cucul_dither_t *, char *, int, int);
int red[256], green[256], blue[256], alpha[256]; int red[256], green[256], blue[256], alpha[256];
float gamma;

/* Colour features */
float gamma, brightness, contrast;
int gammatab[4097]; int gammatab[4097];


/* Bitmap features */ /* Bitmap features */
@@ -324,14 +326,19 @@ cucul_dither_t *cucul_create_dither(unsigned int bpp, unsigned int w,
} }
} }


/* Default features */
d->invert = 0;
d->antialias = 1;

/* Default gamma value */ /* Default gamma value */
d->gamma = 1.0;
for(i = 0; i < 4096; i++) for(i = 0; i < 4096; i++)
d->gammatab[i] = i; d->gammatab[i] = i;


/* Default colour properties */
d->brightness = 1.0;
d->contrast = 1.0;

/* Default features */
d->invert = 0;
d->antialias = 1;

/* Default colour mode */ /* Default colour mode */
d->color_mode = COLOR_MODE_FULL16; d->color_mode = COLOR_MODE_FULL16;


@@ -415,6 +422,8 @@ int cucul_set_dither_palette(cucul_dither_t *d,
int cucul_set_dither_brightness(cucul_dither_t *d, float brightness) int cucul_set_dither_brightness(cucul_dither_t *d, float brightness)
{ {
/* FIXME */ /* FIXME */
d->brightness = brightness;

return 0; return 0;
} }


@@ -429,8 +438,7 @@ int cucul_set_dither_brightness(cucul_dither_t *d, float brightness)
*/ */
float cucul_get_dither_brightness(cucul_dither_t *d) float cucul_get_dither_brightness(cucul_dither_t *d)
{ {
/* FIXME */
return 0.0;
return d->brightness;
} }


/** \brief Set the gamma of a dither object. /** \brief Set the gamma of a dither object.
@@ -499,9 +507,25 @@ float cucul_get_dither_gamma(cucul_dither_t *d)
int cucul_set_dither_contrast(cucul_dither_t *d, float contrast) int cucul_set_dither_contrast(cucul_dither_t *d, float contrast)
{ {
/* FIXME */ /* FIXME */
d->contrast = contrast;

return 0; return 0;
} }


/** \brief Get the contrast of a dither object.
*
* Get the contrast of the given dither object.
*
* This function never fails.
*
* \param d Dither object.
* \return Contrast value.
*/
float cucul_get_dither_contrast(cucul_dither_t *d)
{
return d->contrast;
}

/** \brief Set dither antialiasing /** \brief Set dither antialiasing
* *
* Tell the renderer whether to antialias the dither. Antialiasing smoothens * Tell the renderer whether to antialias the dither. Antialiasing smoothens


Зареждане…
Отказ
Запис