【发布时间】:2016-04-23 21:24:50
【问题描述】:
我的目标是在我的 directx 应用程序中创建一个纹理图集。我所拥有的是需要放在纹理图集上的 ID2D1PathGeometries 向量。所以我创建了一个 ID2D1Bitmap1,但我不知道下一步是什么。换句话说,-我究竟如何在我需要的 ID2D1Bitmap1 上放置一个 ID2D1PathGeometry?
p/s/ 值得一提的是,我是 directx 的新手,当我尝试在 msdn 上寻找答案时,我总是迷失在 direct2d 为您提供的所有内容中。 恩
p/p/s 请求的代码: 正如我已经提到的,没有什么可展示的。
std::vector<Microsoft::WRL::ComPtr<ID2D1PathGeometry>> atlasGeometries; // so i have my geometries
////than i fill the vector
{
....
}
////Creating Bitmap for font sheet
Microsoft::WRL::ComPtr<ID2D1Bitmap1> bitmap;
D2D1_SIZE_U dimensions;
dimensions.height = 1024;
dimensions.width = 1024;
D2D1_BITMAP_PROPERTIES1 d2dbp;
D2D1_PIXEL_FORMAT d2dpf;
FLOAT dpiX;
FLOAT dpiY;
d2dpf.format = DXGI_FORMAT_A8_UNORM;
d2dpf.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED;
this->dxDevMt.GetD2DFactory()->GetDesktopDpi(&dpiX, &dpiY);
d2dbp.pixelFormat = d2dpf;
d2dbp.dpiX = dpiX;
d2dbp.dpiY = dpiY;
d2dbp.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET;
d2dbp.colorContext = nullptr;
newCtx->CreateBitmap(dimensions, nullptr, 0, d2dbp, bitmap.GetAddressOf());
但我接下来要做的是对我的追求。我有点想通了,我应该使用 RenderTarget 来处理这类事情。但我没弄清楚,到底是怎么回事。
【问题讨论】:
-
你能告诉我们你的代码吗?
标签: c++ windows-store-apps directx uwp direct2d