## Printer Device Driver

[prev][next][parent][TOC]

### Example Code

GplPatternCreateBitmaps Usage

Following is an example of using GplPatternCreateBitmaps:

    // PM Graphics Rendering Engine v2.2 Device Surface Function from the Omni driver

    LONG APIENTRY QueryDeviceSurface( PDDC pddc, PVOID pv )

    {

      // Initialize all fields of the device surface structure, then...

      if( !pddc->pdb->bAllocatedPatterns )

      {

          if( ORIENTATION_PORTRAIT == pdb->pJobProperties->ulOrientation )

          {

            if( GplPatternCreateBitmaps ( pddc->hmcbHeap,

                                          pddc->pResInfo->ulXRes,

                                          pddc->pResInfo->ulYRes,

                                          64L,

                                          64L,

                                          (PBMAPINFO)&pds->abmapinfoDefPattern,

                                          DEFAULT_PATTERNS_NUMBER,

                                          0L ) )

            {

              pddc->pdb->bAllocatedPatterns = TRUE;

            } /* end if */

          } /* end if */

      } /* end if */

    } /* end QueryDeviceSurface */

GplPatternDeleteBitmaps Usage

Following is an example of using GplPatternDeleteBitmaps:

    case BEGIN_CLOSE_DC:

      // Perform other disable processing, then near end of case...

      if( GRE_22 <= globals.ulGreVersion )  // PM Graphics Rendering Engine v2.2 or higher

      {

        PDEVICESURFACE pds;

        // Note:  We only allocate patterns in QueryDeviceSurface for GRE v2.2 and higher

        pds = (PDEVICESURFACE)pddc->pdb->pDeviceSurface;

        if( GplPatternDeleteBitmaps( pddc->pdb->hmcbHeap,

                                     (PBMAPINFO)&pds->abmapinfoDefPattern,

                                     DEFAULT_PATTERNS_NUMBER ) )

        {

           pddc->pdb->bAllocatedPatterns = FALSE;

        } /* end if */

      } /* end if */