Date: Fri, 13 Oct 2006 17:20:21 +0900 (JST) Message-Id: <20061013.172021.74751543.garrigue at math.nagoya-u.ac.jp> To: stalkern2 at tin.it Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: How to modify the Gdk.gc of a GDraw.pixmap ? From: Jacques Garrigue In-Reply-To: <452F45BC.1090600 at tin.it> References: <452EBA91.9000704 at tin.it> <452EC8E8.5080903@rftp.com> <452F45BC.1090600@tin.it> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: Text/Plain; charset=us-ascii Content-Length: 1274 From: Stalkern 2 > > 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. > > > > OK, now I see, I have to draw with a function accepting a Gdk.gc, like > > Gdk.Draw.line : [> `drawable ] Gobject.obj -> Gdk.gc -> x:int -> y:int > -> x:int -> y:int -> unit > > Thanks A LOT (thanks A DOT?) You can also rewrap the pixmap, with a new GC, in a new wrapper object that lets you access (and modify) this GC. class add_gc (pm : #GDraw.pixmap) = object inherit GDraw.pixmap pm#pixmap ?mask:pm#mask method color = pm#color method gc = gc end There should probably be methods to access the gc and the colormap in the original drawable class, this would avoid all these problems... Even bettern, one could be allowed to switch gc's. Jacques