From 03acdd75e0c75b78bdf5c2c23bcf6c8cf40cb459 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Mar 2010 00:25:52 +0000 Subject: [#21660] improved UV test grid from shuvro sarker (shuvro) Added text to the patch and made other minor tweaks. moved image generation functions into their own file. --- source/blender/blenkernel/intern/image_gen.c | 360 +++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 source/blender/blenkernel/intern/image_gen.c (limited to 'source/blender/blenkernel/intern/image_gen.c') diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c new file mode 100644 index 00000000000..e11ddfd59fa --- /dev/null +++ b/source/blender/blenkernel/intern/image_gen.c @@ -0,0 +1,360 @@ +/* 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 ***** + */ + +#include +#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; + } + } + } + + /* 2nd pass, colored + */ + for(y= 0; y