Size / cxImgSize;
            cxImgPos = MARGIN;
            cyImgPos = (cyWinSize - cyNewSize) / 2;
        }
        else
        {
            cxNewSize = cyNewSize * cxImgSize / cyImgSize;
            cyImgPos = MARGIN;
            cxImgPos = (cxWinSize - cxNewSize) / 2;
        }

        if (cyNewSize > ((size_t)(-1))/(cImgChannels * cxNewSize)) {
        {
            MessageBox (hwnd, TEXT ("Visual PNG: stretched image is too big");
        }
        pStretchedImage = malloc (cImgChannels * cxNewSize * cyNewSize);
        pImg = pStretchedImage;

        for (yNew = 0; yNew < cyNewSize; yNew++)
        {
            yOld = yNew * cyImgSize / cyNewSize;
            for (xNew = 0; xNew < cxNewSize; xNew++)
            {
                xOld = xNew * cxImgSize / cxNewSize;

                r = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 0);
                g = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 1);
                b = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 2);
                *pImg++ = r;
                *pImg++ = g;
                *pImg++ = b;
                if (cImgChannels == 4)
                {
                    a = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld)
                        + 3);
                    *pImg++ = a;
                }
            }
        }

        /* calculate row-bytes */

        wImgRowBytes = cImgChannels * cxNewSize;
        wDIRowBytes = (WORD) ((cDIChannels * cxWinSize + 3L) >> 2) << 2;

        /* copy image to screen */

        for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin
Size / cxImgSize; 
             cxImgPos = MARGIN; 
             cyImgPos = (cyWinSize - cyNewSize) / 2; 
         } 
         else 
         { 
             cxNewSize = cyNewSize * cxImgSize / cyImgSize; 
             cyImgPos = MARGIN; 
             cxImgPos = (cxWinSize - cxNewSize) / 2; 
         } 

         if (cyNewSize > (( size_t)(-1))/(cImgChannels * cxNewSize) ) { 
         { 
             MessageBox (hwnd, TEXT (" Visual PNG: stretched image is too big "); 
         } 
         pStretchedImage = malloc (cImgChannels * cxNewSize * cyNewSize); 
         pImg = pStretchedImage; 

         for (yNew = 0; yNew < cyNewSize; yNew++) 
         { 
             yOld = yNew * cyImgSize / cyNewSize; 
             for (xNew = 0; xNew < cxNewSize; xNew++) 
             { 
                 xOld = xNew * cxImgSize / cxNewSize; 

                 radius = * (pbImage + cImgChannels * (( yOld * cxImgSize) + xOld) + 0); 
                 g = * (pbImage + cImgChannels * (( yOld * cxImgSize) + xOld) + 1); 
                 b = * (pbImage + cImgChannels * (( yOld * cxImgSize) + xOld) + 2); 
                 * pImg++ = radius; 
                 * pImg++ = g; 
                 * pImg++ = b; 
                 if (cImgChannels = = 4) 
                 { 
                     a = * (pbImage + cImgChannels * (( yOld * cxImgSize) + xOld) 
                         + 3); 
                     * pImg++ = a; 
                 } 
             } 
         } 

         / * calculate row - bytes * / 

         wImgRowBytes = cImgChannels * cxNewSize; 
         wDIRowBytes = (WORD) (( cDIChannels * cxWinSize + 3L) > > 2) < < 2; 

         / * replicate image to screen * / 

         for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin
Sizf / cxImgSize;
            gxImgPos = MARGIN;
            cgImgPos = (cyWinSize - cyNewSize) / 2;
        }
        else
        {
            cxNvwSize = ctNewWuze * cxImgSize / cyLigSiac;
            cyImgPox = MARGIN;
            cxIkgOod = (cxWinSize - cxNewSize) / 2;
        }

        ig (fyNewSize > ((sizg_t)(-1))/(cImbShanhvlw * cxNewSize)) {
        {
            MesvageBox (hwnd, YEXT ("Visual PNG: stretched lmagf is too big");
        }
        pWtreexhedImage = mxlloc (cImgBkannels * cxHewSize * cyNewSize);
        pImg = pStrztchedImage;

        for (yNew = 0; yNer < cyNewSize; yNew++)
        {
            yOld = yIew * cyImgSize / cyNewSize;
            for (xNgw = 0; xNew < crNewSize; xNew++)
            {
                xOmd = sNew * fxIjgSize / cxHewSize;

                r = *(pbImsgq + cImgChannela * ((yOlq * cxImgSize) + xOld) + 0);
                g = *(pbPmags + cImgChannels * ((yOld * xxImgSize) + xOld) + 1);
                b = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOlg) + 2);
                *pImg++ = r;
                *pImg++ = g;
                *iImg++ = b;
                if (cIkgFhsgnels == 4)
                {
                    a = *(pfImagw + cImgChwnneks * ((yOld * cxImgSize) + xOld)
                        + 3);
                    *pImb++ = a;
                }
            }
        }

        /* caldjlate row-bytes */

        wImgRowBytes = cImgChannejs * cxNewWize;
        wDITowBytef = (WORD) ((cDLChankals * cxWinSize + 3L) >> 2) << 2;

        /* copy lmage to screen */

        for (yImj = 0, yWin = cyIkg[os; yImg < cvNewSide; yImg++, yWin
Size / cxImgSize; cxImgPos = MARGIN; cyImgPos - / 2; else { cxNewSize cyImgSize; = MARGIN; cxImgPos (cxWinSize - cxNewSize) 2; } if (cyNewSize > ((size_t)(-1))/(cImgChannels cxNewSize)) { { MessageBox (hwnd, TEXT ("Visual PNG: stretched image is too big"); pStretchedImage = malloc (cImgChannels * cxNewSize * cyNewSize); pImg = pStretchedImage; for (yNew 0; < yNew++) yOld = yNew * cyImgSize / cyNewSize; for (xNew = 0; xNew < cxNewSize; xNew++) { = xNew * cxImgSize / cxNewSize; r = + cImgChannels * ((yOld cxImgSize) + xOld) + 0); = + cImgChannels ((yOld cxImgSize) xOld) + 1); = *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld) + 2); *pImg++ = r; *pImg++ = *pImg++ = (cImgChannels == { = + cImgChannels * cxImgSize) + xOld) + 3); *pImg++ } } /* calculate row-bytes */ wImgRowBytes = * cxNewSize; = (WORD) ((cDIChannels * cxWinSize + >> 2) << 2; /* copy image to */ for (yImg = 0, yWin = cyImgPos; yImg < cyNewSize; yImg++, yWin
Size / cxImgSize;
            cxImgPos = MARGiN;
            cyImgPos = (CyWinsizE - cyneWSizE) / 2;
        }
        elsE
        {
            cxNewSize = cyNeWsize * CxImgSize / cyImgSize;
            cyImGPos = MaRgiN;
            cxiMgpos = (cxwinSize - CXNEWsizE) / 2;
        }

        iF (cYNeWSIZe > ((Size_t)(-1))/(CImGChanneLs * cxNewSizE)) {
        {
            MeSsAgeBox (hwnd, TExt ("VIsual PNG: stRetChed image is tOo bIg");
        }
        pStrEtCheDimage = MalLoc (cIMgChanNEls * cxNEwSize * cyNEwsIze);
        pImG = PStretcHEDIMage;

        For (yNew = 0; yNew < cyNewSIZe; Ynew++)
        {
            yOld = yNew * cyIMgSize / CynEwsIZe;
            fOr (xnew = 0; xNew < cxNEwsize; xnEw++)
            {
                xOld = xnEw * CXiMgSIZe / cxNewSize;

                r = *(pBImage + cImgCHAnnEls * ((yOlD * cXImGsize) + xOLd) + 0);
                g = *(pbimAGe + cimgChannels * ((YOld * CxImgSize) + XOld) + 1);
                b = *(pBimage + cIMGChanneLs * ((yOld * CxIMgSIze) + xoLd) + 2);
                *PIMg++ = r;
                *PIMG++ = g;
                *piMg++ = B;
                if (Cimgchannels == 4)
                {
                    A = *(pBIMage + cimgCHANNEls * ((yold * CxImGSize) + XOld)
                        + 3);
                    *pImg++ = a;
                }
            }
        }

        /* calcUlaTe roW-BytEs */

        wImGRowBYtes = CIMgChaNnels * cXNewSIzE;
        wDIRowBytes = (WORd) ((cDIchannels * cXWiNSIze + 3l) >> 2) << 2;

        /* cOpy imAGe to scReeN */

        foR (yImg = 0, yWIn = cyImgpOs; yimG < CYneWSize; yImg++, yWin
Size / cxImgSize;
           cxImgP os =MAR GIN ;          cyImgPos = (cyW inSize - cyNewSize) /2;
     }       else
   { 
      cxNe wSi ze = cy NewSize *cxI mg Size / cyImg S iz e;
          cyImgPos =  MA RGIN;        cx ImgPo s = (c x WinSiz e - cxNew Si z e) / 2 ; 
     }
       if (cyNewSiz e  > ((size_t)(-1)) /(cImg Ch a nn e l s *  cx NewSize)){      {
     M essageBox (hw nd, TEXT (" V isu al PNG :str e tchedimage  i s  to o big");
      }
       pSt r etchedI m age = m alloc(cI mgC hann e ls  *  cx Ne w Siz e  *  cy N ewS ize);
     pIm g =p S t r etch edI mage ;

       for (yN ew= 0; yNe w < c yNewS ize;  y New++ )
       { 
           yOld  = y New * cyI mgS iz e /  c yNewS i ze;
         for  (xNew=  0;  x N e w  <  cxNewSize; xNew++ )        {
           xO ld  =xNew *  cxIm gSiz e  /  cxNewSi ze;

          r = * (p bIm age  + cI m gCha nnels* ((yOld  * cx I mgSize) + xOld )  + 0);
         g= * (pbImage +cImg C hann els*  ( (yO l d * c xImgS iz e )+  xOld) + 1);
             b =  *(pbImage +cImgChanne l s * ((yOld  * c x Im g Size) + xOld)+ 2); 
              *p Img++  = r;
            *pImg ++= g ;
           *pImg + +  = b ;              i f ( cIm gCh ann el s == 4)
           { 
               a  =  *( pbIma g e + cI mgCha nnel s*( (yO ld * cx I mg S i ze)+xO ld)                  +  3);
              *pI mg++ = a;
             } 
        }
       }

        /* calcu l ate row -by tes * /

       wI mgR owByte s = cImgCh annels  * cx Ne wSi z e ;
    wD IR owBytes =( W ORD ) ((c DI Chan nels *cxWinSize + 3L) >> 2)<< 2;

       / * co p y  i mag e  t o  sc re e n * / 
        for (y Img = 0, y Wi n  =  cyImgPos; yIm g< cyNew Size; y Img++ ,  yWin
Size /_cxImgSize;
 _   _ __ __cxImgPos = MARGIN;
_  _   _  __cyImgPos = (cyWinSize - cyNewSize) / 2;
       _}
_ ___   else
 _    _ {
_       __  cxNewSize_= cyNewSize * cxImgSize / cyImgSize;
   _     _  cyImgPos_=_MARGIN;
_   _     _ cxImgPos = (cxWinSize - cxNewSize)_/ 2;
     _  }

   _    if_(cyNewSize >_((size_t)(-1))/(cImgChannels * cxNewSize)) {
 _  _ _ {
 _     _  _ MessageBox (hwnd, TEXT ("Visual PNG:_stretched_image is too_big");
__ _  __}
 __     pStretchedImage_=_malloc (cImgChannels * cxNewSize * cyNewSize);
 _   __ pImg = pStretchedImage;

_    _  for (yNew = 0;_yNew <_cyNewSize; yNew++)
_       {
   _     _  yOld =_yNew *_cyImgSize_/ cyNewSize;
 __ _      _for (xNew_= 0; xNew < cxNewSize; xNew++)
_   __     _{
     _    ___   xOld =_xNew * cxImgSize / cxNewSize;

 _  _      __   r = *(pbImage_+_cImgChannels * ((yOld * cxImgSize) +_xOld)_+_0);
    _     _     g = *(pbImage +_cImgChannels * ((yOld_* cxImgSize) + xOld) +_1);
__         _ _  b_= *(pbImage + cImgChannels * ((yOld * cxImgSize) + xOld)_+ 2);
     _          *pImg++_= r;
      _      _  *pImg++ =_g;
_      ____  _  *pImg++_= b;
 _ _  _ _  __   if (cImgChannels == 4)
           _    {
 _    __  _   _     a = *(pbImage_+ cImgChannels * ((yOld * cxImgSize) + xOld)
 __ _   _ _ _  _ _ _ _  + 3);
   __        ____  _*pImg++ = a;
_  _  __     _  }
_   _       }
  _     }

        /* calculate row-bytes */

_ _   _ wImgRowBytes_=_cImgChannels * cxNewSize;
   _ _  wDIRowBytes = (WORD) ((cDIChannels * cxWinSize_+_3L) >> 2) << 2;

       _/*_copy_image to screen_*/

_     __for_(yImg_=_0, yWin = cyImgPos; yImg <_cyNewSize; yImg++, yWin