You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@@ -36,6 +36,7 @@ namespace System.Drawing.Drawing2D {
|
||||
public sealed class LinearGradientBrush : Brush
|
||||
{
|
||||
RectangleF rectangle;
|
||||
private bool _interpolationColorsWasSet;
|
||||
|
||||
internal LinearGradientBrush (IntPtr native)
|
||||
{
|
||||
@@ -142,6 +143,14 @@ namespace System.Drawing.Drawing2D {
|
||||
|
||||
public Blend Blend {
|
||||
get {
|
||||
// Interpolation colors and blends don't work together very well. Getting the Blend when InterpolationColors
|
||||
// is set set puts the Brush into an unusable state afterwards.
|
||||
// Bail out here to avoid that.
|
||||
if (_interpolationColorsWasSet)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int count;
|
||||
Status status = GDIPlus.GdipGetLineBlendCount (NativeBrush, out count);
|
||||
GDIPlus.CheckStatus (status);
|
||||
@@ -196,6 +205,11 @@ namespace System.Drawing.Drawing2D {
|
||||
|
||||
public ColorBlend InterpolationColors {
|
||||
get {
|
||||
if (!_interpolationColorsWasSet)
|
||||
{
|
||||
throw new ArgumentException("Property must be set to a valid ColorBlend object to use interpolation colors.");
|
||||
}
|
||||
|
||||
int count;
|
||||
Status status = GDIPlus.GdipGetLinePresetBlendCount (NativeBrush, out count);
|
||||
GDIPlus.CheckStatus (status);
|
||||
@@ -239,6 +253,8 @@ namespace System.Drawing.Drawing2D {
|
||||
|
||||
Status status = GDIPlus.GdipSetLinePresetBlend (NativeBrush, blend, positions, count);
|
||||
GDIPlus.CheckStatus (status);
|
||||
|
||||
_interpolationColorsWasSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,6 +373,8 @@ namespace System.Drawing.Drawing2D {
|
||||
|
||||
Status status = GDIPlus.GdipSetLineLinearBlend (NativeBrush, focus, scale);
|
||||
GDIPlus.CheckStatus (status);
|
||||
|
||||
_interpolationColorsWasSet = false;
|
||||
}
|
||||
|
||||
public void SetSigmaBellShape (float focus)
|
||||
@@ -371,6 +389,8 @@ namespace System.Drawing.Drawing2D {
|
||||
|
||||
Status status = GDIPlus.GdipSetLineSigmaBlend (NativeBrush, focus, scale);
|
||||
GDIPlus.CheckStatus (status);
|
||||
|
||||
_interpolationColorsWasSet = false;
|
||||
}
|
||||
|
||||
public void TranslateTransform (float dx, float dy)
|
||||
|
Reference in New Issue
Block a user