eumandy/eugtk/examples/test86.ex
2016-11-25 00:33:18 -07:00

46 lines
995 B
Elixir

-------------------------------------------------------------------------
--# Resizing Images
-- To load images at a different size than normal, load them into a
-- GdkPixbuf, then create a GtkImage from that pixbuf.
-------------------------------------------------------------------------
include GtkEngine.e
constant docs = `<u><b>Resized Image</b></u>
Original size: 525 x 360 pixels
Loaded as GdkPixbuf,
with width of 150 pixels,
HxW ratio retained.
`
constant win = create(GtkWindow,
"size=200x100,border_width=10,position=1,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant lbl = create(GtkLabel)
set(lbl,"markup",docs)
add(panel,lbl)
object pix = create(GdkPixbuf,"thumbnails/7300.jpg")
pix = get(pix,"scale simple",150,100,1)
constant img = create(GtkImage,pix)
set(img,"margin bottom",5)
add(panel,img)
constant btn1 = create(GtkButton,"gtk-quit","Quit")
pack(panel,-btn1)
show_all(win)
main()