将bmp文件连接到hdc以使用StretchBlt(hdc,....)函数 [英] connect bmp file to hdc to use StretchBlt( hdc, ....) function
问题描述
我有一个bmp文件。我想放大(或缩小)
图片并将其显示在屏幕上。
I have a bmp file. I want to magnify( or reduce) the picture and display it on the screen.
我使用的函数如
hdc = GetDC(ViewWindow );
SetStretchBltMode(hdc,
HALFTONE );
StretchBlt(hdc,x1,y1,wd2,hd2,hdc,x2,y2,wd,hd,
SRCCOPY );
for (j = 0; j< hd2; j ++){
(i = 0; i< wd2; i ++){
lcol = *(pl + wd2 * j + i)& 0x00FFFFFF;
lcol = *(pl + wd2*j + i) & 0x00FFFFFF;
SetPixel(hdc,xOffset + i,yOffset + j,lcol);   ;
SetPixel(hdc, xOffset + i, yOffset + j, lcol);
}
}
}
ReleaseDC(ViewWindow,hdc);
有人能告诉我
如何 我可以将bmp文件转换为hdc,以便我可以使用 StretchBlt(hdc,...) function?
我在窗口8平台上使用C语言
谢谢,
ChangChiTheGraphics
chang Chi
chang Chi
推荐答案
您没有将bmp转换为hdc。 您使用
SelectObject函数使用它的句柄(HDC)选择位图(HBITMAP)到设备上下文的句柄。  ;请参阅hgdiobj参数说明中表格中包含的位图的各种函数
You don't convert a bmp into an hdc. You use the SelectObject function to select a handle to a bitmap (HBITMAP) into a device context using it's handle (HDC). Refer to the various functions for bitmaps included in the table under the explanation for the hgdiobj parameter
这篇关于将bmp文件连接到hdc以使用StretchBlt(hdc,....)函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!