From 66e87956563a8863736ad6cfc0f29aacb60e02de Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sun, 16 Jun 2019 13:27:58 -0700 Subject: [PATCH] Plotting: Handle mask transparency This handles images with transparent colors by mapping the transparent color to white. This only works when plotted into the background. (cherry picked from commit b32439a69433f50f93b489050854b438a24c1a1a) --- common/plotters/PDF_plotter.cpp | 16 +++++++++++++--- common/plotters/PS_plotter.cpp | 11 +++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index cde9f51795..6286bc83e6 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -405,12 +405,22 @@ void PDF_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, } } + if( aImage.HasMask() ) + { + if( r == aImage.GetMaskRed() && g == aImage.GetMaskGreen() && b == aImage.GetMaskBlue() ) + { + r = 0xFF; + g = 0xFF; + b = 0xFF; + } + } + // As usual these days, stdio buffering has to suffeeeeerrrr if( colorMode ) { - putc( r, workFile ); - putc( g, workFile ); - putc( b, workFile ); + putc( r, workFile ); + putc( g, workFile ); + putc( b, workFile ); } else { diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp index 46f7fc174a..7b2425814d 100644 --- a/common/plotters/PS_plotter.cpp +++ b/common/plotters/PS_plotter.cpp @@ -723,6 +723,17 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, } } + if( aImage.HasMask() ) + { + if( red == aImage.GetMaskRed() && green == aImage.GetMaskGreen() + && blue == aImage.GetMaskBlue() ) + { + red = 0xFF; + green = 0xFF; + blue = 0xFF; + } + } + if( colorMode ) fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue ); else