//
//  GSLayer+Transformation.h
//  TransformPanel
//
//  Created by Georg Seifert on 16.07.11.
//  Copyright 2011 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSLayer.h>

#define defaultCorrectContrast 0.5
#define defaultCorrectShape 0.5
#define defaultCorrectThickness 1

@interface GSLayer (Transformation)

/// Slants content horizontally around an origin.
///
/// - Parameter angle: The slant angle in degrees.
/// - Parameter origin: The horizontal shear origin in layer coordinates.
/// - Parameter correction: Whether to preserve stem contrast.
/// - Parameter checkSelection: Whether to restrict the operation to selected nodes and elements.
- (void)slantX:(CGFloat)angle origin:(CGFloat)origin doCorrection:(BOOL)correction checkSelection:(BOOL)checkSelection;

/// Slants content horizontally with configurable outline corrections.
///
/// - Parameter angle: The slant angle in degrees.
/// - Parameter origin: The horizontal shear origin in layer coordinates.
/// - Parameter correctContrast: The amount of stem contrast correction.
/// - Parameter shape: The amount of shape correction.
/// - Parameter thickness: The amount of vertical stem thickness correction.
/// - Parameter checkSelection: Whether to restrict the operation to selected nodes and elements.
- (void)slantX:(CGFloat)angle origin:(CGFloat)origin correctContrast:(CGFloat)correctContrast correctShape:(CGFloat)shape correctThickness:(CGFloat)thickness checkSelection:(BOOL)checkSelection;

/// Slants content vertically around an origin.
///
/// - Parameter angle: The slant angle in degrees.
/// - Parameter origin: The vertical shear origin in layer coordinates.
/// - Parameter checkSelection: Whether to restrict the operation to selected nodes and elements.
- (void)slantY:(CGFloat)angle origin:(CGFloat)origin checkSelection:(BOOL)checkSelection;

/// Corrects stem contrast for a horizontal slant.
///
/// Stem dimensions are taken from the associated font master.
///
/// - Parameter angle: The slant angle in degrees.
/// - Parameter checkSelection: Whether to restrict the operation to selected nodes.
- (void)doSlantingCorrectionWithAngle:(CGFloat)angle checkSelection:(BOOL)checkSelection;

/// Corrects outlines for a horizontal slant using associated font master stems.
///
/// - Parameter angle: The slant angle in degrees.
/// - Parameter correctContrast: The amount of stem contrast correction.
/// - Parameter correctShape: The amount of shape correction.
/// - Parameter correctThickness: The amount of vertical stem thickness correction.
/// - Parameter checkSelection: Whether to restrict the operation to selected nodes.
- (void)doSlantingCorrectionWithAngle:(CGFloat)angle correctContrast:(CGFloat)correctContrast correctShape:(CGFloat)correctShape correctThickness:(CGFloat)correctThickness checkSelection:(BOOL)checkSelection;

/// Corrects outlines for a horizontal slant using explicit stem dimensions and a correction center.
///
/// - Parameter angle: The slant angle in degrees.
/// - Parameter checkSelection: Whether to restrict the operation to selected nodes.
/// - Parameter correctContrast: The amount of stem contrast correction.
/// - Parameter correctShape: The amount of shape correction.
/// - Parameter correctThickness: The amount of vertical stem thickness correction.
/// - Parameter horizontalStem: The horizontal stem dimension used for correction.
/// - Parameter verticalStem: The vertical stem dimension used for correction.
/// - Parameter center: The center for shape correction in layer coordinates.
- (void)doSlantingCorrectionWithAngle:(CGFloat)angle checkSelection:(BOOL)checkSelection correctContrast:(CGFloat)correctContrast correctShape:(CGFloat)correctShape correctThickness:(CGFloat)correctThickness horizontalStem:(CGFloat)horizontalStem verticalStem:(CGFloat)verticalStem center:(NSPoint)center;

@end
