From bbc2c7d45bd69c52d9b7f0f3d9125a319c0d8541 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 24 Mar 2023 13:08:36 +0100 Subject: [PATCH] Regenerate methods/enums for libvips 8.14 --- CHANGELOG.md | 1 + .../Samples/GenerateImageClass.cs | 12 +- src/NetVips/Enums.cs | 50 +- src/NetVips/GValue.cs | 2 +- src/NetVips/Image.Generated.cs | 539 +++++++++++------- src/NetVips/Image.cs | 6 +- src/NetVips/MutableImage.Generated.cs | 2 +- src/NetVips/Operation.cs | 2 +- tests/NetVips.Tests/Helper.cs | 2 +- tests/NetVips.Tests/IoFuncsTests.cs | 4 +- 10 files changed, 406 insertions(+), 214 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 708fba5b..30db784d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Ensure code is AOT-friendly ([#196](https://github.com/kleisauke/net-vips/issues/196)). ### Changed +- Update methods/enums for libvips 8.14. - The [NetVips.Extensions](https://www.nuget.org/packages/NetVips.Extensions/) package is now only supported on Windows when targeting .NET 7.0. See https://aka.ms/systemdrawingnonwindows for more information. ## [2.2.0] - 2022-07-25 diff --git a/samples/NetVips.Samples/Samples/GenerateImageClass.cs b/samples/NetVips.Samples/Samples/GenerateImageClass.cs index c7cb6384..2a66f8fb 100644 --- a/samples/NetVips.Samples/Samples/GenerateImageClass.cs +++ b/samples/NetVips.Samples/Samples/GenerateImageClass.cs @@ -58,9 +58,12 @@ public GenerateImageClass() _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsDirection"), "Enums.Direction"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsExtend"), "Enums.Extend"); _gTypeToCSharpDict.Add(FailOnType, "Enums.FailOn"); - _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignDzContainer"), "Enums.ForeignDzContainer"); + if (NetVips.TypeFind("VipsOperation", "dzsave") != IntPtr.Zero) + { + _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignDzContainer"), "Enums.ForeignDzContainer"); + _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignDzLayout"), "Enums.ForeignDzLayout"); + } _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignDzDepth"), "Enums.ForeignDzDepth"); - _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignDzLayout"), "Enums.ForeignDzLayout"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignHeifCompression"), "Enums.ForeignHeifCompression"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignPpmFormat"), "Enums.ForeignPpmFormat"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignSubsample"), "Enums.ForeignSubsample"); @@ -85,6 +88,11 @@ public GenerateImageClass() _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsPrecision"), "Enums.Precision"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsRegionShrink"), "Enums.RegionShrink"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsSize"), "Enums.Size"); + if (NetVips.AtLeastLibvips(8, 14)) + { + _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsTextWrap"), "Enums.TextWrap"); + _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignHeifEncoder"), "Enums.ForeignHeifEncoder"); + } // Flags _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignFlags"), "Enums.ForeignFlags"); diff --git a/src/NetVips/Enums.cs b/src/NetVips/Enums.cs index 074a188a..cf9fb38e 100644 --- a/src/NetVips/Enums.cs +++ b/src/NetVips/Enums.cs @@ -508,6 +508,31 @@ public enum ForeignPngFilter All = None | Sub | Up | Avg | Paeth // "all" } + /// + /// The selected encoder to use. + /// + /// + /// If libheif hasn't been compiled with the selected encoder, it will + /// fallback to the default encoder based on . + /// + public enum ForeignHeifEncoder + { + /// Pick encoder automatically. + Auto = 0, // "auto" + + /// AOM + Aom = 1, // "aom" + + /// RAV1E + Rav1e = 2, // "rav1e" + + /// SVT-AV1 + Svt = 3, // "svt" + + /// x265 + X265 = 4 // "x265" + } + /// /// The netpbm file format to save as. /// @@ -523,7 +548,10 @@ public enum ForeignPpmFormat Ppm = 2, // "ppm" /// Images are 32-bit float pixels. - Pfm = 3 // "pfm" + Pfm = 3, // "pfm" + + /// Images are anymap images -- the image format is used to pick the saver. + Pnm = 4 // "pnm" } /// @@ -649,7 +677,7 @@ public enum Intent /// /// Pick the algorithm vips uses to decide image "interestingness". - /// This is used by , for example, to decide what parts of the image to keep. + /// This is used by , for example, to decide what parts of the image to keep. /// public enum Interesting { @@ -1049,6 +1077,24 @@ public enum Size Force = 3 // "force" } + /// + /// Sets the word wrapping style for when used with a maximum width. + /// + public enum TextWrap + { + /// Wrap at word boundaries. + Word = 0, // "word" + + /// Wrap at character boundaries. + Char = 1, // "char" + + /// Wrap at word boundaries, but fall back to character boundaries if there is not enough space for a full word. + WordChar = 2, // "word-char" + + /// No wrapping. + None = 3 // "none" + } + #endregion /// diff --git a/src/NetVips/GValue.cs b/src/NetVips/GValue.cs index b120f419..5dd4ebe6 100644 --- a/src/NetVips/GValue.cs +++ b/src/NetVips/GValue.cs @@ -29,7 +29,7 @@ public class GValue : IDisposable internal Internal.GValue.Struct Struct; /// - /// Track whether has been called. + /// Track whether has been called. /// private bool _disposed; diff --git a/src/NetVips/Image.Generated.cs b/src/NetVips/Image.Generated.cs index 982aa564..b9b86e8f 100644 --- a/src/NetVips/Image.Generated.cs +++ b/src/NetVips/Image.Generated.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// libvips version: 8.13.1 +// libvips version: 8.14.2 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -1909,8 +1909,8 @@ public double[] Getpoint(int x, int y) /// /// /// Filename to load from. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -1938,8 +1938,8 @@ public static Image Gifload(string filename, int? n = null, int? page = null, bo /// /// Filename to load from. /// Flags for this file. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -1973,8 +1973,8 @@ public static Image Gifload(string filename, out Enums.ForeignFlags flags, int? /// /// /// Buffer to load from. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -2002,8 +2002,8 @@ public static Image GifloadBuffer(byte[] buffer, int? n = null, int? page = null /// /// Buffer to load from. /// Flags for this file. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -2037,8 +2037,8 @@ public static Image GifloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, i /// /// /// Source to load from. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -2065,8 +2065,8 @@ public static Image GifloadSource(Source source, int? n = null, int? page = null /// /// /// Stream to load from. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -2091,8 +2091,8 @@ public static Image GifloadStream(Stream stream, int? n = null, int? page = null /// /// Source to load from. /// Flags for this file. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -2127,8 +2127,8 @@ public static Image GifloadSource(Source source, out Enums.ForeignFlags flags, i /// /// Stream to load from. /// Flags for this file. - /// Load this many pages. - /// Load this page from the file. + /// Number of pages to load, -1 for all. + /// First page to load. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -2148,7 +2148,7 @@ public static Image GifloadStream(Stream stream, out Enums.ForeignFlags flags, i /// /// /// - /// in.Gifsave(filename, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reoptimise: bool, interpaletteMaxerror: double, strip: bool, background: double[], pageHeight: int); + /// in.Gifsave(filename, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, strip: bool, background: double[], pageHeight: int); /// /// /// Filename to save to. @@ -2156,12 +2156,13 @@ public static Image GifloadStream(Stream stream, out Enums.ForeignFlags flags, i /// Quantisation effort. /// Number of bits per pixel. /// Maximum inter-frame error for transparency. - /// Reoptimise colour palettes. + /// Reuse palette from input. /// Maximum inter-palette error for palette reusage. + /// Generate an interlaced (progressive) GIF. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. - public void Gifsave(string filename, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reoptimise = null, double? interpaletteMaxerror = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public void Gifsave(string filename, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? strip = null, double[] background = null, int? pageHeight = null) { var options = new VOption(); @@ -2169,8 +2170,9 @@ public void Gifsave(string filename, double? dither = null, int? effort = null, options.AddIfPresent(nameof(effort), effort); options.AddIfPresent(nameof(bitdepth), bitdepth); options.AddIfPresent("interframe_maxerror", interframeMaxerror); - options.AddIfPresent(nameof(reoptimise), reoptimise); + options.AddIfPresent(nameof(reuse), reuse); options.AddIfPresent("interpalette_maxerror", interpaletteMaxerror); + options.AddIfPresent(nameof(interlace), interlace); options.AddIfPresent(nameof(strip), strip); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -2183,20 +2185,21 @@ public void Gifsave(string filename, double? dither = null, int? effort = null, /// /// /// - /// byte[] buffer = in.GifsaveBuffer(dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reoptimise: bool, interpaletteMaxerror: double, strip: bool, background: double[], pageHeight: int); + /// byte[] buffer = in.GifsaveBuffer(dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, strip: bool, background: double[], pageHeight: int); /// /// /// Amount of dithering. /// Quantisation effort. /// Number of bits per pixel. /// Maximum inter-frame error for transparency. - /// Reoptimise colour palettes. + /// Reuse palette from input. /// Maximum inter-palette error for palette reusage. + /// Generate an interlaced (progressive) GIF. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. /// An array of bytes. - public byte[] GifsaveBuffer(double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reoptimise = null, double? interpaletteMaxerror = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public byte[] GifsaveBuffer(double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? strip = null, double[] background = null, int? pageHeight = null) { var options = new VOption(); @@ -2204,8 +2207,9 @@ public byte[] GifsaveBuffer(double? dither = null, int? effort = null, int? bitd options.AddIfPresent(nameof(effort), effort); options.AddIfPresent(nameof(bitdepth), bitdepth); options.AddIfPresent("interframe_maxerror", interframeMaxerror); - options.AddIfPresent(nameof(reoptimise), reoptimise); + options.AddIfPresent(nameof(reuse), reuse); options.AddIfPresent("interpalette_maxerror", interpaletteMaxerror); + options.AddIfPresent(nameof(interlace), interlace); options.AddIfPresent(nameof(strip), strip); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -2218,7 +2222,7 @@ public byte[] GifsaveBuffer(double? dither = null, int? effort = null, int? bitd /// /// /// - /// in.GifsaveTarget(target, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reoptimise: bool, interpaletteMaxerror: double, strip: bool, background: double[], pageHeight: int); + /// in.GifsaveTarget(target, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, strip: bool, background: double[], pageHeight: int); /// /// /// Target to save to. @@ -2226,12 +2230,13 @@ public byte[] GifsaveBuffer(double? dither = null, int? effort = null, int? bitd /// Quantisation effort. /// Number of bits per pixel. /// Maximum inter-frame error for transparency. - /// Reoptimise colour palettes. + /// Reuse palette from input. /// Maximum inter-palette error for palette reusage. + /// Generate an interlaced (progressive) GIF. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. - public void GifsaveTarget(Target target, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reoptimise = null, double? interpaletteMaxerror = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public void GifsaveTarget(Target target, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? strip = null, double[] background = null, int? pageHeight = null) { var options = new VOption(); @@ -2239,8 +2244,9 @@ public void GifsaveTarget(Target target, double? dither = null, int? effort = nu options.AddIfPresent(nameof(effort), effort); options.AddIfPresent(nameof(bitdepth), bitdepth); options.AddIfPresent("interframe_maxerror", interframeMaxerror); - options.AddIfPresent(nameof(reoptimise), reoptimise); + options.AddIfPresent(nameof(reuse), reuse); options.AddIfPresent("interpalette_maxerror", interpaletteMaxerror); + options.AddIfPresent(nameof(interlace), interlace); options.AddIfPresent(nameof(strip), strip); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -2253,7 +2259,7 @@ public void GifsaveTarget(Target target, double? dither = null, int? effort = nu /// /// /// - /// in.GifsaveStream(stream, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reoptimise: bool, interpaletteMaxerror: double, strip: bool, background: double[], pageHeight: int); + /// in.GifsaveStream(stream, dither: double, effort: int, bitdepth: int, interframeMaxerror: double, reuse: bool, interpaletteMaxerror: double, interlace: bool, strip: bool, background: double[], pageHeight: int); /// /// /// Stream to save to. @@ -2261,15 +2267,16 @@ public void GifsaveTarget(Target target, double? dither = null, int? effort = nu /// Quantisation effort. /// Number of bits per pixel. /// Maximum inter-frame error for transparency. - /// Reoptimise colour palettes. + /// Reuse palette from input. /// Maximum inter-palette error for palette reusage. + /// Generate an interlaced (progressive) GIF. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. - public void GifsaveStream(Stream stream, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reoptimise = null, double? interpaletteMaxerror = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public void GifsaveStream(Stream stream, double? dither = null, int? effort = null, int? bitdepth = null, double? interframeMaxerror = null, bool? reuse = null, double? interpaletteMaxerror = null, bool? interlace = null, bool? strip = null, double[] background = null, int? pageHeight = null) { using var target = TargetStream.NewFromStream(stream); - GifsaveTarget(target, dither, effort, bitdepth, interframeMaxerror, reoptimise, interpaletteMaxerror, strip, background, pageHeight); + GifsaveTarget(target, dither, effort, bitdepth, interframeMaxerror, reuse, interpaletteMaxerror, interlace, strip, background, pageHeight); } /// @@ -2364,8 +2371,8 @@ public Image Grid(int tileHeight, int across, int down) /// /// /// Filename to load from. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2397,8 +2404,8 @@ public static Image Heifload(string filename, int? page = null, int? n = null, b /// /// Filename to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2436,8 +2443,8 @@ public static Image Heifload(string filename, out Enums.ForeignFlags flags, int? /// /// /// Buffer to load from. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2469,8 +2476,8 @@ public static Image HeifloadBuffer(byte[] buffer, int? page = null, int? n = nul /// /// Buffer to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2508,8 +2515,8 @@ public static Image HeifloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, /// /// /// Source to load from. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2540,8 +2547,8 @@ public static Image HeifloadSource(Source source, int? page = null, int? n = nul /// /// /// Stream to load from. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2568,8 +2575,8 @@ public static Image HeifloadStream(Stream stream, int? page = null, int? n = nul /// /// Source to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2608,8 +2615,8 @@ public static Image HeifloadSource(Source source, out Enums.ForeignFlags flags, /// /// Stream to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Fetch thumbnail image. /// Remove all denial of service limits. /// Force open via memory. @@ -2631,7 +2638,7 @@ public static Image HeifloadStream(Stream stream, out Enums.ForeignFlags flags, /// /// /// - /// in.Heifsave(filename, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, strip: bool, background: double[], pageHeight: int); + /// in.Heifsave(filename, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, strip: bool, background: double[], pageHeight: int); /// /// /// Filename to save to. @@ -2641,10 +2648,11 @@ public static Image HeifloadStream(Stream stream, out Enums.ForeignFlags flags, /// Compression format. /// CPU effort. /// Select chroma subsample operation mode. + /// Select encoder to use. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. - public void Heifsave(string filename, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public void Heifsave(string filename, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, bool? strip = null, double[] background = null, int? pageHeight = null) { var options = new VOption(); @@ -2654,6 +2662,7 @@ public void Heifsave(string filename, int? q = null, int? bitdepth = null, bool? options.AddIfPresent(nameof(compression), compression); options.AddIfPresent(nameof(effort), effort); options.AddIfPresent("subsample_mode", subsampleMode); + options.AddIfPresent(nameof(encoder), encoder); options.AddIfPresent(nameof(strip), strip); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -2666,7 +2675,7 @@ public void Heifsave(string filename, int? q = null, int? bitdepth = null, bool? /// /// /// - /// byte[] buffer = in.HeifsaveBuffer(q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, strip: bool, background: double[], pageHeight: int); + /// byte[] buffer = in.HeifsaveBuffer(q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, strip: bool, background: double[], pageHeight: int); /// /// /// Q factor. @@ -2675,11 +2684,12 @@ public void Heifsave(string filename, int? q = null, int? bitdepth = null, bool? /// Compression format. /// CPU effort. /// Select chroma subsample operation mode. + /// Select encoder to use. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. /// An array of bytes. - public byte[] HeifsaveBuffer(int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public byte[] HeifsaveBuffer(int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, bool? strip = null, double[] background = null, int? pageHeight = null) { var options = new VOption(); @@ -2689,6 +2699,7 @@ public byte[] HeifsaveBuffer(int? q = null, int? bitdepth = null, bool? lossless options.AddIfPresent(nameof(compression), compression); options.AddIfPresent(nameof(effort), effort); options.AddIfPresent("subsample_mode", subsampleMode); + options.AddIfPresent(nameof(encoder), encoder); options.AddIfPresent(nameof(strip), strip); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -2701,7 +2712,7 @@ public byte[] HeifsaveBuffer(int? q = null, int? bitdepth = null, bool? lossless /// /// /// - /// in.HeifsaveTarget(target, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, strip: bool, background: double[], pageHeight: int); + /// in.HeifsaveTarget(target, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, strip: bool, background: double[], pageHeight: int); /// /// /// Target to save to. @@ -2711,10 +2722,11 @@ public byte[] HeifsaveBuffer(int? q = null, int? bitdepth = null, bool? lossless /// Compression format. /// CPU effort. /// Select chroma subsample operation mode. + /// Select encoder to use. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. - public void HeifsaveTarget(Target target, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public void HeifsaveTarget(Target target, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, bool? strip = null, double[] background = null, int? pageHeight = null) { var options = new VOption(); @@ -2724,6 +2736,7 @@ public void HeifsaveTarget(Target target, int? q = null, int? bitdepth = null, b options.AddIfPresent(nameof(compression), compression); options.AddIfPresent(nameof(effort), effort); options.AddIfPresent("subsample_mode", subsampleMode); + options.AddIfPresent(nameof(encoder), encoder); options.AddIfPresent(nameof(strip), strip); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -2736,7 +2749,7 @@ public void HeifsaveTarget(Target target, int? q = null, int? bitdepth = null, b /// /// /// - /// in.HeifsaveStream(stream, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, strip: bool, background: double[], pageHeight: int); + /// in.HeifsaveStream(stream, q: int, bitdepth: int, lossless: bool, compression: Enums.ForeignHeifCompression, effort: int, subsampleMode: Enums.ForeignSubsample, encoder: Enums.ForeignHeifEncoder, strip: bool, background: double[], pageHeight: int); /// /// /// Stream to save to. @@ -2746,13 +2759,14 @@ public void HeifsaveTarget(Target target, int? q = null, int? bitdepth = null, b /// Compression format. /// CPU effort. /// Select chroma subsample operation mode. + /// Select encoder to use. /// Strip all metadata from image. /// Background value. /// Set page height for multipage save. - public void HeifsaveStream(Stream stream, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, bool? strip = null, double[] background = null, int? pageHeight = null) + public void HeifsaveStream(Stream stream, int? q = null, int? bitdepth = null, bool? lossless = null, Enums.ForeignHeifCompression? compression = null, int? effort = null, Enums.ForeignSubsample? subsampleMode = null, Enums.ForeignHeifEncoder? encoder = null, bool? strip = null, double[] background = null, int? pageHeight = null) { using var target = TargetStream.NewFromStream(stream); - HeifsaveTarget(target, q, bitdepth, lossless, compression, effort, subsampleMode, strip, background, pageHeight); + HeifsaveTarget(target, q, bitdepth, lossless, compression, effort, subsampleMode, encoder, strip, background, pageHeight); } /// @@ -4627,8 +4641,8 @@ public static Image Logmat(double sigma, double minAmpl, bool? separable = null, /// /// Filename to load from. /// Canvas resolution for rendering vector formats like SVG. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -4658,8 +4672,8 @@ public static Image Magickload(string filename, string density = null, int? page /// Filename to load from. /// Flags for this file. /// Canvas resolution for rendering vector formats like SVG. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -4695,8 +4709,8 @@ public static Image Magickload(string filename, out Enums.ForeignFlags flags, st /// /// Buffer to load from. /// Canvas resolution for rendering vector formats like SVG. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -4726,8 +4740,8 @@ public static Image MagickloadBuffer(byte[] buffer, string density = null, int? /// Buffer to load from. /// Flags for this file. /// Canvas resolution for rendering vector formats like SVG. - /// Load this page from the file. - /// Load this many pages. + /// First page to load. + /// Number of pages to load, -1 for all. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -6617,26 +6631,28 @@ public static Image Openexrload(string filename, out Enums.ForeignFlags flags, b /// /// /// - /// using Image @out = NetVips.Image.Openslideload(filename, attachAssociated: bool, level: int, autocrop: bool, associated: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn); + /// using Image @out = NetVips.Image.Openslideload(filename, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn); /// /// /// Filename to load from. - /// Attach all associated images. /// Load this level from the file. /// Crop to image bounds. /// Load this associated image. + /// Attach all associated images. + /// Output RGB (not RGBA). /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. /// A new . - public static Image Openslideload(string filename, bool? attachAssociated = null, int? level = null, bool? autocrop = null, string associated = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) + public static Image Openslideload(string filename, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) { var options = new VOption(); - options.AddIfPresent("attach_associated", attachAssociated); options.AddIfPresent(nameof(level), level); options.AddIfPresent(nameof(autocrop), autocrop); options.AddIfPresent(nameof(associated), associated); + options.AddIfPresent("attach_associated", attachAssociated); + options.AddIfPresent(nameof(rgb), rgb); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -6649,27 +6665,29 @@ public static Image Openslideload(string filename, bool? attachAssociated = null /// /// /// - /// using Image @out = NetVips.Image.Openslideload(filename, out var flags, attachAssociated: bool, level: int, autocrop: bool, associated: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn); + /// using Image @out = NetVips.Image.Openslideload(filename, out var flags, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn); /// /// /// Filename to load from. /// Flags for this file. - /// Attach all associated images. /// Load this level from the file. /// Crop to image bounds. /// Load this associated image. + /// Attach all associated images. + /// Output RGB (not RGBA). /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. /// A new . - public static Image Openslideload(string filename, out Enums.ForeignFlags flags, bool? attachAssociated = null, int? level = null, bool? autocrop = null, string associated = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) + public static Image Openslideload(string filename, out Enums.ForeignFlags flags, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) { var options = new VOption(); - options.AddIfPresent("attach_associated", attachAssociated); options.AddIfPresent(nameof(level), level); options.AddIfPresent(nameof(autocrop), autocrop); options.AddIfPresent(nameof(associated), associated); + options.AddIfPresent("attach_associated", attachAssociated); + options.AddIfPresent(nameof(rgb), rgb); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -6689,26 +6707,28 @@ public static Image Openslideload(string filename, out Enums.ForeignFlags flags, /// /// /// - /// using Image @out = NetVips.Image.OpenslideloadSource(source, attachAssociated: bool, level: int, autocrop: bool, associated: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn); + /// using Image @out = NetVips.Image.OpenslideloadSource(source, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn); /// /// /// Source to load from. - /// Attach all associated images. /// Load this level from the file. /// Crop to image bounds. /// Load this associated image. + /// Attach all associated images. + /// Output RGB (not RGBA). /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. /// A new . - public static Image OpenslideloadSource(Source source, bool? attachAssociated = null, int? level = null, bool? autocrop = null, string associated = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) + public static Image OpenslideloadSource(Source source, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) { var options = new VOption(); - options.AddIfPresent("attach_associated", attachAssociated); options.AddIfPresent(nameof(level), level); options.AddIfPresent(nameof(autocrop), autocrop); options.AddIfPresent(nameof(associated), associated); + options.AddIfPresent("attach_associated", attachAssociated); + options.AddIfPresent(nameof(rgb), rgb); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -6721,22 +6741,23 @@ public static Image OpenslideloadSource(Source source, bool? attachAssociated = /// /// /// - /// using Image @out = NetVips.Image.OpenslideloadStream(stream, attachAssociated: bool, level: int, autocrop: bool, associated: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn); + /// using Image @out = NetVips.Image.OpenslideloadStream(stream, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn); /// /// /// Stream to load from. - /// Attach all associated images. /// Load this level from the file. /// Crop to image bounds. /// Load this associated image. + /// Attach all associated images. + /// Output RGB (not RGBA). /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. /// A new . - public static Image OpenslideloadStream(Stream stream, bool? attachAssociated = null, int? level = null, bool? autocrop = null, string associated = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) + public static Image OpenslideloadStream(Stream stream, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) { var source = SourceStream.NewFromStream(stream); - var image = OpenslideloadSource(source, attachAssociated, level, autocrop, associated, memory, access, failOn); + var image = OpenslideloadSource(source, level, autocrop, associated, attachAssociated, rgb, memory, access, failOn); image.OnPostClose += () => source.Dispose(); @@ -6748,27 +6769,29 @@ public static Image OpenslideloadStream(Stream stream, bool? attachAssociated = /// /// /// - /// using Image @out = NetVips.Image.OpenslideloadSource(source, out var flags, attachAssociated: bool, level: int, autocrop: bool, associated: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn); + /// using Image @out = NetVips.Image.OpenslideloadSource(source, out var flags, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn); /// /// /// Source to load from. /// Flags for this file. - /// Attach all associated images. /// Load this level from the file. /// Crop to image bounds. /// Load this associated image. + /// Attach all associated images. + /// Output RGB (not RGBA). /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. /// A new . - public static Image OpenslideloadSource(Source source, out Enums.ForeignFlags flags, bool? attachAssociated = null, int? level = null, bool? autocrop = null, string associated = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) + public static Image OpenslideloadSource(Source source, out Enums.ForeignFlags flags, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) { var options = new VOption(); - options.AddIfPresent("attach_associated", attachAssociated); options.AddIfPresent(nameof(level), level); options.AddIfPresent(nameof(autocrop), autocrop); options.AddIfPresent(nameof(associated), associated); + options.AddIfPresent("attach_associated", attachAssociated); + options.AddIfPresent(nameof(rgb), rgb); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -6788,23 +6811,24 @@ public static Image OpenslideloadSource(Source source, out Enums.ForeignFlags fl /// /// /// - /// using Image @out = NetVips.Image.OpenslideloadStream(stream, out var flags, attachAssociated: bool, level: int, autocrop: bool, associated: string, memory: bool, access: Enums.Access, failOn: Enums.FailOn); + /// using Image @out = NetVips.Image.OpenslideloadStream(stream, out var flags, level: int, autocrop: bool, associated: string, attachAssociated: bool, rgb: bool, memory: bool, access: Enums.Access, failOn: Enums.FailOn); /// /// /// Stream to load from. /// Flags for this file. - /// Attach all associated images. /// Load this level from the file. /// Crop to image bounds. /// Load this associated image. + /// Attach all associated images. + /// Output RGB (not RGBA). /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. /// A new . - public static Image OpenslideloadStream(Stream stream, out Enums.ForeignFlags flags, bool? attachAssociated = null, int? level = null, bool? autocrop = null, string associated = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) + public static Image OpenslideloadStream(Stream stream, out Enums.ForeignFlags flags, int? level = null, bool? autocrop = null, string associated = null, bool? attachAssociated = null, bool? rgb = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null) { var source = SourceStream.NewFromStream(stream); - var image = OpenslideloadSource(source, out flags, attachAssociated, level, autocrop, associated, memory, access, failOn); + var image = OpenslideloadSource(source, out flags, level, autocrop, associated, attachAssociated, rgb, memory, access, failOn); image.OnPostClose += () => source.Dispose(); @@ -6820,12 +6844,12 @@ public static Image OpenslideloadStream(Stream stream, out Enums.ForeignFlags fl /// /// /// Filename to load from. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -6857,12 +6881,12 @@ public static Image Pdfload(string filename, int? page = null, int? n = null, do /// /// Filename to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -6900,12 +6924,12 @@ public static Image Pdfload(string filename, out Enums.ForeignFlags flags, int? /// /// /// Buffer to load from. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -6937,12 +6961,12 @@ public static Image PdfloadBuffer(byte[] buffer, int? page = null, int? n = null /// /// Buffer to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -6980,12 +7004,12 @@ public static Image PdfloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, i /// /// /// Source to load from. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -7016,12 +7040,12 @@ public static Image PdfloadSource(Source source, int? page = null, int? n = null /// /// /// Stream to load from. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -7046,12 +7070,12 @@ public static Image PdfloadStream(Stream stream, int? page = null, int? n = null /// /// Source to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -7090,12 +7114,12 @@ public static Image PdfloadSource(Source source, out Enums.ForeignFlags flags, i /// /// Stream to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Render at this DPI. - /// Scale output by this factor. - /// Background value. - /// Decrypt with this password. + /// First page to load. + /// Number of pages to load, -1 for all. + /// DPI to render at. + /// Factor to scale by. + /// Background colour. + /// Password to decrypt with. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -8834,6 +8858,67 @@ public Image Smartcrop(int width, int height, Enums.Interesting? interesting = n return this.Call("smartcrop", options, width, height) as Image; } + /// + /// Extract an area from an image. + /// + /// + /// + /// using Image @out = input.Smartcrop(width, height, out var attentionX, interesting: Enums.Interesting); + /// + /// + /// Width of extract area. + /// Height of extract area. + /// Horizontal position of attention centre. + /// How to measure interestingness. + /// A new . + public Image Smartcrop(int width, int height, out int attentionX, Enums.Interesting? interesting = null) + { + var options = new VOption(); + + options.AddIfPresent(nameof(interesting), interesting); + + options.Add("attention_x", true); + + var results = this.Call("smartcrop", options, width, height) as object[]; + var finalResult = results?[0] as Image; + var opts = results?[1] as VOption; + attentionX = opts?["attention_x"] is int out1 ? out1 : 0; + + return finalResult; + } + + /// + /// Extract an area from an image. + /// + /// + /// + /// using Image @out = input.Smartcrop(width, height, out var attentionX, out var attentionY, interesting: Enums.Interesting); + /// + /// + /// Width of extract area. + /// Height of extract area. + /// Horizontal position of attention centre. + /// Vertical position of attention centre. + /// How to measure interestingness. + /// A new . + public Image Smartcrop(int width, int height, out int attentionX, out int attentionY, Enums.Interesting? interesting = null) + { + var options = new VOption(); + + options.AddIfPresent(nameof(interesting), interesting); + + options.Add("attention_x", true); + options.Add("attention_y", true); + + var results = this.Call("smartcrop", options, width, height) as object[]; + var finalResult = results?[0] as Image; + var opts = results?[1] as VOption; + attentionX = opts?["attention_x"] is int out1 ? out1 : 0; + attentionY = opts?["attention_y"] is int out2 ? out2 : 0; + + return finalResult; + } + /// /// Sobel edge detector. /// @@ -9358,7 +9443,7 @@ public static void System(string cmdFormat, out Image @out, out string log, Imag /// /// /// - /// using Image @out = NetVips.Image.Text(text, font: string, width: int, height: int, align: Enums.Align, rgba: bool, dpi: int, justify: bool, spacing: int, fontfile: string); + /// using Image @out = NetVips.Image.Text(text, font: string, width: int, height: int, align: Enums.Align, justify: bool, dpi: int, spacing: int, fontfile: string, rgba: bool, wrap: Enums.TextWrap); /// /// /// Text to render. @@ -9366,13 +9451,14 @@ public static void System(string cmdFormat, out Image @out, out string log, Imag /// Maximum image width in pixels. /// Maximum image height in pixels. /// Align on the low, centre or high edge. - /// Enable RGBA output. - /// DPI to render at. /// Justify lines. + /// DPI to render at. /// Line spacing. /// Load this font file. + /// Enable RGBA output. + /// Wrap lines on word or character boundaries. /// A new . - public static Image Text(string text, string font = null, int? width = null, int? height = null, Enums.Align? align = null, bool? rgba = null, int? dpi = null, bool? justify = null, int? spacing = null, string fontfile = null) + public static Image Text(string text, string font = null, int? width = null, int? height = null, Enums.Align? align = null, bool? justify = null, int? dpi = null, int? spacing = null, string fontfile = null, bool? rgba = null, Enums.TextWrap? wrap = null) { var options = new VOption(); @@ -9380,11 +9466,12 @@ public static Image Text(string text, string font = null, int? width = null, int options.AddIfPresent(nameof(width), width); options.AddIfPresent(nameof(height), height); options.AddIfPresent(nameof(align), align); - options.AddIfPresent(nameof(rgba), rgba); - options.AddIfPresent(nameof(dpi), dpi); options.AddIfPresent(nameof(justify), justify); + options.AddIfPresent(nameof(dpi), dpi); options.AddIfPresent(nameof(spacing), spacing); options.AddIfPresent(nameof(fontfile), fontfile); + options.AddIfPresent(nameof(rgba), rgba); + options.AddIfPresent(nameof(wrap), wrap); return Operation.Call("text", options, text) as Image; } @@ -9394,7 +9481,7 @@ public static Image Text(string text, string font = null, int? width = null, int /// /// /// - /// using Image @out = NetVips.Image.Text(text, out var autofitDpi, font: string, width: int, height: int, align: Enums.Align, rgba: bool, dpi: int, justify: bool, spacing: int, fontfile: string); + /// using Image @out = NetVips.Image.Text(text, out var autofitDpi, font: string, width: int, height: int, align: Enums.Align, justify: bool, dpi: int, spacing: int, fontfile: string, rgba: bool, wrap: Enums.TextWrap); /// /// /// Text to render. @@ -9403,13 +9490,14 @@ public static Image Text(string text, string font = null, int? width = null, int /// Maximum image width in pixels. /// Maximum image height in pixels. /// Align on the low, centre or high edge. - /// Enable RGBA output. - /// DPI to render at. /// Justify lines. + /// DPI to render at. /// Line spacing. /// Load this font file. + /// Enable RGBA output. + /// Wrap lines on word or character boundaries. /// A new . - public static Image Text(string text, out int autofitDpi, string font = null, int? width = null, int? height = null, Enums.Align? align = null, bool? rgba = null, int? dpi = null, bool? justify = null, int? spacing = null, string fontfile = null) + public static Image Text(string text, out int autofitDpi, string font = null, int? width = null, int? height = null, Enums.Align? align = null, bool? justify = null, int? dpi = null, int? spacing = null, string fontfile = null, bool? rgba = null, Enums.TextWrap? wrap = null) { var options = new VOption(); @@ -9417,11 +9505,12 @@ public static Image Text(string text, out int autofitDpi, string font = null, in options.AddIfPresent(nameof(width), width); options.AddIfPresent(nameof(height), height); options.AddIfPresent(nameof(align), align); - options.AddIfPresent(nameof(rgba), rgba); - options.AddIfPresent(nameof(dpi), dpi); options.AddIfPresent(nameof(justify), justify); + options.AddIfPresent(nameof(dpi), dpi); options.AddIfPresent(nameof(spacing), spacing); options.AddIfPresent(nameof(fontfile), fontfile); + options.AddIfPresent(nameof(rgba), rgba); + options.AddIfPresent(nameof(wrap), wrap); options.Add("autofit_dpi", true); @@ -9624,9 +9713,9 @@ public static Image ThumbnailStream(Stream stream, int width, string optionStrin /// /// /// Filename to load from. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9657,9 +9746,9 @@ public static Image Tiffload(string filename, int? page = null, int? subifd = nu /// /// Filename to load from. /// Flags for this file. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9696,9 +9785,9 @@ public static Image Tiffload(string filename, out Enums.ForeignFlags flags, int? /// /// /// Buffer to load from. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9729,9 +9818,9 @@ public static Image TiffloadBuffer(byte[] buffer, int? page = null, int? subifd /// /// Buffer to load from. /// Flags for this file. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9768,9 +9857,9 @@ public static Image TiffloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, /// /// /// Source to load from. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9800,9 +9889,9 @@ public static Image TiffloadSource(Source source, int? page = null, int? subifd /// /// /// Stream to load from. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9828,9 +9917,9 @@ public static Image TiffloadStream(Stream stream, int? page = null, int? subifd /// /// Source to load from. /// Flags for this file. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -9868,9 +9957,9 @@ public static Image TiffloadSource(Source source, out Enums.ForeignFlags flags, /// /// Stream to load from. /// Flags for this file. - /// Load this page from the image. - /// Select subifd index. - /// Load this many pages. + /// First page to load. + /// Subifd index. + /// Number of pages to load, -1 for all. /// Rotate image using orientation tag. /// Force open via memory. /// Required access pattern for this file. @@ -10458,9 +10547,9 @@ public void VipssaveStream(Stream stream, bool? strip = null, double[] backgroun /// /// /// Filename to load from. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10489,9 +10578,9 @@ public static Image Webpload(string filename, int? page = null, int? n = null, d /// /// Filename to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10526,9 +10615,9 @@ public static Image Webpload(string filename, out Enums.ForeignFlags flags, int? /// /// /// Buffer to load from. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10557,9 +10646,9 @@ public static Image WebploadBuffer(byte[] buffer, int? page = null, int? n = nul /// /// Buffer to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10594,9 +10683,9 @@ public static Image WebploadBuffer(byte[] buffer, out Enums.ForeignFlags flags, /// /// /// Source to load from. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10624,9 +10713,9 @@ public static Image WebploadSource(Source source, int? page = null, int? n = nul /// /// /// Stream to load from. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10651,9 +10740,9 @@ public static Image WebploadStream(Stream stream, int? page = null, int? n = nul /// /// Source to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10689,9 +10778,9 @@ public static Image WebploadSource(Source source, out Enums.ForeignFlags flags, /// /// Stream to load from. /// Flags for this file. - /// Load this page from the file. - /// Load this many pages. - /// Scale factor on load. + /// First page to load. + /// Number of pages to load, -1 for all. + /// Factor to scale by. /// Force open via memory. /// Required access pattern for this file. /// Error level to fail on. @@ -10707,7 +10796,7 @@ public static Image WebploadStream(Stream stream, out Enums.ForeignFlags flags, } /// - /// Save image to webp file. + /// Save as WebP. /// /// /// @@ -10754,7 +10843,7 @@ public void Webpsave(string filename, int? q = null, bool? lossless = null, Enum } /// - /// Save image to webp buffer. + /// Save as WebP. /// /// /// @@ -10801,7 +10890,53 @@ public byte[] WebpsaveBuffer(int? q = null, bool? lossless = null, Enums.Foreign } /// - /// Save image to webp target. + /// Save image to webp mime. + /// + /// + /// + /// in.WebpsaveMime(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, profile: string, mixed: bool, strip: bool, background: double[], pageHeight: int); + /// + /// + /// Q factor. + /// Enable lossless compression. + /// Preset for lossy compression. + /// Enable high quality chroma subsampling. + /// Enable preprocessing in lossless mode (uses Q). + /// Change alpha plane fidelity for lossy compression. + /// Optimise for minimum size. + /// Minimum number of frames between key frames. + /// Maximum number of frames between key frames. + /// Level of CPU effort to reduce file size. + /// ICC profile to embed. + /// Allow mixed encoding (might reduce file size). + /// Strip all metadata from image. + /// Background value. + /// Set page height for multipage save. + public void WebpsaveMime(int? q = null, bool? lossless = null, Enums.ForeignWebpPreset? preset = null, bool? smartSubsample = null, bool? nearLossless = null, int? alphaQ = null, bool? minSize = null, int? kmin = null, int? kmax = null, int? effort = null, string profile = null, bool? mixed = null, bool? strip = null, double[] background = null, int? pageHeight = null) + { + var options = new VOption(); + + options.AddIfPresent("Q", q); + options.AddIfPresent(nameof(lossless), lossless); + options.AddIfPresent(nameof(preset), preset); + options.AddIfPresent("smart_subsample", smartSubsample); + options.AddIfPresent("near_lossless", nearLossless); + options.AddIfPresent("alpha_q", alphaQ); + options.AddIfPresent("min_size", minSize); + options.AddIfPresent(nameof(kmin), kmin); + options.AddIfPresent(nameof(kmax), kmax); + options.AddIfPresent(nameof(effort), effort); + options.AddIfPresent(nameof(profile), profile); + options.AddIfPresent(nameof(mixed), mixed); + options.AddIfPresent(nameof(strip), strip); + options.AddIfPresent(nameof(background), background); + options.AddIfPresent("page_height", pageHeight); + + this.Call("webpsave_mime", options); + } + + /// + /// Save as WebP. /// /// /// @@ -10848,7 +10983,7 @@ public void WebpsaveTarget(Target target, int? q = null, bool? lossless = null, } /// - /// Save image to webp stream. + /// Save as WebP. /// /// /// diff --git a/src/NetVips/Image.cs b/src/NetVips/Image.cs index 884dc250..b853bec3 100644 --- a/src/NetVips/Image.cs +++ b/src/NetVips/Image.cs @@ -21,7 +21,7 @@ public partial class Image : VipsObject /// signals. /// /// - /// Use to enable progress reporting on an image. + /// Use to enable progress reporting on an image. /// public delegate void EvalDelegate(Image image, VipsProgress progressStruct); @@ -725,7 +725,7 @@ public static Image NewFromMemory( } /// - /// Like , but libvips + /// Like , but libvips /// will make a copy of the memory area. This means more memory use and an extra copy /// operation, but is much simpler and safer. /// @@ -2133,7 +2133,7 @@ void EvalMarshal(IntPtr imagePtr, VipsProgress progress, IntPtr userDataPtr) /// indirectly, are also dropped from the libvips operation cache. /// /// This method can be useful if you wrap a libvips image around an array - /// with + /// with /// and then change some bytes without libvips knowing. /// public void Invalidate() diff --git a/src/NetVips/MutableImage.Generated.cs b/src/NetVips/MutableImage.Generated.cs index dd1e60a8..bbe2f571 100644 --- a/src/NetVips/MutableImage.Generated.cs +++ b/src/NetVips/MutableImage.Generated.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// libvips version: 8.13.1 +// libvips version: 8.14.2 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/NetVips/Operation.cs b/src/NetVips/Operation.cs index f32bf0f7..05fc4615 100644 --- a/src/NetVips/Operation.cs +++ b/src/NetVips/Operation.cs @@ -22,7 +22,7 @@ private Operation(IntPtr pointer) /// /// /// You'll need to set any arguments and build the operation before you can use it. See - /// for a higher-level way to make new operations. + /// for a higher-level way to make new operations. /// /// Nickname of operation to create. /// The new operation. diff --git a/tests/NetVips.Tests/Helper.cs b/tests/NetVips.Tests/Helper.cs index 7f75fcff..30d0e81e 100644 --- a/tests/NetVips.Tests/Helper.cs +++ b/tests/NetVips.Tests/Helper.cs @@ -459,7 +459,7 @@ public ObjectComparerDelta(double delta) var a = Convert.ToDouble(x); var b = Convert.ToDouble(y); - return Math.Abs(a - b) < delta; + return Math.Abs(a - b) <= delta; } public int GetHashCode(object obj) diff --git a/tests/NetVips.Tests/IoFuncsTests.cs b/tests/NetVips.Tests/IoFuncsTests.cs index f9eda391..046f1ba5 100644 --- a/tests/NetVips.Tests/IoFuncsTests.cs +++ b/tests/NetVips.Tests/IoFuncsTests.cs @@ -222,9 +222,11 @@ public void TestInvalidate() Assert.Equal(data[0], point[0]); } - [Fact] + [SkippableFact] public void TestSetProgress() { + Skip.IfNot(Helper.Have("dzsave"), "no dzsave support, skipping test"); + var im = Image.NewFromFile(Helper.JpegFile, access: Enums.Access.Sequential); var lastPercent = 0;