コード例 #1
0
ファイル: dither.c プロジェクト: neuroradiology/libsixel
static int
test2(void)
{
    sixel_dither_t *dither = NULL;
    int colors;
    int nret = EXIT_FAILURE;

#if HAVE_DIAGNOSTIC_DEPRECATED_DECLARATIONS
#  pragma GCC diagnostic push
#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
    dither = sixel_dither_create(INT_MAX);
#if HAVE_DIAGNOSTIC_DEPRECATED_DECLARATIONS
#  pragma GCC diagnostic pop
#endif
    if (dither == NULL) {
        goto error;
    }
    sixel_dither_set_body_only(dither, 1);
    colors = sixel_dither_get_num_of_histogram_colors(dither);
    if (colors != -1) {
        goto error;
    }
    nret = EXIT_SUCCESS;

error:
    sixel_dither_unref(dither);
    return nret;
}
コード例 #2
0
ファイル: main.c プロジェクト: saitoha/libsixel
static SIXELSTATUS
output_sixel(unsigned char *pixbuf, int width, int height,
             int ncolors, int pixelformat)
{
    sixel_output_t *context;
    sixel_dither_t *dither;
    SIXELSTATUS status;

#if USE_OSMESA
    pixelformat = SIXEL_PIXELFORMAT_RGBA8888;
#endif
    context = sixel_output_create(sixel_write, stdout);
    dither = sixel_dither_create(ncolors);
    status = sixel_dither_initialize(dither, pixbuf,
                                     width, height,
                                     pixelformat,
                                     SIXEL_LARGE_AUTO,
                                     SIXEL_REP_AUTO,
                                     SIXEL_QUALITY_AUTO);
    if (SIXEL_FAILED(status))
        return status;
    status = sixel_encode(pixbuf, width, height,
                          pixelformat, dither, context);
    if (SIXEL_FAILED(status))
        return status;
    sixel_output_unref(context);
    sixel_dither_unref(dither);

    return status;
}
コード例 #3
0
ファイル: dither.c プロジェクト: neuroradiology/libsixel
static int
test1(void)
{
    sixel_dither_t *dither = NULL;
    int nret = EXIT_FAILURE;

#if HAVE_DIAGNOSTIC_DEPRECATED_DECLARATIONS
#  pragma GCC diagnostic push
#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
    dither = sixel_dither_create(0);
#if HAVE_DIAGNOSTIC_DEPRECATED_DECLARATIONS
#  pragma GCC diagnostic pop
#endif
    if (dither == NULL) {
        goto error;
    }
    sixel_dither_ref(dither);
    sixel_dither_unref(dither);
    nret = EXIT_SUCCESS;

error:
    sixel_dither_unref(dither);
    return nret;
}