Eeschema plot: honor B&W plot option for bitmap images.

Fixes #14013
https://gitlab.com/kicad/code/kicad/issues/14013
This commit is contained in:
jean-pierre charras 2023-02-23 09:50:05 +01:00
parent 6803976ab3
commit bc8a78c6df
1 changed files with 7 additions and 1 deletions

View File

@ -633,7 +633,13 @@ void SVG_PLOTTER::PlotImage( const wxImage& aImage, const VECTOR2I& aPos, double
{ {
wxMemoryOutputStream img_stream; wxMemoryOutputStream img_stream;
aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG ); if( m_colorMode )
aImage.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
else // Plot in B&W
{
wxImage image = aImage.ConvertToGreyscale();
image.SaveFile( img_stream, wxBITMAP_TYPE_PNG );
}
size_t input_len = img_stream.GetOutputStreamBuffer()->GetBufferSize(); size_t input_len = img_stream.GetOutputStreamBuffer()->GetBufferSize();
std::vector<uint8_t> buffer( input_len ); std::vector<uint8_t> buffer( input_len );
std::vector<uint8_t> encoded; std::vector<uint8_t> encoded;