Re: [gtk-list] Line attributes

*-Ionut Borcoman at home <>
| Hi,
| I have a GdkPixmap used for buffered drawing into a drawing area. I can
| draw lines, rectangles, etc. Now I'd like to draw with different kinds
| of lines. I have found in the headers the function:
| 	gdk_gc_set_line_attributes
| but I don't know how to use it. (I don't have the gtk/gdk sources, just
| the libs and the headers). 
| Can somebody send me a sample code about how to use this function,
| please ? 

I can try to explain, but I don't have any code handy.

I'll explain two functions:
gdk_gc_set_line_attributes and gdk_gc_set_dashes

With the first you set width, line_style, cap_style and join_style.

Width is line width in pixels.

line_style can be GDK_LINE_SOLID, GDK_LINE_ON_OFF_DASH or
GDK_LINE_DOUBLE_DASH. With the first, lines are drawn solid. With
the second the dashes are drawn with foreground colour and the
parts between are ignored. The third is like the second but
the parts inbetween are drawn with background colour.

cap_style says how endpoints are drawn.

join_style says how corners are drawn.

(just let me know, and I'll explain their values)

With the second function you actually specify the dashing.

dash_offset defines the phase of the pattern.

dash_list is a list of numbers, telling how long (in pixels) the
on/off pieces shall be.

n is the length of dash_list.

This pattern:
-- --  --- --  --- --  --- --  --- --  --- --  --- -- 

Can be specified with:

gdk_gc_set_dashes (foogc, 1, {3, 1, 2, 2}, 4);

--   [-: .elOle. :-]

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]