ip_lib.c
/* Converte una ip_mat in una bitmap*/
Converte una ip_mat in una bitmap
Converte una ip_mat in una bitmap
Bitmap *ip_mat_to_bitmap(ip_mat *t)
{
    not_null_ip_mat(t);
    {
        Bitmap *b = bm_create(t->w, t->h);
        unsigned int i, j;
        for (i = 0; i < t->h; i++)
        {
            for (j = 0; j < t->w; j++)
            {
                bm_set_pixel(b, j, i, (unsigned char)restrict_val(get_val(t, i, j, 0), MIN_PIXEL_FLOAT, MAX_PIXEL_FLOAT),
                             (unsigned char)restrict_val(get_val(t, i, j, 1), MIN_PIXEL_FLOAT, MAX_PIXEL_FLOAT),
                             (unsigned char)restrict_val(get_val(t, i, j, 2), MIN_PIXEL_FLOAT, MAX_PIXEL_FLOAT));
            }
        }
        return b;
    }
}
Bitmap * ip_mat_to_bitmap ( ip_mat * t ) { not_null_ip_mat ( t ) ; { Bitmap * b = bm_create ( t -> w , t -> h ) ; unsigned int i , j ; for ( i = 0 ; i < t -> h ; i ++ ) { for ( j = 0 ; j < t -> w ; j ++ ) { bm_set_pixel ( b , j , i , ( unsigned char ) restrict_val ( get_val ( t , i , j , 0 ) , MIN_PIXEL_FLOAT , MAX_PIXEL_FLOAT ) , ( unsigned char ) restrict_val ( get_val ( t , i , j , 1 ) , MIN_PIXEL_FLOAT , MAX_PIXEL_FLOAT ) , ( unsigned char ) restrict_val ( get_val ( t , i , j , 2 ) , MIN_PIXEL_FLOAT , MAX_PIXEL_FLOAT ) ) ; } } return b ; } }
Converte una ip_mat in una bitmap
Converte una ip_mat in una bitmap