⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libmng_cms.c

📁 Linux下的基于X11的图形开发环境。
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS *//* ************************************************************************** */#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)mng_retcode init_gamma_only_object (mng_datap pData){  mng_float      dGamma;  mng_imagedatap pBuf;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY_OBJ, MNG_LC_START)#endif                                       /* address the object-buffer */  pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;  if (pBuf->bHasSRGB)                  /* get the gamma value */    dGamma = 0.45455;  else  if (pBuf->bHasGAMA)    dGamma = (mng_float)pBuf->iGamma / 100000;  else    dGamma = pData->dDfltimggamma;  if (dGamma)                          /* lets not divide by zero, shall we... */    dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma);  if (dGamma != pData->dLastgamma)     /* lookup table needs to be computed ? */  {    mng_int32 iX;    pData->aGammatab [0] = 0;    for (iX = 1; iX <= 255; iX++)      pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5);    pData->dLastgamma = dGamma;        /* keep for next time */  }                                       /* load color-correction routine */  pData->fCorrectrow = (mng_fptr)correct_gamma_only;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY_OBJ, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS *//* ************************************************************************** */#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)mng_retcode correct_gamma_only (mng_datap pData){  mng_uint8p pWork;  mng_int32  iX;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_START)#endif  pWork = pData->pRGBArow;             /* address intermediate row */  if (pData->bIsRGBA16)                /* 16-bit intermediate row ? */  {       /* TODO: 16-bit precision gamma processing */     /* we'll just do the high-order byte for now */                                            /* convert all samples in the row */     for (iX = 0; iX < pData->iRowsamples; iX++)     {                                 /* using the precalculated gamma lookup table */       *pWork     = pData->aGammatab [*pWork];       *(pWork+2) = pData->aGammatab [*(pWork+2)];       *(pWork+4) = pData->aGammatab [*(pWork+4)];       pWork += 8;     }  }  else  {                                    /* convert all samples in the row */     for (iX = 0; iX < pData->iRowsamples; iX++)     {                                 /* using the precalculated gamma lookup table */       *pWork     = pData->aGammatab [*pWork];       *(pWork+1) = pData->aGammatab [*(pWork+1)];       *(pWork+2) = pData->aGammatab [*(pWork+2)];       pWork += 4;     }  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS *//* ************************************************************************** */#ifdef MNG_APP_CMSmng_retcode init_app_cms (mng_datap pData){  mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_START)#endif  if ( (pData->fProcessiccp) &&       ((pBuf->bHasICCP) || (pData->bHasglobalICCP)) )  {    mng_uint32 iProfilesize;    mng_ptr    pProfile;    if (pBuf->bHasICCP)                /* get the right profile */    {      iProfilesize = pBuf->iProfilesize;      pProfile     = pBuf->pProfile;    }    else    {      iProfilesize = pData->iGlobalProfilesize;      pProfile     = pData->pGlobalProfile;    }                                       /* inform the app */    if (!pData->fProcessiccp ((mng_handle)pData, iProfilesize, pProfile))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }  if ( (pData->fProcesssrgb) &&       ((pBuf->bHasSRGB) || (pData->bHasglobalSRGB)) )  {    mng_uint8 iIntent;    if (pBuf->bHasSRGB)                /* determine rendering intent */      iIntent = pBuf->iRenderingintent;    else      iIntent = pData->iGlobalRendintent;                                       /* inform the app */    if (!pData->fProcesssrgb ((mng_handle)pData, iIntent))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }  if ( (pData->fProcesschroma) &&       ( ((pBuf->bHasCHRM) || (pData->bHasglobalCHRM)) ) )  {    mng_uint32 iWhitepointx,   iWhitepointy;    mng_uint32 iPrimaryredx,   iPrimaryredy;    mng_uint32 iPrimarygreenx, iPrimarygreeny;    mng_uint32 iPrimarybluex,  iPrimarybluey;    if (pBuf->bHasCHRM)                /* local cHRM ? */    {      iWhitepointx   = pBuf->iWhitepointx;      iWhitepointy   = pBuf->iWhitepointy;      iPrimaryredx   = pBuf->iPrimaryredx;      iPrimaryredy   = pBuf->iPrimaryredy;      iPrimarygreenx = pBuf->iPrimarygreenx;      iPrimarygreeny = pBuf->iPrimarygreeny;      iPrimarybluex  = pBuf->iPrimarybluex;      iPrimarybluey  = pBuf->iPrimarybluey;      }    else    {      iWhitepointx   = pData->iGlobalWhitepointx;      iWhitepointy   = pData->iGlobalWhitepointy;      iPrimaryredx   = pData->iGlobalPrimaryredx;      iPrimaryredy   = pData->iGlobalPrimaryredy;      iPrimarygreenx = pData->iGlobalPrimarygreenx;      iPrimarygreeny = pData->iGlobalPrimarygreeny;      iPrimarybluex  = pData->iGlobalPrimarybluex;      iPrimarybluey  = pData->iGlobalPrimarybluey;    }                                       /* inform the app */    if (!pData->fProcesschroma ((mng_handle)pData, iWhitepointx,   iWhitepointy,                                                   iPrimaryredx,   iPrimaryredy,                                                   iPrimarygreenx, iPrimarygreeny,                                                   iPrimarybluex,  iPrimarybluey))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }  if ( (pData->fProcessgamma) &&       ((pBuf->bHasGAMA) || (pData->bHasglobalGAMA)) )  {    mng_uint32 iGamma;    if (pBuf->bHasGAMA)                /* get the gamma value */      iGamma = pBuf->iGamma;    else      iGamma = pData->iGlobalGamma;                                       /* inform the app */    if (!pData->fProcessgamma ((mng_handle)pData, iGamma))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_APP_CMS *//* ************************************************************************** */#ifdef MNG_APP_CMSmng_retcode init_app_cms_object (mng_datap pData){  mng_imagedatap pBuf = ((mng_imagep)pData->pCurrentobj)->pImgbuf;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_APP_CMS_OBJ, MNG_LC_START)#endif  if ((pData->fProcessiccp) && (pBuf->bHasICCP))  {                                    /* inform the app */    if (!pData->fProcessiccp ((mng_handle)pData, pBuf->iProfilesize, pBuf->pProfile))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }  if ((pData->fProcesssrgb) && (pBuf->bHasSRGB))  {                                    /* inform the app */    if (!pData->fProcesssrgb ((mng_handle)pData, pBuf->iRenderingintent))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }  if ((pData->fProcesschroma) && (pBuf->bHasCHRM))  {                                    /* inform the app */    if (!pData->fProcesschroma ((mng_handle)pData, pBuf->iWhitepointx,   pBuf->iWhitepointy,                                                   pBuf->iPrimaryredx,   pBuf->iPrimaryredy,                                                   pBuf->iPrimarygreenx, pBuf->iPrimarygreeny,                                                   pBuf->iPrimarybluex,  pBuf->iPrimarybluey))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }  if ((pData->fProcessgamma) && (pBuf->bHasGAMA))  {                                    /* inform the app */    if (!pData->fProcessgamma ((mng_handle)pData, pBuf->iGamma))      MNG_ERROR (pData, MNG_APPCMSERROR)                                       /* load color-correction routine */    pData->fCorrectrow = (mng_fptr)correct_app_cms;  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_INIT_APP_CMS_OBJ, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_APP_CMS *//* ************************************************************************** */#ifdef MNG_APP_CMSmng_retcode correct_app_cms (mng_datap pData){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_START)#endif  if (pData->fProcessarow)             /* let the app do something with our row */    if (!pData->fProcessarow ((mng_handle)pData, pData->iRowsamples,                              pData->bIsRGBA16, pData->pRGBArow))      MNG_ERROR (pData, MNG_APPCMSERROR)#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_END)#endif  return MNG_NOERROR;}#endif /* MNG_APP_CMS *//* ************************************************************************** */#endif /* MNG_INCLUDE_DISPLAY_PROCS *//* ************************************************************************** *//* * end of file                                                            * *//* ************************************************************************** */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -