[cairo] Cairo metafile

dirk.schoenberger at sz-online.de dirk.schoenberger at sz-online.de
Thu Aug 12 09:44:47 PDT 2004


> I am currently writing such a API:
>
>   cairo_shape_t *shape = cairo_shape_create(10000, 10000);
>   cairo_shape_viewport_t *view = cairo_shape_viewport_create(shape);
>   cairo_shape_t *shape2 = cairo_shape_create(30, 50);
>
>   ctx = cairo_shape_get_drawing_context(shape2);
>   ctx->rectangle(ctx, 10, 10, 10, 20);
>   ctx->move_to(ctx, 1, 1);
>   ctx->line_to(ctx, 30, 50);
>   ctx->stroke(ctx);
>   cairo_shape_set_parent(shape2, shape);
>
> [...]
>   if (xev.xkey.keycode == left_keycode)
> 	  cairo_shape_translate(shape, -10, 0);
> [...]
>
>   cairo_shape_viewport_show_x11(view, dpy, d, x, y, width, height);

Hi Jost,

this sounds at least interesting.
I am not quite sure how this fits into our KCanvas design, I will have to
discuss this witou the main developer.

Some questions:

Does there exists something like

int hitFills = cairo_shape_viewport_hit_test(view, 128, 128, true); ?

Basically I would like to know if the given  coordinate is hit by the
given shape. The last parameter specifies if I want to check only filled
areas, or ares which would be rendered by a stroke?

Does there exists something like

cairo_shape_viewport_bbox(shape, &x, &y, &w, &h); ?

This calculates the bounding box of a shape?

What are the meaning in the function cairo_shape_create(10000, 10000);

You don't really create a surface of 10000 x 10000 pxels, do you?


	  cairo_shape_translate(shape, -10, 0);

This sound interesting, even if it doesn't really fits into our design. Do
you render all shapes, or do you have some "optimized rendering"
algorithms in place? This means that you could render display parts which
are not affected by previous changes by blitting the "old" surface?

Does you shape have  render informations, e.g. something like

          cairo_gradient_t *gradient = cairo_create_gradient();
	  cairo_shape_set_stroke(shape, gradient);

Some of the latter feature would be especially interesting because so I
could hopefully radically simplify our KCanvas design ;)

Regards
Dirk




More information about the cairo mailing list