147 lines
4.8 KiB
C#
147 lines
4.8 KiB
C#
#region PDFsharp - A .NET library for processing PDF
|
|
//
|
|
// Authors:
|
|
// Ben Askren
|
|
//
|
|
// Copyright (c) 2005-2016 empira Software GmbH, Cologne Area (Germany)
|
|
//
|
|
// http://www.PdfSharp.com
|
|
// http://sourceforge.net/projects/pdfsharp
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
// to deal in the Software without restriction, including without limitation
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included
|
|
// in all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
// DEALINGS IN THE SOFTWARE.
|
|
#endregion
|
|
|
|
using System;
|
|
using System.ComponentModel;
|
|
using PdfSharpCore.Internal;
|
|
|
|
// ReSharper disable RedundantNameQualifier because it is required for hybrid build
|
|
namespace PdfSharpCore.Drawing
|
|
{
|
|
public class XBaseGradientBrush : XBrush
|
|
{
|
|
protected XBaseGradientBrush(XColor color1, XColor color2)
|
|
{
|
|
_color1 = color1;
|
|
_color2 = color2;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets an XMatrix that defines a local geometric transform for this LinearGradientBrush.
|
|
/// </summary>
|
|
public XMatrix Transform
|
|
{
|
|
get { return _matrix; }
|
|
set { _matrix = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Translates the brush with the specified offset.
|
|
/// </summary>
|
|
public void TranslateTransform(double dx, double dy)
|
|
{
|
|
_matrix.TranslatePrepend(dx, dy);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Translates the brush with the specified offset.
|
|
/// </summary>
|
|
public void TranslateTransform(double dx, double dy, XMatrixOrder order)
|
|
{
|
|
_matrix.Translate(dx, dy, order);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Scales the brush with the specified scalars.
|
|
/// </summary>
|
|
public void ScaleTransform(double sx, double sy)
|
|
{
|
|
_matrix.ScalePrepend(sx, sy);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Scales the brush with the specified scalars.
|
|
/// </summary>
|
|
public void ScaleTransform(double sx, double sy, XMatrixOrder order)
|
|
{
|
|
_matrix.Scale(sx, sy, order);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Rotates the brush with the specified angle.
|
|
/// </summary>
|
|
public void RotateTransform(double angle)
|
|
{
|
|
_matrix.RotatePrepend(angle);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Rotates the brush with the specified angle.
|
|
/// </summary>
|
|
public void RotateTransform(double angle, XMatrixOrder order)
|
|
{
|
|
_matrix.Rotate(angle, order);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Multiply the brush transformation matrix with the specified matrix.
|
|
/// </summary>
|
|
public void MultiplyTransform(XMatrix matrix)
|
|
{
|
|
_matrix.Prepend(matrix);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Multiply the brush transformation matrix with the specified matrix.
|
|
/// </summary>
|
|
public void MultiplyTransform(XMatrix matrix, XMatrixOrder order)
|
|
{
|
|
_matrix.Multiply(matrix, order);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Resets the brush transformation matrix with identity matrix.
|
|
/// </summary>
|
|
public void ResetTransform()
|
|
{
|
|
_matrix = new XMatrix();
|
|
}
|
|
|
|
//public void SetBlendTriangularShape(double focus);
|
|
//public void SetBlendTriangularShape(double focus, double scale);
|
|
//public void SetSigmaBellShape(double focus);
|
|
//public void SetSigmaBellShape(double focus, double scale);
|
|
|
|
|
|
|
|
//public Blend Blend { get; set; }
|
|
//public bool GammaCorrection { get; set; }
|
|
//public ColorBlend InterpolationColors { get; set; }
|
|
//public XColor[] LinearColors { get; set; }
|
|
//public RectangleF Rectangle { get; }
|
|
//public WrapMode WrapMode { get; set; }
|
|
//private bool interpolationColorsWasSet;
|
|
|
|
internal XColor _color1, _color2;
|
|
internal XMatrix _matrix;
|
|
|
|
}
|
|
}
|