GetDeviceCaps查询设备上下文的属性

msdn:https://msdn.microsoft.com/en-us/library/dd144877(VS.85).aspx

GetDeviceCaps用于按照整数索引查询设备上下文的属性,如帧缓冲区格式,色彩处理能力、分辨率、调色板、物理大小、页边距、alpha混合和渐进填充的能力、对ICM的支持,以及DDI特性和限制。


int GetDeviceCaps( _In_ HDC hdc, _In_ int nIndex);

参数:

hdc [in]: 设备上下文的句柄 nIndex [in]:设备上下文的属性索引

The item to be returned. This parameter can be one of the following values.

IndexMeaning
DRIVERVERSION

驱动器版本,16位,格式为0xXYZZ,如0x4001,其中X是操作系统的主版本号,Y是操作系统的次版本号,ZZ是驱动程序的版本号,由驱动程序报告

TECHNOLOGY

Device technology. It can be any one of the following values.

DT_PLOTTER     用于绘图仪
DT_RASDISPLAY     用于光栅显卡
DT_RASPRINTER    用于光栅打印机
DT_RASCAMERA    用于光栅照相机
DT_CHARSTREAM 用于纯设备字体驱动程序
DT_METAFILE   图元文件
DT_DISPFILE    显示器


如果hdc参数指定文件的设备上下文环境,则设备技术就是给CreateEnhMetaFile函数的引用设备,使用GetObjectType函数可以确定它是否是一增强文件设备上下文环境。

HORZSIZE

物理屏幕的宽度(毫米)

VERTSIZE

物理屏幕的高度(毫米)

HORZRES

屏暮的宽度(像素)

VERTRES

屏幕的高度(像素)

LOGPIXELSX

沿屏幕宽度每逻辑英寸的像素数,在多显示器系统中,该值对所显示器相同;

LOGPIXELSY

沿屏幕高度每逻辑英寸的像素数,在多显示器系统中,该值对所显示器相同;

BITSPIXEL

素相连颜色位数

PLANES

颜色位面数

NUMBRUSHES

设备指定画刷数

NUMPENS

设备指定笔数

NUMFONTS

设备指定字体数

NUMCOLORS

设备颜色表的入口数

ASPECTX

用于画线的设备像素的相对宽度

ASPECTY

用于画线的设备像素的相对高度

ASPECTXY

用于画线的设备像素的对角线宽度

PDEVICESIZE

Reserved.

CLIPCAPS

Flag that indicates the clipping capabilities of the device. If the device can clip to a rectangle, it is 1. Otherwise, it is 0.

SIZEPALETTE

Number of entries in the system palette. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.

NUMRESERVED

Number of reserved entries in the system palette. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.

COLORRES

Actual color resolution of the device, in bits per pixel. This index is valid only if the device driver sets the RC_PALETTE bit in the RASTERCAPS index and is available only if the driver is compatible with 16-bit Windows.

PHYSICALWIDTH

For printing devices: the width of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5-x11-inch paper has a physical width value of 5100 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller.

PHYSICALHEIGHT

For printing devices: the height of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper has a physical height value of 6600 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller.

PHYSICALOFFSETX

For printing devices: the distance from the left edge of the physical page to the left edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper, that cannot print on the leftmost 0.25-inch of paper, has a horizontal physical offset of 150 device units.

PHYSICALOFFSETY

For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5-by-11-inch paper, that cannot print on the topmost 0.5-inch of paper, has a vertical physical offset of 300 device units.

VREFRESH

For display devices: the current vertical refresh rate of the device, in cycles per second (Hz).

A vertical refresh rate value of 0 or 1 represents the display hardware's default refresh rate. This default rate is typically set by switches on a display card or computer motherboard, or by a configuration program that does not use display functions such as ChangeDisplaySettings.

SCALINGFACTORX

Scaling factor for the x-axis of the printer.

SCALINGFACTORY

Scaling factor for the y-axis of the printer.

BLTALIGNMENT

Preferred horizontal drawing alignment, expressed as a multiple of pixels. For best drawing performance, windows should be horizontally aligned to a multiple of this value. A value of zero indicates that the device is accelerated, and any alignment may be used.

SHADEBLENDCAPS

Value that indicates the shading and blending capabilities of the device. See Remarks for further comments.

SB_CONST_ALPHA Handles theSourceConstantAlpha member of theBLENDFUNCTION structure, which is referenced by the blendFunction parameter of theAlphaBlend function.
SB_GRAD_RECT Capable of doingGradientFill rectangles.
SB_GRAD_TRI Capable of doingGradientFill triangles.
SB_NONE Device does not support any of these capabilities.
SB_PIXEL_ALPHA Capable of handling per-pixel alpha inAlphaBlend.
SB_PREMULT_ALPHA Capable of handling premultiplied alpha inAlphaBlend.

 

RASTERCAPS

Value that indicates the raster capabilities of the device, as shown in the following table.

RC_BANDING Requires banding support.
RC_BITBLT Capable of transferring bitmaps.
RC_BITMAP64 Capable of supporting bitmaps larger than 64 KB.
RC_DI_BITMAP Capable of supporting theSetDIBits andGetDIBits functions.
RC_DIBTODEV Capable of supporting theSetDIBitsToDevice function.
RC_FLOODFILL Capable of performing flood fills.
RC_PALETTE Specifies a palette-based device.
RC_SCALING Capable of scaling.
RC_STRETCHBLT Capable of performing theStretchBlt function.
RC_STRETCHDIB Capable of performing theStretchDIBits function.

 

CURVECAPS

Value that indicates the curve capabilities of the device, as shown in the following table.

CC_NONE Device does not support curves.
CC_CHORD Device can draw chord arcs.
CC_CIRCLES Device can draw circles.
CC_ELLIPSES Device can draw ellipses.
CC_INTERIORS Device can draw interiors.
CC_PIE Device can draw pie wedges.
CC_ROUNDRECT Device can draw rounded rectangles.
CC_STYLED Device can draw styled borders.
CC_WIDE Device can draw wide borders.
CC_WIDESTYLED Device can draw borders that are wide and styled.

 

LINECAPS

Value that indicates the line capabilities of the device, as shown in the following table:

LC_NONE Device does not support lines.
LC_INTERIORS Device can draw interiors.
LC_MARKER Device can draw a marker.
LC_POLYLINE Device can draw a polyline.
LC_POLYMARKER Device can draw multiple markers.
LC_STYLED Device can draw styled lines.
LC_WIDE Device can draw wide lines.
LC_WIDESTYLED Device can draw lines that are wide and styled.

 

POLYGONALCAPS

Value that indicates the polygon capabilities of the device, as shown in the following table.

PC_NONE Device does not support polygons.
PC_INTERIORS Device can draw interiors.
PC_POLYGON Device can draw alternate-fill polygons.
PC_RECTANGLE Device can draw rectangles.
PC_SCANLINE Device can draw a single scanline.
PC_STYLED Device can draw styled borders.
PC_WIDE Device can draw wide borders.
PC_WIDESTYLED Device can draw borders that are wide and styled.
PC_WINDPOLYGON Device can draw winding-fill polygons.

 

TEXTCAPS

Value that indicates the text capabilities of the device, as shown in the following table.

TC_OP_CHARACTER Device is capable of character output precision.
TC_OP_STROKE Device is capable of stroke output precision.
TC_CP_STROKE Device is capable of stroke clip precision.
TC_CR_90 Device is capable of 90-degree character rotation.
TC_CR_ANY Device is capable of any character rotation.
TC_SF_X_YINDEP Device can scale independently in the x- and y-directions.
TC_SA_DOUBLE Device is capable of doubled character for scaling.
TC_SA_INTEGER Device uses integer multiples only for character scaling.
TC_SA_CONTIN Device uses any multiples for exact character scaling.
TC_EA_DOUBLE Device can draw double-weight characters.
TC_IA_ABLE Device can italicize.
TC_UA_ABLE Device can underline.
TC_SO_ABLE Device can draw strikeouts.
TC_RA_ABLE Device can draw raster fonts.
TC_VA_ABLE Device can draw vector fonts.
TC_RESERVED Reserved; must be zero.
TC_SCROLLBLT Device cannot scroll using a bit-block transfer. Note that this meaning may be the opposite of what you expect.

 

COLORMGMTCAPS

Value that indicates the color management capabilities of the device.

CM_CMYK_COLOR Device can accept CMYK color space ICC color profile.
CM_DEVICE_ICM Device can perform ICM on either the device driver or the device itself.
CM_GAMMA_RAMP Device supportsGetDeviceGammaRamp andSetDeviceGammaRamp
CM_NONE Device does not support ICM.

 

 

Return value

The return value specifies the value of the desired item.

When nIndex is BITSPIXEL and the device has 15bpp or 16bpp, the return value is 16.



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值