L_PrintBitmapGDIPlus

# include“l_bitmap.h”

L_LTDIS_APIL_INTnX L_PrintBitmapGDIPlus (hDC pBitmap, nY, nWidth, nHeight, uFlags)

打印位图使用GDI +到指定的设备上下文。

参数

L_HDChDC

处理设备上下文(DC)位图是打印的地方。设备的映射模式必须MM_TEXT上下文。

pBITMAPHANDLEpBitmap

位图句柄指针引用位图打印。

L_INTnX

值代表了X位置开始打印。

L_INT纽约

值代表了Y位置开始打印。

L_INTnWidth

值表示打印宽度,以像素为单位。实际的宽度取决于每英寸点数(DPI)的打印机。

L_INTnHeight

值代表了印刷高度,以像素为单位。实际的高度取决于每英寸点数(DPI)的打印机。

L_UINT32uFlags

保留以供将来使用。通过0。

返回

价值 意义
成功 函数是成功的。
< 1 一个错误发生。指返回代码

评论

如果GDI +库没有安装到系统,将返回一个错误代码。

必需的dll和库

平台

x64 Win32。

另请参阅

功能

主题

例子

这个例子中决定了输出尺寸适合半个页面上的图像,并打印位图在同一页的两倍。

L_INT PrintBitmapGDIPlusExample (L_VOID){BITMAPHANDLE LeadBitmap;图片* / / *位图句柄HDC PrinterDC;* / / * DC的打印机L_INT WidthAllowed、HeightAllowed WidthFactor HeightFactor;/ * * /尺寸计算L_INT PrintWidth PrintHeight;/ *打印图像的宽度和高度* /L_INT nRet;/ *加载位图的位/像素* /nRet = L_LoadBitmap (MAKE_IMAGE_PATH(文本(“Image1.cmp”&LeadBitmap)),运算符(BITMAPHANDLE), 0 ORDER_BGR空,空);如果(nRet ! =成功)返回nRet;/ *获取打印机直流* /PrinterDC = L_PrintBitmapFast(空,空,0,0,0,0,假);/ *初始化变量拟合图像半页* /WidthAllowed = GetDeviceCaps (PrinterDC HORZRES);HeightAllowed = GetDeviceCaps (PrinterDC VERTRES) * 4/10;HeightFactor = BITMAPHEIGHT (&LeadBitmap);WidthFactor = BITMAPWIDTH (&LeadBitmap);/ *是否使用最大宽度会使图像太高* /如果((L_INT) (((L_INT32) WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed){/ *使用最大宽度,计算出高度值* /PrintWidth = WidthAllowed;PrintHeight = (L_INT) (((L_INT32) PrintWidth * HeightFactor) / WidthFactor);}其他的{/ *使用的最大高度,并计算宽度值* /PrintHeight = HeightAllowed;PrintWidth = (L_INT) (((L_INT32) PrintHeight * WidthFactor) / HeightFactor);}/ *打印第一个图片* /nRet = L_PrintBitmapGDIPlus (PrinterDC &LeadBitmap 1, 1 PrintWidth PrintHeight, 0);如果(nRet ! =成功)返回nRet;* / / *打印第二图像nRet = L_PrintBitmapGDIPlus (PrinterDC &LeadBitmap 1, HeightAllowed * 6/5, PrintWidth, PrintHeight, 0);如果(nRet ! =成功)返回nRet;EndPage (PrinterDC);EndDoc (PrinterDC);L_FreeBitmap (&LeadBitmap);DeleteDC (PrinterDC);返回成功;}

LEADTOOLS光栅成像C API的帮助
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。