switch (pBuf->iBitdepth)          { case 1 : iG = (mng_uint8)((iG << 1) + iG); case 2 : iG = (mng_uint8)((iG << 2) + iG); case 4 : iG = (mng_uint8)((iG << 4) + iG); }
mng_retcode retrieve_g8 (mng_datap pData){  mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf;  mng_uint8p     pWorkrow;  mng_uint8p     pRGBArow;  mng_int32      iX;  mng_uint8      iG;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_START)#endif  pRGBArow = pData->pRGBArow;          /* temporary work pointers */  pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize);  if (pBuf->bHasTRNS)                  /* tRNS in buffer ? */  {    for (iX = 0; iX < pData->iRowsamples; iX++)    {      iG = *pWorkrow;                  /* get the gray-value */                                       /* is it transparent ? */      if ((mng_uint16)iG == pBuf->iTRNSgray)      {        *pRGBArow     = 0x00;          /* nuttin to display */        *(pRGBArow+1) = 0x00;        *(pRGBArow+2) = 0x00;        *(pRGBArow+3) = 0x00;      }      else      {        *pRGBArow     = iG;            /* put in intermediate row */        *(pRGBArow+1) = iG;        *(pRGBArow+2) = iG;        *(pRGBArow+3) = 0xFF;      }      pWorkrow++;                      /* next pixel */      pRGBArow += 4;    }  }  else  {    for (iX = 0; iX < pData->iRowsamples; iX++)    {      iG = *pWorkrow;                  /* get the gray-value */      *pRGBArow     = iG;              /* put in intermediate row */      *(pRGBArow+1) = iG;      *(pRGBArow+2) = iG;      *(pRGBArow+3) = 0xFF;      pWorkrow++;                      /* next pixel */      pRGBArow += 4;    }  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_END)#endif  return MNG_NOERROR;}