// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace SharpDX.DirectWrite { /// ///

Creates a rendering parameters object with the specified properties.

///
/// /// Hh780402 /// IDWriteFactory2 /// IDWriteFactory2 public partial class Factory2 { /// ///

This method is called on a glyph run to translate it in to multiple color glyph runs.

///
///

The horizontal baseline origin of the original glyph run.

///

The vertical baseline origin of the original glyph run.

///

Original glyph run containing monochrome glyph IDs.

///

Optional glyph run description.

///

Measuring mode used to compute glyph positions if the run contains color glyphs.

///

World transform multiplied by any DPI scaling. This is needed to compute glyph positions if the run contains color glyphs and the measuring mode is not DWRITE_MEASURING_MODE_NATURAL. If this parameter is null, and identity transform is assumed.

///

Zero-based index of the color palette to use. Valid indices are less than the number of palettes in the font, as returned by IDWriteFontFace2::GetColorPaletteCount.

///

If the original glyph run contains color glyphs, this parameter receives a reference to an interface. The client uses the returned interface to get information about glyph runs and associated colors to render instead of the original glyph run. If the original glyph run does not contain color glyphs, this method returns DWRITE_E_NOCOLOR and the output reference is null.

///

If this method succeeds, it returns . Otherwise, it returns an error code.

/// ///

If the code calls this method with a glyph run that contains no color information, the method returns DWRITE_E_NOCOLOR to let the application know that it can just draw the original glyph run. If the glyph run contains color information, the function returns an object that can be enumerated through to expose runs and associated colors. The application then calls DrawGlyphRun with each of the returned glyph runs and foreground colors.

///
/// dn280451 /// HRESULT IDWriteFactory2::TranslateColorGlyphRun([In] float baselineOriginX,[In] float baselineOriginY,[In] const DWRITE_GLYPH_RUN* glyphRun,[In, Optional] const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,[In] DWRITE_MEASURING_MODE measuringMode,[In, Optional] const DWRITE_MATRIX* worldToDeviceTransform,[In] unsigned int colorPaletteIndex,[Out] IDWriteColorGlyphRunEnumerator** colorLayers) /// IDWriteFactory2::TranslateColorGlyphRun public void TranslateColorGlyphRun(System.Single baselineOriginX, System.Single baselineOriginY, SharpDX.DirectWrite.GlyphRun glyphRun, SharpDX.DirectWrite.GlyphRunDescription glyphRunDescription, SharpDX.Direct2D1.MeasuringMode measuringMode, SharpDX.Mathematics.Interop.RawMatrix3x2? worldToDeviceTransform, System.Int32 colorPaletteIndex, out SharpDX.DirectWrite.ColorGlyphRunEnumerator colorLayers) { var result = TryTranslateColorGlyphRun(baselineOriginX, baselineOriginY, glyphRun, glyphRunDescription, measuringMode, worldToDeviceTransform, colorPaletteIndex, out colorLayers); result.CheckError(); } /// ///

This method is called on a glyph run to translate it in to multiple color glyph runs.

///
///

The horizontal baseline origin of the original glyph run.

///

The vertical baseline origin of the original glyph run.

///

Original glyph run containing monochrome glyph IDs.

///

Optional glyph run description.

///

Measuring mode used to compute glyph positions if the run contains color glyphs.

///

World transform multiplied by any DPI scaling. This is needed to compute glyph positions if the run contains color glyphs and the measuring mode is not DWRITE_MEASURING_MODE_NATURAL. If this parameter is null, and identity transform is assumed.

///

Zero-based index of the color palette to use. Valid indices are less than the number of palettes in the font, as returned by IDWriteFontFace2::GetColorPaletteCount.

///

If the original glyph run contains color glyphs, this parameter receives a reference to an interface. The client uses the returned interface to get information about glyph runs and associated colors to render instead of the original glyph run. If the original glyph run does not contain color glyphs, this method returns DWRITE_E_NOCOLOR and the output reference is null.

/// ///

If the code calls this method with a glyph run that contains no color information, the method returns DWRITE_E_NOCOLOR to let the application know that it can just draw the original glyph run. If the glyph run contains color information, the function returns an object that can be enumerated through to expose runs and associated colors. The application then calls DrawGlyphRun with each of the returned glyph runs and foreground colors.

///
/// dn280451 /// HRESULT IDWriteFactory2::TranslateColorGlyphRun([In] float baselineOriginX,[In] float baselineOriginY,[In] const DWRITE_GLYPH_RUN* glyphRun,[In, Optional] const DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription,[In] DWRITE_MEASURING_MODE measuringMode,[In, Optional] const DWRITE_MATRIX* worldToDeviceTransform,[In] unsigned int colorPaletteIndex,[Out] IDWriteColorGlyphRunEnumerator** colorLayers) /// IDWriteFactory2::TranslateColorGlyphRun public SharpDX.DirectWrite.ColorGlyphRunEnumerator TranslateColorGlyphRun(System.Single baselineOriginX, System.Single baselineOriginY, SharpDX.DirectWrite.GlyphRun glyphRun, SharpDX.DirectWrite.GlyphRunDescription glyphRunDescription, SharpDX.Direct2D1.MeasuringMode measuringMode, SharpDX.Mathematics.Interop.RawMatrix3x2? worldToDeviceTransform, System.Int32 colorPaletteIndex) { SharpDX.DirectWrite.ColorGlyphRunEnumerator colorLayers; TranslateColorGlyphRun(baselineOriginX, baselineOriginY, glyphRun, glyphRunDescription, measuringMode, worldToDeviceTransform, colorPaletteIndex, out colorLayers); return colorLayers; } } }