Windows Phone 8 (WP8)确定不支持D2D,WIC

今天WP8 SDK Preview正式发布了。确定D2D,WIC完全不支持。

真不知道微软在想什么,发布个Win8逼着大家放弃GDI,改用D2D,结果WP8出来,又不支持D2D。

看来之前决定走纯D3D路线还是正确的,微软的话绝对不可轻信,哈哈!

 

D2D不支持,DW自然也不支持,好在引擎已经支持预处理字体了,直接存成纹理就行了,效果一样,效率还高些,只是中文麻烦些。

由于不支持WIC,官方的说法,纹理也只能使用DDS了。不过还好引擎纹理模块采用完全跨平台代码,支持PNG。

文字输入部分好像也有些区别。

看看还有什么需要稍微移植一下的。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Windows下,可以使用Direct2D来创建位图,OpenCV中的Mat是一个矩阵类,可以表示图像。我们可以通过将Direct2D位图转换为GDI+位图,然后使用OpenCV的imread函数将其读入Mat中。 以下是一个示例代码: ```c++ #include <d2d1.h> #include <gdiplus.h> #include <opencv2/opencv.hpp> #pragma comment(lib, "d2d1.lib") #pragma comment(lib, "gdiplus.lib") using namespace Gdiplus; int main() { // Initialize Direct2D HRESULT hr = CoInitialize(NULL); ID2D1Factory* pFactory = NULL; hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &pFactory); // Create a Direct2D bitmap ID2D1Bitmap* pBitmap = NULL; D2D1_SIZE_U size = D2D1::SizeU(640, 480); hr = pFactory->CreateBitmap(size, D2D1::BitmapProperties(D2D1_PIXEL_FORMAT{ DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_IGNORE }), &pBitmap); // Draw something on the bitmap ID2D1RenderTarget* pRenderTarget = NULL; hr = pFactory->CreateWicBitmapRenderTarget(pBitmap, &D2D1::RenderTargetProperties(), &pRenderTarget); pRenderTarget->BeginDraw(); pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White)); ID2D1SolidColorBrush* pBrush = NULL; hr = pRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Red), &pBrush); pRenderTarget->DrawLine(D2D1::Point2F(0, 0), D2D1::Point2F(640, 480), pBrush); pRenderTarget->DrawLine(D2D1::Point2F(0, 480), D2D1::Point2F(640, 0), pBrush); hr = pRenderTarget->EndDraw(); // Convert Direct2D bitmap to GDI+ bitmap IWICImagingFactory* pWICFactory = NULL; hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (LPVOID*)&pWICFactory); IWICBitmap* pWICBitmap = NULL; hr = pRenderTarget->GetBitmap(&pWICBitmap); IWICBitmapSource* pWICBitmapSource = NULL; hr = pWICBitmap->QueryInterface(IID_IWICBitmapSource, (LPVOID*)&pWICBitmapSource); Gdiplus::Bitmap* pGdiBitmap = new Gdiplus::Bitmap(pWICBitmapSource, NULL); // Convert GDI+ bitmap to Mat cv::Mat mat = cv::Mat(pGdiBitmap->GetHeight(), pGdiBitmap->GetWidth(), CV_8UC4, pGdiBitmap->GetPixelAddress(0, 0)); // Show the Mat cv::imshow("Mat from Direct2D Bitmap", mat); cv::waitKey(); // Clean up delete pGdiBitmap; pWICBitmapSource->Release(); pWICBitmap->Release(); pRenderTarget->Release(); pBrush->Release(); pBitmap->Release(); pFactory->Release(); CoUninitialize(); return 0; } ``` 在这个示例中,我们首先使用Direct2D创建了一个640x480的位图,并在其中绘制了两条对角线。接下来,我们将Direct2D位图转换为GDI+位图,并使用GDI+位图的像素地址创建了一个OpenCV的Mat对象。最后,我们将Mat对象显示在一个窗口中。 请注意,在将Direct2D位图转换为GDI+位图时,我们使用了Windows Imaging Component (WIC)。WIC是一个功能强大的图像处理库,可以用于在Windows中处理各种图像格式。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值