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 |
/// <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(); } }
/// <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(); } }