예제 #1
0
 internal Path RenderToCairoPath(Context context, DirectWriteCairoTextRenderer render, TextLayout textLayout)
 {
     //Debug.WriteLine("Before `Draw`: Current point at <{0},{1}>", (float)context.CurrentPoint.X, (float)context.CurrentPoint.Y);
     Draw(context.Handle, render, (float)context.CurrentPoint.X, (float)context.CurrentPoint.Y);
     var result = context.CopyPath();
     context.NewPath();
     return result;
 }
예제 #2
0
 /// <summary>
 /// Initiate drawing of the text.
 /// (In fact it just build a cairo path of the text. It DO NOT draw to cairo surface.)
 /// </summary>
 /// <param name="clientDrawingContext">An application defined value
 /// included in rendering callbacks.</param>
 /// <param name="renderer">The set of application-defined callbacks that do
 /// the actual rendering.</param>
 /// <param name="originX">X-coordinate of the layout's left side.</param>
 /// <param name="originY">Y-coordinate of the layout's top side.</param>
 /// <remarks>
 /// Native signature of the COM method
 /// <code>
 /// STDMETHOD(Draw)(
 ///     _In_opt_ void* clientDrawingContext,
 ///     _In_ IDWriteTextRenderer* renderer,
 ///     FLOAT originX,
 ///     FLOAT originY
 ///     ) PURE;
 /// </code>
 /// </remarks>
 private void Draw(
     IntPtr clientDrawingContext, DirectWriteCairoTextRenderer renderer,
     float originX, float originY)
 {
     var dwriterender = (IDWriteTextRenderer) renderer.comObject; 
     Marshal.ThrowExceptionForHR(draw(
         comObject,
         clientDrawingContext, dwriterender, originX, originY));
 }