Printing 打印Alpha图像
我是印刷新手 如何打印alpha图像 我正在使用Gdi+的DrawImage来绘制图像 浅灰色部分为黑色,含20%阿尔法 但是,结果并不像我预期的那样 看起来像是被抛弃了 我使用下面的代码来打印Printing 打印Alpha图像,printing,mfc,gdi+,Printing,Mfc,Gdi+,我是印刷新手 如何打印alpha图像 我正在使用Gdi+的DrawImage来绘制图像 浅灰色部分为黑色,含20%阿尔法 但是,结果并不像我预期的那样 看起来像是被抛弃了 我使用下面的代码来打印 #include <windows.h> #include <gdiplus.h> #include <stdio.h> #pragma comment(lib, "gdiplus.lib") using namespace Gdiplus; INT main()
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
#pragma comment(lib, "gdiplus.lib")
using namespace Gdiplus;
INT main()
{
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// Get a device context for the printer.
HDC hdcPrint = CreateDC(NULL, TEXT("\\\\printserver\\HP CP3505_2F"), NULL, NULL);
DOCINFO docInfo;
ZeroMemory(&docInfo, sizeof(docInfo));
docInfo.cbSize = sizeof(docInfo);
docInfo.lpszDocName = L"GdiplusPrint";
Bitmap image(L"e:\\__.png");
StartDoc(hdcPrint, &docInfo);
StartPage(hdcPrint);
Graphics* graphics = new Graphics(hdcPrint);
Pen* pen = new Pen(Color(255, 0, 0, 0));
graphics->DrawImage(&image, 50, 50);
delete pen;
delete graphics;
EndPage(hdcPrint);
EndDoc(hdcPrint);
DeleteDC(hdcPrint);
GdiplusShutdown(gdiplusToken);
return 0;
}
但是,使用WordMS Office图像按预期打印
请帮忙
编辑:
GDI Alphablend函数将图像alpha部分绘制为灰色
看起来不错
但是,重叠alpha无法正常工作
它只需画两次灰色的alpha部分
不是阿尔法混合
我认为利用alpha的能力取决于驱动程序,我不希望打印机驱动程序支持它。也许Word正在将整个图像渲染为一个没有alpha的位图,然后打印出来。我想我还没有见过支持alpha的打印机。