ID2D1PathGeometry 和 ID2D1DeviceContext 的组合
Combination of ID2D1PathGeometry and ID2D1DeviceContext
我的目标是在ID2D1DeviceContext
提供的渲染目标中绘制几何路径。 我有一个由D2D1CreateFactory
创建的ID2D1Factory
,以下代码失败:
CComPtr<ID2D1PathGeometry> m_pPathGeometry;
fa->CreatePathGeometry(&m_pPathGeometry);
CComQIPtr<ID2D1SolidColorBrush> b;
D2D1_COLOR_F cc = { 1.0f,1.0f,1.0f,1.0f };
pRT->CreateSolidColorBrush(cc, &b);
pRT->FillGeometry(m_pPathGeometry, b);
调用 pRT->EndDraw(( 时,我收到一条消息0x88990012 : Objects used together must be created from the same factory instance
。
为什么?这是否意味着路径几何体仅与使用fa->CreateHwndRenderTarget()
创建的呈现器目标兼容?但我当然需要一个ID2D1DeviceContext来渲染成位图。
我的水晶球告诉我,您正在通过调用D2D1CreateDeviceContext
函数来创建ID2D1DeviceContext
实例,该函数也会创建一个新的工厂对象,然后通过调用导致创建对象不兼容D2D1CreateFactory
函数来创建另一个工厂。因此,您应该使用ID2D1Resource::GetFactory
查询与设备上下文对应的工厂,而不是创建另一个工厂。
相关文章:
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 可组合的lambda/std::函数与std::可选
- 如何将两个不同矢量的同一位置的两个元素组合在一起
- 混合组合和继承的C++问题
- 我需要将多个函数组合为一个函数
- 构建可组合有向图(扫描仪生成器的汤普森构造算法)
- 通过组合不同的类型来创建唯一的id
- 用常见虚拟函数实现的任意组合来实现派生类的正确方法是什么
- 模板元编程:如何将参数包组合成新的参数包
- 检查向量是否具有所有可能的字符组合
- 如何在加密++中将两个源组合成新的源
- 根中的组合
- 更改 C++ 中的组合分类变量
- 错误:(-210:不支持的格式或格式组合)功能'create'中的硬件视频解码器不支持视频源
- 组合字符串不适用于 libCurl,C++
- 测试两个类型列表中的所有组合
- 将多个 for 循环组合成单个迭代器
- 如何从组合指数中找到仓位
- 防止组合框被关闭
- 如何解决可能的唯一组合问题