00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <math.h>
00024 #include <stdlib.h>
00025 #include <flgrCoreDispatch.h>
00026 #include <flgrCoreVector.h>
00027 #include <flgrCoreData.h>
00028 #include <flgrCoreCopy.h>
00029 #include <flgrCoreIO.h>
00030 #include <flgrCoreShift.h>
00031 #include <flgrCoreTranspose.h>
00032 #include "flgrCoreShear.h"
00033
00034
00040 #define FLGR_MACRO_SHEAR_X_2D(dtype) \
00041 FLGR_Vector *vec; \
00042 fgFLOAT64 alpha,a; \
00043 int i,k,shift; \
00044 \
00045 \
00046 \
00047 vec = flgr_vector_create(datsrc->spp,datsrc->type); \
00048 flgr_vector_clear(vec); \
00049 \
00050 a = (angle * FLGR_PI)/180; \
00051 \
00052 flgr1d_copy_##dtype##_##dtype(datdest->row[yc], datsrc->row[yc]); \
00053 \
00054 alpha = tan(a); \
00055 alpha = (alpha < 0) ? (-1*alpha) : (alpha); \
00056 \
00057 if(angle<0) { \
00058 for(i=1,k=yc-1 ; i<yc ; i++,k--) { \
00059 shift = (int) (alpha * ((fgFLOAT64) i)); \
00060 flgr1d_shift_right_##dtype(datdest->row[k], datsrc->row[k], \
00061 shift, vec); \
00062 } \
00063 for(k=yc+1,i=1 ; k<datsrc->size_y ; i++,k++) { \
00064 shift = (int) (alpha * ((fgFLOAT64) i)); \
00065 flgr1d_shift_left_##dtype(datdest->row[k], datsrc->row[k], \
00066 shift, vec); \
00067 } \
00068 }else { \
00069 for(i=1,k=yc-1 ; i<yc ; i++,k--) { \
00070 shift = (int) (alpha * ((fgFLOAT64) i)); \
00071 flgr1d_shift_left_##dtype(datdest->row[k], datsrc->row[k], \
00072 shift, vec); \
00073 } \
00074 for(k=yc+1,i=1 ; k<datsrc->size_y ; i++,k++) { \
00075 shift = (int) (alpha * ((fgFLOAT64) i)); \
00076 flgr1d_shift_right_##dtype(datdest->row[k], datsrc->row[k], \
00077 shift, vec); \
00078 } \
00079 } \
00080 \
00081 flgr_vector_destroy(vec)
00082
00083
00084 void flgr2d_shear_x_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00085 FLGR_MACRO_SHEAR_X_2D(fgBIT);
00086 }
00087 void flgr2d_shear_x_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00088 FLGR_MACRO_SHEAR_X_2D(fgUINT8);
00089 }
00090 void flgr2d_shear_x_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00091 FLGR_MACRO_SHEAR_X_2D(fgUINT16);
00092 }
00093 void flgr2d_shear_x_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00094 FLGR_MACRO_SHEAR_X_2D(fgUINT32);
00095 }
00096 void flgr2d_shear_x_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00097 FLGR_MACRO_SHEAR_X_2D(fgINT8);
00098 }
00099 void flgr2d_shear_x_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00100 FLGR_MACRO_SHEAR_X_2D(fgINT16);
00101 }
00102 void flgr2d_shear_x_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00103 FLGR_MACRO_SHEAR_X_2D(fgINT32);
00104 }
00105 void flgr2d_shear_x_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00106 FLGR_MACRO_SHEAR_X_2D(fgFLOAT32);
00107 }
00108 void flgr2d_shear_x_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00109 FLGR_MACRO_SHEAR_X_2D(fgFLOAT64);
00110 }
00112
00120
00121 FLGR_Ret flgr2d_shear_x(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00122 FLGR_Ret ret;
00123
00124
00125
00126 if((datdest==NULL) || (datsrc==NULL)) {
00127 POST_ERROR("Null objects!\n");
00128 return FLGR_RET_NULL_OBJECT;
00129 }
00130
00131 if(angle>360) {
00132 POST_ERROR("angle > 360\n");
00133 return FLGR_RET_PARAM_ERROR;
00134 }
00135
00136 if(angle<-360) {
00137 POST_ERROR("angle < -360\n");
00138 return FLGR_RET_PARAM_ERROR;
00139 }
00140
00141 if((ret = flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__)) != FLGR_RET_OK) return ret;
00142
00143 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_shear_x,datdest,datsrc,xc,yc,angle);
00144
00145 }
00146
00147
00148
00149
00150
00151
00152 #define FLGR_MACRO_SHEAR_Y_2D(dtype) \
00153 FLGR_Vector *vec; \
00154 FLGR_Data2D *tdatdest; \
00155 FLGR_Data2D *tdatsrc; \
00156 fgFLOAT64 alpha,a; \
00157 int i,k,shift; \
00158 \
00159 \
00160 \
00161 tdatsrc = flgr2d_create_pixmap(datsrc->size_x,datsrc->size_y, \
00162 datsrc->spp,datsrc->type); \
00163 tdatdest = flgr2d_create_pixmap(datsrc->size_x,datsrc->size_y, \
00164 datsrc->spp,datsrc->type); \
00165 \
00166 flgr2d_transpose_##dtype(tdatsrc,datsrc); \
00167 \
00168 vec = flgr_vector_create(datsrc->spp,datsrc->type); \
00169 flgr_vector_clear(vec); \
00170 \
00171 a = (angle * FLGR_PI)/180; \
00172 \
00173 flgr1d_copy_##dtype##_##dtype(tdatdest->row[xc], tdatsrc->row[xc]); \
00174 \
00175 alpha = sin(a); \
00176 alpha = (alpha < 0) ? (-1*alpha) : (alpha); \
00177 \
00178 if(angle<0) { \
00179 for(i=1,k=xc-1 ; i<xc ; i++,k--) { \
00180 shift = (int) (alpha * ((fgFLOAT64) i)); \
00181 flgr1d_shift_left_##dtype(tdatdest->row[k], tdatsrc->row[k], \
00182 shift, vec); \
00183 } \
00184 for(k=xc+1,i=0 ; k<tdatsrc->size_y ; i++,k++) { \
00185 shift = (int) (alpha * ((fgFLOAT64) i)); \
00186 flgr1d_shift_right_##dtype(tdatdest->row[k], tdatsrc->row[k], \
00187 shift, vec); \
00188 } \
00189 }else { \
00190 for(i=1,k=xc-1 ; i<xc ; i++,k--) { \
00191 shift = (int) (alpha * ((fgFLOAT64) i)); \
00192 flgr1d_shift_right_##dtype(tdatdest->row[k], tdatsrc->row[k], \
00193 shift, vec); \
00194 } \
00195 for(k=xc+1,i=1 ; k<tdatsrc->size_y ; i++,k++) { \
00196 shift = (int) (alpha * ((fgFLOAT64) i)); \
00197 flgr1d_shift_left_##dtype(tdatdest->row[k], tdatsrc->row[k], \
00198 shift, vec); \
00199 } \
00200 } \
00201 \
00202 flgr2d_transpose_##dtype(datdest,tdatdest); \
00203 \
00204 flgr2d_destroy(tdatdest); \
00205 flgr2d_destroy(tdatsrc); \
00206 flgr_vector_destroy(vec)
00207
00208
00209 void flgr2d_shear_y_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00210 FLGR_MACRO_SHEAR_Y_2D(fgBIT);
00211 }
00212 void flgr2d_shear_y_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00213 FLGR_MACRO_SHEAR_Y_2D(fgUINT8);
00214 }
00215 void flgr2d_shear_y_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00216 FLGR_MACRO_SHEAR_Y_2D(fgUINT16);
00217 }
00218 void flgr2d_shear_y_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00219 FLGR_MACRO_SHEAR_Y_2D(fgUINT32);
00220 }
00221 void flgr2d_shear_y_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00222 FLGR_MACRO_SHEAR_Y_2D(fgINT8);
00223 }
00224 void flgr2d_shear_y_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00225 FLGR_MACRO_SHEAR_Y_2D(fgINT16);
00226 }
00227 void flgr2d_shear_y_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00228 FLGR_MACRO_SHEAR_Y_2D(fgINT32);
00229 }
00230 void flgr2d_shear_y_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00231 FLGR_MACRO_SHEAR_Y_2D(fgFLOAT32);
00232 }
00233 void flgr2d_shear_y_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00234 FLGR_MACRO_SHEAR_Y_2D(fgFLOAT64);
00235 }
00237
00245
00246 FLGR_Ret flgr2d_shear_y(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00247 FLGR_Ret ret;
00248
00249
00250
00251 if((datdest==NULL) || (datsrc==NULL)) {
00252 POST_ERROR("Null objects!\n");
00253 return FLGR_RET_NULL_OBJECT;
00254 }
00255
00256 if(angle>360) {
00257 POST_ERROR("angle > 360\n");
00258 return FLGR_RET_PARAM_ERROR;
00259 }
00260
00261 if(angle<-360) {
00262 POST_ERROR("angle < -360\n");
00263 return FLGR_RET_PARAM_ERROR;
00264 }
00265
00266 if((ret = flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__)) != FLGR_RET_OK) return ret;
00267
00268 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_shear_y,datdest,datsrc,xc,yc,angle);
00269
00270 }
00271
00272
00273
00274
00275 #define FLGR_MACRO_SHEAR_CIRCULAR_X_2D(dtype) \
00276 fgFLOAT64 alpha,a; \
00277 int i,k,shift_circular; \
00278 \
00279 \
00280 \
00281 a = (angle * FLGR_PI)/180; \
00282 \
00283 flgr1d_copy_##dtype##_##dtype(datdest->row[yc], datsrc->row[yc]); \
00284 \
00285 alpha = tan(a); \
00286 alpha = (alpha < 0) ? (-1*alpha) : (alpha); \
00287 \
00288 if(angle<0) { \
00289 for(i=0,k=yc-1 ; i<yc ; i++,k--) { \
00290 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00291 flgr1d_shift_circular_right_##dtype(datdest->row[k], \
00292 datsrc->row[k], \
00293 shift_circular); \
00294 } \
00295 for(k=yc+1,i=0 ; k<datsrc->size_y ; i++,k++) { \
00296 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00297 flgr1d_shift_circular_left_##dtype(datdest->row[k], \
00298 datsrc->row[k], \
00299 shift_circular); \
00300 } \
00301 }else { \
00302 for(i=0,k=yc-1 ; i<yc ; i++,k--) { \
00303 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00304 flgr1d_shift_circular_left_##dtype(datdest->row[k], \
00305 datsrc->row[k], \
00306 shift_circular); \
00307 } \
00308 for(k=yc+1,i=0 ; k<datsrc->size_y ; i++,k++) { \
00309 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00310 flgr1d_shift_circular_right_##dtype(datdest->row[k], \
00311 datsrc->row[k], \
00312 shift_circular); \
00313 } \
00314 } \
00315 \
00316 return
00317
00318
00319 void flgr2d_shear_circular_x_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00320 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgBIT);
00321 }
00322 void flgr2d_shear_circular_x_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00323 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgUINT8);
00324 }
00325 void flgr2d_shear_circular_x_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00326 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgUINT16);
00327 }
00328 void flgr2d_shear_circular_x_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00329 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgUINT32);
00330 }
00331 void flgr2d_shear_circular_x_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00332 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgINT8);
00333 }
00334 void flgr2d_shear_circular_x_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00335 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgINT16);
00336 }
00337 void flgr2d_shear_circular_x_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00338 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgINT32);
00339 }
00340 void flgr2d_shear_circular_x_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00341 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgFLOAT32);
00342 }
00343 void flgr2d_shear_circular_x_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00344 FLGR_MACRO_SHEAR_CIRCULAR_X_2D(fgFLOAT64);
00345 }
00347
00355
00356 FLGR_Ret flgr2d_shear_circular_x(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00357 FLGR_Ret ret;
00358
00359
00360
00361 if((datdest==NULL) || (datsrc==NULL)) {
00362 POST_ERROR("Null objects!\n");
00363 return FLGR_RET_NULL_OBJECT;
00364 }
00365
00366 if(angle>45) {
00367 POST_ERROR("angle > 45\n");
00368 return FLGR_RET_PARAM_ERROR;
00369 }
00370
00371 if(angle<-45) {
00372 POST_ERROR("angle < -45\n");
00373 return FLGR_RET_PARAM_ERROR;
00374 }
00375
00376 if((ret = flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__)) != FLGR_RET_OK) return ret;
00377
00378 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_shear_circular_x,datdest,datsrc,xc,yc,angle);
00379
00380 }
00381
00382
00383
00384
00385
00386
00387 #define FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(dtype) \
00388 FLGR_Data2D *tdatdest; \
00389 FLGR_Data2D *tdatsrc; \
00390 fgFLOAT64 alpha,a; \
00391 int i,k,shift_circular; \
00392 \
00393 \
00394 \
00395 tdatsrc = flgr2d_create_pixmap(datsrc->size_x,datsrc->size_y, \
00396 datsrc->spp,datsrc->type); \
00397 tdatdest = flgr2d_create_pixmap(datsrc->size_x,datsrc->size_y, \
00398 datsrc->spp,datsrc->type); \
00399 \
00400 flgr2d_transpose_##dtype(tdatsrc,datsrc); \
00401 \
00402 a = (angle * FLGR_PI)/180; \
00403 \
00404 flgr1d_copy_##dtype##_##dtype(tdatdest->row[xc], tdatsrc->row[xc]); \
00405 \
00406 alpha = sin(a); \
00407 alpha = (alpha < 0) ? (-1*alpha) : (alpha); \
00408 \
00409 if(angle<0) { \
00410 for(i=0,k=xc-1 ; i<xc ; i++,k--) { \
00411 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00412 flgr1d_shift_circular_left_##dtype(tdatdest->row[k], \
00413 tdatsrc->row[k], \
00414 shift_circular); \
00415 } \
00416 for(k=xc+1,i=0 ; k<tdatsrc->size_y ; i++,k++) { \
00417 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00418 flgr1d_shift_circular_right_##dtype(tdatdest->row[k], \
00419 tdatsrc->row[k], \
00420 shift_circular); \
00421 } \
00422 }else { \
00423 for(i=0,k=xc-1 ; i<xc ; i++,k--) { \
00424 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00425 flgr1d_shift_circular_right_##dtype(tdatdest->row[k], \
00426 tdatsrc->row[k], \
00427 shift_circular); \
00428 } \
00429 for(k=xc+1,i=0 ; k<tdatsrc->size_y ; i++,k++) { \
00430 shift_circular = (int) (alpha * ((fgFLOAT64) i)); \
00431 flgr1d_shift_circular_left_##dtype(tdatdest->row[k], \
00432 tdatsrc->row[k], \
00433 shift_circular); \
00434 } \
00435 } \
00436 \
00437 flgr2d_transpose_##dtype(datdest,tdatdest); \
00438 \
00439 flgr2d_destroy(tdatdest); \
00440 flgr2d_destroy(tdatsrc)
00441
00442 void flgr2d_shear_circular_y_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00443 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgBIT);
00444 }
00445 void flgr2d_shear_circular_y_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00446 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgUINT8);
00447 }
00448 void flgr2d_shear_circular_y_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00449 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgUINT16);
00450 }
00451 void flgr2d_shear_circular_y_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00452 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgUINT32);
00453 }
00454 void flgr2d_shear_circular_y_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00455 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgINT8);
00456 }
00457 void flgr2d_shear_circular_y_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00458 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgINT16);
00459 }
00460 void flgr2d_shear_circular_y_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00461 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgINT32);
00462 }
00463 void flgr2d_shear_circular_y_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00464 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgFLOAT32);
00465 }
00466 void flgr2d_shear_circular_y_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00467 FLGR_MACRO_SHEAR_CIRCULAR_Y_2D(fgFLOAT64);
00468 }
00470
00478
00479 FLGR_Ret flgr2d_shear_circular_y(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, int xc, int yc, fgFLOAT64 angle) {
00480 FLGR_Ret ret;
00481
00482
00483
00484 if((datdest==NULL) || (datsrc==NULL)) {
00485 POST_ERROR("Null objects!\n");
00486 return FLGR_RET_NULL_OBJECT;
00487 }
00488
00489 if(angle>90) {
00490 POST_ERROR("angle > 90\n");
00491 return FLGR_RET_PARAM_ERROR;
00492 }
00493
00494 if(angle<-90) {
00495 POST_ERROR("angle < -90\n");
00496 return FLGR_RET_PARAM_ERROR;
00497 }
00498
00499 if((ret = flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__)) != FLGR_RET_OK) return ret;
00500
00501 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_shear_circular_y,datdest,datsrc,xc,yc,angle);
00502
00503 }
00504
00505
00506 #define FLGR_MACRO_ROTATE_CENTER(dtype) \
00507 int xc = datsrc->size_x/2; \
00508 int yc = datsrc->size_y/2; \
00509 FLGR_Data2D *dattmp; \
00510 \
00511 \
00512 \
00513 dattmp = flgr2d_create_from(datsrc); \
00514 \
00515 if((angle==180) || (angle==-180)) { \
00516 flgr2d_mirror_horizontal_##dtype(dattmp,datsrc); \
00517 flgr2d_mirror_vertical(datdest,dattmp); \
00518 \
00519 }else if((angle>90) && (angle<180)) { \
00520 flgr2d_mirror_horizontal_##dtype(dattmp,datsrc); \
00521 flgr2d_mirror_vertical_hmorph(dattmp); \
00522 angle = angle-180; \
00523 flgr2d_shear_circular_x_##dtype(datdest,dattmp,xc,yc, angle/2); \
00524 flgr2d_shear_circular_y_##dtype(dattmp,datdest,xc,yc, angle); \
00525 flgr2d_shear_circular_x_##dtype(datdest,dattmp,xc,yc, angle/2); \
00526 \
00527 }else if((angle < -90) && (angle > -180)) { \
00528 flgr2d_mirror_horizontal_##dtype(dattmp,datsrc); \
00529 flgr2d_mirror_vertical_hmorph(dattmp); \
00530 angle = 180+angle; \
00531 flgr2d_shear_circular_x_##dtype(datdest,dattmp,xc,yc, angle/2); \
00532 flgr2d_shear_circular_y_##dtype(dattmp,datdest,xc,yc, angle); \
00533 flgr2d_shear_circular_x_##dtype(datdest,dattmp,xc,yc, angle/2); \
00534 \
00535 }else{ \
00536 flgr2d_shear_circular_x_##dtype(datdest,datsrc,xc,yc, angle/2); \
00537 flgr2d_shear_circular_y_##dtype(dattmp,datdest,xc,yc, angle); \
00538 flgr2d_shear_circular_x_##dtype(datdest,dattmp,xc,yc, angle/2); \
00539 \
00540 } \
00541 \
00542 flgr2d_destroy(dattmp)
00543
00544
00545 void flgr2d_rotate_center_fgBIT(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00546 FLGR_MACRO_ROTATE_CENTER(fgBIT);
00547 }
00548 void flgr2d_rotate_center_fgUINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00549 FLGR_MACRO_ROTATE_CENTER(fgUINT8);
00550 }
00551 void flgr2d_rotate_center_fgUINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00552 FLGR_MACRO_ROTATE_CENTER(fgUINT16);
00553 }
00554 void flgr2d_rotate_center_fgUINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00555 FLGR_MACRO_ROTATE_CENTER(fgUINT32);
00556 }
00557 void flgr2d_rotate_center_fgINT8(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00558 FLGR_MACRO_ROTATE_CENTER(fgINT8);
00559 }
00560 void flgr2d_rotate_center_fgINT16(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00561 FLGR_MACRO_ROTATE_CENTER(fgINT16);
00562 }
00563 void flgr2d_rotate_center_fgINT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00564 FLGR_MACRO_ROTATE_CENTER(fgINT32);
00565 }
00566 void flgr2d_rotate_center_fgFLOAT32(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00567 FLGR_MACRO_ROTATE_CENTER(fgFLOAT32);
00568 }
00569 void flgr2d_rotate_center_fgFLOAT64(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00570 FLGR_MACRO_ROTATE_CENTER(fgFLOAT64);
00571 }
00573
00579
00580 FLGR_Ret flgr2d_rotate_center(FLGR_Data2D *datdest, FLGR_Data2D *datsrc, fgFLOAT64 angle) {
00581 FLGR_Ret ret;
00582
00583
00584
00585 if((datdest==NULL) || (datsrc==NULL)) {
00586 POST_ERROR("Null objects!\n");
00587 return FLGR_RET_NULL_OBJECT;
00588 }
00589
00590 if(angle>180) {
00591 POST_ERROR("angle > 180\n");
00592 return FLGR_RET_PARAM_ERROR;
00593 }
00594
00595 if(angle<-180) {
00596 POST_ERROR("angle < -180\n");
00597 return FLGR_RET_PARAM_ERROR;
00598 }
00599
00600 if((ret = flgr2d_is_data_same_attributes(datdest,datsrc,__FUNCTION__)) != FLGR_RET_OK) return ret;
00601
00602 FLGR_DISPATCH_PROCEDURE(datdest->type,flgr2d_rotate_center,datdest,datsrc,angle);
00603
00604
00605 }
00606