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

38 lines
1.0 KiB
Elixir

--# SVG vs. other image formats;
include GtkEngine.e
sequence docs = """<u><b>SVG images</b></u> can be resized without losing any resolution.
<b>Natural</b> size (90 x 90 px) is shown below left, <b>png</b> sized to 400 x 400 px. is blurry, <b>svg</b> is sharp and clear"""
constant win = create(GtkWindow,"border_width=10,$destroy=Quit")
constant panel = create(GtkBox,"orientation=VERTICAL")
add(win,panel)
constant lbl1 = create(GtkLabel)
set(lbl1,"markup",docs)
add(panel,lbl1)
constant panel2 = create(GtkBox,HORIZONTAL)
add(panel,panel2)
-- creating image directly from file results in a 'natural' size image;
constant img = create(GtkImage,"thumbnails/clown.png")
add(panel2,img)
constant pb2 = create(GdkPixbuf,"thumbnails/clown.png",400,400)
constant img2 = create(GtkImage,pb2)
add(panel2,img2)
-- below, we want to enlarge the images to 400px, so we load as pixbufs at size;
constant pb1 = create(GdkPixbuf,"thumbnails/clown.svg",400,400,1)
constant img1 = create(GtkImage,pb1)
add(panel2,img1)
show_all(win)
main()