File: LynkeosInterpolator.h

package info (click to toggle)
lynkeos.app 3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,740 kB
  • sloc: objc: 40,528; ansic: 811; cpp: 150; sh: 68; makefile: 27
file content (147 lines) | stat: -rw-r--r-- 5,239 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//
//  Lynkeos
//  $Id:$
//
//  Created by Jean-Etienne LAMIAUD on Mon Oct 27 2014.
//  Copyright (c) 2014-2020. Jean-Etienne LAMIAUD
//
// This program 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.
//
// 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.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//

/*!
 * @header
 * @abstract Protocol for interpolator classes.
 */
#ifndef __LYNKEOSINTERPOLATOR_H
#define __LYNKEOSINTERPOLATOR_H

#import <Foundation/Foundation.h>

//#include "LynkeosCore/processing_core.h"
#include "LynkeosCore/LynkeosProcessing.h"
#include "LynkeosCore/LynkeosImageBuffer.h"

/*!
 * @abstract Type of scaling, for stating interpolator capability
 */
typedef enum
{
   VariableDownScaling, // This is not an affine transform
   ConstantDownScaling,
   UseTransform,        // Use transform to determine the scaling
   ConstantUpScaling,
   VariableUpScaling    // This is not an affine transform
} Scaling_t;

/*!
 * @abstract Protocol for interpolators
 */
@protocol LynkeosInterpolator

/*!
 * @abstract Accessor to the interpolator name
 * @result The interpolator name
 */
+ (NSString*) name ;

/*!
 * @abstract Geometry compatibility check
 * @param scaling The requested kind of scaling
 * @param transform The applied affine transform, if any
 * @result The compatibility level (highest is better, 0 is incompatible)
 */
+ (int) isCompatibleWithScaling:(Scaling_t)scaling
                  withTransform:(NSAffineTransformStruct)transform;

/*!
 * @abstract Initializer for interpolating from an item
 * @discussion If the parameter offsets is nil, no additional offsets per plane
 *    will be applied.
 *    The transform is relative to the bitmap coordinate system.
 * @param item The item to interpolate
 * @param rect The rectangle wich will be extracted
 * @param transform The transform to apply to the image before extraction
 * @param offsets An optional array of offsets (one per item image plane)
 * @param dictionary Parameters dictionary, keys depends on the interpolator
 * @result The initialized interpolator
 */
- (id) initWithItem:(NSObject <LynkeosProcessableItem> *)item
             inRect:(LynkeosIntegerRect)rect
 withNumberOfPlanes:(u_short)nPlanes
       withTranform:(NSAffineTransformStruct)transform
        withOffsets:(const NSPoint*)offsets
     withParameters:(NSDictionary*)params;

/*!
 * @abstract Initializer for interpolating from an image
 * @discussion If the parameter offsets is NULL, no additional offsets per plane
 *    will be applied.
 *    The transform is relative to the bitmap coordinate system.
 * @param image The image to interpolate
 * @param rect The rectangle wich will be extracted
 * @param transform The transform to apply to the image before extraction
 * @param offsets An optional array of offsets (one per item image plane)
 * @param dictionary Parameters dictionary, keys depends on the interpolator
 * @result The initialized interpolator
 */
- (id) initWithImage:(LynkeosImageBuffer *)image
              inRect:(LynkeosIntegerRect)rect
  withNumberOfPlanes:(u_short)nPlanes
        withTranform:(NSAffineTransformStruct)transform
         withOffsets:(const NSPoint*)offsets
      withParameters:(NSDictionary*)params;

/*!
 * @abstract Interpolate one point
 * @param plane The plane in which to interpolate
 * @param x The x coordinate (relative in the rect) of the point to interpolate
 * @param y The y coordinate (relative in the rect) of the point to interpolate
 * @result The interpolated value
 */
- (REAL) interpolateInPLane:(u_short)plane atX:(double)x atY:(double)y;

/*!
 * @abstract Interpolate a vector of points
 * @discussion The first point to interpolate is given by (x, y), other points
 *    are at consecutive x coordinates.
 * @param plane The plane in which to interpolate
 * @param x The x coordinate (relative in the rect) of the 1st point to interpolate
 * @param y The y coordinate (relative in the rect) of the 1st point to interpolate
 * @result The interpolated vector
 */
- (REALVECT) interpolateVectInPLane:(u_short)plane atX:(double)x atY:(double)y;

@end

@interface LynkeosInterpolatorManager : NSObject

/*!
 * @abstract Retrieve the interpolator class best suited for a transformation
 * @param scaling The scaling factor applied to the item
 * @param transform The affine transform applied to the item
 * @result The interpolator class
 */
+ (Class) interpolatorWithScaling:(Scaling_t)scaling transform:(NSAffineTransformStruct)transform ;

/*!
 * @abstract Retrieve an interpolator class by its name
 * @param name The interpolator registered name
 * @result The interpolator class
 */
+ (Class) interpolatorWithName:(NSString*)name;

@end

#endif