|
KiCad PCB EDA Suite
|
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference for the user. More...
#include <reference_image.h>
Public Member Functions | |
| REFERENCE_IMAGE (const EDA_IU_SCALE &aIuScale) | |
| REFERENCE_IMAGE (const REFERENCE_IMAGE &aOther) | |
| ~REFERENCE_IMAGE () | |
| REFERENCE_IMAGE & | operator= (const REFERENCE_IMAGE &aOther) |
| bool | operator== (const REFERENCE_IMAGE &aOther) const |
| double | Similarity (const REFERENCE_IMAGE &aOther) const |
| BOX2I | GetBoundingBox () const |
| bool | HitTest (const BOX2I &aRect, bool aContained, int aAccuracy) const |
| VECTOR2I | GetPosition () const |
| void | SetPosition (const VECTOR2I &aPos) |
| VECTOR2I | GetSize () const |
| double | GetImageScale () const |
| void | SetImageScale (double aScale) |
| Set the image "zoom" value. | |
| void | SetWidth (int aWidth) |
| void | SetHeight (int aHeight) |
| void | Flip (const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) |
| void | Rotate (const VECTOR2I &aCenter, const EDA_ANGLE &aAngle) |
| bool | ReadImageFile (const wxString &aFullFilename) |
| Read and store an image file. | |
| bool | ReadImageFile (wxMemoryBuffer &aBuf) |
| Read and store an image file. | |
| bool | SetImage (const wxImage &aImage) |
| Set the image from an existing wxImage. | |
| void | SwapData (REFERENCE_IMAGE &aItem) |
| const BITMAP_BASE & | GetImage () const |
| Get the underlying image. | |
| BITMAP_BASE & | MutableImage () const |
| Only use this if you really need to modify the underlying image. | |
| VECTOR2I | GetTransformOriginOffset () const |
| Get the center of scaling, etc, relative to the image center (GetPosition()). | |
| void | SetTransformOriginOffset (const VECTOR2I &aCenter) |
Private Member Functions | |
| void | scaleBy (double ratio) |
| void | updatePixelSizeInIU () |
Private Attributes | |
| const EDA_IU_SCALE & | m_iuScale |
| VECTOR2I | m_pos |
| XY coordinates of center of the bitmap. | |
| VECTOR2I | m_transformOriginOffset |
| Center of scaling, etc, relative to the image center. | |
| std::unique_ptr< BITMAP_BASE > | m_bitmapBase |
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference for the user.
Definition at line 42 of file reference_image.h.
| REFERENCE_IMAGE::REFERENCE_IMAGE | ( | const EDA_IU_SCALE & | aIuScale | ) |
Definition at line 68 of file reference_image.cpp.
References m_bitmapBase, m_iuScale, m_pos, m_transformOriginOffset, and updatePixelSizeInIU().
Referenced by HitTest(), operator=(), operator==(), REFERENCE_IMAGE(), Similarity(), and SwapData().
| REFERENCE_IMAGE::REFERENCE_IMAGE | ( | const REFERENCE_IMAGE & | aOther | ) |
Definition at line 76 of file reference_image.cpp.
References m_bitmapBase, m_iuScale, m_pos, m_transformOriginOffset, REFERENCE_IMAGE(), and updatePixelSizeInIU().
| REFERENCE_IMAGE::~REFERENCE_IMAGE | ( | ) |
Definition at line 85 of file reference_image.cpp.
| void REFERENCE_IMAGE::Flip | ( | const VECTOR2I & | aCentre, |
| FLIP_DIRECTION | aFlipDirection ) |
Definition at line 268 of file reference_image.cpp.
References BOX2< VECTOR2D >::ByCenter(), IsBOX2Safe(), m_bitmapBase, m_pos, and MIRROR().
| BOX2I REFERENCE_IMAGE::GetBoundingBox | ( | ) | const |
Definition at line 163 of file reference_image.cpp.
References BOX2< VECTOR2I >::ByCenter(), m_bitmapBase, and m_pos.
Referenced by PCB_GRID_HELPER::AddConstructionItems(), and PCB_GRID_HELPER::computeAnchors().
| const BITMAP_BASE & REFERENCE_IMAGE::GetImage | ( | ) | const |
Get the underlying image.
This will always return a valid reference, but it may be to an empty image.
Definition at line 333 of file reference_image.cpp.
References m_bitmapBase.
Referenced by BOOST_DATA_TEST_CASE_F(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), PCB_IO_KICAD_SEXPR::format(), SCH_IO_KICAD_LEGACY::loadBitmap(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), SCH_IO_KICAD_LEGACY::saveBitmap(), and SCH_IO_KICAD_SEXPR::saveBitmap().
| double REFERENCE_IMAGE::GetImageScale | ( | ) | const |
Definition at line 224 of file reference_image.cpp.
References m_bitmapBase.
Referenced by BOOST_DATA_TEST_CASE_F(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), PCB_IO_KICAD_SEXPR::format(), SCH_IO_KICAD_LEGACY::loadBitmap(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_REFERENCE_IMAGE(), SCH_IO_KICAD_LEGACY::saveBitmap(), SCH_IO_KICAD_SEXPR::saveBitmap(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem().
| VECTOR2I REFERENCE_IMAGE::GetPosition | ( | ) | const |
Definition at line 169 of file reference_image.cpp.
References m_pos.
Referenced by PCB_GRID_HELPER::AddConstructionItems(), KIGFX::PCB_PAINTER::draw(), BITMAP_POINT_EDIT_BEHAVIOR::MakePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::MakePoints(), SCH_IO_KICAD_SEXPR::saveBitmap(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), BITMAP_POINT_EDIT_BEHAVIOR::UpdatePoints(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdatePoints().
| VECTOR2I REFERENCE_IMAGE::GetSize | ( | ) | const |
Definition at line 198 of file reference_image.cpp.
References m_bitmapBase.
Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), BITMAP_POINT_EDIT_BEHAVIOR::MakePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::MakePoints(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_IO_ALTIUM::ParseImage(), SCH_IO_GEDA::parsePicture(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), BITMAP_POINT_EDIT_BEHAVIOR::UpdatePoints(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdatePoints().
| VECTOR2I REFERENCE_IMAGE::GetTransformOriginOffset | ( | ) | const |
Get the center of scaling, etc, relative to the image center (GetPosition()).
Definition at line 186 of file reference_image.cpp.
References m_transformOriginOffset.
Referenced by PCB_GRID_HELPER::AddConstructionItems(), PCB_GRID_HELPER::computeAnchors(), BITMAP_POINT_EDIT_BEHAVIOR::MakePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::MakePoints(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem(), BITMAP_POINT_EDIT_BEHAVIOR::UpdatePoints(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdatePoints().
| bool REFERENCE_IMAGE::HitTest | ( | const BOX2I & | aRect, |
| bool | aContained, | ||
| int | aAccuracy ) const |
References REFERENCE_IMAGE().
| BITMAP_BASE & REFERENCE_IMAGE::MutableImage | ( | ) | const |
Only use this if you really need to modify the underlying image.
Definition at line 340 of file reference_image.cpp.
References m_bitmapBase.
Referenced by DIALOG_REFERENCE_IMAGE_PROPERTIES::DIALOG_REFERENCE_IMAGE_PROPERTIES(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), and DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow().
| REFERENCE_IMAGE & REFERENCE_IMAGE::operator= | ( | const REFERENCE_IMAGE & | aOther | ) |
Definition at line 97 of file reference_image.cpp.
References EDA_IU_SCALE::IU_PER_MILS, m_bitmapBase, m_iuScale, m_pos, m_transformOriginOffset, REFERENCE_IMAGE(), and updatePixelSizeInIU().
| bool REFERENCE_IMAGE::operator== | ( | const REFERENCE_IMAGE & | aOther | ) | const |
Definition at line 116 of file reference_image.cpp.
References compareImages(), BITMAP_BASE::GetPPI(), BITMAP_BASE::GetScale(), BITMAP_BASE::GetSize(), m_bitmapBase, m_pos, m_transformOriginOffset, and REFERENCE_IMAGE().
| bool REFERENCE_IMAGE::ReadImageFile | ( | const wxString & | aFullFilename | ) |
Read and store an image file.
Initialize the bitmap used to draw this item format.
| aFullFilename | is the full filename of the image file to read. |
Definition at line 297 of file reference_image.cpp.
References m_bitmapBase, and updatePixelSizeInIU().
Referenced by SCH_IO_KICAD_LEGACY::loadBitmap(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_IO_ALTIUM::ParseImage(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_REFERENCE_IMAGE(), SCH_IO_GEDA::parsePicture(), SCH_EASYEDA_PARSER::ParseSchematic(), and SCH_EASYEDAPRO_PARSER::ParseSchematic().
| bool REFERENCE_IMAGE::ReadImageFile | ( | wxMemoryBuffer & | aBuf | ) |
Read and store an image file.
Initialize the bitmap used to draw this item format.
| aBuf | is the memory buffer containing the image file to read. |
Definition at line 309 of file reference_image.cpp.
References m_bitmapBase, and updatePixelSizeInIU().
Definition at line 283 of file reference_image.cpp.
References EDA_ANGLE::AsDegrees(), DEGREES_T, m_bitmapBase, m_pos, EDA_ANGLE::Normalize(), and RotatePoint().
|
private |
Definition at line 240 of file reference_image.cpp.
References BOX2< VECTOR2D >::ByCenter(), IsBOX2Safe(), IsVec2SafeXY(), KiROUND(), m_bitmapBase, m_pos, m_transformOriginOffset, and SetTransformOriginOffset().
Referenced by SetHeight(), SetImageScale(), and SetWidth().
| void REFERENCE_IMAGE::SetHeight | ( | int | aHeight | ) |
Definition at line 214 of file reference_image.cpp.
References m_bitmapBase, and scaleBy().
| bool REFERENCE_IMAGE::SetImage | ( | const wxImage & | aImage | ) |
Set the image from an existing wxImage.
Definition at line 321 of file reference_image.cpp.
References m_bitmapBase, and updatePixelSizeInIU().
| void REFERENCE_IMAGE::SetImageScale | ( | double | aScale | ) |
Set the image "zoom" value.
The image is scaled such that the position of the image's transform origin is unchanged.
If the scale is negative or the image would overflow the the coordinate system, nothing is updated.
Definition at line 230 of file reference_image.cpp.
References m_bitmapBase, and scaleBy().
Referenced by SCH_IO_KICAD_LEGACY::loadBitmap(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_IO_ALTIUM::ParseImage(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_REFERENCE_IMAGE(), SCH_IO_GEDA::parsePicture(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem().
| void REFERENCE_IMAGE::SetPosition | ( | const VECTOR2I & | aPos | ) |
Definition at line 175 of file reference_image.cpp.
References BOX2< VECTOR2D >::ByCenter(), IsBOX2Safe(), m_bitmapBase, and m_pos.
| void REFERENCE_IMAGE::SetTransformOriginOffset | ( | const VECTOR2I & | aCenter | ) |
Definition at line 192 of file reference_image.cpp.
References m_transformOriginOffset.
Referenced by scaleBy(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem().
| void REFERENCE_IMAGE::SetWidth | ( | int | aWidth | ) |
Definition at line 204 of file reference_image.cpp.
References m_bitmapBase, and scaleBy().
| double REFERENCE_IMAGE::Similarity | ( | const REFERENCE_IMAGE & | aOther | ) | const |
Definition at line 140 of file reference_image.cpp.
References compareImages(), BITMAP_BASE::GetPPI(), BITMAP_BASE::GetScale(), BITMAP_BASE::GetSize(), m_bitmapBase, m_pos, and REFERENCE_IMAGE().
| void REFERENCE_IMAGE::SwapData | ( | REFERENCE_IMAGE & | aItem | ) |
Definition at line 346 of file reference_image.cpp.
References m_bitmapBase, m_pos, m_transformOriginOffset, and REFERENCE_IMAGE().
|
private |
Definition at line 90 of file reference_image.cpp.
References m_bitmapBase, and m_iuScale.
Referenced by operator=(), ReadImageFile(), ReadImageFile(), REFERENCE_IMAGE(), REFERENCE_IMAGE(), and SetImage().
|
private |
Definition at line 148 of file reference_image.h.
Referenced by Flip(), GetBoundingBox(), GetImage(), GetImageScale(), GetSize(), MutableImage(), operator=(), operator==(), ReadImageFile(), ReadImageFile(), REFERENCE_IMAGE(), REFERENCE_IMAGE(), Rotate(), scaleBy(), SetHeight(), SetImage(), SetImageScale(), SetPosition(), SetWidth(), Similarity(), SwapData(), and updatePixelSizeInIU().
|
private |
Definition at line 141 of file reference_image.h.
Referenced by operator=(), REFERENCE_IMAGE(), REFERENCE_IMAGE(), and updatePixelSizeInIU().
|
private |
XY coordinates of center of the bitmap.
Definition at line 143 of file reference_image.h.
Referenced by Flip(), GetBoundingBox(), GetPosition(), operator=(), operator==(), REFERENCE_IMAGE(), REFERENCE_IMAGE(), Rotate(), scaleBy(), SetPosition(), Similarity(), and SwapData().
|
private |
Center of scaling, etc, relative to the image center.
Definition at line 146 of file reference_image.h.
Referenced by GetTransformOriginOffset(), operator=(), operator==(), REFERENCE_IMAGE(), REFERENCE_IMAGE(), scaleBy(), SetTransformOriginOffset(), and SwapData().