private static unsafe int DrawGlyphRun(IntPtr thisObject, IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, GlyphOrientationAngle orientationAngle, MeasuringMode measuringMode, GlyphRun.__Native *glyphRunNative, GlyphRunDescription.__Native *glyphRunDescriptionNative, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRenderer1Shadow shadow = ToShadow <IDWriteTextRenderer1Shadow>(thisObject); IDWriteTextRenderer1 callback = (IDWriteTextRenderer1)shadow.Callback; using (var glyphRun = new GlyphRun()) { glyphRun.__MarshalFrom(ref *glyphRunNative); var glyphRunDescription = new Vortice.DirectWrite.GlyphRunDescription(); glyphRunDescription.__MarshalFrom(ref *glyphRunDescriptionNative); ComObject clientDrawingEffect = clientDrawingEffectPtr == IntPtr.Zero ? null : new ComObject(clientDrawingEffectPtr); callback.DrawGlyphRun(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, measuringMode, glyphRun, ref glyphRunDescription, clientDrawingEffect); } return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
private static unsafe int DrawInlineObject(IntPtr thisObject, IntPtr clientDrawingContext, float originX, float originY, GlyphOrientationAngle orientationAngle, IntPtr inlineObjectPtr, RawBool isSideways, RawBool isRightToLeft, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRenderer1Shadow shadow = ToShadow <IDWriteTextRenderer1Shadow>(thisObject); IDWriteTextRenderer1 callback = (IDWriteTextRenderer1)shadow.Callback; IDWriteInlineObjectNative inlineObject = inlineObjectPtr == IntPtr.Zero ? null : new IDWriteInlineObjectNative(inlineObjectPtr); ComObject clientDrawingEffect = clientDrawingEffectPtr == IntPtr.Zero ? null : new ComObject(clientDrawingEffectPtr); callback.DrawInlineObject(clientDrawingContext, originX, originY, orientationAngle, inlineObject, isSideways, isRightToLeft, clientDrawingEffect); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }
private static unsafe int DrawStrikethrough(IntPtr thisObject, IntPtr clientDrawingContext, float baselineOriginX, float baselineOriginY, GlyphOrientationAngle orientationAngle, Strikethrough.__Native *strikethroughNative, IntPtr clientDrawingEffectPtr) { try { IDWriteTextRenderer1Shadow shadow = ToShadow <IDWriteTextRenderer1Shadow>(thisObject); IDWriteTextRenderer1 callback = (IDWriteTextRenderer1)shadow.Callback; Strikethrough strikethrough = default; strikethrough.__MarshalFrom(ref *strikethroughNative); ComObject clientDrawingEffect = clientDrawingEffectPtr == IntPtr.Zero ? null : new ComObject(clientDrawingEffectPtr); callback.DrawStrikethrough(clientDrawingContext, baselineOriginX, baselineOriginY, orientationAngle, ref strikethrough, clientDrawingEffect); return(Result.Ok.Code); } catch (Exception ex) { return(Result.GetResultFromException(ex).Code); } }