[cairo] Creating Win32 Bitmap with cairo

Gerdus van Zyl gerdusvanzyl at gmail.com
Thu Nov 6 00:18:59 PST 2008


Do you fill the surface with a colour/pattern? I am not sure if you
would get good results from rendering to a surface with
alpha(Format32bppArgb) and thus empty without a background colour.

~Gerdus

On Thu, Nov 6, 2008 at 7:47 AM, Isenko Evgeny <isenko at po.gsinet.co.jp> wrote:
> 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
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>


More information about the cairo mailing list