openmp/heat/common/pngwriter.c
void cmap(double value, const double scaling, const double offset,
          pixel_t *pix)
{
    int ival;

    ival = (int)(value * scaling + offset);
    if (ival < 0) {             /* Colder than colorscale, substitute blue */
        pix->red = 0;
        pix->green = 0;
        pix->blue = 255;
    } else if (ival > 255) {
        pix->red = 255;         /* Hotter than colormap, substitute red */
        pix->green = 0;
        pix->blue = 0;
    } else {
        pix->red = heat_colormap[ival][0];
        pix->green = heat_colormap[ival][1];
        pix->blue = heat_colormap[ival][2];
    }
}
/*
 * This routine sets the RGB values for the pixel_t structure using
 * the colormap data heat_colormap. If the value is outside the
 * acceptable png values 0, 255 blue or red color is used instead.
 */
This routine sets the RGB values for the pixel_t structure using
the colormap data heat_colormap. If the value is outside the
acceptable png values 0, 255 blue or red color is used instead.
This routine sets the RGB values for the pixel_t structure using the colormap data heat_colormap . If the value is outside the acceptable png values 0 255 blue or red color is used instead .
void cmap(double value, const double scaling, const double offset,
          pixel_t *pix)
{
    int ival;
    ival = (int)(value * scaling + offset);
    if (ival < 0) {             
        pix->red = 0;
        pix->green = 0;
        pix->blue = 255;
    } else if (ival > 255) {
        pix->red = 255;         
        pix->green = 0;
        pix->blue = 0;
    } else {
        pix->red = heat_colormap[ival][0];
        pix->green = heat_colormap[ival][1];
        pix->blue = heat_colormap[ival][2];
    }
}
void cmap ( double value , const double scaling , const double offset , pixel_t * pix ) { int ival ; ival = ( int ) ( value * scaling + offset ) ; if ( ival < 0 ) { pix -> red = 0 ; pix -> green = 0 ; pix -> blue = 255 ; } else if ( ival > 255 ) { pix -> red = 255 ; pix -> green = 0 ; pix -> blue = 0 ; } else { pix -> red = heat_colormap [ ival ] [ 0 ] ; pix -> green = heat_colormap [ ival ] [ 1 ] ; pix -> blue = heat_colormap [ ival ] [ 2 ] ; } }
This routine sets the RGB values for the pixel_t structure using
 the colormap data heat_colormap.
This routine sets the RGB values for the pixel_t structure using the colormap data heat_colormap .
/* Colder than colorscale, substitute blue */ /* Hotter than colormap, substitute red */