diff --git a/doc/migrating.dox b/doc/migrating.dox index fe155b8..27253e1 100644 --- a/doc/migrating.dox +++ b/doc/migrating.dox @@ -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; } diff --git a/doc/tutorial.dox b/doc/tutorial.dox index 8f04c46..74a70f2 100644 --- a/doc/tutorial.dox +++ b/doc/tutorial.dox @@ -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; } diff --git a/test/hsv.c b/test/hsv.c index 74263d9..435ec04 100644 --- a/test/hsv.c +++ b/test/hsv.c @@ -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; }