165 #include "allheaders.h" 167 static const l_float32 MIN_ANGLE_TO_ROTATE = 0.001;
168 static const l_float32 MAX_2_SHEAR_ANGLE = 0.06;
169 static const l_float32 LIMIT_SHEAR_ANGLE = 0.35;
202 PROCNAME(
"pixRotateShear");
205 return (
PIX *)(
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
207 return (
PIX *)(
PIX *)ERROR_PTR(
"invalid incolor value", procName, NULL);
209 if (L_ABS(angle) < MIN_ANGLE_TO_ROTATE)
212 if (L_ABS(angle) <= MAX_2_SHEAR_ANGLE)
215 if (L_ABS(angle) > LIMIT_SHEAR_ANGLE)
216 L_WARNING(
"%6.2f radians; large angle for shear rotation\n",
217 procName, L_ABS(angle));
254 PIX *pix1, *pix2, *pixd;
256 PROCNAME(
"pixRotate2Shear");
259 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
261 return (
PIX *)(
PIX *)ERROR_PTR(
"invalid incolor value", procName, NULL);
263 if (L_ABS(angle) < MIN_ANGLE_TO_ROTATE)
265 if (L_ABS(angle) > MAX_2_SHEAR_ANGLE)
266 L_WARNING(
"%6.2f radians; large angle for 2-shear rotation\n",
267 procName, L_ABS(angle));
269 if ((pix1 =
pixHShear(NULL, pixs, ycen, angle, incolor)) == NULL)
270 return (
PIX *)ERROR_PTR(
"pix1 not made", procName, NULL);
271 pixd =
pixVShear(NULL, pix1, xcen, angle, incolor);
274 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
276 if (pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4) {
326 PIX *pix1, *pix2, *pixd;
328 PROCNAME(
"pixRotate3Shear");
331 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
333 return (
PIX *)(
PIX *)ERROR_PTR(
"invalid incolor value", procName, NULL);
335 if (L_ABS(angle) < MIN_ANGLE_TO_ROTATE)
337 if (L_ABS(angle) > LIMIT_SHEAR_ANGLE) {
338 L_WARNING(
"%6.2f radians; large angle for 3-shear rotation\n",
339 procName, L_ABS(angle));
342 hangle = atan(sin(angle));
343 if ((pixd =
pixVShear(NULL, pixs, xcen, angle / 2., incolor)) == NULL)
344 return (
PIX *)ERROR_PTR(
"pixd not made", procName, NULL);
345 if ((pix1 =
pixHShear(NULL, pixd, ycen, hangle, incolor)) == NULL) {
347 return (
PIX *)ERROR_PTR(
"pix1 not made", procName, NULL);
349 pixVShear(pixd, pix1, xcen, angle / 2., incolor);
352 if (pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4) {
403 PROCNAME(
"pixRotateShearIP");
406 return ERROR_INT(
"pixs not defined", procName, 1);
408 return ERROR_INT(
"invalid value for incolor", procName, 1);
409 if (pixGetColormap(pixs) != NULL)
410 return ERROR_INT(
"pixs is colormapped", procName, 1);
414 if (L_ABS(angle) > LIMIT_SHEAR_ANGLE) {
415 L_WARNING(
"%6.2f radians; large angle for in-place 3-shear rotation\n",
416 procName, L_ABS(angle));
419 hangle = atan(sin(angle));
443 PROCNAME(
"pixRotateShearCenter");
446 return (
PIX *)ERROR_PTR(
"pixs not defined", procName, NULL);
449 pixGetHeight(pixs) / 2, angle, incolor);
466 PROCNAME(
"pixRotateShearCenterIP");
469 return ERROR_INT(
"pixs not defined", procName, 1);
472 pixGetHeight(pixs) / 2, angle, incolor);
PIX * pixRotateShear(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotateShear()
l_ok pixSetRGBComponent(PIX *pixd, PIX *pixs, l_int32 comp)
pixSetRGBComponent()
PIX * pixRotate2Shear(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotate2Shear()
PIX * pixRotate3Shear(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotate3Shear()
l_ok pixRotateShearIP(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotateShearIP()
l_ok pixVShearIP(PIX *pixs, l_int32 xloc, l_float32 radang, l_int32 incolor)
pixVShearIP()
PIX * pixVShear(PIX *pixd, PIX *pixs, l_int32 xloc, l_float32 radang, l_int32 incolor)
pixVShear()
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
l_ok pixHShearIP(PIX *pixs, l_int32 yloc, l_float32 radang, l_int32 incolor)
pixHShearIP()
PIX * pixRotateShearCenter(PIX *pixs, l_float32 angle, l_int32 incolor)
pixRotateShearCenter()
PIX * pixClone(PIX *pixs)
pixClone()
void pixDestroy(PIX **ppix)
pixDestroy()
PIX * pixHShear(PIX *pixd, PIX *pixs, l_int32 yloc, l_float32 radang, l_int32 incolor)
pixHShear()
l_ok pixRotateShearCenterIP(PIX *pixs, l_float32 angle, l_int32 incolor)
pixRotateShearCenterIP()