//
//  GSTransformableElement.h
//  GlyphsCore
//
//  Created by Georg Seifert on 02.02.19.
//  Copyright © 2019 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSShape.h>

NS_ASSUME_NONNULL_BEGIN

#ifdef GLYPHS_VIEWER
typedef NSAffineTransform GSSafeAffineTransform;
#endif

@interface GSTransformableElement : GSShape {
  @public
#pragma GSAutoCodeStart ivars

	CGFloat _angle;
	NSPoint _scale;
	CGFloat _slantHorizontal;
	CGFloat _slantVertical;

#pragma GSAutoCodeEnd ivars
}

/** The transformation of the component.

 The values of the struct are:
 {m11, m12, m21, m22, tX, tY}
 this is equivalent to the glif attributes
 {xScale, xyScale, yxScale, yScale, xOffset, yOffset}
 in the same order.
 The initial value is {1,0,0,1,0,0}.
 */
@property (assign, nonatomic) NSAffineTransformStruct transformStruct;
- (void)setTransformStructFast:(NSAffineTransformStruct)newTS grid:(GSGridSettings)grid;

@property (readonly, nonatomic) NSAffineTransform *transform;

// this holds the transformation during linear interpolation. See GSGlyph.linearInterpolateComponents
@property (assign, nonatomic) NSAffineTransformStruct transformStructTemp;

#pragma GSAutoCodeStart methods

/// The angle.
@property (nonatomic) CGFloat angle;

/// The scale.
@property (nonatomic) NSPoint scale;

/// The slantHorizontal.
@property (nonatomic) CGFloat slantHorizontal;

/// The slantVertical.
@property (nonatomic) CGFloat slantVertical;

#pragma GSAutoCodeEnd methods

@end

NS_ASSUME_NONNULL_END
