From e8a88411eaa5bd9bf0a1246ffd314a2e8fe895e1 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 14 Feb 2023 21:36:47 -0500 Subject: [PATCH] Set PPI properly in schematic bitmaps, too --- eeschema/sch_bitmap.cpp | 7 +++++++ eeschema/sch_bitmap.h | 2 ++ eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 7a6d51d661..d1b8f09ed9 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -92,6 +92,13 @@ bool SCH_BITMAP::ReadImageFile( const wxString& aFullFilename ) } +void SCH_BITMAP::SetImage( wxImage* aImage ) +{ + m_image->SetImage( aImage ); + m_image->SetPixelSizeIu( 254000.0 / m_image->GetPPI() ); +} + + EDA_ITEM* SCH_BITMAP::Clone() const { return new SCH_BITMAP( *this ); diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index 3c0e5844ce..7285b78d0d 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -57,6 +57,8 @@ public: return m_image; } + void SetImage( wxImage* aImage ); + /** * @return the image "zoom" value. * scale = 1.0 = original size of bitmap. diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index d33c68e554..1045e381a8 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -2967,7 +2967,7 @@ SCH_BITMAP* SCH_SEXPR_PARSER::parseImage() wxImage* image = new wxImage(); wxMemoryInputStream istream( stream ); image->LoadFile( istream, wxBITMAP_TYPE_PNG ); - bitmap->GetImage()->SetImage( image ); + bitmap->SetImage( image ); break; }