165 #include <config_auto.h>
170 #include "allheaders.h"
178 static const l_float32 MinAngleToRotate = 0.001;
179 static const l_float32 MaxTwoShearAngle = 0.06;
180 static const l_float32 MaxThreeShearAngle = 0.35;
181 static const l_float32 MaxShearAngle = 0.50;
215 return (
PIX *)(
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
217 return (
PIX *)(
PIX *)ERROR_PTR(
"invalid incolor value", __func__, NULL);
219 if (L_ABS(angle) > MaxShearAngle) {
220 L_ERROR(
"%6.2f radians; too large for shear rotation\n", __func__,
224 if (L_ABS(angle) < MinAngleToRotate)
227 if (L_ABS(angle) <= MaxTwoShearAngle)
266 PIX *pix1, *pix2, *pixd;
269 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
271 return (
PIX *)(
PIX *)ERROR_PTR(
"invalid incolor value", __func__, NULL);
273 if (L_ABS(angle) > MaxShearAngle) {
274 L_ERROR(
"%6.2f radians; too large for shear rotation\n", __func__,
278 if (L_ABS(angle) < MinAngleToRotate)
280 if (L_ABS(angle) > MaxTwoShearAngle)
281 L_WARNING(
"%6.2f radians; large angle for 2-shear rotation\n",
282 __func__, L_ABS(angle));
284 if ((pix1 =
pixHShear(NULL, pixs, ycen, angle, incolor)) == NULL)
285 return (
PIX *)ERROR_PTR(
"pix1 not made", __func__, NULL);
286 pixd =
pixVShear(NULL, pix1, xcen, angle, incolor);
289 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
291 if (pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4) {
342 PIX *pix1, *pix2, *pixd;
345 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
347 return (
PIX *)(
PIX *)ERROR_PTR(
"invalid incolor value", __func__, NULL);
349 if (L_ABS(angle) > MaxShearAngle) {
350 L_ERROR(
"%6.2f radians; too large for shear rotation\n", __func__,
354 if (L_ABS(angle) < MinAngleToRotate)
356 if (L_ABS(angle) > MaxThreeShearAngle) {
357 L_WARNING(
"%6.2f radians; large angle for 3-shear rotation\n",
358 __func__, L_ABS(angle));
361 hangle = atan(sin(angle));
362 if ((pixd =
pixVShear(NULL, pixs, xcen, angle / 2., incolor)) == NULL)
363 return (
PIX *)ERROR_PTR(
"pixd not made", __func__, NULL);
364 if ((pix1 =
pixHShear(NULL, pixd, ycen, hangle, incolor)) == NULL) {
366 return (
PIX *)ERROR_PTR(
"pix1 not made", __func__, NULL);
368 pixVShear(pixd, pix1, xcen, angle / 2., incolor);
371 if (pixGetDepth(pixs) == 32 && pixGetSpp(pixs) == 4) {
423 return ERROR_INT(
"pixs not defined", __func__, 1);
425 return ERROR_INT(
"invalid value for incolor", __func__, 1);
426 if (pixGetColormap(pixs) != NULL)
427 return ERROR_INT(
"pixs is colormapped", __func__, 1);
431 if (L_ABS(angle) > MaxThreeShearAngle) {
432 L_WARNING(
"%6.2f radians; large angle for in-place 3-shear rotation\n",
433 __func__, L_ABS(angle));
436 hangle = atan(sin(angle));
461 return (
PIX *)ERROR_PTR(
"pixs not defined", __func__, NULL);
464 pixGetHeight(pixs) / 2, angle, incolor);
482 return ERROR_INT(
"pixs not defined", __func__, 1);
485 pixGetHeight(pixs) / 2, angle, incolor);
void pixDestroy(PIX **ppix)
pixDestroy()
PIX * pixClone(PIX *pixs)
pixClone()
PIX * pixGetRGBComponent(PIX *pixs, l_int32 comp)
pixGetRGBComponent()
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()
l_ok pixRotateShearIP(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotateShearIP()
PIX * pixRotate3Shear(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotate3Shear()
PIX * pixRotateShear(PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor)
pixRotateShear()
l_ok pixRotateShearCenterIP(PIX *pixs, l_float32 angle, l_int32 incolor)
pixRotateShearCenterIP()
PIX * pixRotateShearCenter(PIX *pixs, l_float32 angle, l_int32 incolor)
pixRotateShearCenter()
PIX * pixVShear(PIX *pixd, PIX *pixs, l_int32 xloc, l_float32 radang, l_int32 incolor)
pixVShear()
l_ok pixHShearIP(PIX *pixs, l_int32 yloc, l_float32 radang, l_int32 incolor)
pixHShearIP()
l_ok pixVShearIP(PIX *pixs, l_int32 xloc, l_float32 radang, l_int32 incolor)
pixVShearIP()
PIX * pixHShear(PIX *pixd, PIX *pixs, l_int32 yloc, l_float32 radang, l_int32 incolor)
pixHShear()