/*
* 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.
*/
/*
* FUNCTIONS
* mlib_ImageChannelInsert - Copy the source image into the selected
* channels of the destination image
*
* SYNOPSIS
* mlib_status mlib_ImageChannelInsert(mlib_image *dst,
* mlib_image *src,
* mlib_s32 cmask);
*
* ARGUMENT
* dst Pointer to destination image.
* src Pointer to source image.
* cmask Destination channel selection mask.
* The least significant bit (LSB) is corresponding to the
* last channel in the destination image data.
* The bits with value 1 stand for the channels selected.
* If more than N channels are selected, the leftmost N
* channels are inserted, where N is the number of channels
* in the source image.
*
* RESTRICTION
* The src and dst must have the same width, height and data type.
* The src and dst can have 1, 2, 3 or 4 channels.
* The src and dst can be either MLIB_BYTE, MLIB_SHORT, MLIB_INT,
* MLIB_FLOAT or MLIB_DOUBLE.
*
* DESCRIPTION
* Copy the source image into the selected channels of the destination
* image
*/
#include <stdlib.h>
#include "mlib_image.h"
#include "mlib_ImageCheck.h"
/***************************************************************/
/* functions defined in mlib_v_ImageChannelInsert_1.c */
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
/***************************************************************/
/* functions defined in mlib_v_ImageChannelInsert_34.c */
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
/***************************************************************/
#ifdef MLIB_TEST
#else
#endif
{
int i, bit1count = 0;
/* normalize the cmask, and count the number of bit with value 1 */
for (i = (channeld - 1); i >= 0; i--) {
ncmask += (1 << i);
bit1count++;
}
}
/* do not support the cases in which the number of selected channels is
* less than the nubmber of channels in the source image */
return MLIB_FAILURE;
}
}
switch (mlib_ImageGetType(src)) {
case MLIB_BYTE:
if (channels == 1) {
switch (channeld) {
case 2:
ncmask);
}
ncmask);
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
ncmask);
}
else {
ncmask);
}
break;
case 3:
ncmask);
}
ncmask);
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
ncmask);
}
else {
ncmask);
}
break;
case 4:
ncmask);
}
ncmask);
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
ncmask);
}
else {
ncmask);
}
break;
default:
return MLIB_FAILURE;
}
}
else {
dsize);
}
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
dsize);
}
else {
}
}
dsize);
}
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
dsize);
}
}
else {
ncmask);
}
}
break;
case MLIB_SHORT:
if (channels == 1) {
switch (channeld) {
case 2:
ncmask);
}
ncmask);
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
ncmask);
}
else {
ncmask);
}
break;
case 3:
ncmask);
}
ncmask);
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
ncmask);
}
else {
ncmask);
}
break;
case 4:
ncmask);
}
ncmask);
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
ncmask);
}
else {
ncmask);
}
break;
default:
return MLIB_FAILURE;
}
}
dsize);
}
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
dsize);
}
else {
}
}
dsize);
}
}
else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
dsize);
}
else {
}
}
else {
ncmask);
}
break;
case MLIB_INT:
ncmask);
break;
case MLIB_FLOAT:
ncmask);
break;
case MLIB_DOUBLE:
ncmask);
break;
case MLIB_BIT:
default:
return MLIB_FAILURE; /* MLIB_BIT is not supported here */
}
return MLIB_SUCCESS;
}
/***************************************************************/