Browse Source

* Renamed cucul_export() to cucul_export_memory(), paves the way for a

cucul_export_file() but I'm not sure yet this is a good idea.
  * Use the new import/export API in libcaca.
tags/v0.99.beta14
Sam Hocevar sam 18 years ago
parent
commit
391bc8b493
5 changed files with 18 additions and 19 deletions
  1. +5
    -7
      caca/caca0.c
  2. +8
    -7
      caca/driver_raw.c
  3. +1
    -1
      cucul/cucul.h
  4. +3
    -3
      cucul/export.c
  5. +1
    -1
      cucul/legacy.c

+ 5
- 7
caca/caca0.c View File

@@ -213,16 +213,14 @@ char const *__caca0_get_feature_name(int feature)

cucul_canvas_t *__caca0_load_sprite(char const *file)
{
cucul_buffer_t *buf;
cucul_canvas_t *cv;

buf = cucul_load_file(file);
if(!buf)
return NULL;
cv = cucul_import_canvas(buf, "");
cucul_free_buffer(buf);
if(!cv)
cv = cucul_create_canvas(0, 0);;
if(cucul_import_file(cv, file, "") < 0)
{
cucul_free_canvas(cv);
return NULL;
}

return cv;
}


+ 8
- 7
caca/driver_raw.c View File

@@ -66,13 +66,14 @@ static unsigned int raw_get_display_height(caca_display_t *dp)

static void raw_display(caca_display_t *dp)
{
cucul_buffer_t *buffer;

buffer = cucul_export_canvas(dp->cv, "caca");
fwrite(cucul_get_buffer_data(buffer),
cucul_get_buffer_size(buffer), 1, stdout);
fflush(stdout);
cucul_free_buffer(buffer);
void *buffer;
unsigned long int len;

buffer = cucul_export_memory(dp->cv, "caca", &len);
if(!buffer)
return;
fwrite(buffer, len, 1, stdout);
free(buffer);
}

static void raw_handle_resize(caca_display_t *dp)


+ 1
- 1
cucul/cucul.h View File

@@ -220,7 +220,7 @@ long int cucul_import_memory(cucul_canvas_t *, unsigned char const *,
unsigned long int, char const *);
long int cucul_import_file(cucul_canvas_t *, char const *, char const *);
char const * const * cucul_get_import_list(void);
void *cucul_export(cucul_canvas_t *, char const *, unsigned long int *);
void *cucul_export_memory(cucul_canvas_t *, char const *, unsigned long int *);
char const * const * cucul_get_export_list(void);
/* @} */



+ 3
- 3
cucul/export.c View File

@@ -84,8 +84,8 @@ static void *export_tga(cucul_canvas_t *, unsigned long int *);
* allocated bytes will be written.
* \return A pointer to the exported memory area, or NULL in case of error.
*/
void *cucul_export(cucul_canvas_t *cv, char const *format,
unsigned long int *bytes)
void *cucul_export_memory(cucul_canvas_t *cv, char const *format,
unsigned long int *bytes)
{
if(!strcasecmp("caca", format))
return export_caca(cv, bytes);
@@ -127,7 +127,7 @@ void *cucul_export(cucul_canvas_t *cv, char const *format,
*
* Return a list of available export formats. The list is a NULL-terminated
* array of strings, interleaving a string containing the internal value for
* the export format, to be used with cucul_export_canvas(), and a string
* the export format, to be used with cucul_export_memory(), and a string
* containing the natural language description for that export format.
*
* This function never fails.


+ 1
- 1
cucul/legacy.c View File

@@ -80,7 +80,7 @@ cucul_buffer_t * cucul_export_canvas(cucul_canvas_t *cv, char const *format)
return NULL;
}

ex->data = cucul_export(cv, format, &ex->size);
ex->data = cucul_export_memory(cv, format, &ex->size);
if(!ex->data)
{
free(ex);


Loading…
Cancel
Save