Add SCH_BITMAP::ReadImageFile( wxMemoryBuffer& ).

This commit is contained in:
Alex Shvartzkop 2023-09-07 04:16:20 +03:00
parent 10c495952e
commit 69261df022
2 changed files with 23 additions and 0 deletions

View File

@ -92,6 +92,19 @@ bool SCH_BITMAP::ReadImageFile( const wxString& aFullFilename )
} }
bool SCH_BITMAP::ReadImageFile( wxMemoryBuffer& aBuffer )
{
if( m_bitmapBase->ReadImageFile( aBuffer ) )
{
m_bitmapBase->SetPixelSizeIu( (float) pcbIUScale.MilsToIU( 1000 )
/ m_bitmapBase->GetPPI() );
return true;
}
return false;
}
EDA_ITEM* SCH_BITMAP::Clone() const EDA_ITEM* SCH_BITMAP::Clone() const
{ {
return new SCH_BITMAP( *this ); return new SCH_BITMAP( *this );

View File

@ -108,6 +108,16 @@ public:
*/ */
bool ReadImageFile( const wxString& aFullFilename ); bool ReadImageFile( const wxString& aFullFilename );
/**
* Read and store an image file.
*
* Initialize the bitmap used to draw this item format.
*
* @param aBuf is the memory buffer containing the image file to read.
* @return true if success reading else false.
*/
bool ReadImageFile( wxMemoryBuffer& aBuf );
void Move( const VECTOR2I& aMoveVector ) override void Move( const VECTOR2I& aMoveVector ) override
{ {
m_pos += aMoveVector; m_pos += aMoveVector;