4
4
// Stefan Lange (mailto:Stefan.Lange@pdfsharp.com)
6
// Copyright (c) 2005-2008 empira Software GmbH, Cologne (Germany)
6
// Copyright (c) 2005-2009 empira Software GmbH, Cologne (Germany)
8
8
// http://www.pdfsharp.com
9
9
// http://sourceforge.net/projects/pdfsharp
114
/// Initializes a new instance of the <see cref="XLinearGradientBrush"/> class.
112
116
public XLinearGradientBrush(Rect rect, XColor color1, XColor color2, XLinearGradientMode linearGradientMode)
113
117
: this(new XRect(rect), color1, color2, linearGradientMode)
231
/// Resets the brush tranformation matrix with identity matrix.
235
/// Resets the brush transformation matrix with identity matrix.
233
237
public void ResetTransform()
235
this.matrix = XMatrix.Identity;
239
this.matrix = new XMatrix(); //XMatrix.Identity;
238
242
//public void SetBlendTriangularShape(double focus);
291
295
System.Windows.Media.LinearGradientBrush brush;
292
296
if (this.useRect)
294
299
brush = new System.Windows.Media.LinearGradientBrush(this.color1.ToWpfColor(), this.color2.ToWpfColor(), new System.Windows.Point(0, 0), new System.Windows.Point(1,1));// this.rect.TopLeft, this.rect.BottomRight);
295
300
//brush = new System.Drawing.Drawing2D.LinearGradientBrush(this.rect.ToRectangleF(),
296
301
// this.color1.ToGdiColor(), this.color2.ToGdiColor(), (LinearGradientMode)this.linearGradientMode);
303
GradientStop gs1 = new GradientStop();
304
gs1.Color = this.color1.ToWpfColor();
307
GradientStop gs2 = new GradientStop();
308
gs2.Color = this.color2.ToWpfColor();
311
GradientStopCollection gsc = new GradientStopCollection();
315
brush = new LinearGradientBrush(gsc, 0);
316
brush.StartPoint = new Point(0, 0);
317
brush.EndPoint = new Point(1, 1);
300
323
brush = new System.Windows.Media.LinearGradientBrush(this.color1.ToWpfColor(), this.color2.ToWpfColor(), this.point1, this.point2);
301
324
//brush = new System.Drawing.Drawing2D.LinearGradientBrush(
302
325
// this.point1.ToPointF(), this.point2.ToPointF(),
303
326
// this.color1.ToGdiColor(), this.color2.ToGdiColor());
328
GradientStop gs1 = new GradientStop();
329
gs1.Color = this.color1.ToWpfColor();
332
GradientStop gs2 = new GradientStop();
333
gs2.Color = this.color2.ToWpfColor();
336
GradientStopCollection gsc = new GradientStopCollection();
340
brush = new LinearGradientBrush(gsc, 0);
341
brush.StartPoint = this.point1;
342
brush.EndPoint = this.point2;
305
345
if (!this.matrix.IsIdentity)
306
348
brush.Transform = new MatrixTransform(this.matrix.ToWpfMatrix());
350
MatrixTransform transform = new MatrixTransform();
351
transform.Matrix = this.matrix.ToWpfMatrix();
352
brush.Transform = transform;
307
355
return brush; //this.brush;