[cairo] Creating Win32 Bitmap with cairo

Isenko Evgeny isenko at po.gsinet.co.jp
Wed Nov 5 21:47:06 PST 2008


Hello!

Does anyone have an experience of creating Win32 Bitmap with cairo?

The below example is working just fine except one thing: the resulting
Bitmap is not antialiased. However, if I save the surface into png,
imgsrf.WriteToPng(fName);
it IS antialiased.
So, how make the graphics on the Bitmap to be antialiased?

{
Bitmap img = new Bitmap(200, 200, Imaging.PixelFormat.Format32bppArgb);
Graphics mygr = Graphics.FromImage(img);

Cairo.Win32Surface winsrf = new Cairo.Win32Surface(mygr.GetHdc());
Cairo.Context cr = new Cairo.Context(winsrf);

cr.Antialias = Cairo.Antialias.Grey;

/* Some drawings here */

mygr.Dispose();
return img;
}

By the way, I am not sure that this code is the better way of creating
Win32 Bitmap with cairo...

Thanks for any advice.

Evgeny



More information about the cairo mailing list