void DrawableShape::FillAndStrokeState::setStrokeType (const PathStrokeType& newStrokeType, UndoManager* undoManager)
{
    state.setProperty (strokeWidth, (double) newStrokeType.getStrokeThickness(), undoManager);
    state.setProperty (jointStyle, newStrokeType.getJointStyle() == PathStrokeType::mitered
                                     ? "miter" : (newStrokeType.getJointStyle() == PathStrokeType::curved ? "curved" : "bevel"), undoManager);
    state.setProperty (capStyle, newStrokeType.getEndStyle() == PathStrokeType::butt
                                     ? "butt" : (newStrokeType.getEndStyle() == PathStrokeType::square ? "square" : "round"), undoManager);
}
Exemple #2
0
const String StrokeType::getPathStrokeCode() const
{
    PathStrokeType defaultStroke (1.0f);

    String s;

    s << "PathStrokeType (" << valueToFloat (stroke.getStrokeThickness());

    if (stroke.getJointStyle() != defaultStroke.getJointStyle()
        || stroke.getEndStyle() != defaultStroke.getEndStyle())
    {
        s << ", ";

        switch (stroke.getJointStyle())
        {
        case PathStrokeType::mitered:
            s << "PathStrokeType::mitered";
            break;

        case PathStrokeType::curved:
            s << "PathStrokeType::curved";
            break;
        case PathStrokeType::beveled:
            s << "PathStrokeType::beveled";
            break;

        default:
            jassertfalse
            break;
        }

        if (stroke.getEndStyle() != defaultStroke.getEndStyle())
        {
            s << ", ";

            switch (stroke.getEndStyle())
            {
            case PathStrokeType::butt:
                s << "PathStrokeType::butt";
                break;

            case PathStrokeType::square:
                s << "PathStrokeType::square";
                break;
            case PathStrokeType::rounded:
                s << "PathStrokeType::rounded";
                break;

            default:
                jassertfalse
                break;
            }
        }