public void Scale(float scaleX, float scaleY, MatrixOrderX order) { if (order == MatrixOrderX.Prepend) { MatrixFP m = MatrixFP.Identity(); m.Scale(SingleFP.FromFloat(scaleX), SingleFP.FromFloat(scaleY)); m.Multiply(matrix); matrix = m; } else { matrix.Scale(SingleFP.FromFloat(scaleX), SingleFP.FromFloat(scaleY)); } }
public GradientBrushFP(int ff_xmin, int ff_ymin, int ff_xmax, int ff_ymax, int ff_angle, int type) { bounds.Reset(ff_xmin, ff_ymin, ff_xmax == ff_xmin ? ff_xmin + 1 : ff_xmax, ff_ymax == ff_ymin ? ff_ymin + 1 : ff_ymax); matrix = new MatrixFP(); matrix.Translate(-(ff_xmin + ff_xmax) / 2, -(ff_ymin + ff_ymax) / 2); matrix.Rotate(-ff_angle); this.type = type; if (type == RADIAL_GRADIENT) { matrix.Scale(MathFP.Div(SingleFP.One, bounds.Width), MathFP.Div(SingleFP.One, bounds.Height)); } int ff_ang = MathFP.Atan(MathFP.Div(bounds.Height, bounds.Width == 0 ? 1 : bounds.Width)); int ff_len = PointFP.Distance(bounds.Height, bounds.Width); ff_length = MathFP.Mul(ff_len, MathFP.Max( MathFP.Abs(MathFP.Cos(ff_angle - ff_ang)), MathFP.Abs(MathFP.Cos(ff_angle + ff_ang)))); }