KiCad PCB EDA Suite
Loading...
Searching...
No Matches
REFERENCE_IMAGE Class Reference

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_IMAGEoperator= (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_BASEGetImage () const
 Get the underlying image.
 
BITMAP_BASEMutableImage () 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_SCALEm_iuScale
 
VECTOR2I m_pos
 
VECTOR2I m_transformOriginOffset
 < Center of scaling, etc, relative to the image center
 
std::unique_ptr< BITMAP_BASEm_bitmapBase
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ REFERENCE_IMAGE() [1/2]

REFERENCE_IMAGE::REFERENCE_IMAGE ( const EDA_IU_SCALE aIuScale)

Definition at line 32 of file reference_image.cpp.

References updatePixelSizeInIU().

◆ REFERENCE_IMAGE() [2/2]

REFERENCE_IMAGE::REFERENCE_IMAGE ( const REFERENCE_IMAGE aOther)

Definition at line 40 of file reference_image.cpp.

References updatePixelSizeInIU().

◆ ~REFERENCE_IMAGE()

REFERENCE_IMAGE::~REFERENCE_IMAGE ( )

Definition at line 49 of file reference_image.cpp.

Member Function Documentation

◆ Flip()

void REFERENCE_IMAGE::Flip ( const VECTOR2I aCentre,
FLIP_DIRECTION  aFlipDirection 
)

◆ GetBoundingBox()

BOX2I REFERENCE_IMAGE::GetBoundingBox ( ) const

◆ GetImage()

◆ GetImageScale()

◆ GetPosition()

◆ GetSize()

◆ GetTransformOriginOffset()

◆ HitTest()

bool REFERENCE_IMAGE::HitTest ( const BOX2I aRect,
bool  aContained,
int  aAccuracy 
) const

◆ MutableImage()

BITMAP_BASE & REFERENCE_IMAGE::MutableImage ( ) const

◆ operator=()

REFERENCE_IMAGE & REFERENCE_IMAGE::operator= ( const REFERENCE_IMAGE aOther)

◆ operator==()

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.

◆ ReadImageFile() [1/2]

bool REFERENCE_IMAGE::ReadImageFile ( const wxString &  aFullFilename)

Read and store an image file.

Initialize the bitmap used to draw this item format.

Parameters
aFullFilenameis the full filename of the image file to read.
Returns
true if success reading else false.

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().

◆ ReadImageFile() [2/2]

bool REFERENCE_IMAGE::ReadImageFile ( wxMemoryBuffer &  aBuf)

Read and store an image file.

Initialize the bitmap used to draw this item format.

Parameters
aBufis the memory buffer containing the image file to read.
Returns
true if success reading else false.

Definition at line 278 of file reference_image.cpp.

References m_bitmapBase, and updatePixelSizeInIU().

◆ Rotate()

void REFERENCE_IMAGE::Rotate ( const VECTOR2I aCenter,
const EDA_ANGLE aAngle 
)

◆ scaleBy()

void REFERENCE_IMAGE::scaleBy ( double  ratio)
private

◆ SetHeight()

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().

◆ SetImage()

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().

◆ SetImageScale()

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(), PCB_POINT_EDITOR::updateItem(), and EE_POINT_EDITOR::updateParentItem().

◆ SetPosition()

◆ SetTransformOriginOffset()

◆ SetWidth()

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().

◆ Similarity()

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().

◆ SwapData()

void REFERENCE_IMAGE::SwapData ( REFERENCE_IMAGE aItem)

◆ updatePixelSizeInIU()

void REFERENCE_IMAGE::updatePixelSizeInIU ( )
private

Member Data Documentation

◆ m_bitmapBase

◆ m_iuScale

const EDA_IU_SCALE& REFERENCE_IMAGE::m_iuScale
private

Definition at line 141 of file reference_image.h.

Referenced by operator=(), and updatePixelSizeInIU().

◆ m_pos

VECTOR2I REFERENCE_IMAGE::m_pos
private

◆ m_transformOriginOffset

VECTOR2I REFERENCE_IMAGE::m_transformOriginOffset
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().


The documentation for this class was generated from the following files: