函数:

void
gdk_draw_line (GdkDrawable *drawable,
               GdkGC *gc,
               gint x1_,
               gint y1_,
               gint x2_,
               gint y2_);

参数:

  • drawable
    a GdkDrawable (a GdkWindow or a GdkPixmap).
  • gc
    a GdkGC.
  • x1_
    the x coordinate of the start point.
  • y1_
    the y coordinate of the start point.
  • x2_
    the x coordinate of the end point.
  • y2_
    the y coordinate of the end point.

功能:

gdk_draw_line has been deprecated since version 2.22 and should not be used in newly-written code.

Use cairo_line_to() and cairo_stroke() instead. Be aware that the default line width in Cairo is 2 pixels and that your coordinates need to describe the center of the line. To draw a single pixel wide pixel-aligned line, you would use:

cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_move_to (cr, 0.5, 0.5);
cairo_line_to (cr, 9.5, 0.5);
cairo_stroke (cr);]|

Draws a line, using the foreground color and other attributes of the GdkGC.


来源:
https://developer.gnome.org/gdk2/stable/gdk2-Drawing-Primitives.html#gdk-draw-line