SCH_BITMAP and PCB_BITMAP: rename m_image to m_bitmapBase. Add more info

in GetMsgPanelInfo() (PPI, scale).
m_image name was confusing: it is not a wxImage, but a BITMAP_BASE item,
and m_image name was already in use in BITMAP_BASE, used inside SCH_IMAGE.
Bitmap properties dialog: show PPI value and add Title to dialog.
This commit is contained in:
jean-pierre charras 2023-04-22 16:13:55 +02:00
parent 0c544f1f45
commit c617abe8e9
13 changed files with 229 additions and 55 deletions

View File

@ -39,9 +39,13 @@ PANEL_IMAGE_EDITOR::PANEL_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem )
PANEL_IMAGE_EDITOR_BASE( aParent )
{
m_workingImage = new BITMAP_BASE( *aItem );
wxString msg;
msg.Printf( wxT( "%f" ), m_workingImage->GetScale() );
m_textCtrlScale->SetValue( msg );
msg.Printf( wxT( "%d" ), m_workingImage->GetPPI() );
m_stPPI_Value->SetLabel( msg );
}

View File

@ -41,6 +41,20 @@ PANEL_IMAGE_EDITOR_BASE::PANEL_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID i
m_textCtrlScale = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_textCtrlScale, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* bSizerPPI;
bSizerPPI = new wxBoxSizer( wxHORIZONTAL );
m_staticTextPPI = new wxStaticText( this, wxID_ANY, _("PPI:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPPI->Wrap( -1 );
bSizerPPI->Add( m_staticTextPPI, 0, wxALL, 5 );
m_stPPI_Value = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_stPPI_Value->Wrap( -1 );
bSizerPPI->Add( m_stPPI_Value, 1, wxALL|wxEXPAND, 5 );
bSizerRight->Add( bSizerPPI, 0, wxEXPAND, 5 );
bSizerLeft->Add( bSizerRight, 0, wxEXPAND|wxALL, 5 );

View File

@ -356,6 +356,141 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerPPI</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">PPI:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextPPI</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">dummy</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_stPPI_Value</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>

View File

@ -39,6 +39,8 @@ class PANEL_IMAGE_EDITOR_BASE : public wxPanel
wxButton* m_buttonGrey;
wxStaticText* m_staticTextScale;
wxTextCtrl* m_textCtrlScale;
wxStaticText* m_staticTextPPI;
wxStaticText* m_stPPI_Value;
// Virtual event handlers, override them in your derived class
virtual void OnRedrawPanel( wxPaintEvent& event ) { event.Skip(); }

View File

@ -51,7 +51,7 @@
<property name="size">363,281</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title"></property>
<property name="title">Image Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>

View File

@ -52,7 +52,7 @@ class DIALOG_IMAGE_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 363,281 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Image Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 363,281 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_IMAGE_PROPERTIES_BASE();

View File

@ -46,7 +46,7 @@ SCH_BITMAP::SCH_BITMAP( const VECTOR2I& pos ) :
m_pos = pos;
m_layer = LAYER_NOTES; // used only to draw/plot a rectangle,
// when a bitmap cannot be drawn or plotted
m_image = new BITMAP_BASE();
m_bitmapBase = new BITMAP_BASE();
}
@ -55,7 +55,7 @@ SCH_BITMAP::SCH_BITMAP( const SCH_BITMAP& aSchBitmap ) :
{
m_pos = aSchBitmap.m_pos;
m_layer = aSchBitmap.m_layer;
m_image = new BITMAP_BASE( *aSchBitmap.m_image );
m_bitmapBase = new BITMAP_BASE( *aSchBitmap.m_bitmapBase );
}
@ -71,8 +71,8 @@ SCH_BITMAP& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
SCH_BITMAP* bitmap = (SCH_BITMAP*) &aItem;
delete m_image;
m_image = new BITMAP_BASE( *bitmap->m_image );
delete m_bitmapBase;
m_bitmapBase = new BITMAP_BASE( *bitmap->m_bitmapBase );
m_pos = bitmap->m_pos;
}
@ -82,9 +82,9 @@ SCH_BITMAP& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
bool SCH_BITMAP::ReadImageFile( const wxString& aFullFilename )
{
if( m_image->ReadImageFile( aFullFilename ) )
if( m_bitmapBase->ReadImageFile( aFullFilename ) )
{
m_image->SetPixelSizeIu( 254000.0 / m_image->GetPPI() );
m_bitmapBase->SetPixelSizeIu( 254000.0 / m_bitmapBase->GetPPI() );
return true;
}
@ -94,8 +94,8 @@ 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() );
m_bitmapBase->SetImage( aImage );
m_bitmapBase->SetPixelSizeIu( 254000.0 / m_bitmapBase->GetPPI() );
}
@ -113,13 +113,13 @@ void SCH_BITMAP::SwapData( SCH_ITEM* aItem )
SCH_BITMAP* item = (SCH_BITMAP*) aItem;
std::swap( m_pos, item->m_pos );
std::swap( m_image, item->m_image );
std::swap( m_bitmapBase, item->m_bitmapBase );
}
const BOX2I SCH_BITMAP::GetBoundingBox() const
{
BOX2I bbox = m_image->GetBoundingBox();
BOX2I bbox = m_bitmapBase->GetBoundingBox();
bbox.Move( m_pos );
@ -131,34 +131,34 @@ void SCH_BITMAP::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
{
VECTOR2I pos = m_pos + aOffset;
m_image->DrawBitmap( aSettings->GetPrintDC(), pos );
m_bitmapBase->DrawBitmap( aSettings->GetPrintDC(), pos );
}
VECTOR2I SCH_BITMAP::GetSize() const
{
return m_image->GetSize();
return m_bitmapBase->GetSize();
}
void SCH_BITMAP::MirrorVertically( int aCenter )
{
MIRROR( m_pos.y, aCenter );
m_image->Mirror( true );
m_bitmapBase->Mirror( true );
}
void SCH_BITMAP::MirrorHorizontally( int aCenter )
{
MIRROR( m_pos.x, aCenter );
m_image->Mirror( false );
m_bitmapBase->Mirror( false );
}
void SCH_BITMAP::Rotate( const VECTOR2I& aCenter )
{
RotatePoint( m_pos, aCenter, ANGLE_90 );
m_image->Rotate( false );
m_bitmapBase->Rotate( false );
}
@ -200,7 +200,7 @@ void SCH_BITMAP::Plot( PLOTTER* aPlotter, bool aBackground ) const
{
if( aBackground )
{
m_image->PlotImage( aPlotter, m_pos,
m_bitmapBase->PlotImage( aPlotter, m_pos,
aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
aPlotter->RenderSettings()->GetDefaultPenWidth() );
}
@ -217,6 +217,9 @@ void SCH_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
{
aList.emplace_back( _( "Bitmap" ), wxEmptyString );
aList.emplace_back( _( "PPI" ), wxString::Format( wxT( "%d "), GetImage()->GetPPI() ) );
aList.emplace_back( _( "Scale" ), wxString::Format( wxT( "%f "), GetImageScale() ) );
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetSize().x ) );
aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetSize().y ) );
}

View File

@ -46,15 +46,16 @@ public:
~SCH_BITMAP()
{
delete m_image;
delete m_bitmapBase;
}
SCH_BITMAP& operator=( const SCH_ITEM& aItem );
BITMAP_BASE* GetImage() const
{
wxCHECK_MSG( m_image != nullptr, nullptr, "Invalid SCH_BITMAP init, m_image is NULL." );
return m_image;
wxCHECK_MSG( m_bitmapBase != nullptr, nullptr,
"Invalid SCH_BITMAP init, m_bitmapBase is NULL." );
return m_bitmapBase;
}
void SetImage( wxImage* aImage );
@ -67,12 +68,12 @@ public:
*/
double GetImageScale() const
{
return m_image->GetScale();
return m_bitmapBase->GetScale();
}
void SetImageScale( double aScale )
{
m_image->SetScale( aScale );
m_bitmapBase->SetScale( aScale );
}
static inline bool ClassOf( const EDA_ITEM* aItem )
@ -151,7 +152,7 @@ public:
private:
VECTOR2I m_pos; // XY coordinates of center of the bitmap
BITMAP_BASE* m_image; // the BITMAP_BASE item
BITMAP_BASE* m_bitmapBase; // the BITMAP_BASE item
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -94,7 +94,6 @@ DIALOG_IMAGE_PROPERTIES_BASE::DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wx
this->SetSizer( m_GeneralBoxSizer );
this->Layout();
m_GeneralBoxSizer->Fit( this );
this->Centre( wxBOTH );
}

View File

@ -36,6 +36,7 @@
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
@ -47,10 +48,10 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_IMAGE_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="size">353,260</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title"></property>
<property name="title">Image Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
@ -87,6 +88,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -143,6 +145,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -231,6 +234,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -292,6 +296,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -356,6 +361,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -417,6 +423,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -478,6 +485,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -542,6 +550,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -603,6 +612,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -665,6 +675,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
@ -742,6 +753,7 @@
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -59,7 +59,7 @@ class DIALOG_IMAGE_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Image Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 353,260 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_IMAGE_PROPERTIES_BASE();

View File

@ -47,16 +47,16 @@ PCB_BITMAP::PCB_BITMAP( BOARD_ITEM* aParent, const VECTOR2I& pos, PCB_LAYER_ID a
BOARD_ITEM( aParent, PCB_BITMAP_T, aLayer )
{
m_pos = pos;
m_image = new BITMAP_BASE();
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
m_bitmapBase = new BITMAP_BASE();
m_bitmapBase->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_bitmapBase->GetPPI() );
}
PCB_BITMAP::PCB_BITMAP( const PCB_BITMAP& aPCBBitmap ) : BOARD_ITEM( aPCBBitmap )
{
m_pos = aPCBBitmap.m_pos;
m_image = new BITMAP_BASE( *aPCBBitmap.m_image );
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
m_bitmapBase = new BITMAP_BASE( *aPCBBitmap.m_bitmapBase );
m_bitmapBase->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_bitmapBase->GetPPI() );
}
@ -72,10 +72,10 @@ PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem )
PCB_BITMAP* bitmap = (PCB_BITMAP*) &aItem;
delete m_image;
m_image = new BITMAP_BASE( *bitmap->m_image );
delete m_bitmapBase;
m_bitmapBase = new BITMAP_BASE( *bitmap->m_bitmapBase );
m_pos = bitmap->m_pos;
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
m_bitmapBase->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_bitmapBase->GetPPI() );
}
return *this;
@ -84,16 +84,16 @@ PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem )
void PCB_BITMAP::SetImage( wxImage* aImage )
{
m_image->SetImage( aImage );
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
m_bitmapBase->SetImage( aImage );
m_bitmapBase->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_bitmapBase->GetPPI() );
}
bool PCB_BITMAP::ReadImageFile( const wxString& aFullFilename )
{
if( m_image->ReadImageFile( aFullFilename ) )
if( m_bitmapBase->ReadImageFile( aFullFilename ) )
{
m_image->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_image->GetPPI() );
m_bitmapBase->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 ) / m_bitmapBase->GetPPI() );
return true;
}
@ -121,7 +121,7 @@ void PCB_BITMAP::swapData( BOARD_ITEM* aItem )
std::swap( m_parent, item->m_parent );
std::swap( m_forceVisible, item->m_forceVisible );
std::swap( m_pos, item->m_pos );
std::swap( m_image, item->m_image );
std::swap( m_bitmapBase, item->m_bitmapBase );
}
@ -141,7 +141,7 @@ double PCB_BITMAP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
const BOX2I PCB_BITMAP::GetBoundingBox() const
{
// Bitmaps are center origin, BOX2Is need top-left origin
VECTOR2I size = m_image->GetSize();
VECTOR2I size = m_bitmapBase->GetSize();
VECTOR2I topLeft = { m_pos.x - size.x / 2, m_pos.y - size.y / 2 };
return BOX2I( topLeft, size );
@ -158,7 +158,7 @@ std::shared_ptr<SHAPE> PCB_BITMAP::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASH
const VECTOR2I PCB_BITMAP::GetSize() const
{
return m_image->GetSize();
return m_bitmapBase->GetSize();
}
@ -167,12 +167,12 @@ void PCB_BITMAP::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
if( aFlipLeftRight )
{
MIRROR( m_pos.x, aCentre.x );
m_image->Mirror( false );
m_bitmapBase->Mirror( false );
}
else
{
MIRROR( m_pos.y, aCentre.y );
m_image->Mirror( true );
m_bitmapBase->Mirror( true );
}
}
@ -184,9 +184,9 @@ void PCB_BITMAP::Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle )
norm.Normalize();
// each call to m_image->Rotate() rotates 90 degrees CCW
// each call to m_bitmapBase->Rotate() rotates 90 degrees CCW
for( double ang = 45.0; ang < norm.AsDegrees(); ang += 90.0 )
m_image->Rotate( false );
m_bitmapBase->Rotate( false );
}
@ -234,6 +234,9 @@ void PCB_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
{
aList.emplace_back( _( "Bitmap" ), wxEmptyString );
aList.emplace_back( _( "PPI" ), wxString::Format( wxT( "%d "), GetImage()->GetPPI() ) );
aList.emplace_back( _( "Scale" ), wxString::Format( wxT( "%f "), GetImageScale() ) );
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetSize().x ) );
aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetSize().y ) );
aList.emplace_back( _( "Layer" ), LayerName( m_layer ) );

View File

@ -46,14 +46,15 @@ public:
PCB_BITMAP( const PCB_BITMAP& aPcbBitmap );
~PCB_BITMAP() { delete m_image; }
~PCB_BITMAP() { delete m_bitmapBase; }
PCB_BITMAP& operator=( const BOARD_ITEM& aItem );
const BITMAP_BASE* GetImage() const
{
wxCHECK_MSG( m_image != nullptr, nullptr, "Invalid PCB_BITMAP init, m_image is NULL." );
return m_image;
wxCHECK_MSG( m_bitmapBase != nullptr, nullptr,
"Invalid PCB_BITMAP init, m_bitmapBase is NULL." );
return m_bitmapBase;
}
/**
@ -61,7 +62,7 @@ public:
*/
BITMAP_BASE* MutableImage() const
{
return m_image;
return m_bitmapBase;
}
void SetImage( wxImage* aImage );
@ -72,9 +73,9 @@ public:
* scale < 1.0 = the bitmap is drawn smaller than its original size.
* scale > 1.0 = the bitmap is drawn bigger than its original size.
*/
double GetImageScale() const { return m_image->GetScale(); }
double GetImageScale() const { return m_bitmapBase->GetScale(); }
void SetImageScale( double aScale ) { m_image->SetScale( aScale ); }
void SetImageScale( double aScale ) { m_bitmapBase->SetScale( aScale ); }
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@ -141,7 +142,7 @@ protected:
private:
VECTOR2I m_pos; // XY coordinates of center of the bitmap
BITMAP_BASE* m_image; // the BITMAP_BASE item
BITMAP_BASE* m_bitmapBase; // the BITMAP_BASE item
};
#endif // _PCB_BITMAP_H_