Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Gtk+/Gnome Application Development
Prev Home Next


To draw a single line, pass its endpoints as arguments to gdk_draw_line() (Figure 18). To draw connected lines, you pass a list of points to gdk_draw_lines(); GDK will "connect the dots." To draw multiple lines that aren't necessarily connected, pass a list of segments to gdk_draw_segments(); a GdkSegment is:

typedef struct _GdkSegment GdkSegment;

struct _GdkSegment
  gint16 x1;
  gint16 y1;
  gint16 x2;
  gint16 y2;

If lines or segments drawn in the same request meet at their endpoints, they are joined with the join style from the GC.

#include <gdk/gdk.h>

void gdk_draw_line(GdkDrawable* drawable, GdkGC* gc, gint x1, gint y1, gint x2, gint y2);

void gdk_draw_lines(GdkDrawable* drawable, GdkGC* gc, GdkPoint* points, gint npoints);

void gdk_draw_segments(GdkDrawable* drawable, GdkGC* gc, GdkSegment* segments, gint nsegments);

Figure 18. Drawing Lines

Gtk+/Gnome Application Development
Prev Home Next

  Published under free license. Design by Interspire