//
//  GSPath+PenDrawing.h
//  GlyphsCore
//
//  Created by Georg Seifert on 07.05.17.
//  Copyright © 2017 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSPath.h>
#import <GlyphsCore/GSPenProtocol.h>

NS_ASSUME_NONNULL_BEGIN

@class GSHint;

@interface GSPath (PenDrawing)

/// Removes outside overlaps at sharp line corners.
///
/// - Parameter saveHints: Whether to preserve layer hints while changing the path.
- (void)removeOutsideOverlaps:(BOOL)saveHints;

/// Replaces a corner, cap, segment, brush, or head hint with outline geometry.
- (BOOL)decomposeCorner:(GSHint *)corner;

/// A cubic path representation with special curve types converted to Bezier curves.
///
/// Returns the receiver when the path does not contain special curve types.
- (nonnull GSPath *)convertSpecialToBezier;

/// Position for a node index.
///
/// Closed paths wrap indexes around the node array.
/// Open paths return the zero point for indexes outside the node array.
- (NSPoint)positionAtIndex:(NSInteger)idx NS_REFINED_FOR_SWIFT;

// TODO: replace with or merge with similar code in GSComponent
/// Layer used as source for a corner glyph on this path.
///
/// Brace layers use the current layer position in the design space.
- (GSLayer *)getCornerLayer:(GSGlyph *)cornerGlyph font:(GSFont *)font;

@end

NS_ASSUME_NONNULL_END
