//
//  GSBasePen.h
//  GlyphsCore
//
//  Created by Georg Seifert on 16.11.11.
//  Copyright 2011 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSPenProtocol.h>

@class GSFont;

typedef NS_OPTIONS(uint8_t, GSPenOperation) {
	GSPenOperationQuadratic = 1 << 0,
	GSPenOperationCubic = 1 << 1,
	GSPenOperationQuartic = 1 << 2,
	GSPenOperationHobby = 1 << 3,
	GSPenOperationRaph = 1 << 4,
};

@interface GSBasePen : NSObject <GSPenProtocol> {
	GSFont *_glyphSet;
	NSPoint _lastPoint;
	NSAffineTransform *_transform;
	GSPenOperation _supportedOperations;
}
@property (nonatomic, assign) NSPoint lastPoint;

@property (nonatomic, strong) NSAffineTransform *transform;

#ifndef GLYPHS_VIEWER
@property (nonatomic) BOOL optimizeQuadratic2Cubic;
#endif
/// Defaults to `GSPenOperationQuadratic | GSPenOperationCubic`.
///
/// Subclasses may customize the default value and allow setting custom subsets.
/// At a minimum, cubic operations must be supported by all subclasses.
@property (nonatomic, readonly) GSPenOperation supportedOperations;

- (instancetype)initWithGlyphSet:(id)glyphSet;

/// Convenience method for creating a quadratic curve segment with a single off-curve node.
- (void)qCurveTo:(NSPoint)pt off:(NSPoint)off;

@end
