render


Description:

public void render (Context cr, CanvasBounds? bounds, double scale)

Renders all or part of a canvas to the given cairo context.

This example code could be used in a PrintOperation draw_page callback to print each page in a multi-page document (assuming the pages appear one after the other vertically in the canvas). Note the call to translate to translate the output to the correct position on the printed page.

<informalexample><programlisting> GooCanvasBounds bounds; bounds.x1 = 0; bounds.x2 = A4_PAGE_WIDTH; bounds.y1 = A4_PAGE_HEIGHT * page_num; bounds.y2 = A4_PAGE_HEIGHT * (page_num + 1);

cr = gtk_print_context_get_cairo_context (print_context); cairo_translate (cr, 0, -A4_PAGE_HEIGHT * page_num); goo_canvas_render ( GOO_CANVAS (canvas), cr, &bounds, 0.0); </programlisting></informalexample>

Parameters:

this

a Canvas.

cr

a cairo context.

bounds

the area to render, or null to render the entire canvas.

scale

the scale to compare with each item's visibility threshold to see if they should be rendered. This only affects items that have their visibility set to goo_canvas_item_visible_above_threshold.




2022 vala-language.org