AlphaBlend使用_编程资料

AlphaBlend使用2008-01-24 15:39This function displays bitmaps that have transparent or semitransparent pixels.
BOOL AlphaBlend(
HDC hdcDest,
int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
HDC hdcSrc,
int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
BLENDFUNCTION blendFunction
);
Parameters
hdcDest
[in] Handle to the destination device context.
nXOriginDest
[in] Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nYOriginDest
[in] Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.
nWidthDest
[in] Specifies the width, in logical units, of the destination rectangle. This value cannot be negative.
nHeightDest
[in] Specifies the height, in logical units, of the destination rectangle. This value cannot be negative.
hdcSrc
[in] Handle to the source device context.
nXOriginSrc
[in] Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle.
nYOriginSrc
[in] Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle.
nWidthSrc
[in] Specifies the width, in logical units, of the source rectangle. This value cannot be negative.
nHeightSrc
[in] Specifies the height, in logical units, of the source rectangle. This value cannot be negative.
blendFunction
[in] A BLENDFUNCTION structure that specifies the alpha-blending function for source and destination bitmaps, a global alpha value to be applied to the entire source bitmap, and format information for the source bitmap. The source and destination blend functions are currently limited to AC_SRC_OVER.
Return Values
If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE.
To get extended error information, call GetLastError. GetLastError can return the following value.
ValueDescription
ERROR_INVALID_PARAMETEROne or more of the input parameters is invalid.

Remarks
If the source rectangle and destination rectangle are different sizes, the source bitmap is stretched to match the destination rectangle. If the SetStretchBltMode function is used, the iStretchMode value is automatically converted to COLORONCOLOR for this function.
The destination coordinates are transformed by using the transformation currently specified for the destination device context. The source coordinates are transformed by using the transformation currently specified for the source device context.
If the source device context identifies an enhanced metafile device context, an error occurs (and the function returns FALSE).
If destination and source bitmaps do not have the same color format, AlphaBlend converts the source bitmap to match the destination bitmap.
AlphaBlend does not support mirroring. If either the width or height of the source or destination is negative, the call to AlphaBlend will fail.
When rendering to a printer, first call GetDeviceCaps with SHADEBLENDCAPS to determine if the printer supports blending with AlphaBlend. Note that, for a display DC, all blending operations are supported and these flags represent whether the operations are accelerated.
The source rectangle must lie completely within the source surface, otherwise an error occurs and the function returns FALSE.
The SourceConstantaAlpha member of the BLENDFUNCTION structure specifies an alpha transparency value to be used on the entire source bitmap. The SourceConstantAlpha value is combined with any per-pixel alpha values. If SourceConstantAlpha is 0, it is assumed that the image is transparent. To use only per-pixel alpha values, set the SourceConstantAlpha value to 255 to indicate that the image is opaque.
Requirements
OS Versions: Microsoft® Windows CE® 5.0 and later.
Header: Windows.h.
Link Library: Coredll.lib.
在有些情况下需要加载 #pragma comment(lib,"Msimg32.lib")
CBitmap map1;
map1.LoadBitmap(IDB_BITMAP1);
CBitmap map2;
map2.LoadBitmap(IDB_BITMAP2);
CDC dc1;
dc1.CreateCompatibleDC(pDC);
dc1.SelectObject(map1);
CDC dc2;
dc2.CreateCompatibleDC(pDC);
dc2.SelectObject(map2);
pDC->BitBlt(0,0,50,50,&dc1,0,0,SRCCOPY);
BLENDFUNCTION pl;
pl.BlendOp=AC_SRC_OVER;
pl.BlendFlags=0;
pl.SourceConstantAlpha =175;
pl.AlphaFormat=0;
// pDC->BitBlt(0,0,50,50,&dc2,0,0,SRCCOPY);
::AlphaBlend(pDC->GetSafeHdc(),0,0,150,150,dc2.GetSafeHdc(),0,0,20,20,pl);

本文转自
http://hi.baidu.com/csuhkx/blog/item/e7bd1bfad1d62e8d9e5146bd.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: OpenGL 3.3 混合(blend)和透明(alphablend)是一种图形渲染技术。在OpenGL中,混合是指将一个物体的颜色与背景颜色进行相互融合,以产生透明或半透明的效果。透明(alphablend)是指对物体表面的透明度进行控制,使得背景能够透过物体显示出来。 要下载OpenGL 3.3的混合和透明技术(blendalphablend),您需要遵循以下步骤: 1. 首先,确保您的计算机已安装支持OpenGL 3.3的图形硬件设备。如果您的计算机不支持该版本的OpenGL,则无法下载。 2. 在您的计算机上安装适当的OpenGL开发环境。可以从官方OpenGL网站或第三方供应商网站下载,并按照说明进行安装。 3. 熟悉OpenGL编程语言和环境。了解如何使用OpenGL的混合和透明技术,包括调整透明度、混合模式等。 4. 在互联网上搜索和下载与OpenGL 3.3混合和透明技术相关的示例代码或资料。这些示例代码会指导您如何实现混合和透明效果,并为您提供一个起点来编写自己的代码。 5. 如果您希望使用特定的图形库或框架(如GLFW、FreeGLUT等),请下载并安装它们,以便更方便地使用OpenGL 3.3混合和透明技术。 6. 按照示例代码或教程中的说明来编写您自己的程序,并测试它是否能够正确地实现所需的混合和透明效果。 通过以上步骤,您应该能够成功地开始使用OpenGL 3.3混合和透明技术。记住,这是一项技术复杂的任务,需要不断的实践和学习才能掌握。 ### 回答2: 要下载OpenGL 3.3的混合模式(Blend)和透明混合(Alpha Blend)的相关内容,你可以按照以下步骤进行: 1. 首先,打开你喜欢使用的互联网浏览器(例如谷歌浏览器、火狐浏览器等)。 2. 在浏览器的搜索栏中输入关键词“OpenGL 3.3 Blend Alpha Blend下载”。 3. 按下回车键,浏览器将显示与你的搜索相关的结果页面。 4. 在搜索结果页面中,寻找与你要下载的内容相关的链接。你可以查看每个链接的描述和概述来确定其是否与你的需求相符。 5. 找到一个可靠的来源后,点击链接以访问网站。 6. 在网站上查找下载链接或按钮。一些网站可能需要你注册账户或支付费用才能下载内容。 7. 点击下载链接或按钮,并按照网站上的指示完成下载过程。 请注意,在下载任何内容之前,一定要确保你所使用的来源可靠且安全。最好选择知名的软件下载网站或官方网站以确保下载的文件是可信的。同时,注意防范电脑病毒和恶意软件,建议在下载和打开文件之前进行杀毒扫描。 总结起来,要下载OpenGL 3.3的混合模式和透明混合的内容,你需要使用浏览器搜索相关内容并访问可靠的来源,然后按照指示完成下载过程。记得确保来源可靠、文件安全,并在下载和打开文件前进行杀毒扫描。 ### 回答3: 要下载OpenGL 3.3 blend alphablend,您可以按照以下步骤进行操作: 1. 打开您偏好的浏览器,并搜索OpenGL官方网站。 2. 在OpenGL官网上寻找下载页面或者资源库。 3. 查找OpenGL版本3.3并点击进入。 4. 在资源库或下载页面中,寻找与blendalphablend相关的文件。 5. 确保您选择的文件与您的操作系统兼容,如Windows、Mac OS或Linux。 6. 下载所选文件。这可能需要一段时间,具体取决于您的网络连接速度。 7. 一旦下载完成,您可以在您的计算机上找到下载的文件(通常是一个安装程序或归档文件)。 8. 根据您的需求和操作系统,运行安装程序或解压归档文件。 9. 按照安装程序的指示进行安装,或者将解压的文件复制到您选择的目标文件夹中。 10. 一旦安装或复制完成,您就可以在开发环境中使用OpenGL 3.3的blendalphablend功能了。 请注意,具体的下载和安装步骤可能因您的操作系统和开发环境而有所不同。此外,确保您从官方和可信的来源下载文件,以保证其安全性和可靠性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值