Browse Source

* Switch to caca_create_display(NULL) in a few places to document the

behaviour.
tags/v0.99.beta14
Sam Hocevar sam 17 years ago
parent
commit
7e49e3e6fb
3 changed files with 8 additions and 16 deletions
  1. +1
    -2
      doc/migrating.dox
  2. +2
    -4
      doc/tutorial.dox
  3. +5
    -10
      test/hsv.c

+ 1
- 2
doc/migrating.dox View File

@@ -48,8 +48,8 @@ int main(void)
/* Initialise libcaca */
cucul_canvas_t *cv;
caca_display_t *dp;
cv = cucul_create_canvas(0, 0);
dp = caca_create_display(cv);
cv = caca_get_canvas(dp);
/* Set window title */
caca_set_display_title(dp, "Window");
/* Choose drawing colours */
@@ -64,7 +64,6 @@ int main(void)
NULL, -1);
/* Clean up library */
caca_free_display(dp);
cucul_free_canvas(cv);

return 0;
}


+ 2
- 4
doc/tutorial.dox View File

@@ -20,10 +20,9 @@ int main(void)
{
/* Initialise libcaca */
cucul_canvas_t *cv; caca_display_t *dp; caca_event_t ev;
cv = cucul_create_canvas(0, 0);
if(!cv) return 1;
dp = caca_create_display(cv);
dp = caca_create_display(NULL);
if(!dp) return 1;
cv = caca_get_canvas(dp);
/* Set window title */
caca_set_display_title(dp, "Hello!");
/* Choose drawing colours */
@@ -36,7 +35,6 @@ int main(void)
caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
/* Clean up library */
caca_free_display(dp);
cucul_free_canvas(cv);

return 0;
}


+ 5
- 10
test/hsv.c View File

@@ -29,25 +29,21 @@ uint32_t buffer[256*256];

int main(int argc, char *argv[])
{
cucul_canvas_t *cv;
caca_display_t *dp;
cucul_canvas_t *cv;

cucul_dither_t *dither;
int x, y;

cv = cucul_create_canvas(0, 0);
if(cv == NULL)
{
printf("Can't created canvas\n");
return -1;
}
dp = caca_create_display(cv);
dp = caca_create_display(NULL);
if(dp == NULL)
{
printf("Can't create display\n");
return -1;
}

cv = caca_get_canvas(dp);

for(y = 0; y < 256; y++)
for(x = 0; x < 256; x++)
{
@@ -56,7 +52,7 @@ int main(int argc, char *argv[])

dither = cucul_create_dither(32, 256, 256, 4 * 256,
0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv),
cucul_dither_bitmap(caca_get_canvas(dp), 0, 0, cucul_get_canvas_width(cv),
cucul_get_canvas_height(cv), dither, buffer);
cucul_free_dither(dither);

@@ -65,7 +61,6 @@ int main(int argc, char *argv[])
caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);

caca_free_display(dp);
cucul_free_canvas(cv);

return 0;
}


Loading…
Cancel
Save