From 37d397793e7432335437958da540999f45c9bc14 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 20 Jun 2024 15:38:49 +0200 Subject: [PATCH] [PixImage] Make naming of Create() parameters consistent --- .../PixImage/PixImage.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs b/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs index 37dcd970..930d8820 100644 --- a/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs +++ b/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs @@ -389,16 +389,16 @@ private static void ToGray(PixImage src, object dst, Func toGra // Helper class to create PixImage from given Type private static class Dispatch { - private delegate PixImage CreateDelegate(Col.Format format, long width, long height, long channels); - private delegate PixImage CreateArrayDelegate(Array data, Col.Format format, long width, long height, long channels); + private delegate PixImage CreateDelegate(Col.Format format, long sizeX, long sizeY, long channels); + private delegate PixImage CreateArrayDelegate(Array data, Col.Format format, long sizeX, long sizeY, long channels); private static class CreateDispatcher { - public static PixImage Create(Col.Format format, long width, long height, long channels) - => new PixImage(format, width, height, channels); + public static PixImage Create(Col.Format format, long sizeX, long sizeY, long channels) + => new PixImage(format, sizeX, sizeY, channels); - public static PixImage CreateArray(Array data, Col.Format format, long width, long height, long channels) - => new PixImage(format, ((T[])data).CreateImageVolume(new V3l(width, height, channels))); + public static PixImage CreateArray(Array data, Col.Format format, long sizeX, long sizeY, long channels) + => new PixImage(format, ((T[])data).CreateImageVolume(new V3l(sizeX, sizeY, channels))); } private const BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public; @@ -409,24 +409,24 @@ public static PixImage CreateArray(Array data, Col.Format format, long width, private static readonly MethodInfo s_createArrayMethod = typeof(CreateDispatcher).GetMethod(nameof(CreateDispatcher.CreateArray), flags); private static readonly ConcurrentDictionary s_createArrayDelegates = new(); - public static PixImage Create(PixFormat format, long width, long height, long channels) + public static PixImage Create(PixFormat format, long sizeX, long sizeY, long channels) { var create = s_createDelegates.GetOrAdd(format.Type, t => { var mi = s_createMethod.MakeGenericMethod(t); return (CreateDelegate)Delegate.CreateDelegate(typeof(CreateDelegate), mi); }); - return create(format.Format, width, height, channels); + return create(format.Format, sizeX, sizeY, channels); } - public static PixImage Create(Array array, Col.Format format, long width, long height, long channels) + public static PixImage Create(Array array, Col.Format format, long sizeX, long sizeY, long channels) { var create = s_createArrayDelegates.GetOrAdd(array.GetType().GetElementType(), t => { var mi = s_createArrayMethod.MakeGenericMethod(t); return (CreateArrayDelegate)Delegate.CreateDelegate(typeof(CreateArrayDelegate), mi); }); - return create(array, format, width, height, channels); + return create(array, format, sizeX, sizeY, channels); } } @@ -436,17 +436,17 @@ public static PixImage Create(Array array, Col.Format format, long width, long h #region Static Creator Functions - public static PixImage Create(PixFormat format, long sx, long sy, long ch) - => Dispatch.Create(format, sx, sy, ch); + public static PixImage Create(PixFormat format, long sizeX, long sizeY, long channelCount) + => Dispatch.Create(format, sizeX, sizeY, channelCount); - public static PixImage Create(PixFormat format, long sx, long sy) - => Dispatch.Create(format, sx, sy, format.ChannelCount); + public static PixImage Create(PixFormat format, long sizeX, long sizeY) + => Dispatch.Create(format, sizeX, sizeY, format.ChannelCount); - public static PixImage Create(Array array, Col.Format format, long sx, long sy, long ch) - => Dispatch.Create(array, format, sx, sy, ch); + public static PixImage Create(Array array, Col.Format format, long sizeX, long sizeY, long channelCount) + => Dispatch.Create(array, format, sizeX, sizeY, channelCount); - public static PixImage Create(Array array, Col.Format format, long sx, long sy) - => Dispatch.Create(array, format, sx, sy, format.ChannelCount()); + public static PixImage Create(Array array, Col.Format format, long sizeX, long sizeY) + => Dispatch.Create(array, format, sizeX, sizeY, format.ChannelCount()); public static Volume CreateVolume(V3i size) => size.ToV3l().CreateImageVolume();