Beispiel #1
0
void draw_text_r(BITMAP *bmp, int x, int y, int color, const char *format, ...)
{
  char buf[512];
  va_list ap;

  va_start(ap, format);
  uvszprintf(buf, sizeof(buf), format, ap);
  va_end(ap);

  textout_right_ex(bmp, gamefont, buf, x, y+1, blend_color(color, makecol(0, 0, 0), 0.5), -1);
  textout_right_ex(bmp, gamefont, buf, x, y, color, -1);
}
int raster_rgba_hline_blend(pb_rgba *pb, unsigned int x, unsigned int y, unsigned int length, uint32_t value)
{
	size_t terminus = x + length;
	terminus = terminus - x;

	unsigned int * data = &((unsigned int *)pb->data)[y*pb->pixelpitch + x];
	for (size_t idx = 0; idx < terminus; idx++)
	{
		int bg = *data;
		int fg = value;

		*data = blend_color(bg, fg);
		data++;
	}

	return 0;
}
Beispiel #3
0
void draw_text(BITMAP *bmp, int x, int y, int w, int h, int color, const char *format, ...)
{
  if (w > 0 && h > 0) {
    char buf[512];
    va_list ap;

    va_start(ap, format);
    uvszprintf(buf, sizeof(buf), format, ap);
    va_end(ap);

    BITMAP *tmp = create_bitmap(text_length(gamefont, buf),
				text_height(gamefont)+1);

    clear_to_color(tmp, bitmap_mask_color(tmp));
    textout_ex(tmp, gamefont, buf, 0, 1, blend_color(color, makecol(0, 0, 0), 0.5), -1);
    textout_ex(tmp, gamefont, buf, 0, 0, color, -1);

    masked_stretch_blit(tmp, bmp, 0, 0, tmp->w, tmp->h, x, y, w, h);
    destroy_bitmap(tmp);
  }
}