D2D Solid Brush With Alpha
-
mercredi 2 mai 2012 17:15DrawGeometry with solid brush with alpha color, when one stroke covers another, why some will add 2 alpha value, some will not?
C++ DX11
Toutes les réponses
-
jeudi 3 mai 2012 08:47Modérateur
Hello,
I draw a gird but can not reproduce this issue. Would you please provide us some codes to reproduce it?
// In head file Microsoft::WRL::ComPtr<ID2D1PathGeometry> m_pathGeometry[6]; //void geomerty::CreateWindowSizeDependentResources() function for(int i=0;i<2;i++) { DX::ThrowIfFailed( m_d2dFactory->CreatePathGeometry(&m_pathGeometry[i]) ); ID2D1GeometrySink *pSink=NULL; DX::ThrowIfFailed(m_pathGeometry[i]->Open(&pSink)); pSink->BeginFigure(D2D1::Point2F(100+i*50,200),D2D1_FIGURE_BEGIN_HOLLOW); pSink->AddLine(D2D1::Point2F(100+i*50,700)); pSink->EndFigure(D2D1_FIGURE_END_CLOSED); pSink->Close(); } for(int i=2;i<6;i++) { DX::ThrowIfFailed( m_d2dFactory->CreatePathGeometry(&m_pathGeometry[i]) ); ID2D1GeometrySink *pSink=NULL; DX::ThrowIfFailed(m_pathGeometry[i]->Open(&pSink)); pSink->BeginFigure(D2D1::Point2F(100,200+(i-2)*50),D2D1_FIGURE_BEGIN_HOLLOW); pSink->AddLine(D2D1::Point2F(700,200+(i-2)*50)); pSink->EndFigure(D2D1_FIGURE_END_CLOSED); pSink->Close(); } //void geomerty::Render() function for(int i=0;i<5;i++) { m_d2dContext->DrawGeometry(m_pathGeometry[i].Get(),m_solidBrush.Get(),30.f); }
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
jeudi 3 mai 2012 12:20
See the DWriteCustomTextRenderer sample.
DWriteCustomTextRenderer.cpp : Change to alpha brush
m_d2dContext->CreateSolidColorBrush(
D2D1::ColorF(D2D1::ColorF::GreenYellow,0.5),
&m_blackBrush
)CustomTextRenderer.cpp : Draw wide Outline
D2DDeviceContext->DrawGeometry(
transformedGeometry.Get(),
outlineBrush.Get(),32
);Just because different fonts? They are in ONE Draw command. Where can I set alpha operation mode. I DON'T want them added up.
Some Asian characters' outline with SAME font even cover each other when there are several Draws in the CustomTextRenderer::DrawGlyphRun
Why they are different? Seems some characters are not drawn at one time.
C++ DX11
-
jeudi 10 mai 2012 11:44Modérateur
Hi,
Sorry for delay replay, did you solve this problem? If so, would you please sharing the solution with us?
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
jeudi 10 mai 2012 16:45
Seems there will be several "DrawGlyphRun" calls in ONE "IDWriteTextLayout.Draw" command when using Asian fonts. (Is it a bug, or ? ) A new DrawGlyphRun will cover the old one. So just do not draw in DrawGlyphRun .
D2D and DWrite seems not fast enough, and I will only use it in offline rendering.
-
vendredi 11 mai 2012 01:34Modérateur
Hello,
Would you please provide us the whole codes to reproduce this issue?
You can upload your project to skydriver
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
vendredi 11 mai 2012 02:36
Seems only have problem when fontname="", default font ?
C++ DX11

