Skip to content

Commit dd30d8b

Browse files
committed
Added MipmapCount to the DdsWriteDefines that will replace the Mipmaps property in the next major release.
1 parent 91a18cb commit dd30d8b

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/Magick.NET/Formats/Dds/DdsWriteDefines.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
22
// Licensed under the Apache License, Version 2.0.
33

4+
using System;
45
using System.Collections.Generic;
56

67
namespace ImageMagick.Formats;
@@ -35,7 +36,17 @@ public MagickFormat Format
3536
/// <summary>
3637
/// Gets or sets the the number of mipmaps, zero will disable writing mipmaps (dds:mipmaps).
3738
/// </summary>
38-
public int? Mipmaps { get; set; }
39+
[Obsolete($"This property will be removed in the next major release, use {nameof(MipmapCount)} instead.")]
40+
public int? Mipmaps
41+
{
42+
get => MipmapCount;
43+
set => MipmapCount = value;
44+
}
45+
46+
/// <summary>
47+
/// Gets or sets the the number of mipmaps, zero will disable writing mipmaps (dds:mipmaps).
48+
/// </summary>
49+
public int? MipmapCount { get; set; }
3950

4051
/// <summary>
4152
/// Gets or sets a value indicating whether the mipmaps should be created from the images in the collection (dds:mipmaps=fromlist).
@@ -70,8 +81,8 @@ public IEnumerable<IDefine> Defines
7081

7182
if (MipmapsFromCollection == true)
7283
yield return new MagickDefine(Format, "mipmaps", "fromlist");
73-
else if (Mipmaps.HasValue)
74-
yield return new MagickDefine(Format, "mipmaps", Mipmaps.Value);
84+
else if (MipmapCount.HasValue)
85+
yield return new MagickDefine(Format, "mipmaps", MipmapCount.Value);
7586

7687
if (Raw.HasValue)
7788
yield return new MagickDefine(Format, "raw", Raw.Value);

tests/Magick.NET.Tests/Formats/Dds/DdsWriteDefinesTests/TheMipmapsProperty.cs renamed to tests/Magick.NET.Tests/Formats/Dds/DdsWriteDefinesTests/TheMipmapCountProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ namespace Magick.NET.Tests;
99

1010
public partial class DdsWriteDefinesTests
1111
{
12-
public class TheMipmapsProperty
12+
public class TheMipmapCountProperty
1313
{
1414
[Fact]
1515
public void ShouldSetTheDefine()
1616
{
1717
var defines = new DdsWriteDefines
1818
{
19-
Mipmaps = 2,
19+
MipmapCount = 2,
2020
};
2121

2222
using var image = new MagickImage();

tests/Magick.NET.Tests/Formats/Dds/DdsWriteDefinesTests/TheMipmapsFromCollectionProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void ShouldSetTheDefine()
1717
var defines = new DdsWriteDefines
1818
{
1919
MipmapsFromCollection = true,
20-
Mipmaps = 4, // this is ignored
20+
MipmapCount = 4, // this is ignored
2121
};
2222

2323
using var image = new MagickImage();
@@ -32,7 +32,7 @@ public void ShouldBeIgnoredWhenSetToFalse()
3232
var defines = new DdsWriteDefines
3333
{
3434
MipmapsFromCollection = false,
35-
Mipmaps = 4,
35+
MipmapCount = 4,
3636
};
3737

3838
using var image = new MagickImage();

0 commit comments

Comments
 (0)