[Mono-list] How can I copy one drawable into another?

Ian Norton inb at ncipher.com
Tue Nov 16 15:50:33 EST 2010


On Tue, 2010-11-16 at 20:43 +0000, Jonathan Pobst wrote:
> Once you have it in a PixBuf, just paint it onto your ImageSurface:
> 
> using (Cairo.Context g = new Cairo.Context (mySurface)) {
> 	g.DrawPixbuf (mypixbuf, new Cairo.Point (0, 0));
> }

Ooh, handy. Perhaps someone needs to update
http://www.mono-project.com/Mono.Cairo_Cookbook.

Regards

Ian

> 
> Jonathan
> 
> 
> On 11/16/2010 2:28 PM, Ian Norton wrote:
> > Hi Francisco,
> >
> > If you have a png on disk, this is done like so:
> >
> > void PaintImage( Context ctx, ImageSurface img, int x, int y ){
> >    img.Show( ctx, x, y );	
> > }
> > ...
> > ImageSurface image = new ImageSurface( filename );
> > PaintImage( ctx, image, 10, 20 );
> >
> > If you have a Gtk.Image and want to turn it into a Cairo ImageSurface
> > then you at the moment have to do something horrible like this:
> >
> > Gtk.Image myImage;
> > ...
> > Gdk.PixBuf buf = myImage.PixBuf;
> > buf.Save( "temp_convert","png" );
> > ImageSurface image = new ImageSurface ( "temp_convert" );
> >
> > Regards
> >
> > Ian
> >
> >
> > On Tue, 2010-11-16 at 19:29 +0000, Francisco M. Marzoa wrote:
> >> Hello,
> >>
> >> I've a Gtk.Image widget with a given content and I just want to copy
> >> that content within a Gtk.DrawingArea, is this possible in an easy manner?
> >>
> >> Thanks in advance,
> >>
> >> _______________________________________________
> >> Mono-list maillist  -  Mono-list at lists.ximian.com
> >> http://lists.ximian.com/mailman/listinfo/mono-list
> >
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> >
> 




More information about the Mono-list mailing list