
// PathStyle.hpp - style properties of SVG paths

#ifndef __PathStyle_hpp__
#define __PathStyle_hpp__

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

#include "DashStyle.hpp"

// Properties of a path necessary to determine stencil coverage.
// (PathStyle does not contain shading/covering parameters.)
struct PathStyle : DashStyle {
    // fill properties
    enum FillRule {
        EVEN_ODD = 0,
        NON_ZERO
    };
    FillRule fill_rule;

    // stroke properties
    bool non_scaling_stroke;
    float stroke_width;
    enum LineCap {
        BUTT_CAP,
        ROUND_CAP,
        TRIANGLE_CAP,
        SQUARE_CAP,
        LINE_CAP_COUNT  // Count, not enumated value; must be last value.
    };
    LineCap line_cap;
    enum LineJoin {
        NONE_JOIN, // "naked" joins, don't add special join geometry
        MITER_REVERT_JOIN,  // SVG-style miter joins, snap to bevel when miter limit exceeded
        ROUND_JOIN,
        BEVEL_JOIN,
        // Qt limits the length of the miter edges to
        // stroke_width*miter_limit instead of snapping to bevel.
        MITER_TRUNCATE_JOIN, // consistent with Qt's miter join style
        TRIANGLE_JOIN,  // NV_path_rendering 1.4 feature
        LINE_JOIN_COUNT  // Count, not enumated value; must be last value.
    };
    LineJoin line_join;
    float miter_limit;

    bool allow_dilation;

    // XXX these really belong in GraphicsElements!
    enum ColorInterpolation {
        AUTO,
        SRGB,
        LINEAR_RGB
    };
    ColorInterpolation color_interpolation;
    ColorInterpolation color_interpolation_filters;

    // Initializations match the initial Fill Properties and Stroke Properites of SVG
    PathStyle();
    PathStyle(const PathStyle &src);

    bool compatibleWithTwoEdgeQuadraticStrokeDiscardShader() const;

    bool operator < (const PathStyle& other) const;
    bool operator == (const PathStyle& other) const;
};

#endif // __PathStyle_hpp__
