📄 libmng_object_prc.c
字号:
#endif iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* ga -> ga */ if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) && (iColortype == MNG_COLORTYPE_GRAYA)) { iNewsamplesize = 2;#ifndef MNG_NO_16BIT_SUPPORT if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16; if (iBitdepth == 16) iNewsamplesize = 4;#endif } else /* ga -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) && (iColortype == MNG_COLORTYPE_RGBA)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16;#endif iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* rgb -> rgb */ if ((pBuf->iColortype == MNG_COLORTYPE_RGB) && (iColortype == MNG_COLORTYPE_RGB)) { iNewsamplesize = 3;#ifndef MNG_NO_16BIT_SUPPORT if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16; if (iBitdepth == 16) iNewsamplesize = 6;#endif } else /* rgb -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_RGB) && (iColortype == MNG_COLORTYPE_RGBA)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16;#endif iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* indexed -> rgb */ if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) && (iColortype == MNG_COLORTYPE_RGB)) {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb8; iNewsamplesize = 3;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 6;#endif } else /* indexed -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) && (iColortype == MNG_COLORTYPE_RGBA)) {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba8; iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* rgba -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_RGBA) && (iColortype == MNG_COLORTYPE_RGBA)) { iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ { if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16; } if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif }#ifdef MNG_INCLUDE_JNG else /* JPEG g -> g */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && (iColortype == MNG_COLORTYPE_JPEGGRAY)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_g8_g16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_g8_g8; } iNewsamplesize = 1;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 2;#endif } else /* JPEG g -> ga */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && (iColortype == MNG_COLORTYPE_JPEGGRAYA)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16;#endif iNewsamplesize = 2;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 4;#endif } else /* JPEG g -> rgb */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && (iColortype == MNG_COLORTYPE_JPEGCOLOR)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16;#endif iNewsamplesize = 3;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 6;#endif } else /* JPEG g -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && (iColortype == MNG_COLORTYPE_JPEGCOLORA)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16;#endif iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* JPEG ga -> ga */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) && (iColortype == MNG_COLORTYPE_JPEGGRAYA)) { iNewsamplesize = 2;#ifndef MNG_NO_16BIT_SUPPORT if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16; if (iBitdepth == 16) iNewsamplesize = 4;#endif } else /* JPEG ga -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) && (iColortype == MNG_COLORTYPE_JPEGCOLORA)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16;#endif iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* JPEG rgb -> rgb */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) && (iColortype == MNG_COLORTYPE_JPEGCOLOR)) { iNewsamplesize = 3;#ifndef MNG_NO_16BIT_SUPPORT if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16; if (iBitdepth == 16) iNewsamplesize = 6;#endif } else /* JPEG rgb -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) && (iColortype == MNG_COLORTYPE_JPEGCOLORA)) { if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ {#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16; else#endif pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8; }#ifndef MNG_NO_16BIT_SUPPORT else /* source = 16 bits */ pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16;#endif iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (iBitdepth == 16) /* 16-bit wide ? */ iNewsamplesize = 8;#endif } else /* JPEG rgba -> rgba */ if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && (iColortype == MNG_COLORTYPE_JPEGCOLORA)) { iNewsamplesize = 4;#ifndef MNG_NO_16BIT_SUPPORT if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ if (iBitdepth == 16) pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16; if (iBitdepth == 16) iNewsamplesize = 8;#endif }#endif /* JNG */ /* found a proper promotion ? */ if (pData->fPromoterow) { pData->pPromBuf = (mng_ptr)pBuf; pData->iPromWidth = pBuf->iWidth; iNewrowsize = iW * iNewsamplesize; iNewbufsize = iH * iNewrowsize; MNG_ALLOC (pData, pNewbuf, iNewbufsize); pData->pPromSrc = (mng_ptr)pBuf->pImgdata; pData->pPromDst = (mng_ptr)pNewbuf; iY = 0; while ((!iRetcode) && (iY < iH)) { iRetcode = ((mng_promoterow)pData->fPromoterow) (pData); pData->pPromSrc = (mng_uint8p)pData->pPromSrc + pBuf->iRowsize; pData->pPromDst = (mng_uint8p)pData->pPromDst + iNewrowsize;/* pData->pPromSrc = (mng_ptr)((mng_uint32)pData->pPromSrc + pBuf->iRowsize); *//* pData->pPromDst = (mng_ptr)((mng_uint32)pData->pPromDst + iNewrowsize); */ iY++; } MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize); pB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -