Direct2D 学习笔记(1)概述
2024-09-01 14:05:05
Direct2D 应用程序接口概述
主要用到的头文件是:d2d1.h
编译时需要连接文件:d2d1.lib
编译时需要连接文件:d2d1.lib
Direct2D接口的老大 (root) 是 ID2D1Factory 和 ID2D1Resource
并且 ID2D1Resource 对象由 ID2D1Factory 对象创建
所有的 Direct2D 绘制对象都继承于 ID2D1Resource
ID2D1Factory 对象的创建需要调用 CreateFactory 方法
ID2D1Factory *pDirect2dFactory;
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pDirect2dFactory);
ID2D1HwndRenderTarget 接口用于窗口的绘制
ID2D1BitmapRenderTarget 接口用于位图的绘制
ID2D1BitmapRenderTarget 接口用于位图的绘制
ID2D1Target 实现绘制需要调用 BeginDraw / EndDraw 方法:
ID2D1HwndRenderTarget *pDirect2dRenderTarget;
//初始化Target代码......
pDirect2dRenderTarget->BeginDraw();
//绘制代码......
pDirect2dRenderTarget->EndDraw();
画刷:ID2D1Brush
SolidColor \ LinearGradient \ RadialGradient \ Bitmap \...
创建方法: pDirect2dRenderTarget->Creat***Brush(...);
***可以用任意一个画刷种类代替
SolidColor \ LinearGradient \ RadialGradient \ Bitmap \...
创建方法: pDirect2dRenderTarget->Creat***Brush(...);
***可以用任意一个画刷种类代替
简单几何图形:ID2D1Geometry
Rectangle \ Rounded \ Ellipse \ Path \ ...
创建方法:pDirect2dFactory->Create***Geometry(...);
Rectangle \ Rounded \ Ellipse \ Path \ ...
创建方法:pDirect2dFactory->Create***Geometry(...);
位图加载:ID2D1Bitmap
采用WIC(Windows Imaging Component)加载
pDirect2dRenderTarget->CreateBitmapFromWicBitmap(...);
采用WIC(Windows Imaging Component)加载
pDirect2dRenderTarget->CreateBitmapFromWicBitmap(...);
文字加载:(由RenderTarget调用)
DrawText方法:用于简单输出文字
DrawTextLayout方法:用于输出格式化的文字(需要IDWriteTextLayout 对象设置格式)
DrawGlyphRun方法:用于精确控制符号级布置的场景(需要用到dwrite.h文件中的DirectWrite工具)
DrawText方法:用于简单输出文字
DrawTextLayout方法:用于输出格式化的文字(需要IDWriteTextLayout 对象设置格式)
DrawGlyphRun方法:用于精确控制符号级布置的场景(需要用到dwrite.h文件中的DirectWrite工具)
至于这些接口的使用我将在之后的学习笔记中更新。
最新文章
- bzoj2002弹(dan)飞绵羊 分块水过
- angular-ui-bootstrap-modal必须要说的几个点(转)
- 听着好像很牛的特效——幽灵按钮DOM
- PHP中类自动加载的方式
- svn服务器搭建与使用
- CCF真题之网络延时
- Microsoft Dynamics CRM 2013/2015 选项集的多选
- MySQL 字符串 分割 多列
- 输入输出流ObjectInputStream、ObjectOutputStream(对象序列化与反序列化)
- 微信硬件平台(八) 4 ESP8266通过微信公众号给用户推送消息
- linux内存源码分析 - 内存池
- Nginx详解二十一:Nginx深度学习篇之配置苹果要求的openssl后台HTTPS服务
- 29.Hibernate-二级缓存和session管理.md
- salt 配置管理
- iOS 基础-----关于UIView 的 frame 与 bounds
- Nginx优化(十七)
- LINUX环境变量(二)
- 【LeetCode】48. Rotate Image (2 solutions)
- navicat连接PostgreSQL报:column “rolcatupdate” does not exist ...错误的解决办法
- 访问ashx一般应用程序