/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* FUNCTION
* mlib_ImageAffine - image affine transformation with edge condition
*
* SYNOPSIS
* mlib_status mlib_ImageAffine(mlib_image *dst,
* const mlib_image *src,
* const mlib_d64 *mtx,
* mlib_filter filter,
* mlib_edge edge)
*
* ARGUMENTS
* dst Pointer to destination image
* src Pointer to source image
* mtx Transformation matrix, where
* mtx[0] holds a; mtx[1] holds b;
* mtx[2] holds tx; mtx[3] holds c;
* mtx[4] holds d; mtx[5] holds ty.
* filter Type of resampling filter.
* edge Type of edge condition.
*
* DESCRIPTION
* xd = a*xs + b*ys + tx
* yd = c*xs + d*ys + ty
*
* The upper-left corner pixel of an image is located at (0.5, 0.5).
*
* The resampling filter can be one of the following:
* MLIB_NEAREST
* MLIB_BILINEAR
* MLIB_BICUBIC
* MLIB_BICUBIC2
*
* The edge condition can be one of the following:
* MLIB_EDGE_DST_NO_WRITE (default)
* MLIB_EDGE_DST_FILL_ZERO
* MLIB_EDGE_OP_NEAREST
* MLIB_EDGE_SRC_EXTEND
* MLIB_EDGE_SRC_PADDED
*
* RESTRICTION
* src and dst must be the same type and the same number of channels.
* They can have 1, 2, 3 or 4 channels. They can be in MLIB_BIT, MLIB_BYTE,
* MLIB_SHORT, MLIB_USHORT or MLIB_INT data type.
*
* src image can not have width or height larger than 32767.
*/
#include "mlib_ImageCheck.h"
#include "mlib_ImageColormap.h"
#include "mlib_ImageAffine.h"
/***************************************************************/
/***************************************************************/
};
/***************************************************************/
};
/***************************************************************/
};
/***************************************************************/
};
/***************************************************************/
#ifdef i386 /* do not perform the coping by mlib_d64 data type for x86 */
#else
#endif /* i386 ( do not perform the coping by mlib_d64 data type for x86 ) */
/***************************************************************/
const mlib_image *src,
const void *colormap)
{
/* check for obvious errors */
switch (filter) {
case MLIB_NEAREST:
kw = 1;
kw1 = 0;
break;
case MLIB_BILINEAR:
kw = 2;
kw1 = 0;
break;
case MLIB_BICUBIC:
case MLIB_BICUBIC2:
kw = 4;
kw1 = 1;
break;
default:
return MLIB_FAILURE;
}
if (res != MLIB_SUCCESS)
return res;
t_ind = 0;
else if (type == MLIB_SHORT)
t_ind = 1;
t_ind = 2;
else if (type == MLIB_USHORT)
t_ind = 3;
else if (type == MLIB_FLOAT)
t_ind = 4;
else if (type == MLIB_DOUBLE)
t_ind = 5;
else
return MLIB_FAILURE; /* unknown image type */
return MLIB_FAILURE;
t_ind += 2;
t_ind++;
}
return MLIB_FAILURE;
}
else {
switch (filter) {
case MLIB_NEAREST:
if (t_ind >= 3)
/* two channels as one channel of next type */
nchan >>= 1;
t_ind++;
}
break;
case MLIB_BILINEAR:
}
else {
}
break;
case MLIB_BICUBIC:
case MLIB_BICUBIC2:
}
else {
}
break;
}
if (res != MLIB_SUCCESS) {
return res;
}
}
if (edge == MLIB_EDGE_SRC_PADDED)
if (res != MLIB_SUCCESS) {
return res;
}
switch (edge) {
case MLIB_EDGE_DST_FILL_ZERO:
break;
case MLIB_EDGE_OP_NEAREST:
break;
case MLIB_EDGE_SRC_EXTEND:
if (filter == MLIB_BILINEAR) {
}
else {
}
break;
default:
/* nothing to do for other edge types. */
break;
}
}
return res;
}
/***************************************************************/
const mlib_image *src,
{
return MLIB_FAILURE;
}
}
/***************************************************************/