25 #include <wx/dcclient.h> 50 image = image.ConvertToGreyscale();
64 #define MIN_SIZE 15 // Min size in pixels after scaling (50 mils) 65 #define MAX_SIZE 6000 // Max size in pixels after scaling (20 inches) 70 if( !msg.ToDouble( &tmp ) || tmp < 0.0 )
72 wxMessageBox(
_(
"Incorrect scale number" ) );
78 int size_min = (int)std::min( (psize.x * tmp), (psize.y * tmp) );
82 wxMessageBox(
wxString::Format(
_(
"This scale results in an image which is too small " 83 "(%.2f mm or %.1f mil)." ),
84 25.4 / 300 * size_min, 1000.0/300.0 * size_min ) );
88 int size_max = (int)std::max( (psize.x * tmp), (psize.y * tmp) );
94 "(%.1f mm or %.2f in). Are you sure?" ),
95 25.4 / 300 * size_max, size_max /300.0 ) ) )
113 dc.SetDeviceOrigin( size.x/2, size.y/2 );
125 msg.ToDouble( &
scale );
double GetScalingFactor() const
This scaling factor depends on m_pixelSizeIu and m_scale.
Class DIALOG_IMAGE_EDITOR_BASE.
This file is part of the common library.
BITMAP_BASE * m_workingImage
void SetScale(double aScale)
DIALOG_IMAGE_EDITOR(wxWindow *aParent, BITMAP_BASE *aItem)
void OnRedrawPanel(wxPaintEvent &event) override
This class handle bitmap images in KiCad.
void OnGreyScaleConvert(wxCommandEvent &event) override
wxTextCtrl * m_textCtrlScale
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void ImportData(BITMAP_BASE *aItem)
Copy aItem image to this object and update m_bitmap.
wxSize GetSizePixels() const
void TransferToImage(BITMAP_BASE *aItem)
Function TransferToImage copy edited image to aItem.
void DrawBitmap(wxDC *aDC, const wxPoint &aPos)
bool TransferDataFromWindow() override
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.