1 // 2 // PRCurvesView.h 3 // PRICE 4 // 5 // Created by Riccardo Mottola on 7 August 2011. 6 // Copyright 2011-2014 Riccardo Mottola. All rights reserved. 7 // 8 // This application is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 10 11 #import <Foundation/Foundation.h> 12 #import <AppKit/NSView.h> 13 #import <AppKit/NSBezierPath.h> 14 #import "PRCurvesPath.h" 15 16 @class PRCCurves; 17 @class PRImage; 18 19 @interface PRCurvesView : NSView 20 { 21 PRCCurves *controller; 22 23 BOOL hasColor; 24 unsigned pixNum; 25 float histogramScale; /* scale factor for both in and out histograms */ 26 27 unsigned long int histogramDenormL[UCHAR_MAX+1]; /* not normalized pixel count for each level */ 28 unsigned long int histogramDenormR[UCHAR_MAX+1]; /* not normalized pixel count for each level */ 29 unsigned long int histogramDenormG[UCHAR_MAX+1]; /* not normalized pixel count for each level */ 30 unsigned long int histogramDenormB[UCHAR_MAX+1]; /* not normalized pixel count for each level */ 31 32 float histogramL[UCHAR_MAX+1]; /* normalized histogram */ 33 float histogramR[UCHAR_MAX+1]; /* normalized histogram */ 34 float histogramG[UCHAR_MAX+1]; /* normalized histogram */ 35 float histogramB[UCHAR_MAX+1]; /* normalized histogram */ 36 37 float histogramLTr[UCHAR_MAX+1]; /* transformed histogram */ 38 float histogramRTr[UCHAR_MAX+1]; /* transformed histogram */ 39 float histogramGTr[UCHAR_MAX+1]; /* transformed histogram */ 40 float histogramBTr[UCHAR_MAX+1]; /* transformed histogram */ 41 42 43 PRCurvesPath *pathLumi; 44 PRCurvesPath *pathR; 45 PRCurvesPath *pathG; 46 PRCurvesPath *pathB; 47 48 NSBezierPath *pathHLumi; 49 NSBezierPath *pathHR; 50 NSBezierPath *pathHG; 51 NSBezierPath *pathHB; 52 NSBezierPath *pathHLumiTr; 53 NSBezierPath *pathHRTr; 54 NSBezierPath *pathHGTr; 55 NSBezierPath *pathHBTr; 56 57 @public unsigned funL[UCHAR_MAX+1]; /* mapped function */ 58 } 59 60 -(BOOL)hasColor; 61 62 -(PRCurvesPath *)luminancePath; 63 -(PRCurvesPath *)redPath; 64 -(PRCurvesPath *)greenPath; 65 -(PRCurvesPath *)bluePath; 66 67 - (void)initPathLumi; 68 - (void)initPathR; 69 - (void)initPathG; 70 - (void)initPathB; 71 72 -(void)setBlackPoint: (int)value; 73 -(void)setWhitePoint: (int)value; 74 75 -(void)setFilterController: (PRCCurves *)aFilterController; 76 77 -(void)calculateHistogram: (PRImage *)image; 78 -(void)calculateTransformedHistograms; 79 80 -(void)moveControlPoint:(NSPoint)cp ofCurve:(PRCurvesPath *)curveP; 81 82 @end 83