ccdemos/textures.cc
branchpyrit
changeset 60 a23b5089b9c3
parent 48 a4913301c626
child 72 7c3f38dff082
equal deleted inserted replaced
59:64e456ab823d 60:a23b5089b9c3
   283 
   283 
   284 		struct image *img;
   284 		struct image *img;
   285 		new_image(&img, w, h, 3);
   285 		new_image(&img, w, h, 3);
   286 
   286 
   287 		Float *fd = fdata;
   287 		Float *fd = fdata;
   288 		for (char *cd = img->data; cd != img->data + w*h*3; cd++, fd++) {
   288 		for (unsigned char *cd = img->data; cd != img->data + w*h*3; cd++, fd++) {
   289 			if (*fd > 1.0)
   289 			if (*fd > 1.0)
   290 				*cd = 255;
   290 				*cd = 255;
   291 			else
   291 			else
   292 				*cd = (unsigned char)(*fd * 255.0);
   292 				*cd = (unsigned char)(*fd * 255.0);
   293 		}
   293 		}