protected override bool PerformPaintTransformation(ref RadMatrix matrix) { bool flag = false; float angleTransform = this.AngleTransform; if ((double)angleTransform != 0.0) { flag = true; RectangleF bounds = new RectangleF(PointF.Empty, (SizeF)this.Bounds.Size); TelerikHelper.PerformCenteredRotation(ref matrix, bounds, angleTransform); } SizeF scaleTransform = this.ScaleTransform; if ((double)scaleTransform.Width > 0.0 && (double)scaleTransform.Height > 0.0 && ((double)scaleTransform.Width != 1.0 || (double)scaleTransform.Height != 1.0)) { flag = true; matrix.Scale(scaleTransform.Width, scaleTransform.Height, MatrixOrder.Append); } SizeF positionOffset = this.PositionOffset; if (positionOffset != SizeF.Empty) { flag = true; matrix.Translate(this.RightToLeft ? -positionOffset.Width : positionOffset.Width, positionOffset.Height, MatrixOrder.Append); } return(flag); }
public RectangleF GetTransformedBounds(RectangleF bounds) { RadMatrix identity = RadMatrix.Identity; if (this.ScaleTransform != this.defaultScaleTransform) { identity.Translate(-bounds.X, -bounds.Y, MatrixOrder.Append); identity.Scale(this.ScaleTransform.Width, this.ScaleTransform.Height, MatrixOrder.Append); identity.Translate(bounds.X, bounds.Y, MatrixOrder.Append); } if ((double)this.AngleTransform != 0.0) { SizeF sz = new SizeF(bounds.Width / 2f, bounds.Height / 2f); identity.RotateAt(this.AngleTransform, PointF.Add(bounds.Location, sz), MatrixOrder.Append); RectangleF boundingRect = TelerikHelper.GetBoundingRect(bounds, identity); identity.Translate(bounds.X - boundingRect.X, bounds.Y - boundingRect.Y, MatrixOrder.Append); } return(identity.TransformRectangle(bounds)); }
public static RectangleF PerformTopLeftRotation( ref RadMatrix matrix, RectangleF bounds, float angle) { RadMatrix identity = RadMatrix.Identity; RectangleF rectangleF = TelerikHelper.PerformCenteredRotation(ref identity, bounds, angle); identity.Translate(bounds.X - rectangleF.X, bounds.Y - rectangleF.Y, MatrixOrder.Append); matrix.Multiply(identity, MatrixOrder.Append); return(new RectangleF(bounds.Location, rectangleF.Size)); }