Reported at:
http://sourceforge.net/tracker/?func=de ... tid=777115http://pdfsharp.codeplex.com/workitem/15658The code in XSolidBrush's Color attribute reads;
Code:
this.color = value;
#if GDI
this.gdiDirty = this.gdiDirty || this.color != value;
#endif
Since the test follows the assignment it will never be true. In other words, once the brush has been realized, assignments to Color will not update it.
The assignment should be moved after the tests (i.e. to the end of the Color setter)
Patch:
Code:
Index: C:/dev/PDFsharp/code/PdfSharp/PdfSharp.Drawing/XSolidBrush.cs
===================================================================
--- C:/dev/PDFsharp/code/PdfSharp/PdfSharp.Drawing/XSolidBrush.cs (revision 99631)
+++ C:/dev/PDFsharp/code/PdfSharp/PdfSharp.Drawing/XSolidBrush.cs (working copy)
@@ -85,7 +85,6 @@
{
if (this.immutable)
throw new ArgumentException(PSSR.CannotChangeImmutableObject("XSolidBrush"));
- this.color = value;
#if GDI
this.gdiDirty = this.gdiDirty || this.color != value;
#endif
@@ -95,6 +94,7 @@
#if GDI && WPF
this.gdiDirty = this.wpfDirty = true;
#endif
+ this.color = value;
}
}
internal XColor color;
And while I'm here, another minor glitch that would prevent PDF colors from updating:
Code:
Index: C:/dev/PDFsharp/code/PdfSharp/PdfSharp.Drawing.Pdf/PdfGraphicsState.cs
===================================================================
--- C:/dev/PDFsharp/code/PdfSharp/PdfSharp.Drawing.Pdf/PdfGraphicsState.cs (revision 99631)
+++ C:/dev/PDFsharp/code/PdfSharp/PdfSharp.Drawing.Pdf/PdfGraphicsState.cs (working copy)
@@ -248,7 +248,7 @@
if (colorMode != PdfColorMode.Cmyk)
{
- if (this.realizedFillColor.Rgb != color.Rgb)
+ if (this.realizedFillColor.Argb != color.Argb)
{
this.renderer.Append(PdfEncoders.ToString(color, PdfColorMode.Rgb));
this.renderer.Append(" rg\n");