Message-ID: <44D2765B.9060000 at gushee.net> Date: Thu, 03 Aug 2006 16:19:07 -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> <44D24DF8.30601 at gushee.net> <44D269FE.3030902 at gushee.net> <44D26FFB.9090109 at rftp.com> In-Reply-To: <44D26FFB.9090109 at rftp.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Length: 1283 Robert Roessler wrote: > Matt Gushee wrote: >> Never mind, I figured it out. > > Hey, just because no one stepped up with the answer for you, doesn't > mean that no one else is *interested* in the answer... ;) Oh, all right. I guess I got annoyed because a) I dislike GTK in the first place, and b) this is not the first time I've had trouble getting a response from this list. I didn't wait very long today, but I did last time. Anyway ... I don't know if this is *the* way to do it, but it's a way: let pb0 = GdkPixbuf.from_file bgfile and pb = GdkPixbuf.create ~width:width ~height:height () in GdkPixbuf.scale ~dest:pb ~dest_x:0 ~dest_y:0 ~scale_x:width' ~scale_y:1. pb0; (* Yes, ~scale_y:1. is necessary. I would guess that if you omit this argument, the image is scaled by the same amount in both directions--at any rate, it didn't come out right. *) let w = GWindow.window ~width:width ~height:height () in let c = GnoCanvas.canvas ~packing:w#add () in let root_group = c#root in let bg = GnoCanvas.pixbuf ~pixbuf:pb ~props:[`ANCHOR `NW] root_group -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :