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 |
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 32 of file reference_image.cpp.
References updatePixelSizeInIU().
REFERENCE_IMAGE::REFERENCE_IMAGE | ( | const REFERENCE_IMAGE & | aOther | ) |
Definition at line 40 of file reference_image.cpp.
References updatePixelSizeInIU().
REFERENCE_IMAGE::~REFERENCE_IMAGE | ( | ) |
Definition at line 49 of file reference_image.cpp.
void REFERENCE_IMAGE::Flip | ( | const VECTOR2I & | aCentre, |
FLIP_DIRECTION | aFlipDirection | ||
) |
Definition at line 237 of file reference_image.cpp.
References BOX2< VECTOR2D >::ByCenter(), IsBOX2Safe(), m_bitmapBase, m_pos, and MIRROR().
Referenced by PCB_REFERENCE_IMAGE::Flip(), SCH_BITMAP::MirrorHorizontally(), and SCH_BITMAP::MirrorVertically().
BOX2I REFERENCE_IMAGE::GetBoundingBox | ( | ) | const |
Definition at line 133 of file reference_image.cpp.
References BOX2< VECTOR2I >::ByCenter(), m_bitmapBase, and m_pos.
Referenced by SCH_BITMAP::GetBoundingBox(), and PCB_REFERENCE_IMAGE::GetBoundingBox().
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 302 of file reference_image.cpp.
References m_bitmapBase.
Referenced by BOOST_FIXTURE_TEST_CASE(), DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), PCB_IO_KICAD_SEXPR::format(), SCH_BITMAP::GetHeight(), PCB_REFERENCE_IMAGE::GetHeight(), SCH_BITMAP::GetMsgPanelInfo(), PCB_REFERENCE_IMAGE::GetMsgPanelInfo(), SCH_BITMAP::GetWidth(), PCB_REFERENCE_IMAGE::GetWidth(), SCH_IO_KICAD_LEGACY::loadBitmap(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), SCH_BITMAP::Plot(), SCH_BITMAP::Print(), SCH_IO_KICAD_LEGACY::saveBitmap(), and SCH_IO_KICAD_SEXPR::saveBitmap().
double REFERENCE_IMAGE::GetImageScale | ( | ) | const |
Definition at line 194 of file reference_image.cpp.
References m_bitmapBase.
Referenced by BOOST_FIXTURE_TEST_CASE(), KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), PCB_IO_KICAD_SEXPR::format(), SCH_BITMAP::GetImageScale(), PCB_REFERENCE_IMAGE::GetImageScale(), SCH_BITMAP::GetMsgPanelInfo(), PCB_REFERENCE_IMAGE::GetMsgPanelInfo(), 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 139 of file reference_image.cpp.
References m_pos.
Referenced by KIGFX::PCB_PAINTER::draw(), SCH_BITMAP::GetPosition(), PCB_REFERENCE_IMAGE::GetPosition(), 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 168 of file reference_image.cpp.
References m_bitmapBase.
Referenced by KIGFX::PCB_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), SCH_BITMAP::GetMsgPanelInfo(), PCB_REFERENCE_IMAGE::GetMsgPanelInfo(), BITMAP_POINT_EDIT_BEHAVIOR::MakePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::MakePoints(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_IO_ALTIUM::ParseImage(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_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 156 of file reference_image.cpp.
References m_transformOriginOffset.
Referenced by SCH_BITMAP::GetTransformOriginOffsetX(), PCB_REFERENCE_IMAGE::GetTransformOriginOffsetX(), SCH_BITMAP::GetTransformOriginOffsetY(), PCB_REFERENCE_IMAGE::GetTransformOriginOffsetY(), BITMAP_POINT_EDIT_BEHAVIOR::MakePoints(), REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::MakePoints(), SCH_BITMAP::SetTransformOriginOffsetX(), PCB_REFERENCE_IMAGE::SetTransformOriginOffsetX(), SCH_BITMAP::SetTransformOriginOffsetY(), PCB_REFERENCE_IMAGE::SetTransformOriginOffsetY(), 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 |
BITMAP_BASE & REFERENCE_IMAGE::MutableImage | ( | ) | const |
Only use this if you really need to modify the underlying image.
Definition at line 309 of file reference_image.cpp.
References m_bitmapBase.
Referenced by DIALOG_REFERENCE_IMAGE_PROPERTIES::DIALOG_REFERENCE_IMAGE_PROPERTIES(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow(), and DIALOG_REFERENCE_IMAGE_PROPERTIES::TransferDataFromWindow().
REFERENCE_IMAGE & REFERENCE_IMAGE::operator= | ( | const REFERENCE_IMAGE & | aOther | ) |
Definition at line 61 of file reference_image.cpp.
References EDA_IU_SCALE::IU_PER_MILS, m_bitmapBase, m_iuScale, m_pos, m_transformOriginOffset, and updatePixelSizeInIU().
bool REFERENCE_IMAGE::operator== | ( | const REFERENCE_IMAGE & | aOther | ) | const |
Definition at line 80 of file reference_image.cpp.
References m_bitmapBase, m_pos, and m_transformOriginOffset.
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 266 of file reference_image.cpp.
References m_bitmapBase, and updatePixelSizeInIU().
Referenced by SCH_IO_KICAD_LEGACY::loadBitmap(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), SCH_IO_ALTIUM::ParseImage(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_REFERENCE_IMAGE(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), and SCH_EASYEDA_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 278 of file reference_image.cpp.
References m_bitmapBase, and updatePixelSizeInIU().
Definition at line 252 of file reference_image.cpp.
References EDA_ANGLE::AsDegrees(), DEGREES_T, m_bitmapBase, m_pos, EDA_ANGLE::Normalize(), and RotatePoint().
Referenced by SCH_BITMAP::Rotate(), and PCB_REFERENCE_IMAGE::Rotate().
|
private |
Definition at line 210 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 184 of file reference_image.cpp.
References m_bitmapBase, and scaleBy().
Referenced by SCH_BITMAP::SetHeight(), and PCB_REFERENCE_IMAGE::SetHeight().
bool REFERENCE_IMAGE::SetImage | ( | const wxImage & | aImage | ) |
Set the image from an existing wxImage.
Definition at line 290 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 200 of file reference_image.cpp.
References m_bitmapBase, and scaleBy().
Referenced by SCH_IO_KICAD_LEGACY::loadBitmap(), PCB_IO_EASYEDAPRO_PARSER::ParseBoard(), SCH_IO_KICAD_SEXPR_PARSER::parseImage(), SCH_IO_ALTIUM::ParseImage(), PCB_IO_KICAD_SEXPR_PARSER::parsePCB_REFERENCE_IMAGE(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_BITMAP::SetImageScale(), PCB_REFERENCE_IMAGE::SetImageScale(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem().
void REFERENCE_IMAGE::SetPosition | ( | const VECTOR2I & | aPos | ) |
Definition at line 145 of file reference_image.cpp.
References BOX2< VECTOR2D >::ByCenter(), IsBOX2Safe(), m_bitmapBase, and m_pos.
Referenced by PCB_REFERENCE_IMAGE::PCB_REFERENCE_IMAGE(), SCH_BITMAP::SCH_BITMAP(), SCH_BITMAP::SetPosition(), and PCB_REFERENCE_IMAGE::SetPosition().
void REFERENCE_IMAGE::SetTransformOriginOffset | ( | const VECTOR2I & | aCenter | ) |
Definition at line 162 of file reference_image.cpp.
References m_transformOriginOffset.
Referenced by scaleBy(), SCH_BITMAP::SetTransformOriginOffsetX(), PCB_REFERENCE_IMAGE::SetTransformOriginOffsetX(), SCH_BITMAP::SetTransformOriginOffsetY(), PCB_REFERENCE_IMAGE::SetTransformOriginOffsetY(), BITMAP_POINT_EDIT_BEHAVIOR::UpdateItem(), and REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR::UpdateItem().
void REFERENCE_IMAGE::SetWidth | ( | int | aWidth | ) |
Definition at line 174 of file reference_image.cpp.
References m_bitmapBase, and scaleBy().
Referenced by SCH_BITMAP::SetWidth(), and PCB_REFERENCE_IMAGE::SetWidth().
double REFERENCE_IMAGE::Similarity | ( | const REFERENCE_IMAGE & | aOther | ) | const |
Definition at line 107 of file reference_image.cpp.
References m_bitmapBase, and m_pos.
Referenced by PCB_REFERENCE_IMAGE::Similarity(), and SCH_BITMAP::Similarity().
void REFERENCE_IMAGE::SwapData | ( | REFERENCE_IMAGE & | aItem | ) |
Definition at line 315 of file reference_image.cpp.
References m_bitmapBase, m_pos, and m_transformOriginOffset.
Referenced by PCB_REFERENCE_IMAGE::swapData(), and SCH_BITMAP::SwapData().
|
private |
Definition at line 54 of file reference_image.cpp.
References m_bitmapBase, m_iuScale, and EDA_IU_SCALE::MilsToIU().
Referenced by operator=(), ReadImageFile(), REFERENCE_IMAGE(), and SetImage().
|
private |
Definition at line 147 of file reference_image.h.
Referenced by Flip(), GetBoundingBox(), GetImage(), GetImageScale(), GetSize(), MutableImage(), operator=(), operator==(), ReadImageFile(), Rotate(), scaleBy(), SetHeight(), SetImage(), SetImageScale(), SetPosition(), SetWidth(), Similarity(), SwapData(), and updatePixelSizeInIU().
|
private |
Definition at line 141 of file reference_image.h.
Referenced by operator=(), and updatePixelSizeInIU().
|
private |
Definition at line 143 of file reference_image.h.
Referenced by Flip(), GetBoundingBox(), GetPosition(), operator=(), operator==(), Rotate(), scaleBy(), SetPosition(), Similarity(), and SwapData().
|
private |
< Center of scaling, etc, relative to the image center
Definition at line 145 of file reference_image.h.
Referenced by GetTransformOriginOffset(), operator=(), operator==(), scaleBy(), SetTransformOriginOffset(), and SwapData().