Lines Matching refs:buf
28 static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf);
32 static void sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, guint32 rgba);
77 static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf)
85 cairo_save(buf->ct);
86 cairo_translate(buf->ct, -buf->rect.left(), -buf->rect.top());
87 ink_cairo_set_source_rgba32(buf->ct, gl->rgba);
88 cairo_set_line_width(buf->ct, 1);
89 cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE);
90 cairo_set_font_size(buf->ct, 10);
98 cairo_save(buf->ct);
99 cairo_translate(buf->ct, px, py);
100 cairo_rotate(buf->ct, atan2(normal_dt.cw()));
101 cairo_translate(buf->ct, 0, -5);
102 cairo_move_to(buf->ct, 0, 0);
103 cairo_show_text(buf->ct, gl->label);
104 cairo_restore(buf->ct);
109 cairo_move_to(buf->ct, position + 0.5, buf->rect.top() + 0.5);
110 cairo_line_to(buf->ct, position + 0.5, buf->rect.bottom() - 0.5);
111 cairo_stroke(buf->ct);
114 cairo_move_to(buf->ct, buf->rect.left() + 0.5, position + 0.5);
115 cairo_line_to(buf->ct, buf->rect.right() - 0.5, position + 0.5);
116 cairo_stroke(buf->ct);
122 double y_intersect_left = (buf->rect.left() - point_on_line_dt[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + point_on_line_dt[Geom::Y];
123 if ( (y_intersect_left >= buf->rect.top()) && (y_intersect_left <= buf->rect.bottom()) ) {
125 double y_intersect_right = (buf->rect.right() - point_on_line_dt[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + point_on_line_dt[Geom::Y];
126 sp_guideline_drawline (buf, buf->rect.left(), static_cast<gint>(round(y_intersect_left)), buf->rect.right(), static_cast<gint>(round(y_intersect_right)), gl->rgba);
131 double y_intersect_right = (buf->rect.right() - point_on_line_dt[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + point_on_line_dt[Geom::Y];
132 if ( (y_intersect_right >= buf->rect.top()) && (y_intersect_right <= buf->rect.bottom()) ) {
134 sp_guideline_drawline (buf, buf->rect.right(), static_cast<gint>(round(y_intersect_right)), buf->rect.left(), static_cast<gint>(round(y_intersect_left)), gl->rgba);
139 double x_intersect_top = (buf->rect.top() - point_on_line_dt[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + point_on_line_dt[Geom::X];
140 if ( (x_intersect_top >= buf->rect.left()) && (x_intersect_top <= buf->rect.right()) ) {
142 double x_intersect_bottom = (buf->rect.bottom() - point_on_line_dt[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + point_on_line_dt[Geom::X];
143 sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_top)), buf->rect.top(), static_cast<gint>(round(x_intersect_bottom)), buf->rect.bottom(), gl->rgba);
148 double x_intersect_bottom = (buf->rect.bottom() - point_on_line_dt[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + point_on_line_dt[Geom::X];
149 if ( (x_intersect_top >= buf->rect.left()) && (x_intersect_top <= buf->rect.right()) ) {
151 sp_guideline_drawline (buf, static_cast<gint>(round(x_intersect_bottom)), buf->rect.bottom(), static_cast<gint>(round(x_intersect_top)), buf->rect.top(), gl->rgba);
156 cairo_restore(buf->ct);
280 sp_guideline_drawline (SPCanvasBuf *buf, gint x0, gint y0, gint x1, gint y1, guint32 /*rgba*/)
282 cairo_move_to(buf->ct, x0 + 0.5, y0 + 0.5);
283 cairo_line_to(buf->ct, x1 + 0.5, y1 + 0.5);
284 cairo_stroke(buf->ct);