/// <summary> /// Creates a D2dStrokeStyle that describes start cap, dash pattern, /// and other features of a stroke</summary> /// <param name="props">A structure that describes the stroke's line cap, /// dash offset, and other details of a stroke.</param> /// <param name="dashes">An array whose elements are set to the length of each dash and space in the /// dash pattern. The first element sets the length of a dash, the second element /// sets the length of a space, the third element sets the length of a dash, /// and so on. The length of each dash and space in the dash pattern is the product /// of the element value in the array and the stroke width.</param> /// <returns>D2dStrokeStyle that describes stroke features</returns> public static D2dStrokeStyle CreateD2dStrokeStyle(D2dStrokeStyleProperties props, float[] dashes) { var nativeProps = new StrokeStyleProperties(); nativeProps.DashCap = (CapStyle)props.DashCap; nativeProps.DashOffset = props.DashOffset; nativeProps.DashStyle = (DashStyle)props.DashStyle; nativeProps.EndCap = (CapStyle)props.EndCap; nativeProps.LineJoin = (LineJoin)props.LineJoin; nativeProps.MiterLimit = props.MiterLimit; nativeProps.StartCap = (CapStyle)props.StartCap; var strokeStyle = new StrokeStyle(s_d2dFactory, nativeProps, dashes); return(new D2dStrokeStyle(strokeStyle)); }
/// <summary> /// Sets the render target, releasing resources tied to previous render target if necessary</summary> /// <param name="renderTarget">RenderTarget to set</param> protected void SetRenderTarget(RenderTarget renderTarget) { if (renderTarget == null) throw new ArgumentNullException("renderTarget"); m_clipStack.Clear(); ReleaseResources(true); m_renderTargetNumber++; m_renderTarget = renderTarget; m_gdiInterop = m_renderTarget.QueryInterface<GdiInteropRenderTarget>(); Transform = Matrix3x2F.Identity; if (s_strokeStyle == null) { var props = new D2dStrokeStyleProperties { EndCap = D2dCapStyle.Round, StartCap = D2dCapStyle.Round }; s_strokeStyle = D2dFactory.CreateD2dStrokeStyle(props); } m_solidColorBrush = CreateSolidBrush(Color.Empty); }
/// <summary> /// Creates a D2dStrokeStyle that describes start cap, dash pattern, /// and other features of a stroke</summary> /// <param name="props">A structure that describes the stroke's line cap, /// dash offset, and other details of a stroke</param> /// <returns>D2dStrokeStyle that describes stroke features</returns> public static D2dStrokeStyle CreateD2dStrokeStyle(D2dStrokeStyleProperties props) { return(CreateD2dStrokeStyle(props, new float[0])); }