Changeset 2602


Ignore:
Timestamp:
07/29/08 01:01:17 (5 years ago)
Author:
sam
Message:
  • pixels.c: do not return a white pixel when calling getpixel() outside the image boundaries; instead, return the closest pixel in the image.
File:
1 edited

Legend:

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

    r2260 r2602  
    5050    uint8_t *pixel; 
    5151 
    52     if(x < 0 || y < 0 || x >= img->width || y >= img->height) 
    53     { 
    54         *r = *g = *b = 1.; 
    55         return -1; 
    56     } 
     52    if(x < 0) x = 0; 
     53    else if(x >= img->width) x = img->width - 1; 
     54 
     55    if(y < 0) y = 0; 
     56    else if(y >= img->height) y = img->height - 1; 
    5757 
    5858    pixel = img->pixels + y * img->pitch + x * img->channels; 
Note: See TracChangeset for help on using the changeset viewer.