src/rotate.c
PIX *
pixRotateGammaXform(PIX       *pixs,
                    l_float32  gamma,
                    l_float32  angle,
                    l_float32  fract)
{
PIX  *pixg, *pixd;

    PROCNAME("pixRotateGammaXform");

    if (!pixs || (pixGetDepth(pixs) != 32))
        return (PIX *)ERROR_PTR("pixs undefined or not 32 bpp", procName, NULL);
    if (fract == 0.0)
        L_WARNING("fully opaque alpha; image cannot be blended", procName);
    if (gamma <= 0.0)  {
        L_WARNING("gamma must be > 0.0; setting to 1.0", procName);
        gamma = 1.0;
    }

    pixg = pixGammaTRCWithAlpha(NULL, pixs, 1.0 / gamma, 0, 255);
    pixd = pixRotateWithAlpha(pixg, angle, NULL, fract);
    pixGammaTRCWithAlpha(pixd, pixd, gamma, 0, 255);
    pixDestroy(&pixg);
    return pixd;
}
/*!
 *  pixRotateGammaXform()
 *
 *      Input:  pixs (32 bpp rgb)
 *              gamma (gamma correction; must be > 0.0)
 *              angle (radians; clockwise is positive)
 *              fract (between 0.0 and 1.0, with 1.0 fully transparent)
 *      Return: pixd, or null on error
 *
 *  Notes:
 *      (1) This wraps a gamma/inverse-gamma photometric transform
 *          around pixRotateWithAlpha().
 *      (2) For usage, see notes in pixRotateWithAlpha() and
 *          pixGammaTRCWithAlpha().
 *      (3) The basic idea of a gamma/inverse-gamma transform is
 *          to remove gamma correction before rotating and restore
 *          it afterward.  The effects can be subtle, but important for
 *          some applications.  For example, using gamma > 1.0 will
 *          cause the dark areas to become somewhat lighter and slightly
 *          reduce aliasing effects when blending using the alpha channel.
 */
pixRotateGammaXform()
Input:  pixs (32 bpp rgb)
gamma (gamma correction; must be > 0.0)
angle (radians; clockwise is positive)
fract (between 0.0 and 1.0, with 1.0 fully transparent)
Return: pixd, or null on error

(1) This wraps a gamma/inverse-gamma photometric transform
around pixRotateWithAlpha().
(2) For usage, see notes in pixRotateWithAlpha() and
pixGammaTRCWithAlpha().
(3) The basic idea of a gamma/inverse-gamma transform is
to remove gamma correction before rotating and restore
it afterward.  The effects can be subtle, but important for
some applications.  For example, using gamma > 1.0 will
cause the dark areas to become somewhat lighter and slightly
reduce aliasing effects when blending using the alpha channel.
pixRotateGammaXform () Input : pixs ( 32 bpp rgb ) gamma ( gamma correction ; must be > 0 . 0 ) angle ( radians ; clockwise is positive ) fract ( between 0 . 0 and 1 . 0 with 1 . 0 fully transparent ) Return : pixd or null on error ( 1 ) This wraps a gamma / inverse - gamma photometric transform around pixRotateWithAlpha () . ( 2 ) For usage see notes in pixRotateWithAlpha () and pixGammaTRCWithAlpha () . ( 3 ) The basic idea of a gamma / inverse - gamma transform is to remove gamma correction before rotating and restore it afterward . The effects can be subtle but important for some applications . For example using gamma > 1 . 0 will cause the dark areas to become somewhat lighter and slightly reduce aliasing effects when blending using the alpha channel .
PIX *
pixRotateGammaXform(PIX       *pixs,
                    l_float32  gamma,
                    l_float32  angle,
                    l_float32  fract)
{
PIX  *pixg, *pixd;
    PROCNAME("pixRotateGammaXform");
    if (!pixs || (pixGetDepth(pixs) != 32))
        return (PIX *)ERROR_PTR("pixs undefined or not 32 bpp", procName, NULL);
    if (fract == 0.0)
        L_WARNING("fully opaque alpha; image cannot be blended", procName);
    if (gamma <= 0.0)  {
        L_WARNING("gamma must be > 0.0; setting to 1.0", procName);
        gamma = 1.0;
    }
    pixg = pixGammaTRCWithAlpha(NULL, pixs, 1.0 / gamma, 0, 255);
    pixd = pixRotateWithAlpha(pixg, angle, NULL, fract);
    pixGammaTRCWithAlpha(pixd, pixd, gamma, 0, 255);
    pixDestroy(&pixg);
    return pixd;
}
PIX * pixRotateGammaXform ( PIX * pixs , l_float32 gamma , l_float32 angle , l_float32 fract ) { PIX * pixg , * pixd ; PROCNAME ( " " ) ; if ( ! pixs || ( pixGetDepth ( pixs ) != 32 ) ) return ( PIX * ) ERROR_PTR ( " " , procName , NULL ) ; if ( fract == 0.0 ) L_WARNING ( " " , procName ) ; if ( gamma <= 0.0 ) { L_WARNING ( " " , procName ) ; gamma = 1.0 ; } pixg = pixGammaTRCWithAlpha ( NULL , pixs , 1.0 / gamma , 0 , 255 ) ; pixd = pixRotateWithAlpha ( pixg , angle , NULL , fract ) ; pixGammaTRCWithAlpha ( pixd , pixd , gamma , 0 , 255 ) ; pixDestroy ( & pixg ) ; return pixd ; }
pixRotateGammaXform()
      Input:  pixs (32 bpp rgb)
              gamma (gamma correction; must be > 0.0)
              angle (radians; clockwise is positive)
              fract (between 0.0 and 1.0, with 1.0 fully transparent)
      Return: pixd, or null on error
pixRotateGammaXform () Input : pixs ( 32 bpp rgb ) gamma ( gamma correction ; must be > 0 . 0 ) angle ( radians ; clockwise is positive ) fract ( between 0 . 0 and 1 . 0 with 1 . 0 fully transparent ) Return : pixd or null on error