/* * The Npic library * * Copyright (C) 2003 Edouard Thiel * * This library is free software under the terms of the * GNU Lesser General Public License (LGPL) version 2.1. */ /* DO NOT EDIT !!! Generated by npic-templa from "mask_ntype.ct" */ /* * mask_ntype.c - 16/01/2009 * * Translate mask type to name and vice-versa */ #include /*--------------------- P U B L I C - I N T E R F A C E ----------------------*/ /* * Describe the mask type corresponding to dim and pixeltype. * dim is in 2..6 and pixeltype is one of NPIC_L, NPIC_D. * * Return one of these constants: NPIC_MASK_2L, .. NPIC_MASK_6D, * else NPIC_NONE on error. Silent. */ int NpicMaskNtype (int dim, int pixeltype) { switch (dim) { case 2 : switch (pixeltype) { case NPIC_L : return NPIC_MASK_2L; case NPIC_D : return NPIC_MASK_2D; } break; case 3 : switch (pixeltype) { case NPIC_L : return NPIC_MASK_3L; case NPIC_D : return NPIC_MASK_3D; } break; case 4 : switch (pixeltype) { case NPIC_L : return NPIC_MASK_4L; case NPIC_D : return NPIC_MASK_4D; } break; case 5 : switch (pixeltype) { case NPIC_L : return NPIC_MASK_5L; case NPIC_D : return NPIC_MASK_5D; } break; case 6 : switch (pixeltype) { case NPIC_L : return NPIC_MASK_6L; case NPIC_D : return NPIC_MASK_6D; } break; } return NPIC_NONE; } /* * Describe the pixel type from the mask ntype. * * Return one of these constants: NPIC_L or NPIC_D, * else NPIC_NONE on error. Silent. */ int NpicMaskPixelType (int ntype) { switch (ntype) { case NPIC_MASK_2L : return NPIC_L; case NPIC_MASK_3L : return NPIC_L; case NPIC_MASK_4L : return NPIC_L; case NPIC_MASK_5L : return NPIC_L; case NPIC_MASK_6L : return NPIC_L; case NPIC_MASK_2D : return NPIC_D; case NPIC_MASK_3D : return NPIC_D; case NPIC_MASK_4D : return NPIC_D; case NPIC_MASK_5D : return NPIC_D; case NPIC_MASK_6D : return NPIC_D; } return NPIC_NONE; } /* * Return the mask type name from the mask ntype. Silent. */ const char *NpicMaskTypeName (int ntype) { switch (ntype) { case NPIC_MASK_2L : return "NPIC_MASK_2L"; case NPIC_MASK_3L : return "NPIC_MASK_3L"; case NPIC_MASK_4L : return "NPIC_MASK_4L"; case NPIC_MASK_5L : return "NPIC_MASK_5L"; case NPIC_MASK_6L : return "NPIC_MASK_6L"; case NPIC_MASK_2D : return "NPIC_MASK_2D"; case NPIC_MASK_3D : return "NPIC_MASK_3D"; case NPIC_MASK_4D : return "NPIC_MASK_4D"; case NPIC_MASK_5D : return "NPIC_MASK_5D"; case NPIC_MASK_6D : return "NPIC_MASK_6D"; default : return "ERROR"; } } /* * Return Mask dimension from ntype, else -1. Silent. */ int NpicMaskDim (int ntype) { switch (ntype) { case NPIC_MASK_2L : return 2; case NPIC_MASK_2D : return 2; case NPIC_MASK_3L : return 3; case NPIC_MASK_3D : return 3; case NPIC_MASK_4L : return 4; case NPIC_MASK_4D : return 4; case NPIC_MASK_5L : return 5; case NPIC_MASK_5D : return 5; case NPIC_MASK_6L : return 6; case NPIC_MASK_6D : return 6; default : return -1; } } /*-------------------- P R I V A T E - F U N C T I O N S ---------------------*/ /*----------------------------------------------------------------------------*/