1. cairo_surface_t *input = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, (int)buf->rect.width(), (int)buf->rect.height());
  2. cairo_t *ct = cairo_create(input);
  3. cairo_set_source_rgba (ct, 1, 1, 1, 0);
  4. cairo_paint(ct);
  5. Geom::Rect area = buf->rect;
  6. //Gap translate to visual view is working
  7. area *= Geom::Translate(Geom::Point(20,10));
  8. //custom function that render Inkscape rect as cairo surface
  9. //Is working because I see the down image translated by area gap
  10. sp_canvas_arena_render_surface(SP_CANVAS_ARENA(SP_ACTIVE_DESKTOP->getDrawing()), input, area.roundOutwards());
  11. cairo_set_source_surface(ct, input, 0, 0);
  12. cairo_paint(ct);
  13. cairo_set_operator(ct, CAIRO_OPERATOR_XOR);
  14. cairo_rectangle (ct, 40, 30, 120, 90);
  15. cairo_set_source_rgba (ct, 0, 0, 0.9, 0.4);
  16. cairo_fill_preserve(ct);
  17. cairo_set_source_rgba (buf->ct, 1, 1, 1, 0);
  18. cairo_paint(buf->ct);
  19. cairo_set_source_surface(buf->ct, cairo_get_target(ct), 0, 0);
  20. cairo_paint(buf->ct);
 
 

103

 

1142

compositing

-

PasteBin

Lines
20
Words
87
Size
1017 bytes
Created
Type
text/x-c++hdr
Public Domain (PD)
Please log in to leave a comment!