Direct2D 第5篇 绘制图像

本文介绍了如何使用Direct2D进行2D图形绘制,特别是详细讲解了如何加载和绘制具有透明背景的PNG图像,并结合绿色渐变画刷展示图像效果。
摘要由CSDN通过智能技术生成


我加载的图像是一张透明底PNG图像,背景使用渐变的绿色画刷




#include <windows.h>
#include <d2d1.h>
#include <d2d1helper.h>
#include <dwrite.h>
#pragma comment(lib, "dwrite.lib")
#pragma comment(lib, "d2d1.lib")

#include <wincodec.h>

HINSTANCE g_hinst;
HWND g_hwnd;

ID2D1Factory * g_factory;
ID2D1HwndRenderTarget * g_render_target;
ID2D1SolidColorBrush  * g_brush;

IDWriteFactory * g_write_factory;
IDWriteTextFormat * g_text_format;

ID2D1GradientStopCollection * g_gradient_stop_collection;
ID2D1LinearGradientBrush  * g_linear_gradient_brush;
ID2D1RadialGradientBrush * g_radial_gradient_brush;

IWICImagingFactory * g_image_factory = NULL;
ID2D1Bitmap * g_bitmap = NULL;


bool AppInit()
{
	CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);

	D2D1CreateFactory(
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值