diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1fbb5..9fc2a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Add support for a single shared libvips binary on Windows ([#211](https://github.com/kleisauke/net-vips/issues/211)). - Add `ReadOnlySpan` / `ReadOnlyMemory` overloads ([#225](https://github.com/kleisauke/net-vips/issues/225)). +### Changed +- Update methods/enums for libvips 8.16. + ### Removed - Drop support for .NET Standard 2.0 and Mono. NetVips now targets .NET 6 (`net6.0`) and .NET Framework 4.5.2 (`net452`) moving forward. See https://devblogs.microsoft.com/dotnet/the-future-of-net-standard/ for more information. diff --git a/samples/NetVips.Samples/Samples/GenerateImageClass.cs b/samples/NetVips.Samples/Samples/GenerateImageClass.cs index f33fff8..e6765f9 100644 --- a/samples/NetVips.Samples/Samples/GenerateImageClass.cs +++ b/samples/NetVips.Samples/Samples/GenerateImageClass.cs @@ -104,6 +104,11 @@ public GenerateImageClass() _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignHeifEncoder"), "Enums.ForeignHeifEncoder"); } + if (NetVips.AtLeastLibvips(8, 16)) + { + _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsSdfShape"), "Enums.SdfShape"); + } + // Flags _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignFlags"), "Enums.ForeignFlags"); _gTypeToCSharpDict.Add(NetVips.TypeFromName("VipsForeignPngFilter"), "Enums.ForeignPngFilter"); diff --git a/src/NetVips/Enums.cs b/src/NetVips/Enums.cs index 48a9e68..c61a9d7 100644 --- a/src/NetVips/Enums.cs +++ b/src/NetVips/Enums.cs @@ -1084,6 +1084,24 @@ public enum RegionShrink Nearest = 5 // "nearest" } + /// + /// The SDF to generate. + /// + /// + /// See for example . + /// + public enum SdfShape + { + /// A circle at @a, radius @r. + Circle = 0, // "circle" + /// A box from @a to @b. + Box = 1, // "box" + /// A box with rounded @corners from @a to @b. + RoundedBox = 2, // "rounded-box" + /// A line from @a to @b. + Line = 3 // "line" + } + /// /// Controls whether an operation should upsize, downsize, both up and downsize, or force a size. /// diff --git a/src/NetVips/Image.Generated.cs b/src/NetVips/Image.Generated.cs index 3a065d5..8199837 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.15.0 +// libvips version: 8.16.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -417,29 +417,6 @@ public Image Byteswap() return this.Call("byteswap") as Image; } - /// - /// Cache an image. - /// - /// - /// - /// using Image @out = in.Cache(maxTiles: int, tileHeight: int, tileWidth: int); - /// - /// - /// Maximum number of tiles to cache. - /// Tile height in pixels. - /// Tile width in pixels. - /// A new . - public Image Cache(int? maxTiles = null, int? tileHeight = null, int? tileWidth = null) - { - var options = new VOption(); - - options.AddIfPresent("max_tiles", maxTiles); - options.AddIfPresent("tile_height", tileHeight); - options.AddIfPresent("tile_width", tileWidth); - - return this.Call("cache", options) as Image; - } - /// /// Canny edge detector. /// @@ -481,6 +458,27 @@ public Image Cast(Enums.BandFormat format, bool? shift = null) return this.Call("cast", options, format) as Image; } + /// + /// Clamp values of an image. + /// + /// + /// + /// using Image @out = in.Clamp(min: double, max: double); + /// + /// + /// Minimum value. + /// Maximum value. + /// A new . + public Image Clamp(double? min = null, double? max = null) + { + var options = new VOption(); + + options.AddIfPresent(nameof(min), min); + options.AddIfPresent(nameof(max), max); + + return this.Call("clamp", options) as Image; + } + /// /// Transform LCh to CMC. /// @@ -1929,15 +1927,20 @@ public static Image Gaussnoise(int width, int height, double? sigma = null, doub /// /// /// - /// double[] outArray = in.Getpoint(x, y); + /// double[] outArray = in.Getpoint(x, y, unpackComplex: bool); /// /// /// Point to read. /// Point to read. + /// Complex pixels should be unpacked. /// An array of doubles. - public double[] Getpoint(int x, int y) + public double[] Getpoint(int x, int y, bool? unpackComplex = null) { - return this.Call("getpoint", x, y) as double[]; + var options = new VOption(); + + options.AddIfPresent("unpack_complex", unpackComplex); + + return this.Call("getpoint", options, x, y) as double[]; } /// @@ -3553,7 +3556,7 @@ public static Image Jp2kloadStream(Stream stream, out Enums.ForeignFlags flags, /// in.Jp2ksave(filename, tileWidth: int, tileHeight: int, lossless: bool, q: int, subsampleMode: Enums.ForeignSubsample, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// - /// Filename to load from. + /// Filename to save to. /// Tile width in pixels. /// Tile height in pixels. /// Enable lossless compression. @@ -4149,19 +4152,23 @@ public void JpegsaveStream(Stream stream, int? q = null, bool? optimizeCoding = /// /// /// - /// using Image @out = NetVips.Image.Jxlload(filename, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.Jxlload(filename, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Filename to load from. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image Jxlload(string filename, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image Jxlload(string filename, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var options = new VOption(); + options.AddIfPresent(nameof(page), page); + options.AddIfPresent(nameof(n), n); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -4175,20 +4182,24 @@ public static Image Jxlload(string filename, bool? memory = null, Enums.Access? /// /// /// - /// using Image @out = NetVips.Image.Jxlload(filename, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.Jxlload(filename, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Filename to load from. /// Flags for this file. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image Jxlload(string filename, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image Jxlload(string filename, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var options = new VOption(); + options.AddIfPresent(nameof(page), page); + options.AddIfPresent(nameof(n), n); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -4209,19 +4220,23 @@ public static Image Jxlload(string filename, out Enums.ForeignFlags flags, bool? /// /// /// - /// using Image @out = NetVips.Image.JxlloadBuffer(buffer, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.JxlloadBuffer(buffer, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Buffer to load from. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image JxlloadBuffer(byte[] buffer, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image JxlloadBuffer(byte[] buffer, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var options = new VOption(); + options.AddIfPresent(nameof(page), page); + options.AddIfPresent(nameof(n), n); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -4235,20 +4250,24 @@ public static Image JxlloadBuffer(byte[] buffer, bool? memory = null, Enums.Acce /// /// /// - /// using Image @out = NetVips.Image.JxlloadBuffer(buffer, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.JxlloadBuffer(buffer, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Buffer to load from. /// Flags for this file. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image JxlloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image JxlloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var options = new VOption(); + options.AddIfPresent(nameof(page), page); + options.AddIfPresent(nameof(n), n); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -4269,19 +4288,23 @@ public static Image JxlloadBuffer(byte[] buffer, out Enums.ForeignFlags flags, b /// /// /// - /// using Image @out = NetVips.Image.JxlloadSource(source, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.JxlloadSource(source, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Source to load from. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image JxlloadSource(Source source, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image JxlloadSource(Source source, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var options = new VOption(); + options.AddIfPresent(nameof(page), page); + options.AddIfPresent(nameof(n), n); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -4295,19 +4318,21 @@ public static Image JxlloadSource(Source source, bool? memory = null, Enums.Acce /// /// /// - /// using Image @out = NetVips.Image.JxlloadStream(stream, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.JxlloadStream(stream, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Stream to load from. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image JxlloadStream(Stream stream, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image JxlloadStream(Stream stream, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var source = SourceStream.NewFromStream(stream); - var image = JxlloadSource(source, memory, access, failOn, revalidate); + var image = JxlloadSource(source, page, n, memory, access, failOn, revalidate); image.OnPostClose += () => source.Dispose(); @@ -4319,20 +4344,24 @@ public static Image JxlloadStream(Stream stream, bool? memory = null, Enums.Acce /// /// /// - /// using Image @out = NetVips.Image.JxlloadSource(source, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.JxlloadSource(source, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Source to load from. /// Flags for this file. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image JxlloadSource(Source source, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image JxlloadSource(Source source, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var options = new VOption(); + options.AddIfPresent(nameof(page), page); + options.AddIfPresent(nameof(n), n); options.AddIfPresent(nameof(memory), memory); options.AddIfPresent(nameof(access), access); options.AddFailOn(failOn); @@ -4353,20 +4382,22 @@ public static Image JxlloadSource(Source source, out Enums.ForeignFlags flags, b /// /// /// - /// using Image @out = NetVips.Image.JxlloadStream(stream, out var flags, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); + /// using Image @out = NetVips.Image.JxlloadStream(stream, out var flags, page: int, n: int, memory: bool, access: Enums.Access, failOn: Enums.FailOn, revalidate: bool); /// /// /// Stream to load from. /// Flags for this file. + /// 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. /// Don't use a cached result for this operation. /// A new . - public static Image JxlloadStream(Stream stream, out Enums.ForeignFlags flags, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) + public static Image JxlloadStream(Stream stream, out Enums.ForeignFlags flags, int? page = null, int? n = null, bool? memory = null, Enums.Access? access = null, Enums.FailOn? failOn = null, bool? revalidate = null) { var source = SourceStream.NewFromStream(stream); - var image = JxlloadSource(source, out flags, memory, access, failOn, revalidate); + var image = JxlloadSource(source, out flags, page, n, memory, access, failOn, revalidate); image.OnPostClose += () => source.Dispose(); @@ -4381,7 +4412,7 @@ public static Image JxlloadStream(Stream stream, out Enums.ForeignFlags flags, b /// in.Jxlsave(filename, tier: int, distance: double, effort: int, lossless: bool, q: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// - /// Filename to load from. + /// Filename to save to. /// Decode speed tier. /// Target butteraugli distance. /// Encoding effort. @@ -5928,6 +5959,21 @@ public double Max(out int x, out int y, out double[] outArray, out int[] xArray, return finalResult; } + /// + /// Maximum of a pair of images. + /// + /// + /// + /// using Image @out = left.Maxpair(right); + /// + /// + /// Right-hand image argument. + /// A new . + public Image Maxpair(Image right) + { + return this.Call("maxpair", right) as Image; + } + /// /// Measure a set of patches on a color chart. /// @@ -6162,6 +6208,21 @@ public double Min(out int x, out int y, out double[] outArray, out int[] xArray, return finalResult; } + /// + /// Minimum of a pair of images. + /// + /// + /// + /// using Image @out = left.Minpair(right); + /// + /// + /// Right-hand image argument. + /// A new . + public Image Minpair(Image right) + { + return this.Call("minpair", right) as Image; + } + /// /// Morphology operation. /// @@ -8600,19 +8661,19 @@ public void Rawsave(string filename, Enums.ForeignKeep? keep = null, double[] ba } /// - /// Write raw image to file descriptor. + /// Write raw image to buffer. /// /// /// - /// in.RawsaveFd(fd, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// byte[] buffer = in.RawsaveBuffer(keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// - /// File descriptor to write to. /// Which metadata to retain. /// Background value. /// Set page height for multipage save. /// Filename of ICC profile to embed. - public void RawsaveFd(int fd, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + /// An array of bytes. + public byte[] RawsaveBuffer(Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) { var options = new VOption(); @@ -8621,7 +8682,51 @@ public void RawsaveFd(int fd, Enums.ForeignKeep? keep = null, double[] backgroun options.AddIfPresent("page_height", pageHeight); options.AddIfPresent(nameof(profile), profile); - this.Call("rawsave_fd", options, fd); + return this.Call("rawsave_buffer", options) as byte[]; + } + + /// + /// Write raw image to target. + /// + /// + /// + /// in.RawsaveTarget(target, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// + /// + /// Target to save to. + /// Which metadata to retain. + /// Background value. + /// Set page height for multipage save. + /// Filename of ICC profile to embed. + public void RawsaveTarget(Target target, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + { + var options = new VOption(); + + options.AddForeignKeep(keep); + options.AddIfPresent(nameof(background), background); + options.AddIfPresent("page_height", pageHeight); + options.AddIfPresent(nameof(profile), profile); + + this.Call("rawsave_target", options, target); + } + + /// + /// Write raw image to stream. + /// + /// + /// + /// in.RawsaveStream(stream, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// + /// + /// Stream to save to. + /// Which metadata to retain. + /// Background value. + /// Set page height for multipage save. + /// Filename of ICC profile to embed. + public void RawsaveStream(Stream stream, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + { + using var target = TargetStream.NewFromStream(stream); + RawsaveTarget(target, keep, background, pageHeight, profile); } /// @@ -8850,7 +8955,7 @@ public Image Rot45(Enums.Angle45? angle = null) /// using Image @out = in.Rotate(angle, interpolate: GObject, background: double[], odx: double, ody: double, idx: double, idy: double); /// /// - /// Rotate anticlockwise by this many degrees. + /// Rotate clockwise by this many degrees. /// Interpolate pixels with this. /// Background value. /// Horizontal output displacement. @@ -8953,6 +9058,34 @@ public Image ScRGB2XYZ() return this.Call("scRGB2XYZ") as Image; } + /// + /// Create an SDF image. + /// + /// + /// + /// using Image @out = NetVips.Image.Sdf(width, height, shape, r: double, a: double[], b: double[], corners: double[]); + /// + /// + /// Image width in pixels. + /// Image height in pixels. + /// SDF shape to create. + /// Radius. + /// Point a. + /// Point b. + /// Corner radii. + /// A new . + public static Image Sdf(int width, int height, Enums.SdfShape shape, double? r = null, double[] a = null, double[] b = null, double[] corners = null) + { + var options = new VOption(); + + options.AddIfPresent(nameof(r), r); + options.AddIfPresent(nameof(a), a); + options.AddIfPresent(nameof(b), b); + options.AddIfPresent(nameof(corners), corners); + + return Operation.Call("sdf", options, width, height, shape) as Image; + } + /// /// Check sequential access. /// @@ -9085,7 +9218,7 @@ public Image Sign() /// /// /// Scale by this factor. - /// Rotate anticlockwise by this many degrees. + /// Rotate clockwise by this many degrees. /// Interpolate pixels with this. /// Background value. /// Horizontal output displacement. @@ -10330,7 +10463,7 @@ public static Image TiffloadStream(Stream stream, out Enums.ForeignFlags flags, /// Write a bigtiff image. /// Write a properties document to IMAGEDESCRIPTION. /// Method to shrink regions. - /// ZSTD compression level. + /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level. /// Enable WEBP lossless mode. /// Pyramid depth. /// Save pyr layers as sub-IFDs. @@ -10394,7 +10527,7 @@ public void Tiffsave(string filename, Enums.ForeignTiffCompression? compression /// Write a bigtiff image. /// Write a properties document to IMAGEDESCRIPTION. /// Method to shrink regions. - /// ZSTD compression level. + /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level. /// Enable WEBP lossless mode. /// Pyramid depth. /// Save pyr layers as sub-IFDs. @@ -10460,7 +10593,7 @@ public byte[] TiffsaveBuffer(Enums.ForeignTiffCompression? compression = null, i /// Write a bigtiff image. /// Write a properties document to IMAGEDESCRIPTION. /// Method to shrink regions. - /// ZSTD compression level. + /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level. /// Enable WEBP lossless mode. /// Pyramid depth. /// Save pyr layers as sub-IFDs. @@ -10525,7 +10658,7 @@ public void TiffsaveTarget(Target target, Enums.ForeignTiffCompression? compress /// Write a bigtiff image. /// Write a properties document to IMAGEDESCRIPTION. /// Method to shrink regions. - /// ZSTD compression level. + /// Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level. /// Enable WEBP lossless mode. /// Pyramid depth. /// Save pyr layers as sub-IFDs. @@ -11160,7 +11293,7 @@ public static Image WebploadStream(Stream stream, out Enums.ForeignFlags flags, /// /// /// - /// in.Webpsave(filename, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, mixed: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// in.Webpsave(filename, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// /// Filename to save to. @@ -11174,12 +11307,15 @@ public static Image WebploadStream(Stream stream, out Enums.ForeignFlags flags, /// Minimum number of frames between key frames. /// Maximum number of frames between key frames. /// Level of CPU effort to reduce file size. + /// Desired target size in bytes. /// Allow mixed encoding (might reduce file size). + /// Enable auto-adjusting of the deblocking filter. + /// Number of entropy-analysis passes (in [1..10]). /// Which metadata to retain. /// Background value. /// Set page height for multipage save. /// Filename of ICC profile to embed. - public void Webpsave(string filename, 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, bool? mixed = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + public void Webpsave(string filename, 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, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) { var options = new VOption(); @@ -11193,7 +11329,10 @@ public void Webpsave(string filename, int? q = null, bool? lossless = null, Enum options.AddIfPresent(nameof(kmin), kmin); options.AddIfPresent(nameof(kmax), kmax); options.AddIfPresent(nameof(effort), effort); + options.AddIfPresent("target_size", targetSize); options.AddIfPresent(nameof(mixed), mixed); + options.AddIfPresent("smart_deblock", smartDeblock); + options.AddIfPresent(nameof(passes), passes); options.AddForeignKeep(keep); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -11207,7 +11346,7 @@ public void Webpsave(string filename, int? q = null, bool? lossless = null, Enum /// /// /// - /// byte[] buffer = in.WebpsaveBuffer(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, mixed: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// byte[] buffer = in.WebpsaveBuffer(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// /// Q factor. @@ -11220,13 +11359,16 @@ public void Webpsave(string filename, int? q = null, bool? lossless = null, Enum /// Minimum number of frames between key frames. /// Maximum number of frames between key frames. /// Level of CPU effort to reduce file size. + /// Desired target size in bytes. /// Allow mixed encoding (might reduce file size). + /// Enable auto-adjusting of the deblocking filter. + /// Number of entropy-analysis passes (in [1..10]). /// Which metadata to retain. /// Background value. /// Set page height for multipage save. /// Filename of ICC profile to embed. /// An array of bytes. - public byte[] WebpsaveBuffer(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, bool? mixed = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + public byte[] WebpsaveBuffer(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, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) { var options = new VOption(); @@ -11240,7 +11382,10 @@ public byte[] WebpsaveBuffer(int? q = null, bool? lossless = null, Enums.Foreign options.AddIfPresent(nameof(kmin), kmin); options.AddIfPresent(nameof(kmax), kmax); options.AddIfPresent(nameof(effort), effort); + options.AddIfPresent("target_size", targetSize); options.AddIfPresent(nameof(mixed), mixed); + options.AddIfPresent("smart_deblock", smartDeblock); + options.AddIfPresent(nameof(passes), passes); options.AddForeignKeep(keep); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -11254,7 +11399,7 @@ public byte[] WebpsaveBuffer(int? q = null, bool? lossless = null, Enums.Foreign /// /// /// - /// in.WebpsaveMime(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, mixed: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// in.WebpsaveMime(q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// /// Q factor. @@ -11267,12 +11412,15 @@ public byte[] WebpsaveBuffer(int? q = null, bool? lossless = null, Enums.Foreign /// Minimum number of frames between key frames. /// Maximum number of frames between key frames. /// Level of CPU effort to reduce file size. + /// Desired target size in bytes. /// Allow mixed encoding (might reduce file size). + /// Enable auto-adjusting of the deblocking filter. + /// Number of entropy-analysis passes (in [1..10]). /// Which metadata to retain. /// Background value. /// Set page height for multipage save. /// Filename of ICC profile to embed. - 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, bool? mixed = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + 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, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) { var options = new VOption(); @@ -11286,7 +11434,10 @@ public void WebpsaveMime(int? q = null, bool? lossless = null, Enums.ForeignWebp options.AddIfPresent(nameof(kmin), kmin); options.AddIfPresent(nameof(kmax), kmax); options.AddIfPresent(nameof(effort), effort); + options.AddIfPresent("target_size", targetSize); options.AddIfPresent(nameof(mixed), mixed); + options.AddIfPresent("smart_deblock", smartDeblock); + options.AddIfPresent(nameof(passes), passes); options.AddForeignKeep(keep); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -11300,7 +11451,7 @@ public void WebpsaveMime(int? q = null, bool? lossless = null, Enums.ForeignWebp /// /// /// - /// in.WebpsaveTarget(target, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, mixed: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// in.WebpsaveTarget(target, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// /// Target to save to. @@ -11314,12 +11465,15 @@ public void WebpsaveMime(int? q = null, bool? lossless = null, Enums.ForeignWebp /// Minimum number of frames between key frames. /// Maximum number of frames between key frames. /// Level of CPU effort to reduce file size. + /// Desired target size in bytes. /// Allow mixed encoding (might reduce file size). + /// Enable auto-adjusting of the deblocking filter. + /// Number of entropy-analysis passes (in [1..10]). /// Which metadata to retain. /// Background value. /// Set page height for multipage save. /// Filename of ICC profile to embed. - public void WebpsaveTarget(Target target, 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, bool? mixed = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + public void WebpsaveTarget(Target target, 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, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) { var options = new VOption(); @@ -11333,7 +11487,10 @@ public void WebpsaveTarget(Target target, int? q = null, bool? lossless = null, options.AddIfPresent(nameof(kmin), kmin); options.AddIfPresent(nameof(kmax), kmax); options.AddIfPresent(nameof(effort), effort); + options.AddIfPresent("target_size", targetSize); options.AddIfPresent(nameof(mixed), mixed); + options.AddIfPresent("smart_deblock", smartDeblock); + options.AddIfPresent(nameof(passes), passes); options.AddForeignKeep(keep); options.AddIfPresent(nameof(background), background); options.AddIfPresent("page_height", pageHeight); @@ -11347,7 +11504,7 @@ public void WebpsaveTarget(Target target, int? q = null, bool? lossless = null, /// /// /// - /// in.WebpsaveStream(stream, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, mixed: bool, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); + /// in.WebpsaveStream(stream, q: int, lossless: bool, preset: Enums.ForeignWebpPreset, smartSubsample: bool, nearLossless: bool, alphaQ: int, minSize: bool, kmin: int, kmax: int, effort: int, targetSize: int, mixed: bool, smartDeblock: bool, passes: int, keep: Enums.ForeignKeep, background: double[], pageHeight: int, profile: string); /// /// /// Stream to save to. @@ -11361,15 +11518,18 @@ public void WebpsaveTarget(Target target, int? q = null, bool? lossless = null, /// Minimum number of frames between key frames. /// Maximum number of frames between key frames. /// Level of CPU effort to reduce file size. + /// Desired target size in bytes. /// Allow mixed encoding (might reduce file size). + /// Enable auto-adjusting of the deblocking filter. + /// Number of entropy-analysis passes (in [1..10]). /// Which metadata to retain. /// Background value. /// Set page height for multipage save. /// Filename of ICC profile to embed. - public void WebpsaveStream(Stream stream, 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, bool? mixed = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) + public void WebpsaveStream(Stream stream, 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, int? targetSize = null, bool? mixed = null, bool? smartDeblock = null, int? passes = null, Enums.ForeignKeep? keep = null, double[] background = null, int? pageHeight = null, string profile = null) { using var target = TargetStream.NewFromStream(stream); - WebpsaveTarget(target, q, lossless, preset, smartSubsample, nearLossless, alphaQ, minSize, kmin, kmax, effort, mixed, keep, background, pageHeight, profile); + WebpsaveTarget(target, q, lossless, preset, smartSubsample, nearLossless, alphaQ, minSize, kmin, kmax, effort, targetSize, mixed, smartDeblock, passes, keep, background, pageHeight, profile); } /// diff --git a/src/NetVips/MutableImage.Generated.cs b/src/NetVips/MutableImage.Generated.cs index 6b39983..350824e 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.15.0 +// libvips version: 8.16.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/tests/NetVips.Tests/ConversionTests.cs b/tests/NetVips.Tests/ConversionTests.cs index a9219fc..16fb8c6 100644 --- a/tests/NetVips.Tests/ConversionTests.cs +++ b/tests/NetVips.Tests/ConversionTests.cs @@ -225,22 +225,6 @@ dynamic BandRank(dynamic x, dynamic y) Assert.Equal(0, (a - b).Abs().Min()); } - [Fact] - public void TestCache() - { - dynamic Cache(dynamic x) - { - if (x is Image image) - { - return image.Cache(); - } - - return x; - } - - RunUnary(_allImages, Cache); - } - [Fact] public void TestCopy() {