GetDeviceCaps(hDC, RASTERCAPS) Description

Last reviewed: November 2, 1995
Article ID: Q75912
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows version 3.1
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
        - Microsoft Windows 95 version 4.0
    

SUMMARY

GetDeviceCaps(hDC, RASTERCAPS) returns the raster capabilities bit field in the GDIINFO structure, which indicates the raster capabilities of the device. The RASTERCAPS index of the GetDeviceCaps() function is documented in the "Microsoft Windows Software Development Kit Reference Volume 1" on page 4-168. The flags available include: RC_BANDING, RC_BITBLT, RC_BITMAP64, RC_DI_BITMAP, RC_DIBTODEV, RC_GDI20_OUTPUT, RC_PALETTE, RC_SCALING, RC_STRETCHBLT, and RC_STRETCHDIB. The GDIINFO structure itself is documented in the "Microsoft Windows Device Development Kit Device Driver Adaptation Guide."

An application should use GetDeviceCaps() to query the printer driver for device capabilities. For example, before printing a bitmap larger than 64K, the application should query the driver using GetDeviceCaps() with the index RASTERCAPS and the flag RC_BITMAP64. If the application fails to test for the capability and prints a bitmap larger than 64K, unexpected printer output may occur if the driver does not support bitmaps larger than 64K.

In particular, if the driver does not support a capability, GDI will attempt to simulate it using a more fundamental capability of the driver. However, the resulting GDI simulation is usually slower, is of lower quality, or differs in some way from a device driver implementation of the capability.

                                              Differences in
                     GDI Call to Invoke   Functionality Resulting
Field   Capability      Capability or      from Supporting or not
Name    or Function        Function        Supporting Capability
------|-------------|--------------------|----------------------------
  0   | BitBlt      |                    | ?
------|-------------|--------------------|----------------------------
  1   | Requires    |                    | ?
      | banding     |                    |
------|-------------|--------------------|----------------------------
  2   | Requires    |                    | ?
      | scaling     |                    |
------|-------------|--------------------|----------------------------
  3   | Supports    |                    | ?
      | >64K bitmaps|                    |
------|-------------|--------------------|----------------------------
  4   | Supports    | ExtTextOut         | GDI will call StrBlt() once
      | ExtTextOut, |                    | for each character to
      | FastBorder, |                    | simulate the ExtTextOut()
      | GetCharWidth|                    | function's ability to
      |             |                    | position proportionally-
      |             |                    | spaced characters. This can
      |             |                    | be very slow. GDI simulates
      |             |                    | bold text by overstriking
      |             |                    | one or more times. This
      |             |                    | fails on laser printers.
      |             |                    | Laser printer drivers that
      |             |                    | support ExtTextOut() offset
      |             |                    | the text before overstriking.
      |             |                    |
      |             | FastBorder         |
      |             |                    |
      |             | GetCharWidth       | Returns 0 if driver does
      |             |                    | not support GetCharWidth;
      |             |                    | otherwise, it calls
      |             |                    | ExtTextOut() or StrBlt()
      |             |                    | with count = -1 to obtain
      |             |                    | the width of each
      |             |                    | individual character.
------|-------------|--------------------|----------------------------
  5   | Has state   |                    |
      | block       |                    |
------|-------------|--------------------|----------------------------
  6   | Saves       |                    |
      | bitmaps in  |                    |
      | shadow      |                    |
      | memory      |                    |
------|-------------|--------------------|----------------------------
  7   | RC_DI_BITMAP| Supports Get and   | If GDI is called upon to
      |             | Set DIBs and RLEs  | copy a RLE bitmap that
      |             |                    | contains a transparent
      |             |                    | window (region not defined
      |             |                    | by the bitmap), the window
      |             |                    | will be filled by the
      |             |                    | current background color.
      |             |                    |
      |             |                    | The destination for any GDI
      |             |                    | DIB operation is a
      |             |                    | monochrome bitmap.
      |             |                    |
      |             |                    | Unidrv offers a variety of
      |             |                    | halftone dithering
      |             |                    | techniques to simulate a
      |             |                    | range of intensities on
      |             |                    | black and white and color
      |             |                    | printers. GDI does not.
      |             |                    | Unidrv offers intensity
      |             |                    | adjustment to darken and
      |             |                    | lighten halftone output.
      |             |                    | Unidrv does not support RLE
      |             |                    | DIBs at present.
------|-------------|--------------------|----------------------------
  8   | RC_PALETTE  | Performs color     |
      |             | palette management |
------|-------------|--------------------|----------------------------
  9   | RC_DIBTODEV | Supports           | See comments above for
      |             | SetDIBitsToDevice  | RC_DI_BITMAP
------|-------------|--------------------|----------------------------
 10   | RC_BIGFONTS | Supports Windows   | This flag specifies the
      |             | 3.0 FONTINFO       | format of the FONTINFO
      |             | structure format   | structure passed between
      |             |                    | GDI's SelectObject() call
      |             |                    | and the driver's
      |             |                    | RealizeFont() function. If
      |             |                    | a bit is set, the Windows
      |             |                    | 3.0 format is used.
      |             |                    | Otherwise, the Windows 2.0
      |             |                    | font file format is used.
------|-------------|--------------------|----------------------------
 11   |RC_STRETCHBLT| Supports StretchBlt|
------|-------------|--------------------|----------------------------
 12   | RC_FLOODFILL| Supports flood fill|
------|-------------|--------------------|----------------------------
 13   |RC_STRETCHDIB| Supports           | See comments above for
      |             | StretchDIBits      | RC_DI_BITMAP. Additionally,
      |             |                    | Unidrv has these limits on
      |             |                    | the degree of stretching
      |             |                    | and shrinking supported:
      |             |                    |
      |             |                    | The X and Y axes may be
      |             |                    | scaled independently.
      |             |                    |
      |             |                    | The maximum scale-up factor
      |             |                    | is 256.
      |             |                    |
      |             |                    | The maximum product of the
      |             |                    | X and Y scale-down factors
      |             |                    | is 256.
      |             |                    |
      |             |                    | Therefore, if both axes are
      |             |                    | scaled down equally, the
      |             |                    | maximum scale-down factor
      |             |                    | for each axis is 16.
------|-------------|--------------------|----------------------------


Additional reference words: 3.10 3.50 4.00 95
KBCategory: kbgraphic
KBSubcategory: GdiDc


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.