ScaleAt() public static method

Creates a matrix that is scaling from a specified center.
public static ScaleAt ( double scaleX, double scaleY, double centerX, double centerY ) : System.Windows.Media.Matrix
scaleX double Scaling factor that is applied along the x-axis.
scaleY double Scaling factor that is applied along the y-axis.
centerX double The center X-coordinate of the scaling.
centerY double The center Y-coordinate of the scaling.
return System.Windows.Media.Matrix
Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="panelSize"></param>
        /// <param name="elementSize"></param>
        public void Fill(Size panelSize, Size elementSize)
        {
            if (_element != null)
            {
                double pw = panelSize.Width;
                double ph = panelSize.Height;
                double ew = elementSize.Width;
                double eh = elementSize.Height;
                double zx = pw / ew;
                double zy = ph / eh;

                _matrix = MatrixHelper.ScaleAt(zx, zy, ew / 2.0, eh / 2.0);

                Invalidate();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="panelSize"></param>
        /// <param name="elementSize"></param>
        public void Extent(Size panelSize, Size elementSize)
        {
            if (_element != null)
            {
                double pw   = panelSize.Width;
                double ph   = panelSize.Height;
                double ew   = elementSize.Width;
                double eh   = elementSize.Height;
                double zx   = pw / ew;
                double zy   = ph / eh;
                double zoom = Min(zx, zy);
                double cx   = ew / 2.0;
                double cy   = eh / 2.0;

                _matrix = MatrixHelper.ScaleAt(zoom, zoom, cx, cy);

                Invalidate();
            }
        }