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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

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

  




 

 

Gtk+/Gnome Application Development
Prev Home Next

Line Item

GnomeCanvasLine represents one or more line segments joined at their endpoints. You can use it to represent an unfilled polygon as well. GnomeCanvasPolygon is used for filled polygons.

A line is specified using a GnomeCanvasPoints structure, which looks like this:


typedef struct {
        int num_points;
        double *coords;
        int ref_count;
} GnomeCanvasPoints;

      

The coords field contains an array of points, alternating X and Y coordinates. You fill the coords array directly, after creating a GnomeCanvasPoints with gnome_canvas_points_new(); the structure should be destroyed with gnome_canvas_points_unref().

Lines can have arrowheads on either end; the arrowhead shape is specified via three parameters, arbitrarily named A, B, and C. Parameter A (specified with the arrow_shape_a argument) specifies the distance from the base of the arrowhead to the tip. B specifies the distance from the tip of the arrowhead to one of the trailing points; C specifies the distance of a trailing point from the outer edge of the line.

Table 2. GnomeCanvasLine Arguments

Name Type Read/Write Description
points GnomeCanvasPoints* Both Points in the line
fill_color gchar* Write-only Fill color; string for gdk_color_parse()
fill_color_gdk GdkColor* Both Fill color; specified as already-allocated GdkColor
fill_color_rgba guint32 Both Fill color; specified as 32-bit value packing red, green, blue, and alpha into bytes 1, 2, 3, and 4; alpha of 255 is opaque, 0 is invisible
fill_stipple GdkBitmap* Both Stipple to use when drawing line; GDK mode only
width_pixels guint Write-only Width of the line, in pixels (independent of zoom)
width_units double Write-only Width of the line, in canvas units; pixel width changes with zoom factor (pixels per unit)
cap_style GdkCapStyle Both Cap style (GDK mode only)
join_style GdkJoinStyle Both Join style (GDK mode only)
line_style GdkLineStyle Both Line style (GDK mode only)
first_arrowhead gboolean Both Whether to put an arrowhead at the start of the line
last_arrowhead gboolean Both Whether to put an arrowhead at the end of the line
smooth gboolean Both Whether to smooth the line using parabolic splines
spline_steps guint Both Number of steps to use when rendering curves
arrow_shape_a double Both Length of arrowhead
arrow_shape_b double Both Length of arrowhead edges (tip to trailing points)
arrow_shape_c double Both Width of arrowhead
Gtk+/Gnome Application Development
Prev Home Next

 
 
  Published under free license. Design by Interspire