[Mono-list] Expose/use cairo 1.2 api ?

David Cantin david_cantin at videotron.ca
Sun Jul 30 17:44:26 EDT 2006


Hi, I'm trying without any success to create a cairo pdfsurface..., I
use ubuntu edgy witch come with libcairo2 (cairo-1.2),
libmono-cairo1.0-cil and libmono-cairo2.0-cil. All properly installed.

I use monodevelop and I don't know if I'm doing it right but in the
reference panel of my solution, I have two cairo choice both with the
same version number 1.0.5000.0. I think that I should have at least one
cairo with version 1.2.xxxx.x ?? Do i need a special assembly like I did
for mysql (MySql.Data.dll) ?

And finally, my class look like that : 

using System;
using System.Data;
using Cairo;
using Pango;
using Gtk;

public class PdfRenderer{
	
	public PdfRenderer(){
		
		Surface surface = new ImageSurface(Cairo.Format.ARGB32,
 200, 200);
		// this didn't work !
//		Surface surface	= new PdfSurface("test", 100, 100); 

		Cairo.Context cc = new Cairo.Context(surface);
		cc.Color = new Cairo.Color (1.0, 1.0, 1.0, 1.0);
		cc.Rectangle(0, 0, 200, 200);
		cc.Fill();

		cc.Color = new Cairo.Color (1.0, 1, 0, 0);
		cc.ShowText("test");
		cc.Fill();
		
		cc.Color = new Cairo.Color (1.0, 0.2, 0.2, 0.6);
		cc.Rectangle(5, 5, 5, 5);
		cc.Fill();

		surface.WriteToPng("/home/user/surface.png");
//		surface.WriteToPng("/home/user/surface.pdf");
	}
}


Any thought ?

David

	





More information about the Mono-list mailing list