Traitée D2D Solid Brush With Alpha

  • mercredi 2 mai 2012 17:15
     
     
    DrawGeometry 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:47
    Modérateur
     
      A du code

    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,
    Jesse


    Jesse 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


    • Modifié Raptor K jeudi 3 mai 2012 12:43
    • Marqué comme réponse Raptor K mercredi 9 mai 2012 08:35
    • Non marqué comme réponse Raptor K jeudi 10 mai 2012 16:45
    •  
  • jeudi 10 mai 2012 11:44
    Modé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
     
     Traitée

    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.


    • Marqué comme réponse Raptor K jeudi 10 mai 2012 16:45
    • Modifié Raptor K jeudi 10 mai 2012 16:53
    •  
  • vendredi 11 mai 2012 01:34
    Modérateur
     
     

    Hello,

     

    Would you please provide us the whole codes to reproduce this issue?

     

    You can upload your project to skydriver

    http://skydrive.live.com/

     

    Best regards,

    Jesse



    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

  • vendredi 11 mai 2012 02:36