Finished surface

Christophe TROESTLER <[email protected]>
Newsgroups gmane.comp.lib.cairo
Organization Universite de Mons (http://math.umons.ac.be/anum/)
Message-ID <20130808.205055.1072367653407245036.Christophe.Troestler@umons.ac.be>
Hi,

According to the manual¹, after a surface is finished, "Further
drawing to the surface will [...] trigger a
CAIRO_STATUS_SURFACE_FINISHED error."  However the attached code
shows that cairo_stroke aborts the program instead of setting the
appropriate error.  Is this considered the right behavior?  Is there a
way to avoid the abort and have an error instead (I did not see any
way of testing whether a surface is finished or not — this would alow
testing before running cairo_stroke).

Best,
Chris


¹ http://www.cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-finish

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
finish.c (text/plain, 745 B)
#include <stdio.h>
#include <cairo/cairo.h>
#include <cairo/cairo-svg.h>

void print_status(cairo_t *ctx)
{
  cairo_status_t st;

  st = cairo_status(ctx);
  printf("status = %s\n", cairo_status_to_string(st));
  fflush(stdout);
}


int main(void)
{
  cairo_surface_t * surf;
  cairo_t *ctx;
  
  surf = cairo_svg_surface_create("finish.svg", 100., 100.);
  ctx = cairo_create(surf);
  
  cairo_set_line_width(ctx, 1.);
  cairo_move_to(ctx, 0., 0.);
  cairo_line_to(ctx, 100., 100.);
  cairo_stroke(ctx);
  cairo_surface_finish(surf);

  cairo_line_to(ctx, 100., 100.);
  print_status(ctx);  
  cairo_stroke(ctx);
  print_status(ctx);
  
  return(0);
}


/* Local Variables: */
/* compile-command: "gcc -o finish finish.c -lcairo" */
/* End: */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.