Example #1
0
static void checker_board_text(unsigned char *rect, float *rect_float, int width, int height, int step, int outline)
{
	int x, y;
	int pen_x, pen_y;
	char text[3] = {'A', '1', '\0'};
	const int mono = blf_mono_font_render;

	BLF_size(mono, 54, 72); /* hard coded size! */

	/* OCIO_TODO: using NULL as display will assume using sRGB display
	 *            this is correct since currently generated images are assumed to be in sRGB space,
	 *            but this would probably needed to be fixed in some way
	 */
	BLF_buffer(mono, rect_float, rect, width, height, 4, NULL);

	for (y = 0; y < height; y += step) {
		text[1] = '1';

		for (x = 0; x < width; x += step) {
			/* hard coded offset */
			pen_x = x + 33;
			pen_y = y + 44;

			/* terribly crappy outline font! */
			BLF_buffer_col(mono, 1.0, 1.0, 1.0, 1.0);

			BLF_position(mono, pen_x - outline, pen_y, 0.0);
			BLF_draw_buffer(mono, text, 2);
			BLF_position(mono, pen_x + outline, pen_y, 0.0);
			BLF_draw_buffer(mono, text, 2);
			BLF_position(mono, pen_x, pen_y - outline, 0.0);
			BLF_draw_buffer(mono, text, 2);
			BLF_position(mono, pen_x, pen_y + outline, 0.0);
			BLF_draw_buffer(mono, text, 2);

			BLF_position(mono, pen_x - outline, pen_y - outline, 0.0);
			BLF_draw_buffer(mono, text, 2);
			BLF_position(mono, pen_x + outline, pen_y + outline, 0.0);
			BLF_draw_buffer(mono, text, 2);
			BLF_position(mono, pen_x - outline, pen_y + outline, 0.0);
			BLF_draw_buffer(mono, text, 2);
			BLF_position(mono, pen_x + outline, pen_y - outline, 0.0);
			BLF_draw_buffer(mono, text, 2);

			BLF_buffer_col(mono, 0.0, 0.0, 0.0, 1.0);
			BLF_position(mono, pen_x, pen_y, 0.0);
			BLF_draw_buffer(mono, text, 2);

			text[1]++;
		}
		text[0]++;
	}

	/* cleanup the buffer. */
	BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL);
}
Example #2
0
static void checker_board_text(unsigned char *rect, float *rect_float, int width, int height, int step, int outline)
{
	int x, y;
	int pen_x, pen_y;
	char text[3]= {'A', '1', '\0'};
	const int mono= blf_mono_font;

	BLF_size(mono, 54, 72); /* hard coded size! */

	BLF_buffer(mono, rect_float, rect, width, height, 4);

	for(y= 0; y < height; y+=step)
	{
		text[1]= '1';

		for(x= 0; x < width; x+=step)
		{
			/* hard coded offset */
			pen_x = x + 33;
			pen_y = y + 44;

			/* terribly crappy outline font! */
			BLF_buffer_col(mono, 1.0, 1.0, 1.0, 1.0);

			BLF_position(mono, pen_x-outline, pen_y, 0.0);
			BLF_draw_buffer(mono, text);
			BLF_position(mono, pen_x+outline, pen_y, 0.0);
			BLF_draw_buffer(mono, text);
			BLF_position(mono, pen_x, pen_y-outline, 0.0);
			BLF_draw_buffer(mono, text);
			BLF_position(mono, pen_x, pen_y+outline, 0.0);
			BLF_draw_buffer(mono, text);

			BLF_position(mono, pen_x-outline, pen_y-outline, 0.0);
			BLF_draw_buffer(mono, text);
			BLF_position(mono, pen_x+outline, pen_y+outline, 0.0);
			BLF_draw_buffer(mono, text);
			BLF_position(mono, pen_x-outline, pen_y+outline, 0.0);
			BLF_draw_buffer(mono, text);
			BLF_position(mono, pen_x+outline, pen_y-outline, 0.0);
			BLF_draw_buffer(mono, text);

			BLF_buffer_col(mono, 0.0, 0.0, 0.0, 1.0);
			BLF_position(mono, pen_x, pen_y, 0.0);
			BLF_draw_buffer(mono, text);

			text[1]++;
		}
		text[0]++;
	}

	/* cleanup the buffer. */
	BLF_buffer(mono, NULL, NULL, 0, 0, 0);
}