
// DashStyle.hpp - dash properties of SVG paths

#ifndef __DashStyle_hpp__
#define __DashStyle_hpp__

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

#include <vector>

struct DashStyle {
    std::vector<float> dash_array;
    float dash_offset;

    // FYI: OpenVG uses the term "dash phase" to mean what SVG calls the dash offset.
    // From the OpenVG 1.1 specification:
    // "Dash phase – initial offset into the dash pattern".

    // Not real SVG style parameters
    enum DashOffsetReset {
        MOVETO_CONTINUES = 0,
        MOVETO_RESETS,

        // From https://www.w3.org/TR/svg-strokes/#StrokeDashing
        // "The dashing pattern is reset and begins again at the start of each subpath."
        SVG_INITIAL_DASH_OFFSET_RESET = MOVETO_RESETS,

        // From the OpenVG 1.1 specification:
        // Table 4 (Default Parameter Values for a Context) defines the "default value"
        // for VG_STROKE_DASH_PHASE_RSET to be "VG_FALSE (disabled)".
        // "If VG_DASH_PHASE_RESET is disabled (set to VG_FALSE), the final dash
        // phase at the end of the subpath is used as the initial dash phase for the next subpath.
        // Otherwise, the original dash phase is used for all subpaths."
        OPENVG_INITIAL_DASH_OFFSET_RESET = MOVETO_CONTINUES,
    };
    DashOffsetReset dash_offset_reset;

    DashStyle();
    DashStyle(const DashStyle &src);

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

#endif // __DashStyle_hpp__
