Ignore:
Timestamp:
Jul 29, 2008, 1:01:29 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Big API reorganisation. Now libpipi can transparently convert between colour spaces for a given image. For instance, if pipi_gaussian_blur is applied to a 32-bpp image, it is automatically converted to gamma-corrected 32-bit floats beforehands, then converted back to normal.
  • TODO: clipping, regions of interest, more formats, getpixel macros...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/codec/imlib.c

    r2261 r2605  
    3838
    3939    img = (pipi_image_t *)malloc(sizeof(pipi_image_t));
     40    memset(img, 0, sizeof(pipi_image_t));
     41
    4042    imlib_context_set_image(priv);
    41     img->width = imlib_image_get_width();
    42     img->height = imlib_image_get_height();
    43     img->pitch = 4 * imlib_image_get_width();
    44     img->channels = 4;
    45     img->pixels = (char *)imlib_image_get_data();
    46     img->priv = (void *)priv;
     43    img->w = imlib_image_get_width();
     44    img->h = imlib_image_get_height();
     45
     46    img->p[PIPI_PIXELS_RGBA32].pixels = imlib_image_get_data();
     47    img->p[PIPI_PIXELS_RGBA32].w = imlib_image_get_width();
     48    img->p[PIPI_PIXELS_RGBA32].h = imlib_image_get_height();
     49    img->p[PIPI_PIXELS_RGBA32].pitch = 4 * imlib_image_get_width();
     50    img->last_modified = PIPI_PIXELS_RGBA32;
     51
     52    img->codec_priv = (void *)priv;
     53    img->codec_format = PIPI_PIXELS_RGBA32;
    4754
    4855    return img;
     
    5865
    5966    img = (pipi_image_t *)malloc(sizeof(pipi_image_t));
     67    memset(img, 0, sizeof(pipi_image_t));
     68
    6069    imlib_context_set_image(priv);
    61     img->width = imlib_image_get_width();
    62     img->height = imlib_image_get_height();
    63     img->pitch = 4 * imlib_image_get_width();
    64     img->channels = 4;
    65     img->pixels = (char *)imlib_image_get_data();
    66     img->priv = (void *)priv;
     70    img->w = imlib_image_get_width();
     71    img->h = imlib_image_get_height();
     72
     73    img->p[PIPI_PIXELS_RGBA32].pixels = imlib_image_get_data();
     74    img->p[PIPI_PIXELS_RGBA32].w = imlib_image_get_width();
     75    img->p[PIPI_PIXELS_RGBA32].h = imlib_image_get_height();
     76    img->p[PIPI_PIXELS_RGBA32].pitch = 4 * imlib_image_get_width();
     77    img->last_modified = PIPI_PIXELS_RGBA32;
     78
     79    img->codec_priv = (void *)priv;
     80    img->codec_format = PIPI_PIXELS_RGBA32;
    6781
    6882    return img;
     
    7185void pipi_free_imlib2(pipi_image_t *img)
    7286{
    73     imlib_context_set_image(img->priv);
     87    imlib_context_set_image(img->codec_priv);
    7488    imlib_free_image();
    7589
     
    7993void pipi_save_imlib2(pipi_image_t *img, const char *name)
    8094{
    81     imlib_context_set_image(img->priv);
     95    pipi_getpixels(img, img->codec_format);
     96    imlib_context_set_image(img->codec_priv);
    8297    imlib_save_image(name);
    8398}
Note: See TracChangeset for help on using the changeset viewer.