Parcourir la source

* Renamed cucul_clear() to cucul_clear_canvas() and added an argument to

choose the background colour.
tags/v0.99.beta14
Sam Hocevar sam il y a 18 ans
Parent
révision
a4ac581b6f
11 fichiers modifiés avec 20 ajouts et 17 suppressions
  1. +2
    -2
      cpp/cucul++.cpp
  2. +1
    -1
      cpp/cucul++.h
  3. +6
    -3
      cucul/canvas.c
  4. +1
    -1
      cucul/cucul.h
  5. +1
    -1
      src/cacaview.c
  6. +1
    -1
      src/img2irc.c
  7. +1
    -1
      test/colors.c
  8. +4
    -4
      test/demo.c
  9. +1
    -1
      test/event.c
  10. +1
    -1
      test/gamma.c
  11. +1
    -1
      test/spritedit.c

+ 2
- 2
cpp/cucul++.cpp Voir le fichier

@@ -89,9 +89,9 @@ void Cucul::printf ( int x , int y , char const * format,...)

}

void Cucul::clear ()
void Cucul::clear ( unsigned char bg )
{
cucul_clear(cv);
cucul_clear_canvas(cv, bg);
}

void Cucul::blit ( int x, int y, Cucul* c1, Cucul* c2)


+ 1
- 1
cpp/cucul++.h Voir le fichier

@@ -67,7 +67,7 @@ class Cucul {
void printf ( int x , int y , char const * format,...);
void putchar (int x, int y, char ch);
void putstr (int x, int y, char *str);
void clear ();
void clear (unsigned char bg);
void blit ( int, int, Cucul* c1, Cucul* c2);
void invert ();
void flip ();


+ 6
- 3
cucul/canvas.c Voir le fichier

@@ -154,15 +154,18 @@ void cucul_printf(cucul_canvas_t *cv, int x, int y, char const *format, ...)

/** \brief Clear the canvas.
*
* This function clears the canvas using a black background.
* This function clears the canvas using the given background colour.
*
* \param cv The canvas to clear.
* \param bg The background colour to use.
*/
void cucul_clear(cucul_canvas_t *cv)
void cucul_clear_canvas(cucul_canvas_t *cv, unsigned char bg)
{
uint16_t oldfg = cv->fgcolor;
uint16_t oldbg = cv->bgcolor;
int y = cv->height;

cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
cucul_set_color(cv, CUCUL_COLOR_DEFAULT, bg);

/* We could use SLsmg_cls() etc., but drawing empty lines is much faster */
while(y--)


+ 1
- 1
cucul/cucul.h Voir le fichier

@@ -104,7 +104,7 @@ char const *cucul_get_color_name(unsigned int);
void cucul_putchar(cucul_canvas_t *, int, int, char);
void cucul_putstr(cucul_canvas_t *, int, int, char const *);
void cucul_printf(cucul_canvas_t *, int, int, char const *, ...);
void cucul_clear(cucul_canvas_t *);
void cucul_clear_canvas(cucul_canvas_t *, unsigned char);
void cucul_blit(cucul_canvas_t *, int, int, cucul_canvas_t const *, cucul_canvas_t const *);
/* @} */



+ 1
- 1
src/cacaview.c Voir le fichier

@@ -321,7 +321,7 @@ int main(int argc, char **argv)
free(buffer);
}

cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);

if(!items)
{


+ 1
- 1
src/img2irc.c Voir le fichier

@@ -53,7 +53,7 @@ int main(int argc, char **argv)
lines = cols * i->h * 6 / i->w / 10;

cucul_set_canvas_size(cv, cols, lines);
cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_TRANSPARENT);
cucul_dither_bitmap(cv, 0, 0, cols - 1, lines - 1, i->dither, i->pixels);

unload_image(i);


+ 1
- 1
test/colors.c Voir le fichier

@@ -35,7 +35,7 @@ int main(int argc, char **argv)
if(!dp)
return 1;

cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
for(i = 0; i < 16; i++)
{
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);


+ 4
- 4
test/demo.c Voir le fichier

@@ -142,7 +142,7 @@ int main(int argc, char **argv)
}

if(demo)
cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
}
else if(ev.type & CACA_EVENT_MOUSE_MOTION)
{
@@ -196,7 +196,7 @@ static void display_menu(void)
int xo = cucul_get_canvas_width(cv) - 2;
int yo = cucul_get_canvas_height(cv) - 2;

cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
cucul_draw_thin_box(cv, 1, 1, xo, yo);

@@ -236,7 +236,7 @@ static void demo_all(void)

i++;

cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);

/* Draw the sun */
cucul_set_color(cv, CUCUL_COLOR_YELLOW, CUCUL_COLOR_BLACK);
@@ -349,7 +349,7 @@ static void demo_color(void)
int i, j;
char buf[BUFSIZ];

cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
for(i = 0; i < 16; i++)
{
sprintf(buf, "'%c': %i (%s)", 'a' + i, i, cucul_get_color_name(i));


+ 1
- 1
test/event.c Voir le fichier

@@ -81,7 +81,7 @@ int main(int argc, char **argv)
}
while(ret);

cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);

/* Print current event */
cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE);


+ 1
- 1
test/gamma.c Voir le fichier

@@ -90,7 +90,7 @@ int main(void)
cucul_get_canvas_height(cw) - 1, right, buffer);

/* Draw something on the mask */
cucul_clear(mask);
cucul_clear_canvas(mask, CUCUL_COLOR_BLACK);
cucul_set_color(mask, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE);
cucul_fill_ellipse(mask, (1.0 + sin(0.05 * (float)x))
* 0.5 * cucul_get_canvas_width(mask),


+ 1
- 1
test/spritedit.c Voir le fichier

@@ -100,7 +100,7 @@ int main(int argc, char **argv)
}


cucul_clear(cv);
cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);

cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
cucul_draw_thin_box(cv, 0, 0, cucul_get_canvas_width(cv) - 1,


Chargement…
Annuler
Enregistrer