iconSizeDistance

Distance between desired size and minimum or maximum size value supported by icon theme subdirectory.

@nogc @safe nothrow pure
uint
iconSizeDistance

Examples

auto fixed = IconSubDir(32, IconSubDir.Type.Fixed);
assert(iconSizeDistance(fixed, fixed.size()) == 0);
assert(iconSizeDistance(fixed, 30) == 2);
assert(iconSizeDistance(fixed, 35) == 3);

auto threshold = IconSubDir(32, IconSubDir.Type.Threshold, "", 0, 0, 5);
assert(iconSizeDistance(threshold, threshold.size()) == 0);
assert(iconSizeDistance(threshold, threshold.size() - threshold.threshold()) == 0);
assert(iconSizeDistance(threshold, threshold.size() + threshold.threshold()) == 0);
assert(iconSizeDistance(threshold, 26) == 1);
assert(iconSizeDistance(threshold, 39) == 2);

auto scalable = IconSubDir(32, IconSubDir.Type.Scalable, "", 24, 48);
assert(iconSizeDistance(scalable, scalable.size()) == 0);
assert(iconSizeDistance(scalable, scalable.minSize()) == 0);
assert(iconSizeDistance(scalable, scalable.maxSize()) == 0);
assert(iconSizeDistance(scalable, 20) == 4);
assert(iconSizeDistance(scalable, 50) == 2);

Meta