Re: Load a Bitmap in ImageSurface

Saeed shahbazi <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CACyWuDQadb3yF0GU2+EKXzrifzZhE2Bd1z6Lzuy0RBTLEEC2yA@mail.gmail.com>
Thanks but it did not work. I used the code as follows:

           Bitmap clone = new Bitmap(image.Width, image.Height,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            using (System.Drawing.Graphics gr =
System.Drawing.Graphics.FromImage(clone))
            {
                gr.DrawImage(image, new Rectangle(0, 0, clone.Width,
clone.Height));
            }

            var ms = new MemoryStream();
            image.Save(ms, ImageFormat.Bmp);
            var imageSurface = new ImageSurface(ms.ToArray(),
Format.ARGB32, image.Width, image.Height, image.Width * 4);
            this.m_internalContext.Antialias = Antialias.None;
            imageSurface.Show(this.m_internalContext, destRect.X,
destRect.Y);
            imageSurface.Destroy();
            ms.Dispose();

I think the problem is related to the formatting. my black pictures with
white letters inside become green pictures, cut in half which are rotated.

Cheers,


On Mon, Oct 14, 2013 at 1:02 PM, Mike Gran <[email protected]> wrote:

>
>
> > Hi all,
> >
> >
> >I'm using Mono and .Net 2 and I want to load a System.Drawing.Image image
> to ImageSurface. All my efforts led to fuzzy images but the one as follows:
>
> Don't know much about C#, but, maybe you just need to request no
> antialiasing
> explicitly before you paint to a context.  Something like
>
>
> cairo_set_antialias (context, CAIRO_ANTIALIAS_NONE);
>
> -Mike Gran
>
>


-- 
-
Best Regards,
Saeed

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.