Message-ID: <452F3F9F.2070108 at tin.it> Date: Fri, 13 Oct 2006 09:26:23 +0200 From: Stalkern 2 MIME-Version: 1.0 To: lablgtk at math.nagoya-u.ac.jp Subject: Re: How to modify the Gdk.gc of a GDraw.pixmap ? References: <452EBA91.9000704 at tin.it> <452EC8E8.5080903 at rftp.com> In-Reply-To: <452EC8E8.5080903 at rftp.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Content-Length: 1555 Robert Roessler wrote: > Stalkern 2 wrote: >> I'm in trouble when trying to draw dotted lines and the like. >> >> I have a GDraw.pixmap and I would like to use the function >> >> Gdk.GC.set_dashes : Gdk.gc -> offset:int -> int list -> unit >> >> on it. >> >> But how do I access the Gdk.gc of a GDraw.pixmap _directly_? >> >> Shall I create a new GC and then... ? >> >> I feel like there is something that in spite of my copy of ocamlbrowser, >> I can't browse very clearly yet ;-)) >> >> Thx for _any_ hint! > > I would say to do a GC.create call supplying the drawable (pixmap in > this case) that you want to work with. > > Also, if it helps, a pixmap does not "have" a gc in the sense of owning > one - you create a gc with an exemplar pixmap for the purpose of [for > example] drawing into that pixmap - or others like it. > > Finally, note that set_dashes is just setting an attribute (a "value" in > Gdk-land)... you will need to supply that gc along with a compatible > drawable to a "draw" function to actually get your dotted lines. > > Robert Roessler > robertr at rftp.com > http://www.rftp.com > > Thanks for the hint. Now, I am attempting to do so, but code like this ( let newGC = Gdk.GC.create (Gdk.Drawable.cast (mypixmap#pixmap)) in let () = Gdk.GC.set_dashes newGC ~offset:0 [1;1] in (mypixmap #set_line_attributes ~style:`ON_OFF_DASH () ) ) does not allow me to go on with the new GC: after this code, the pixmap shows not to use this "newGC", but its old one. What am I missing? Thank you for any idea. Ernesto