private static unsafe int DrawGlyphRunImpl(IntPtr thisObject, IntPtr clientDrawingContextPtr, float baselineOriginX, float baselineOriginY, MeasuringMode measuringMode, GlyphRun.__Native *glyphRunNative, GlyphRunDescription.__Native *glyphRunDescriptionNative, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRendererShadow shadow = ToShadow <IDWriteTextRendererShadow>(thisObject); IDWriteTextRenderer callback = (IDWriteTextRenderer)shadow.Callback; using (var glyphRun = new GlyphRun()) { glyphRun.__MarshalFrom(ref *glyphRunNative); var glyphRunDescription = new GlyphRunDescription(); glyphRunDescription.__MarshalFrom(ref *glyphRunDescriptionNative); callback.DrawGlyphRun(clientDrawingContextPtr, baselineOriginX, baselineOriginY, measuringMode, glyphRun, ref glyphRunDescription, clientDrawingEffectPtr == IntPtr.Zero ? null : (IUnknown)Marshal.GetObjectForIUnknown(clientDrawingEffectPtr)); } return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
private static unsafe int DrawStrikethroughImpl(IntPtr thisObject, IntPtr clientDrawingContextPtr, float baselineOriginX, float baselineOriginY, Strikethrough.__Native *strikethroughNative, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRendererShadow shadow = ToShadow <IDWriteTextRendererShadow>(thisObject); IDWriteTextRenderer callback = (IDWriteTextRenderer)shadow.Callback; var strikethrough = new Strikethrough(); strikethrough.__MarshalFrom(ref *strikethroughNative); callback.DrawStrikethrough(clientDrawingContextPtr, baselineOriginX, baselineOriginY, ref strikethrough, clientDrawingEffectPtr == IntPtr.Zero ? null : (IUnknown)Marshal.GetObjectForIUnknown(clientDrawingEffectPtr)); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
private static int DrawInlineObjectImpl(IntPtr thisObject, IntPtr clientDrawingContextPtr, float originX, float originY, IntPtr inlineObject, int isSideways, int isRightToLeft, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRendererShadow shadow = ToShadow <IDWriteTextRendererShadow>(thisObject); IDWriteTextRenderer callback = (IDWriteTextRenderer)shadow.Callback; callback.DrawInlineObject(clientDrawingContextPtr, originX, originY, inlineObject == IntPtr.Zero ? null : new IDWriteInlineObjectNative(inlineObject), isSideways != 0, isRightToLeft != 0, clientDrawingEffectPtr == IntPtr.Zero ? null : (IUnknown)Marshal.GetObjectForIUnknown(clientDrawingEffectPtr)); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
public static IntPtr ToIntPtr(IDWriteTextRenderer callback) { return(ToCallbackPtr <IDWriteTextRenderer>(callback)); }