Exportieren (0) Drucken
Alle erweitern

IDWriteBitmapRenderTarget::DrawGlyphRun Method

Draws a run of glyphs to a bitmap target at the specified position.

Syntax

virtual HRESULT DrawGlyphRun(
  FLOAT  baselineOriginX,
  FLOAT  baselineOriginY,
  DWRITE_MEASURING_MODE  measuringMode,
  [in]             const DWRITE_GLYPH_RUN * glyphRun,
  IDWriteRenderingParams * renderingParams,
  COLORREF  textColor,
  [out, optional]  RECT * blackBoxRect
) = 0;

Parameter

baselineOriginX

The horizontal position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB.

baselineOriginY

The vertical position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB.

measuringMode

The measuring method for glyphs in the run, used with the other properties to determine the rendering mode.

glyphRun [in]

The structure containing the properties of the glyph run.

renderingParams

The object that controls rendering behavior.

textColor

The foreground color of the text.

blackBoxRect [out, optional]

The optional rectangle that receives the bounding box (in pixels not DIPs) of all the pixels affected by drawing the glyph run. The black box rectangle may extend beyond the dimensions of the bitmap.

Rückgabewert

Ist Methode erfolgreich, wird "S_OK" zurückgegeben. Andernfalls wird ein HRESULT-Fehlercode zurückgegeben.

Hinweise

You can use the IDWriteBitmapRenderTarget::DrawGlyphRun to render to a bitmap from a custom text renderer that you implement. The custom text renderer should call this method from within the IDWriteTextRenderer::DrawGlyphRun callback method as shown in the following code.


STDMETHODIMP GdiTextRenderer::DrawGlyphRun(
    __maybenull void* clientDrawingContext,
    FLOAT baselineOriginX,
    FLOAT baselineOriginY,
    DWRITE_MEASURING_MODE measuringMode,
    __in DWRITE_GLYPH_RUN const* glyphRun,
    __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
    IUnknown* clientDrawingEffect
    )
{
    HRESULT hr = S_OK;

    // Pass on the drawing call to the render target to do the real work.
    RECT dirtyRect = {0};

    hr = pRenderTarget_->DrawGlyphRun(
        baselineOriginX,
        baselineOriginY,
        measuringMode,
        glyphRun,
        pRenderingParams_,
        RGB(0,200,255),
        &dirtyRect
        );
    

    return hr;
}


The baselineOriginX, baslineOriginY, measuringMethod, and glyphRun parameters are provided (as arguments) when the callback method is invoked. The renderingParams, textColor and blackBoxRect are not.

Default rendering params can be retrieved by using the IDWriteFactory::CreateMonitorRenderingParams method.

Anforderungen

Mindestens unterstützter Client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista

Mindestens unterstützter Server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008

Header

Dwrite.h

Bibliothek

Dwrite.lib

DLL

Dwrite.dll

Siehe auch

IDWriteBitmapRenderTarget

 

 

Anzeigen:
© 2015 Microsoft