Class Factory2
- Namespace
- SharpDX.DirectWrite
- Assembly
- SharpDX.Direct2D1.dll
[Guid("0439fc60-ca44-4994-8dee-3a9af7b732ec")]
public class Factory2 : Factory1
- Inheritance
-
Factory2
- Derived
- Inherited Members
Constructors
Factory2(nint)
public Factory2(nint nativePtr)
Parameters
nativePtr
nint
Properties
SystemFontFallback
Creates a font fallback object from the system font fallback list.
public FontFallback SystemFontFallback { get; }
Property Value
Methods
CreateCustomRenderingParams(float, float, float, float, PixelGeometry, RenderingMode, GridFitMode, out RenderingParams2)
Creates a rendering parameters object with the specified properties.
public void CreateCustomRenderingParams(float gamma, float enhancedContrast, float grayscaleEnhancedContrast, float clearTypeLevel, PixelGeometry pixelGeometry, RenderingMode renderingMode, GridFitMode gridFitMode, out RenderingParams2 renderingParams)
Parameters
gamma
floatThe gamma value used for gamma correction, which must be greater than zero and cannot exceed 256.
enhancedContrast
floatThe amount of contrast enhancement, zero or greater.
grayscaleEnhancedContrast
floatThe amount of contrast enhancement, zero or greater.
clearTypeLevel
floatThe degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType).
pixelGeometry
PixelGeometryThe geometry of a device pixel.
renderingMode
RenderingModeMethod of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode.
gridFitMode
GridFitModeHow to grid fit glyph outlines. In most cases, this should be DWRITE_GRID_FIT_DEFAULT to automatically choose an appropriate mode.
renderingParams
RenderingParams2Holds the newly created rendering parameters object, or
null
in case of failure.
CreateFontFallbackBuilder(out FontFallbackBuilder)
Creates a font fallback builder object.
A font fall back builder allows you to create Unicode font fallback mappings and create a font fall back object from those mappings.
public void CreateFontFallbackBuilder(out FontFallbackBuilder fontFallbackBuilder)
Parameters
fontFallbackBuilder
FontFallbackBuilderContains an address of a reference to the newly created font fallback builder object.
CreateGlyphRunAnalysis(GlyphRun, RawMatrix3x2?, RenderingMode, MeasuringMode, GridFitMode, TextAntialiasMode, float, float, out GlyphRunAnalysis)
Creates a glyph run analysis object, which encapsulates information used to render a glyph run.
public void CreateGlyphRunAnalysis(GlyphRun glyphRun, RawMatrix3x2? transform, RenderingMode renderingMode, MeasuringMode measuringMode, GridFitMode gridFitMode, TextAntialiasMode antialiasMode, float baselineOriginX, float baselineOriginY, out GlyphRunAnalysis glyphRunAnalysis)
Parameters
glyphRun
GlyphRunStructure specifying the properties of the glyph run.
transform
RawMatrix3x2?Optional transform applied to the glyphs and their positions. This transform is applied after the scaling specified by the emSize and pixelsPerDip.
renderingMode
RenderingModeSpecifies the rendering mode, which must be one of the raster rendering modes (i.e., not default and not outline).
measuringMode
MeasuringModeSpecifies the method to measure glyphs.
gridFitMode
GridFitModeHow to grid-fit glyph outlines. This must be non-default.
antialiasMode
TextAntialiasModeSpecifies the antialias mode.
baselineOriginX
floatHorizontal position of the baseline origin, in DIPs.
baselineOriginY
floatVertical position of the baseline origin, in DIPs.
glyphRunAnalysis
GlyphRunAnalysisReceives a reference to the newly created object.
TranslateColorGlyphRun(float, float, GlyphRun, GlyphRunDescription, MeasuringMode, RawMatrix3x2?, int)
This method is called on a glyph run to translate it in to multiple color glyph runs.
public ColorGlyphRunEnumerator TranslateColorGlyphRun(float baselineOriginX, float baselineOriginY, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, MeasuringMode measuringMode, RawMatrix3x2? worldToDeviceTransform, int colorPaletteIndex)
Parameters
baselineOriginX
floatThe horizontal baseline origin of the original glyph run.
baselineOriginY
floatThe vertical baseline origin of the original glyph run.
glyphRun
GlyphRunOriginal glyph run containing monochrome glyph IDs.
glyphRunDescription
GlyphRunDescriptionOptional glyph run description.
measuringMode
MeasuringModeMeasuring mode used to compute glyph positions if the run contains color glyphs.
worldToDeviceTransform
RawMatrix3x2?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.colorPaletteIndex
intZero-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.
Returns
- ColorGlyphRunEnumerator
If the original glyph run contains color glyphs, this parameter receives a reference to an ColorGlyphRunEnumerator 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
.
Remarks
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.
TranslateColorGlyphRun(float, float, GlyphRun, GlyphRunDescription, MeasuringMode, RawMatrix3x2?, int, out ColorGlyphRunEnumerator)
This method is called on a glyph run to translate it in to multiple color glyph runs.
public void TranslateColorGlyphRun(float baselineOriginX, float baselineOriginY, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, MeasuringMode measuringMode, RawMatrix3x2? worldToDeviceTransform, int colorPaletteIndex, out ColorGlyphRunEnumerator colorLayers)
Parameters
baselineOriginX
floatThe horizontal baseline origin of the original glyph run.
baselineOriginY
floatThe vertical baseline origin of the original glyph run.
glyphRun
GlyphRunOriginal glyph run containing monochrome glyph IDs.
glyphRunDescription
GlyphRunDescriptionOptional glyph run description.
measuringMode
MeasuringModeMeasuring mode used to compute glyph positions if the run contains color glyphs.
worldToDeviceTransform
RawMatrix3x2?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.colorPaletteIndex
intZero-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.
colorLayers
ColorGlyphRunEnumeratorIf the original glyph run contains color glyphs, this parameter receives a reference to an ColorGlyphRunEnumerator 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
.
Remarks
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.
TryTranslateColorGlyphRun(float, float, GlyphRun, GlyphRunDescription, MeasuringMode, RawMatrix3x2?, int, out ColorGlyphRunEnumerator)
This method is called on a glyph run to translate it in to multiple color glyph runs.
public Result TryTranslateColorGlyphRun(float baselineOriginX, float baselineOriginY, GlyphRun glyphRun, GlyphRunDescription glyphRunDescription, MeasuringMode measuringMode, RawMatrix3x2? worldToDeviceTransform, int colorPaletteIndex, out ColorGlyphRunEnumerator colorLayers)
Parameters
baselineOriginX
floatThe horizontal baseline origin of the original glyph run.
baselineOriginY
floatThe vertical baseline origin of the original glyph run.
glyphRun
GlyphRunOriginal glyph run containing monochrome glyph IDs.
glyphRunDescription
GlyphRunDescriptionOptional glyph run description.
measuringMode
MeasuringModeMeasuring mode used to compute glyph positions if the run contains color glyphs.
worldToDeviceTransform
RawMatrix3x2?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.colorPaletteIndex
intZero-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.
colorLayers
ColorGlyphRunEnumeratorIf the original glyph run contains color glyphs, this parameter receives a reference to an ColorGlyphRunEnumerator 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
.
Returns
- Result
If this method succeeds, it returns SharpDX.Result.Ok. Otherwise, it returns an SharpDX.Result error code.
Remarks
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.
Operators
explicit operator Factory2(nint)
public static explicit operator Factory2(nint nativePtr)
Parameters
nativePtr
nint