To: lablgtk at math.nagoya-u.ac.jp Subject: Gdk.Cursor.create_from_pixbuf From: Dmitry Bely Date: Mon, 16 Jan 2006 16:47:03 +0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I'm trying to use this function but get the garbage instead of the cursor icon. Am I doing something wrong? Or maybe it's just because the only colorspace for Gdk.pixbuf is `RGB which is acceptable for (Gdk.Cursor.create_from_pixbuf) under Win32? let cursor_pixbuf icon_sz sz = let x = (icon_sz - sz) / 2 in let y = (icon_sz - sz) / 2 in let pm = new GDraw.pixmap ~colormap:(Gdk.Rgb.get_cmap ()) (Gdk.Pixmap.create ~width:icon_sz ~height:icon_sz ~depth:32 ()) in pm#set_foreground `BLACK; pm#rectangle ~x ~y ~width:sz ~height:sz ~filled:true (); let pb = GdkPixbuf.create ~width:icon_sz ~height:icon_sz () in pm#put_pixbuf 0 0 pb; let pb = add_alpha ~transparent:(255,255,255) pb in pb let cursor = Gdk.Cursor.create_from_pixbuf (cursor_pixbuf 32 32 16) 16 16 ... Gdk.Window.set_cursor window cursor - Dmitry Bely