start plugins transformation, SUV theme
[cinelerra_cv/mob.git] / plugins / motion / affine.h
blobf1a54d7a917807a994100cea9e4e1e7f02bc0d69
1 #ifndef AFFINE_H
2 #define AFFINE_H
5 #include "affine.inc"
6 #include "loadbalance.h"
7 #include "vframe.inc"
9 // Affine transform library
11 #define AFFINE_OVERSAMPLE 2
13 class AffineMatrix
15 public:
16 AffineMatrix();
17 void identity();
18 void translate(double x, double y);
19 void scale(double x, double y);
20 // Result is put in dst
21 void multiply(AffineMatrix *dst);
22 void copy_from(AffineMatrix *src);
23 void invert(AffineMatrix *dst);
24 void transform_point(float x, float y, float *newx, float *newy);
25 double determinant();
26 void dump();
27 double values[3][3];
30 class AffinePackage : public LoadPackage
32 public:
33 AffinePackage();
34 int y1, y2;
37 class AffineUnit : public LoadClient
39 public:
40 AffineUnit(AffineEngine *server);
41 void process_package(LoadPackage *package);
42 void calculate_matrix(
43 double in_x1,
44 double in_y1,
45 double in_x2,
46 double in_y2,
47 double out_x1,
48 double out_y1,
49 double out_x2,
50 double out_y2,
51 double out_x3,
52 double out_y3,
53 double out_x4,
54 double out_y4,
55 AffineMatrix *result);
56 float transform_cubic(float dx,
57 float jm1,
58 float j,
59 float jp1,
60 float jp2);
61 AffineEngine *server;
64 class AffineEngine : public LoadServer
66 public:
67 AffineEngine(int total_clients,
68 int total_packages);
70 // Temp is only used for STRETCH oversampling
71 // Range of coords is 0 to 100 for coordinates in the image.
72 // The coordinate locations are clockwise around the image.
73 void process(VFrame *output,
74 VFrame *input,
75 VFrame *temp,
76 int mode,
77 float x1,
78 float y1,
79 float x2,
80 float y2,
81 float x3,
82 float y3,
83 float x4,
84 float y4,
85 int forward);
86 // Do rotation with the affine/perspective transform.
87 // This removes some of the extremely faint artifacts in the trig rotation.
88 void rotate(VFrame *output,
89 VFrame *input,
90 float angle);
91 // Set the viewport to transform. All operations are clamped to this area
92 // instead of the frame dimensions. The rotation operation centers on this
93 // area.
94 void set_viewport(int x, int y, int w, int h);
95 // For rotation, set the pivot point. The default is in the middle of the viewport.
96 void set_pivot(int x, int y);
97 void unset_pivot();
98 void unset_viewport();
99 // To use OpenGL for the processing, set to 1
100 void set_opengl(int value);
101 void init_packages();
102 LoadClient* new_client();
103 LoadPackage* new_package();
104 VFrame *input, *output, *temp;
105 int mode;
106 enum
108 PERSPECTIVE,
109 SHEER,
110 STRETCH,
111 ROTATE
113 float x1, y1, x2, y2, x3, y3, x4, y4;
114 int x, y, w, h;
115 int pivot_x, pivot_y;
116 int user_pivot;
117 int user_viewport;
118 int forward;
119 int use_opengl;
124 #endif