/* image_gen.c * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Contributor(s): Matt Ebb, Campbell Barton, Shuvro Sarker * * ***** END GPL LICENSE BLOCK ***** */ /** \file blender/blenkernel/intern/image_gen.c * \ingroup bke */ #include #include #include "BKE_image.h" #include "BLI_math_color.h" #include "BLF_api.h" void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, float color[4]) { int x, y; /* blank image */ if(rect_float) { for(y= 0; y 0) { rect_float[0]= rect_float[1]= rect_float[2]= 0.25f; rect_float[3]= 1.0f; } else { rect_float[0]= rect_float[1]= rect_float[2]= 0.58f; rect_float[3]= 1.0f; } rect_float+= 4; } else { if (dark > 0) { rect[0]= rect[1]= rect[2]= 64; rect[3]= 255; } else { rect[0]= rect[1]= rect[2]= 150; rect[3]= 255; } rect+= 4; } } } rect= rect_orig; rect_float= rect_float_orig; /* 2nd pass, colored + */ for(y= 0; y