Message-ID: <44D24DF8.30601 at gushee.net> Date: Thu, 03 Aug 2006 13:26:48 -0600 From: Matt Gushee MIME-Version: 1.0 To: lablgtk at math.nagoya-u.ac.jp Subject: Re: Rendering an image on a canvas? References: <44D2455B.6000200 at gushee.net> In-Reply-To: <44D2455B.6000200 at gushee.net> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Length: 1159 Matt Gushee wrote: > I have a really stupid question here, but I have spent the last 3 hours googling and OCamlBrowsing, and I can't figure this out. How do you tile a bitmap image (read from a file) on a GnoCanvas.canvas? The operation seems to require a pixbuf, somehow, but there doesn't seem to be any straightforward way to connect the pixbuf and the canvas. Let me clarify that a bit. I have (for example) a 1x768 PNG image, and I want to tile it across the background of a 1024x768 canvas. I can display the image by creating a pixbuf: let pb = GdkPixbuf.from_file bgfile Then I can display it with GnoCanvas.pixbuf ~x:0. ~y:0. ~width:1024. ~pixbuf:pb root_group But there are a couple of problems with this: the image appears once, in its original dimensions (i.e. one pixel wide). It is also displayed somewhere in the middle of the canvas (not exactly in the center, though). How can I control its position and cause it to repeat across the width of the canvas? -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :