public void Export(Document document, string fileName, Gtk.Window parent)
        {
            Cairo.ImageSurface surf = document.GetFlattenedImage();

            Pixbuf pb = surf.ToPixbuf();

            DoSave(pb, fileName, filetype, parent);

            (pb as IDisposable).Dispose();
            (surf as IDisposable).Dispose();
        }
Beispiel #2
0
        /// <summary>
        /// Returns a thumbnail of an image.
        /// If the format provides an efficient way to load a smaller version of
        /// the image, it is suggested to use that method to load a thumbnail
        /// no larger than the given width and height parameters. Otherwise, the
        /// returned pixbuf will need to be rescaled by the calling code if it
        /// exceeds the maximum size.
        /// </summary>
        /// <returns>
        /// The thumbnail, or null if the image could not be loaded.
        /// </returns>
        /// <param name='maxWidth'>
        /// The maximum width of the thumbnail.
        /// </param>
        /// <param name='maxHeight'>
        /// The maximum height of the thumbnail.
        /// </param>
        /// <param name='parent'>
        /// Window to be used as a parent for any dialogs that are shown.
        /// </param>
        public Pixbuf LoadThumbnail(string filename, int maxWidth, int maxHeight, Gtk.Window parent)
        {
            int width = -1, height = -1, stride = -1;

            byte[] image_data = null;

            if (!LoadImage(filename, ref image_data, ref width, ref height, ref stride, parent))
            {
                return(null);
            }

            using (var surf = new Cairo.ImageSurface(image_data, Cairo.Format.ARGB32, width, height, stride)) {
                return(surf.ToPixbuf());
            }
        }