请问Direct2D有类似于GdiplusPath::AddString这样的方法吗?

solomonlxd 2018-07-26 05:18:25
即将文字转换为一个Path(PathGeometry),然后可以用这个Path(PathGeometry)对文字做一些美化
...全文
201 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
solomonlxd 2018-07-31
  • 打赏
  • 举报
回复
有人有答案吗
oblivi 2018-07-27
  • 打赏
  • 举报
回复
没有找到
solomonlxd 2018-07-27
  • 打赏
  • 举报
回复
引用 3 楼 oblivi 的回复:
[quote=引用 2 楼 solomonlxd 的回复:]
[quote=引用 1 楼 oblivi 的回复:]

res = g_pDCRT->CreateGradientStopCollection(stops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(left, 0.f), Point2F(right, 150.f)), pCollection, &pLinearBrush);
pCollection->Release();
res = g_pDCRT->CreateGradientStopCollection(fillstops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(right, 150.f), Point2F(left, 0.f)), pCollection, &pFillBrush);

g_pDCRT->BindDC(memDC, &CRect(0, 0, 1000, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pLinearBrush);
g_pDCRT->EndDraw();

g_pDCRT->BindDC(memDC, CRect(0, 0, left + schedule * (right - left) / 100, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pFillBrush);
g_pDCRT->EndDraw();
用BindDC()分开处理,和GDI+的ClipRect类似

这段代码只是用渐变色画刷写字而已呀,我想要将文字转换为PathGeometry,然后可以用这个PathGeometry对文字进行一些美化,比如给文字加描边之类[/quote]你是指GDI+DrawPath那种吗,文字边框?[/quote]
是的,就是指那个
oblivi 2018-07-27
  • 打赏
  • 举报
回复
这个只能对部分文字实现特殊处理,加粗下划线那种
oblivi 2018-07-27
  • 打赏
  • 举报
回复
引用 2 楼 solomonlxd 的回复:
[quote=引用 1 楼 oblivi 的回复:]

res = g_pDCRT->CreateGradientStopCollection(stops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(left, 0.f), Point2F(right, 150.f)), pCollection, &pLinearBrush);
pCollection->Release();
res = g_pDCRT->CreateGradientStopCollection(fillstops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(right, 150.f), Point2F(left, 0.f)), pCollection, &pFillBrush);

g_pDCRT->BindDC(memDC, &CRect(0, 0, 1000, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pLinearBrush);
g_pDCRT->EndDraw();

g_pDCRT->BindDC(memDC, CRect(0, 0, left + schedule * (right - left) / 100, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pFillBrush);
g_pDCRT->EndDraw();
用BindDC()分开处理,和GDI+的ClipRect类似

这段代码只是用渐变色画刷写字而已呀,我想要将文字转换为PathGeometry,然后可以用这个PathGeometry对文字进行一些美化,比如给文字加描边之类[/quote]你是指GDI+DrawPath那种吗,文字边框?
solomonlxd 2018-07-27
  • 打赏
  • 举报
回复
引用 1 楼 oblivi 的回复:

res = g_pDCRT->CreateGradientStopCollection(stops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(left, 0.f), Point2F(right, 150.f)), pCollection, &pLinearBrush);
pCollection->Release();
res = g_pDCRT->CreateGradientStopCollection(fillstops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(right, 150.f), Point2F(left, 0.f)), pCollection, &pFillBrush);

g_pDCRT->BindDC(memDC, &CRect(0, 0, 1000, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pLinearBrush);
g_pDCRT->EndDraw();

g_pDCRT->BindDC(memDC, CRect(0, 0, left + schedule * (right - left) / 100, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pFillBrush);
g_pDCRT->EndDraw();
用BindDC()分开处理,和GDI+的ClipRect类似

这段代码只是用渐变色画刷写字而已呀,我想要将文字转换为PathGeometry,然后可以用这个PathGeometry对文字进行一些美化,比如给文字加描边之类
solomonlxd 2018-07-27
  • 打赏
  • 举报
回复
引用 6 楼 oblivi 的回复:
没有找到

谢谢,有付出就有收获
oblivi 2018-07-26
  • 打赏
  • 举报
回复

res = g_pDCRT->CreateGradientStopCollection(stops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(left, 0.f), Point2F(right, 150.f)), pCollection, &pLinearBrush);
pCollection->Release();
res = g_pDCRT->CreateGradientStopCollection(fillstops, 7, &pCollection);
res = g_pDCRT->CreateLinearGradientBrush(LinearGradientBrushProperties(Point2F(right, 150.f), Point2F(left, 0.f)), pCollection, &pFillBrush);

g_pDCRT->BindDC(memDC, &CRect(0, 0, 1000, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pLinearBrush);
g_pDCRT->EndDraw();

g_pDCRT->BindDC(memDC, CRect(0, 0, left + schedule * (right - left) / 100, 150));
g_pDCRT->BeginDraw();
g_pDCRT->DrawText(str, str.GetLength(), pFormat, RectF(left, 15, right, 150), pFillBrush);
g_pDCRT->EndDraw();
用BindDC()分开处理,和GDI+的ClipRect类似

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧