包含blendfunction的词条
本文目录一览:
- 1、如何创建一个最简单的Windows桌面应用程序
- 2、为什么我的VS2010不能调用BLENDFUNCTiON
- 3、什么是 linear School
- 4、如何使用GDI绘制半透明矩形
如何创建一个最简单的Windows桌面应用程序
三部分:
WinMain(主函数)
WinProc(消息处理函数)
...(自定义的函数)
不知道你是什么编译器
如果跟我一样,欢迎追问告诉你创建步骤!
另外附一个小程序(需要用到外部库、文件、函数,请勿尝试编译)
#include windows.h
#include cstdio
#include ctime
#include cmath
#pragma comment(lib,"msimg32")
#define Window_FullWidth 864
#define Window_FullHeight 540
#define Screen_FullWidth GetSystemMetrics(SM_CXSCREEN)
#define Screen_FullHeight GetSystemMetrics(SM_CYSCREEN)
#define Game_Menu
#define Game_Load
#define Game_Play
#define Game_Pause
#define Game_Over
HDC g_hdc,m_hdc,t_hdc;
HBITMAP bm,bk,bg,background;
HFONT hfont;
BLENDFUNCTION bf;
FILE *fp;
POINT p;
int bTrans,bTrans_add=1;
void game_Init(HWND hwnd);
void game_Play(HWND hwnd);
void game_check(HWND hwnd);
void game_Paint(HWND hwnd);
void game_reset(HWND hwnd);
void game_Clear(HWND hwnd);
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
WNDCLASSEX wc; HWND hwnd;
MSG msg;
memset(wc,0,sizeof(wc));
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszClassName = "WindowClass";
wc.hIcon = LoadIcon(hInstance,"DICO");
wc.hIconSm = LoadIcon(hInstance,"DICO");
if(!RegisterClassEx(wc)) {
MessageBox(NULL, "Window Registration Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
return 0;
}
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,"WindowClass","",WS_VISIBLE|WS_OVERLAPPEDWINDOW^WS_THICKFRAME^WS_MINIMIZEBOX^WS_MAXIMIZEBOX,
(Screen_FullWidth-Window_FullWidth)/2,(Screen_FullHeight-Window_FullHeight)/2,Window_FullWidth,Window_FullHeight,NULL,NULL,hInstance,NULL);
if(hwnd == NULL) {
MessageBox(NULL, "Window Creation Failed!","Error!",MB_ICONEXCLAMATION|MB_OK);
return 0;
}
game_Init(hwnd);
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
srand(time(NULL));
game_reset(hwnd);
while (msg.message != WM_QUIT) {
if (PeekMessage(msg,0,0,0,PM_REMOVE))
{
TranslateMessage(msg);
DispatchMessage(msg);
}
else
{
int start_clock_count=clock();
game_Play(hwnd);
game_Paint(hwnd);
while(clock()-start_clock_count30);
}
}
return msg.wParam;
}
void game_Init(HWND hwnd)
{
char s[20]; HINSTANCE hInstance;
t_hdc = GetDC(hwnd);
g_hdc = CreateCompatibleDC(t_hdc);
m_hdc = CreateCompatibleDC(g_hdc);
background = CreateCompatibleBitmap(t_hdc,Window_FullWidth,Window_FullHeight);
bg = (HBITMAP) LoadImage(GetModuleHandle(0),"res\\day.bmp",IMAGE_BITMAP,0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
bk = (HBITMAP) LoadImage(GetModuleHandle(0),"res\\black.bmp",IMAGE_BITMAP,0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = bTrans;
bf.AlphaFormat = 0;
}
void game_Paint(HWND hwnd)
{
SelectObject(g_hdc,background);
SelectObject(m_hdc,bg);
BitBlt(g_hdc,0,0,100,100,m_hdc,0,0,SRCCOPY);
SelectObject(m_hdc,bk);
BitBlt(g_hdc,0,0,300,300,m_hdc,0,0,SRCCOPY);
BitBlt(t_hdc,0,0,Window_FullWidth,Window_FullHeight,g_hdc,0,0,SRCCOPY);
}
void game_Play(HWND hwnd)
{
if(bTrans==255) bTrans_add=-1; if(bTrans==0) bTrans_add=1;
bTrans+=5*bTrans_add; bf.SourceConstantAlpha = bTrans;
}
void game_check(HWND hwnd)
{
}
void game_reset(HWND hwnd)
{
}
void game_Clear(HWND hwnd)
{
ReleaseDC(hwnd,t_hdc);
DeleteObject(g_hdc);
DeleteObject(hfont);
DeleteObject(m_hdc);
DeleteObject(bm);
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
p.x=LOWORD(lParam); p.y=HIWORD(lParam);
switch(Message) {
case WM_DESTROY: {
game_Clear(hwnd);
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hwnd, Message, wParam, lParam);
}
return 0;
}
为什么我的VS2010不能调用BLENDFUNCTION
putchar 函数(字符输出函数)
putchar 函数是字符输出函数, 其功能是在显示器上输出单个字符。
其一般形式为:
putchar(字符变量)
例如:
putchar('A'); (输出大写字母A)
putchar(x); (输出字符变量x的值)
putchar(‘\101’); (也是输出字符A)
putchar('\n'); (换行)
对控制字符则执行控制功能,不在屏幕上显示。
使用本函数前必须要用文件包含命令:
#includestdio.h
或
#include “stdio.h”
什么是 linear School
什么是 linear School
linear School
中文意思:线性学校
例句
1、Study on the Different Surface Linear Understanding Level of the Senior School Students
高中生对异面直线概念理解水平的研究
2、This paper studies currently in Australia and China ’ s implementation of linear programming of high school mathematics curriculum standards through paring and summing up experience, in order to providing with the up-to-date international perspective for improving further the standards of China ’ s mathematics curriculum.In this paper, it mainly adopts the law of literature and parison.
本文选取澳大利亚和我国目前正在施行的高中数学线性规划课程标准为研究对象,通过对二者比较分析,总结经验,以期为进一步完善我国数学课程标准提供最新的国际视角。本文研究主要采用文献法和比较法。
3、Multiple Linear Regression in Statistical Analysis for School Health Survey
学校卫生调查统计分析中的多元线性回归方程
4、Some Suggestions on Linear Algebra Teaching of Higher Vocational School
高职《线性代数》教学的几点建议
5、Simple Application of Linear Programming in Math of Middle School
线性规划在中学数学中的简单应用
什么是Linear
您好,很高兴为您解答:
linear
adj. 直线的,线形的;长度的;数一次的,线性的;通过单独的若干阶段来发展的;
[例句]The most mon linear data structure used is the list.
有序列表是最常见的线性数据结构之一
祝你生活愉快,学习进步!
如果你对这个答案有什么疑问,请追问
如果满意记得采纳哦,谢谢~~~
什么是linear meter
linear meter
线性仪表
保证对!
什么是linear color blending
线性混合颜色
linear color blending
linear是线的,线型的意思。
color是颜色;肤色的意思。
blending是混合;调配;混和物的意思。
颜色混合是指将两个颜色混合在一起产生第三个颜色的处理过程。
第一个颜色叫做源颜色(source color)。第二个颜色叫做目标颜色(destination color),这个颜色已经存在(例如在后备缓冲中)。每个颜色都一个单独的的混合因子确定每种颜色在最终图像中的多少。当源颜色和目标颜色乘以各自的混合因子后,最终结果根据指定的混合函数进行合成。通常混合函数只是简单的相加。
完整公式如下所示:
(source × source blend factor) (blend function) (destination × destination blend factor)
源颜色的混合因子是由SourceBlend属性指定的,目标颜色的混合因子是由DestinationBlend属性指定的。BlendFunction属性指定使用的混合函数,通常是BlendFunction.Add,这种情况公式如下表示:
(source × SourceBlend) + (destination × DestinationBlend)
当AlphaBlendEnable属性为false时,在绘制时不进行混合。
什么是linear image sensor(2048×1pixel)
线性图像传感器 linear image sensor
什么是 Old School 风格?什么是 New School 风格
字面理解,“school”就是“学校”的意思,老派前辈谦虚,称自己是该风格school(学校)的学生。
而old school,意指复古派、守旧派,即【传统经典】。而如今,它更泛指为一种复古文化倾向、态度。
old school new school旧学校新学校old school new school旧学校新学校
什么是线性辨别模型(Linear_Discriminant_Model)?
线性判别式模型(Linear Discriminant Model) 线性判别式模型是由阿特曼(A1tman)发展起来的一种 风险 测 定模型。它通过使用借款者的各种 财务比率 和这些比率的 权重 来对 违 约风险进行 总体 的计算,其中各种财务比率的权重是基于 违约 和非违 约借款者过去的情况得到的经验数据。
什么是grammar school
grammar school
文法学校
grammar school
[英][ˈɡræmə sku:l][美][ˈɡræmɚ skul]
n.语文小学;
复数:grammar schools
例句:
1.
Getting into grammar school has bee increasingly difficult.
进入文法学校学习已经变得越来越困难。
2.
The prospect of a new grammar school is likely to unsettle the coalition.
修建新文法学校的展望在党派之间似乎也激起了波澜。
什么是Grammar School
Grammar School 先不论 汉语的翻译是什么
它是起源于英国。最初是用来教导拉丁文的,之后开始教古希腊语等。现存的 Grammar School 都有较长的历史,所以,也该明白,这些学校是比较好的学校。比如,中国最古老的大学 北大,现在也是很好的学府一样
因为在英国,16岁的时候学生要参加一个叫GCSE的考试,成绩分为八个等级,考的好的可以上大学哦。Grammar School 的学生的成绩一般都比较好。
Grammar School 在国内的翻译是:(英)文法学校;
如:
学校名称:三一文法学校 (男子学校,没有女生的)
英文名称:Trinity Grammar School
希望帮到你
如何使用GDI绘制半透明矩形
HDC hBitmapDC = CreateCompatibleDC(hDC);
HBITMAP hBitmap = CreateCompatibleBitmap(hDC, rt.Width(), rt.Height());
SelectObject(hBitmapDC,hBitmap);
步骤2)在内存DC中绘图
FillRgn(hBitmapDC, (HRGN)rgn, (HBRUSH)m_pGdiBrush);
Rectangle(hBitmapDC, 0, 0, 100, 100);
步骤3) 半透明混合
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.AlphaFormat = 0;
bf.SourceConstantAlpha = 50;
AlphaBlend(hDC,rt.left,rt.top,rt.Width(),rt.Height(),hBitmapDC,0,0,rt.Width(),rt.Height(),bf);
2、GDI+
步骤1) 创建半透明画刷
m_pBrush = new SolidBrush(Color(128, GetRValue(clrMask), GetGValue(clrMask), GetBValue(clrMask))); // 透明度 128
步骤2)使用画刷绘图
Graphics graphics(hDC);
graphics.FillPolygon(m_pBrush, pts, 3, FillModeAlternate);
效率: GDI+ GDI。
使用GDI+绘图简单而高效,所以推荐使用GDI+。
3、Direct Draw
此方法比较复杂,没有对Direct Draw有一定的了解,不推荐此方法。
代码比较多,不做列举,需要注意的地方有:
使用Direct Draw时,注意,绘制半透明多边形的时候,因为牵涉到已有的图像数据,所以会对绘图页面原有的图像进行读取操作。如果当前绘制页面开辟在显存中的时候,
对显存的读操作会导致整个渲染流水线的暂停,
从而严重影响程序的效率,此时,绘制半透明多边形就会变得异常的慢。这时候需要将绘制页面从显存中更改至内存中。或者在内存中创建一个过度页面,绘制完成后再往显存页面上贴图。效率会有显著提升,实测:
blendfunction的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、blendfunction的信息别忘了在本站进行查找喔。
相关文章
发表评论
评论列表
- 这篇文章还没有收到评论,赶紧来抢沙发吧~