All pastes #1636747 Raw Edit

Unnamed

public text v1 · immutable
#1636747 ·published 2009-10-22 07:14 UTC
rendered paste body
  surface = cairo_image_surface_create_for_data (overlay->text_image,
      CAIRO_FORMAT_ARGB32, width, height, width * 4);
  cr = cairo_create (surface);

  /* clear surface */
  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
  cairo_paint (cr);

  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);

  /* apply transformations */
  cairo_set_matrix (cr, &cairo_matrix);

  /* draw text to cairo path */
  pango_cairo_layout_path (cr, overlay->layout);

  /* draw shadow text */
  cairo_save (cr);
  cairo_translate (cr, overlay->shadow_offset, overlay->shadow_offset);
  cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
  cairo_fill_preserve (cr);
  cairo_restore (cr);

  /* draw outline text */
  cairo_save (cr);
  cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
  cairo_set_line_width (cr, overlay->outline_offset);
  cairo_stroke_preserve (cr);
  cairo_restore (cr);

  if (overlay->want_shading) {
    cairo_paint_with_alpha (cr, overlay->shading_value);
  }

  /* draw text */
  cairo_save (cr);
  cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
  cairo_fill (cr);
  cairo_restore (cr);

  cairo_destroy (cr);
  cairo_surface_destroy (surface);