//
//  GSColorStop.h
//  GlyphsCore
//
//  Created by Florian Pircher on 21.04.22.
//  Copyright © 2022 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSBase.h>

@class GSGradient;
@class GSColorLine;

NS_ASSUME_NONNULL_BEGIN

@interface GSColorStop : NSObject <NSCopying> {
#pragma GSAutoCodeStart ivars

	NSColor *_color;
	CGFloat _offset;

#pragma GSAutoCodeEnd ivars
}

- (instancetype)initWithColor:(NSColor *)color atOffset:(CGFloat)offset;

- (BOOL)isEqualToColorStop:(GSColorStop *)other;

@property (weak) GSColorLine *parent;
@property (nonatomic, readonly, nullable) GSGradient *gradient;

#ifndef GLYPHS_VIEWER
- (nullable NSArray *)propertyListValueFormat:(GSFormatVersion)formatVersion error:(out NSError **)error;

- (BOOL)propertyListToData:(CFMutableDataRef)data format:(GSFormatVersion)formatVersion error:(NSError **)error;
#endif

#pragma GSAutoCodeStart methods

/// The color.
@property (nonatomic, strong) NSColor *color;

/**
The offset in the range 0--1.
 */
@property (nonatomic) CGFloat offset;

#pragma GSAutoCodeEnd methods
@end

NS_ASSUME_NONNULL_END
