/* ----------------------------------------------------------------- */ /// /// GetImagePage /// /// <summary> /// Gets a Page object from the specified file. /// </summary> /// /// <param name="io">I/O object.</param> /// <param name="src">File path of the Image.</param> /// <param name="index">Index of the Image.</param> /// /// <returns>Page object.</returns> /// /* ----------------------------------------------------------------- */ public static Page GetImagePage(this FileSystem.IO io, string src, int index) { using (var ss = io.OpenRead(src)) using (var image = Image.FromStream(ss)) { return(io.GetImagePage(src, image, index)); } }
/* ----------------------------------------------------------------- */ /// /// GetImagePage /// /// <summary> /// Gets a Page object from the specified image. /// </summary> /// /// <param name="io">I/O object.</param> /// <param name="src">File path of the Image.</param> /// <param name="image">Image object.</param> /// <param name="index">Index of the Image.</param> /// /// <returns>Page object.</returns> /// /* ----------------------------------------------------------------- */ public static Page GetImagePage(this FileSystem.IO io, string src, Image image, int index) { Debug.Assert(image != null); Debug.Assert(image.FrameDimensionsList != null); Debug.Assert(image.FrameDimensionsList.Length > 0); return(io.GetImagePage(src, image, index, new FrameDimension(image.FrameDimensionsList[0]))); }
/* ----------------------------------------------------------------- */ /// /// GetImagePage /// /// <summary> /// Gets a Page collection from the specified Image. /// </summary> /// /// <param name="io">I/O object.</param> /// <param name="src">File path of the Image.</param> /// <param name="image">Image object.</param> /// /// <returns>Page collection.</returns> /// /* ----------------------------------------------------------------- */ public static IEnumerable <Page> GetImagePages(this FileSystem.IO io, string src, Image image) { var dest = new List <Page>(); var dim = new FrameDimension(image.FrameDimensionsList[0]); for (var i = 0; i < image.GetFrameCount(dim); ++i) { dest.Add(io.GetImagePage(src, image, i, dim)); } return(dest); }
/* ----------------------------------------------------------------- */ /// /// GetImagePage /// /// <summary> /// Gets a Page object from the specified image. /// </summary> /// /// <param name="io">I/O object.</param> /// <param name="src">File path of the Image.</param> /// <param name="image">Image object.</param> /// <param name="index">Index of the Image.</param> /// /// <returns>Page object.</returns> /// /* ----------------------------------------------------------------- */ public static Page GetImagePage(this FileSystem.IO io, string src, Image image, int index) => io.GetImagePage(src, image, index, new FrameDimension(image.FrameDimensionsList[0]));