コード例 #1
0
ファイル: XGraphics.cs プロジェクト: Davincier/openpetra
    /// <summary>
    /// Gets or sets the transformation matrix.
    /// </summary>
    void AddTransform(XMatrix transform, XMatrixOrder order)
    {
      //if (!this.transform.Equals(value))
      {
        XMatrix matrix = this.transform;
        matrix.Multiply(transform, order);
        this.transform = matrix;
        matrix = this.defaultViewMatrix;
        matrix.Multiply(this.transform, XMatrixOrder.Prepend);
#if GDI
        if (this.targetContext == XGraphicTargetContext.GDI)
        {
#if DEBUG
          System.Drawing.Drawing2D.Matrix m = (System.Drawing.Drawing2D.Matrix)matrix;
          this.gfx.Transform = m;
#else
          this.gfx.Transform = (System.Drawing.Drawing2D.Matrix)matrix;
#endif
        }
#endif
#if WPF
        if (this.targetContext == XGraphicTargetContext.WPF)
        {
#if !SILVERLIGHT
          MatrixTransform mt = new MatrixTransform(transform.ToWpfMatrix());
#else
          MatrixTransform mt = new MatrixTransform();
          mt.Matrix = transform.ToWpfMatrix();
#endif
          if (order == XMatrixOrder.Append)
            mt = (MatrixTransform)mt.Inverse;
          this.gsStack.Current.SetTransform(mt);
        }
#endif
        if (this.renderer != null)
          this.renderer.Transform = this.transform;
      }
    }
コード例 #2
0
ファイル: XGraphicsPath.cs プロジェクト: Core2D/PDFsharp
        /// <summary>
        /// Converts each curve in this XGraphicsPath into a sequence of connected line segments. 
        /// </summary>
        public void Flatten(XMatrix matrix, double flatness)
        {
#if CORE
            // Just do nothing.
#endif
#if CORE___
            throw new NotImplementedException("XGraphicsPath.Flatten");
#endif
#if GDI
            try
            {
                Lock.EnterGdiPlus();
                _gdipPath.Flatten(matrix.ToGdiMatrix(), (float)flatness);
            }
            finally { Lock.ExitGdiPlus(); }
#endif
#if WPF || NETFX_CORE
#if !SILVERLIGHT && !NETFX_CORE
            _pathGeometry = _pathGeometry.GetFlattenedPathGeometry();
            // TODO: matrix handling not yet tested
            if (!matrix.IsIdentity)
                _pathGeometry.Transform = new MatrixTransform(matrix.ToWpfMatrix());
#else
            // AG-HACK
            throw new InvalidOperationException("Silverlight/WinRT cannot flatten a geometry.");
            // TODO: no, yagni
#endif
#endif
        }
コード例 #3
0
    /// <summary>
    /// Converts each curve in this XGraphicsPath into a sequence of connected line segments. 
    /// </summary>
    public void Flatten(XMatrix matrix)
    {
#if GDI
      this.gdipPath.Flatten(matrix.ToGdiMatrix());
#endif
#if WPF
      this.pathGeometry = this.pathGeometry.GetFlattenedPathGeometry();
      this.pathGeometry.Transform = new MatrixTransform(matrix.ToWpfMatrix());
#endif
    }
コード例 #4
0
ファイル: XGraphicsPath.cs プロジェクト: Core2D/PDFsharp
        /// <summary>
        /// Converts each curve in this XGraphicsPath into a sequence of connected line segments. 
        /// </summary>
        public void Flatten(XMatrix matrix)
        {
#if CORE
            // Just do nothing.
#endif
#if GDI
            try
            {
                Lock.EnterGdiPlus();
                _gdipPath.Flatten(matrix.ToGdiMatrix());
            }
            finally { Lock.ExitGdiPlus(); }
#endif
#if WPF || NETFX_CORE
#if !SILVERLIGHT && !NETFX_CORE
            _pathGeometry = _pathGeometry.GetFlattenedPathGeometry();
            _pathGeometry.Transform = new MatrixTransform(matrix.ToWpfMatrix());
#else
            // AGHACK
            throw new InvalidOperationException("Silverlight/WinRT cannot flatten a geometry.");
            // TODO: no, yagni
#endif
#endif
        }
コード例 #5
0
    /// <summary>
    /// Converts each curve in this XGraphicsPath into a sequence of connected line segments. 
    /// </summary>
    public void Flatten(XMatrix matrix, double flatness)
    {
#if GDI
      this.gdipPath.Flatten(matrix.ToGdiMatrix(), (float)flatness);
#endif
#if WPF
#if !SILVERLIGHT
      this.pathGeometry = this.pathGeometry.GetFlattenedPathGeometry();
      // TODO: matrix handling not yet tested
      if (!matrix.IsIdentity)
        this.pathGeometry.Transform = new MatrixTransform(matrix.ToWpfMatrix());
#else
      // AGHACK
#endif
#endif
    }