[cairo-commit] rcairo/samples png.rb,1.9,1.10

Kouhei Sutou commit at pdx.freedesktop.org
Sun Jun 25 07:29:26 PDT 2006


Committed by: kou

Update of /cvs/cairo/rcairo/samples
In directory kemper:/tmp/cvs-serv8555/samples

Modified Files:
	png.rb 
Log Message:
* README, packages/cairo/ext/extconf.rb: supported only 1.1.10 or
  higher.

* packages/cairo/ext/rb_cairo_constants.c: supported
  CAIRO_FORMAT_RGB16_565.

* packages/cairo/ext/rb_cairo_surface.c:
  - supported cairo_surface_get_content(),
    cairo_surface_set_fallback_resolution(),
    cairo_image_surface_get_data(),
    cairo_image_surface_get_format() and
    cairo_image_surface_get_stride().
  - removed cairo_ps_surface_set_dpi(),
    cairo_pdf_surface_set_dpi() and cairo_svg_surface_set_dpi()
    support.

* samples/png.rb: added Cairo::ImageSurface#data sample.


Index: png.rb
===================================================================
RCS file: /cvs/cairo/rcairo/samples/png.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- png.rb	15 Oct 2005 14:33:46 -0000	1.9
+++ png.rb	25 Jun 2006 14:29:24 -0000	1.10
@@ -5,7 +5,11 @@
 
 require 'cairo'
 
-surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, 200, 200)
+format = Cairo::FORMAT_ARGB32
+width = 200
+height = 200
+
+surface = Cairo::ImageSurface.new(format, width, height)
 cr = Cairo::Context.new(surface)
 
 # fill background with white
@@ -28,4 +32,11 @@
 
 cr.target.write_to_png("test.png")
 
+data = cr.target.data
+stride = cr.target.stride
+
 cr.target.finish
+
+surface = Cairo::ImageSurface.new(data, Cairo::FORMAT_ARGB32,
+                                  width, height, stride)
+surface.write_to_png("test-renew.png")



More information about the cairo-commit mailing list