diff --git a/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs b/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs index fd6def98..b15f6613 100644 --- a/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs +++ b/src/Aardvark.Base.Tensors.CSharp/PixImage/PixImage.cs @@ -1584,10 +1584,15 @@ public override PixImage RemappedPixImage( ImageInterpolation ip = ImageInterpolation.Cubic ) => Remapped(xMap, xMap, ip); - public PixImage Remapped( - Matrix xMap, Matrix yMap, - ImageInterpolation ip = ImageInterpolation.Cubic - ) => new PixImage(Format, s_remappedFun(Volume, xMap, yMap, ip)); + public PixImage Remapped(Matrix xMap, Matrix yMap, ImageInterpolation ip = ImageInterpolation.Cubic) + { + if (s_remappedFun == null) + { + throw new NotSupportedException($"No remapping function has been installed via PixImage<{(typeof(T).Name)}>.SetRemappedFun"); + } + + return new PixImage(Format, s_remappedFun(Volume, xMap, yMap, ip)); + } private static Func, Matrix, Matrix, ImageInterpolation, Volume> s_remappedFun = null; @@ -1618,10 +1623,15 @@ public override PixImage RotatedPixImage( ImageInterpolation ip = ImageInterpolation.Cubic ) => Rotated(angleInRadiansCCW, resize, ip); - public PixImage Rotated( - double angleInRadiansCCW, bool resize = true, - ImageInterpolation ip = ImageInterpolation.Cubic - ) => new PixImage(Format, s_rotatedFun(Volume, angleInRadiansCCW, resize, ip)); + public PixImage Rotated(double angleInRadiansCCW, bool resize = true, ImageInterpolation ip = ImageInterpolation.Cubic) + { + if (s_rotatedFun == null) + { + throw new NotSupportedException($"No rotating function has been installed via PixImage<{(typeof(T).Name)}>.SetRotatedFun"); + } + + return new PixImage(Format, s_rotatedFun(Volume, angleInRadiansCCW, resize, ip)); + } private static Func, double, bool, ImageInterpolation, Volume> s_rotatedFun = null; @@ -1640,6 +1650,11 @@ public PixImage Scaled( V2d scaleFactor, ImageInterpolation ip = ImageInterpolation.Cubic) { + if (s_scaledFun == null) + { + throw new NotSupportedException($"No scaling function has been installed via PixImage<{(typeof(T).Name)}>.SetScaledFun"); + } + if (!(scaleFactor.X > 0.0 && scaleFactor.Y > 0.0)) throw new ArgumentOutOfRangeException(nameof(scaleFactor)); // SuperSample is only available for scale factors < 1; fall back to Cubic