[cairo] Image fallback in PS backend

Bill Spitzak spitzak at d2.com
Fri Apr 21 14:20:46 PDT 2006


Carl Worth wrote:

 > Instead, what I've envisioned for this is to extend the
 > characterization of operations that a backend can provide to the
 > analysis engine. Currently the information is just a Boolean,
 > (supported or unsupported). What we want here is to be able to say,
 > "I can support this operation only if there is nothing under it".

It might be a good idea to alter the back-end interface so that cairo 
does not have to understand all the possible tests for whether an 
operation can be done, because I think the test interface may get 
unreasonably complex.

Right now I'm guessing the interface cairo uses to a backend is 
something like this:

	cairo_core::do_foo() {
	  if (backend->can_do_foo()) {
	    backend.do_foo(this);
	  } else {
	    this->simulate_foo_using_something_else();
	  }
	}

I would propose that the logic be moved to the backend, so the cairo 
code is basically this:

	cairo_core::do_foo() {
	  backend.do_foo(this);
	}

and the backend implementation is implemented this way:

	backend::do_foo(cairo_core c) {
	  if (elaborate_test_to_see_if_foo_possible()) {
	    this->do_subset_of_foo();
	  } else {
	    c->simulate_foo_using_something_else();
	  }
	}

The main difficulty is that a backend must implement every function as 
at least a call back to the simulation in cairo, and that all the 
informaton needed to simulate it must pass through the backend api.


More information about the cairo mailing list