Ignore:
Timestamp:
May 13, 2002, 7:49:28 AM (23 years ago)
Author:
umoeller
Message:

Massive pager rework.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/gpih.c

    r161 r164  
    546546
    547547    return (lHits);
     548}
     549
     550/*
     551 *@@ gpihFillBackground:
     552 *      fills the specified rectangle in the way
     553 *      that is specified by the given BKGNDINFO
     554 *      structure. This way one can either use
     555 *      a solid color, a color fade, a bitmap,
     556 *      or a combination of those.
     557 *
     558 *      See BKGNDINFO for the various parameters.
     559 *
     560 *      Since this can potentially be expensive,
     561 *      it is strongly recommended to use a buffer
     562 *      bitmap for painting with the size of the
     563 *      window and bitblt that bitmap into the
     564 *      window on repaints. This way the background
     565 *      only has to be recreated on window resize.
     566 *
     567 *@@added V0.9.19 (2002-05-07) [umoeller]
     568 */
     569
     570VOID gpihFillBackground(HPS hps,            // in: PS to paint into
     571                        PRECTL prcl,        // in: rectangle (inclusive!)
     572                        PBKGNDINFO pInfo)   // in: background into
     573{
     574    LONG    l;
     575    POINTL  ptl;
     576
     577    switch (pInfo->flPaintMode & PMOD_COLORMASK)
     578    {
     579        case PMOD_SOLID:
     580            // fill with background color
     581            GpiSetColor(hps,
     582                        pInfo->lcol1);
     583            ptl.x = prcl->xLeft;
     584            ptl.y = prcl->yBottom;
     585            GpiMove(hps,
     586                    &ptl);
     587            ptl.x = prcl->xRight;
     588            ptl.y = prcl->yTop;
     589            GpiBox(hps,
     590                   DRO_FILL,
     591                   &ptl,
     592                   0,
     593                   0);
     594        break;
     595
     596        case PMOD_TOPBOTTOM:
     597        {
     598            LONG lDiffRed   = (LONG)GET_RED(pInfo->lcol2) - (LONG)GET_RED(pInfo->lcol1);
     599            LONG lDiffGreen = (LONG)GET_GREEN(pInfo->lcol2) - (LONG)GET_GREEN(pInfo->lcol1);
     600            LONG lDiffBlue  = (LONG)GET_BLUE(pInfo->lcol2) - (LONG)GET_BLUE(pInfo->lcol1);
     601
     602            LONG lMax = prcl->yTop - prcl->yBottom;
     603
     604            // start at top
     605            ptl.y = prcl->yTop;
     606
     607            for (l = 0;
     608                 l <= lMax;
     609                 ++l)
     610            {
     611                // compose RGB color for this line;
     612                // lcol1 is top, lcol2 is bottom
     613                LONG lRed   =   GET_RED(pInfo->lcol1)
     614                              + (   lDiffRed
     615                                  * l
     616                                  / lMax
     617                                );
     618                LONG lGreen =   GET_GREEN(pInfo->lcol1)
     619                              + (   lDiffGreen
     620                                  * l
     621                                  / lMax
     622                                );
     623                LONG lBlue  =   GET_BLUE(pInfo->lcol1)
     624                              + (   lDiffBlue
     625                                  * l
     626                                  / lMax
     627                                );
     628
     629                GpiSetColor(hps, MAKE_RGB(lRed, lGreen, lBlue));
     630                ptl.x = prcl->xLeft;
     631                GpiMove(hps, &ptl);
     632                ptl.x = prcl->xRight;
     633                GpiLine(hps, &ptl);
     634
     635                // next line below
     636                --(ptl.y);
     637            }
     638        }
     639        break;
     640
     641        case PMOD_LEFTRIGHT:
     642        {
     643            LONG lDiffRed   = (LONG)GET_RED(pInfo->lcol2) - (LONG)GET_RED(pInfo->lcol1);
     644            LONG lDiffGreen = (LONG)GET_GREEN(pInfo->lcol2) - (LONG)GET_GREEN(pInfo->lcol1);
     645            LONG lDiffBlue  = (LONG)GET_BLUE(pInfo->lcol2) - (LONG)GET_BLUE(pInfo->lcol1);
     646
     647            LONG lMax = prcl->xRight - prcl->xLeft;
     648
     649            // start at left
     650            ptl.x = prcl->xLeft;
     651
     652            for (l = 0;
     653                 l <= lMax;
     654                 ++l)
     655            {
     656                // compose RGB color for this line;
     657                // lcol1 is top, lcol2 is bottom
     658                LONG lRed   =   GET_RED(pInfo->lcol1)
     659                              + (   lDiffRed
     660                                  * l
     661                                  / lMax
     662                                );
     663                LONG lGreen =   GET_GREEN(pInfo->lcol1)
     664                              + (   lDiffGreen
     665                                  * l
     666                                  / lMax
     667                                );
     668                LONG lBlue  =   GET_BLUE(pInfo->lcol1)
     669                              + (   lDiffBlue
     670                                  * l
     671                                  / lMax
     672                                );
     673
     674                GpiSetColor(hps, MAKE_RGB(lRed, lGreen, lBlue));
     675                ptl.y = prcl->yBottom;
     676                GpiMove(hps, &ptl);
     677                ptl.y = prcl->yTop;
     678                GpiLine(hps, &ptl);
     679
     680                // next line to the right
     681                ++(ptl.x);
     682            }
     683        }
     684        break;
     685    }
    548686}
    549687
     
    15231661        // set up the BITMAPINFOHEADER2 and BITMAPINFO2 structures
    15241662        bih2.cbFix = (ULONG)sizeof(BITMAPINFOHEADER2);
    1525         bih2.cx = cx; // (prcl->xRight - prcl->xLeft);       changed V0.9.0
    1526         bih2.cy = cy; // (prcl->yTop - prcl->yBottom);       changed V0.9.0
     1663        bih2.cx = cx;
     1664        bih2.cy = cy;
    15271665        bih2.cPlanes = (cPlanes) ? cPlanes : alData[0];
    15281666        bih2.cBitCount = (cBitCount) ? cBitCount : alData[1];
    1529             // _Pmpf((__FUNCTION__ ": cPlanes %d, cBitCount %d",
    1530                //          bih2.cPlanes, bih2.cBitCount));
    15311667        bih2.ulCompression = BCA_UNCOMP;
    15321668        bih2.cbImage = (    (   (bih2.cx
Note: See TracChangeset for help on using the changeset viewer.