Direct2D 应用程序接口概述
主要用到的头文件是:d2d1.h
编译时需要连接文件:d2d1.lib
 
Direct2D接口的老大 (root) 是 ID2D1Factory 和 ID2D1Resource
并且 ID2D1Resource 对象由 ID2D1Factory 对象创建
所有的 Direct2D 绘制对象都继承于 ID2D1Resource 
 
ID2D1Factory 对象的创建需要调用 CreateFactory 方法

ID2D1Factory *pDirect2dFactory;
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pDirect2dFactory);
ID2D1HwndRenderTarget 接口用于窗口的绘制
ID2D1BitmapRenderTarget 接口用于位图的绘制
 
ID2D1Target 实现绘制需要调用 BeginDraw / EndDraw 方法:

ID2D1HwndRenderTarget *pDirect2dRenderTarget;
//初始化Target代码......
pDirect2dRenderTarget->BeginDraw();
//绘制代码......
pDirect2dRenderTarget->EndDraw();
画刷:ID2D1Brush
SolidColor \ LinearGradient \ RadialGradient \ Bitmap \...
创建方法: pDirect2dRenderTarget->Creat***Brush(...);
***可以用任意一个画刷种类代替
 
简单几何图形:ID2D1Geometry
Rectangle \ Rounded \ Ellipse \ Path \ ...
创建方法:pDirect2dFactory->Create***Geometry(...);
 
位图加载:ID2D1Bitmap
采用WIC(Windows Imaging Component)加载
pDirect2dRenderTarget->CreateBitmapFromWicBitmap(...);
 
文字加载:(由RenderTarget调用)
DrawText方法:用于简单输出文字
DrawTextLayout方法:用于输出格式化的文字(需要IDWriteTextLayout 对象设置格式)
DrawGlyphRun方法:用于精确控制符号级布置的场景(需要用到dwrite.h文件中的DirectWrite工具)
 
至于这些接口的使用我将在之后的学习笔记中更新。

最新文章

  1. bzoj2002弹(dan)飞绵羊 分块水过
  2. angular-ui-bootstrap-modal必须要说的几个点(转)
  3. 听着好像很牛的特效——幽灵按钮DOM
  4. PHP中类自动加载的方式
  5. svn服务器搭建与使用
  6. CCF真题之网络延时
  7. Microsoft Dynamics CRM 2013/2015 选项集的多选
  8. MySQL 字符串 分割 多列
  9. 输入输出流ObjectInputStream、ObjectOutputStream(对象序列化与反序列化)
  10. 微信硬件平台(八) 4 ESP8266通过微信公众号给用户推送消息
  11. linux内存源码分析 - 内存池
  12. Nginx详解二十一:Nginx深度学习篇之配置苹果要求的openssl后台HTTPS服务
  13. 29.Hibernate-二级缓存和session管理.md
  14. salt 配置管理
  15. iOS 基础-----关于UIView 的 frame 与 bounds
  16. Nginx优化(十七)
  17. LINUX环境变量(二)
  18. 【LeetCode】48. Rotate Image (2 solutions)
  19. navicat连接PostgreSQL报:column “rolcatupdate” does not exist ...错误的解决办法
  20. 访问ashx一般应用程序

热门文章

  1. BZOJ1209 最佳包裹 (三维凸包 增量法)
  2. 提高React组件的复用性
  3. springboot启动时执行任务CommandLineRunner
  4. Postgresql 日志相关
  5. RDMA Programming - Base on linux-rdma
  6. 10月清北学堂培训 Day 7
  7. 解决vim升级后导致的高亮行行好有下划线问题,
  8. mysql插入数据自动生成主键uuid
  9. Project Euler Problem (1~10)
  10. Selenium: 利用select模块操作下拉框