seed r784 - trunk/examples
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r784 - trunk/examples
- Date: Tue, 20 Jan 2009 22:37:09 +0000 (UTC)
Author: racarr
Date: Tue Jan 20 22:37:09 2009
New Revision: 784
URL: http://svn.gnome.org/viewvc/seed?rev=784&view=rev
Log:
Add GdkPixbufLoader example
Added:
trunk/examples/gdkpixbufloader.js (contents, props changed)
Modified:
trunk/examples/Makefile.am
Modified: trunk/examples/Makefile.am
==============================================================================
--- trunk/examples/Makefile.am (original)
+++ trunk/examples/Makefile.am Tue Jan 20 22:37:09 2009
@@ -12,6 +12,7 @@
examples_DATA = \
actions.js \
Gnio.js \
+ gdkpixbufloader.js \
gtktreeview.js \
async-quine.js \
clutter-cogl.js \
@@ -43,6 +44,7 @@
actions.js \
clutter-cogl.js \
gtktreeview.js \
+ gdkpixbufloader.js \
calculator.js \
clutter-cairo.js \
async-quine.js \
Added: trunk/examples/gdkpixbufloader.js
==============================================================================
--- (empty file)
+++ trunk/examples/gdkpixbufloader.js Tue Jan 20 22:37:09 2009
@@ -0,0 +1,33 @@
+#!/usr/local/bin/seed
+Seed.import_namespace("GLib");
+Seed.import_namespace("Gio");
+Seed.import_namespace("GdkPixbuf");
+Seed.import_namespace("Gtk");
+
+var blue_marble =
+ Gio.file_new_for_uri("http://veimages.gsfc.nasa.gov/7100/world.topo.bathy.200401.3x5400x2700.jpg");
+
+blue_marble.read_async(0, null, function(source, result)
+ {
+ var loader = new GdkPixbuf.PixbufLoader();
+ var stream = source.read_finish(result);
+ var dstream = new Gio.DataInputStream.c_new(stream);
+
+ try
+ {
+ while (1)
+ {
+ loader.write([dstream.read_byte()], 1);
+ }
+ }
+ catch (e)
+ {
+ }
+
+ var pixbuf = loader.get_pixbuf();
+ pixbuf.savev("bluemarble","jpeg");
+ });
+
+var loop = GLib.main_loop_new();
+GLib.main_loop_run(loop);
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]