
// CommonStrokeTessellatorLinkType.hpp - common functions for decoding link type

#ifndef __CommonStrokeTessellatorLinkType_hpp__
#define __CommonStrokeTessellatorLinkType_hpp__

#include "CommonStrokeTessellatorPrivate.hpp"

//// Utility functions for interpreting link_type.

STATIC bool isQuadratic(int link_type)
{
    return (link_type == LT_QUADRATIC_SEGMENT);
}

STATIC bool isJoin(int link_type)
{
    return (link_type == LT_JOIN);
}

STATIC bool isCap(int link_type)
{
    return (link_type >= LT_NO_CAP);
}

STATIC bool isJoinOrCap(int link_type)
{
    return (link_type >= LT_JOIN);
}

STATIC bool isSquare(int link_type)
{
    return (link_type == LT_SQUARE_CAP);
}

STATIC bool isTriangular(int link_type)
{
    return (link_type == LT_TRIANGULAR_CAP);
}

STATIC float linkTypeToClampedSteps(int link_type)
{
    assert(isCap(link_type));  // Only applies to caps
    return float(link_type);
}

//// Utility functions for max_join_steps.

STATIC bool isMiterJoin(int max_join_steps)
{
    return (max_join_steps < 0);
}

STATIC bool isMiterTruncateJoin(int max_join_steps)
{
    return (max_join_steps == -2);
}

#endif // __CommonStrokeTessellatorLinkType_hpp__
