Ignore:
Timestamp:
Mar 11, 2008, 3:56:27 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • getpixel/setpixel functions use doubles instead of ints for now.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/pixels.c

    r2247 r2260  
    2626#include <math.h>
    2727
     28#include "pipi.h"
    2829#include "pipi_internals.h"
    29 #include "pipi.h"
    3030
    31 #define C2I(p) ((int)255.999*pow(((double)p)/255., 2.2))
    32 #define I2C(p) ((int)255.999*pow(((double)p)/255., 1./2.2))
     31#define C2I(p) (pow(((double)p)/255., 2.2))
     32#define I2C(p) ((int)255.999*pow(((double)p), 1./2.2))
    3333
    3434int pipi_getgray(pipi_image_t const *img, int x, int y, int *g)
     
    4646
    4747int pipi_getpixel(pipi_image_t const *img,
    48                   int x, int y, int *r, int *g, int *b)
     48                  int x, int y, double *r, double *g, double *b)
    4949{
    5050    uint8_t *pixel;
     
    5252    if(x < 0 || y < 0 || x >= img->width || y >= img->height)
    5353    {
    54         *r = 255;
    55         *g = 255;
    56         *b = 255;
     54        *r = *g = *b = 1.;
    5755        return -1;
    5856    }
     
    6765}
    6866
    69 int pipi_setpixel(pipi_image_t *img, int x, int y, int r, int g, int b)
     67int pipi_setpixel(pipi_image_t *img, int x, int y, double r, double g, double b)
    7068{
    7169    uint8_t *pixel;
Note: See TracChangeset for help on using the changeset viewer.