Direct2D画背景纹理
2013-06-07 22:52
218 查看
d2d 画背景纹理
HRESULT ImageComponent::CreateGridPatternBrush(ID2D1RenderTarget *pRenderTarget,ID2D1BitmapBrush **ppBitmapBrush) { HRESULT hr = S_OK; // Create a compatible render target. ID2D1BitmapRenderTarget *pCompatibleRenderTarget = NULL; hr = pRenderTarget->CreateCompatibleRenderTarget(D2D1::SizeF(10.0f, 10.0f),&pCompatibleRenderTarget); if (SUCCEEDED(hr)) { // Draw a pattern. ID2D1SolidColorBrush *pGridBrush = NULL; hr = pCompatibleRenderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF(0.93f, 0.94f, 0.96f, 1.0f)),&pGridBrush); if (SUCCEEDED(hr)) { pCompatibleRenderTarget->BeginDraw(); pCompatibleRenderTarget->FillRectangle(D2D1::RectF(0.0f, 0.0f, 10.0f, 1.0f), pGridBrush); pCompatibleRenderTarget->FillRectangle(D2D1::RectF(0.0f, 0.0f, 1.0f, 10.0f), pGridBrush); hr = pCompatibleRenderTarget->EndDraw(); if (SUCCEEDED(hr)) { // Retrieve the bitmap from the render target. ID2D1Bitmap *pGridBitmap = NULL; hr = pCompatibleRenderTarget->GetBitmap(&pGridBitmap); if (SUCCEEDED(hr)) { // Create the bitmap brush. hr = m_pRenderTarget->CreateBitmapBrush(pGridBitmap,D2D1::BitmapBrushProperties(D2D1_EXTEND_MODE_WRAP,D2D1_EXTEND_MODE_WRAP),ppBitmapBrush); pGridBitmap->Release(); } } pGridBrush->Release(); } pCompatibleRenderTarget->Release(); } return hr; }
相关文章推荐
- 网页素材精品:40套很漂亮的纹理背景图片
- 基于纹理与颜色的多层背景差分
- 分享10个Web设计者喜欢的超棒背景和纹理资源
- 大搜集—背景纹理
- 应用纹理背景的优秀网站设计作品【上篇】
- 如何为表视图添加纹理背景
- 23个充满吸引力的纹理背景网页作品
- 使用glfw库将OpenCV读取到的图片作为OpenGL的背景纹理贴图
- 加载位图树纹理的两种方法---背景透明
- 分享最新20套漂亮的网页背景纹理素材
- 分享最新20套漂亮的网页背景纹理素材
- 一个非常不错的背景纹理图的网站
- CSS3实现各种纹理背景效果
- 推荐30个很酷的木材纹理背景
- IOS 纹理填充 背景
- 分享10个Web设计者喜欢的超棒背景和纹理资源
- 绘制有纹理的背景的应用程序
- 分享35套很不错的抽象纹理背景素材
- 分享10个高质量纹理背景资源网站
- 10个获取免费网页背景纹理的最佳网站