25#include <wx/dcclient.h>
73 if( !msg.ToDouble( &tmp ) || tmp < 0.0 )
75 wxMessageBox(
_(
"Incorrect scale number" ) );
81 int size_min = (int) std::min( ( psize.
x * tmp ), ( psize.
y * tmp ) );
85 wxMessageBox( wxString::Format(
_(
"This scale results in an image which is too small "
86 "(%.2f mm or %.1f mil)." ),
87 25.4 / 300 * size_min, 1000.0 / 300.0 * size_min ) );
91 int size_max = (int) std::max( ( psize.
x * tmp ), ( psize.
y * tmp ) );
96 if( !
IsOK(
this, wxString::Format(
_(
"This scale results in an image which is very large "
97 "(%.1f mm or %.2f in). Are you sure?" ),
98 25.4 / 300 * size_max, size_max / 300.0 ) ) )
117 wxSize display_size =
m_panelDraw->GetClientSize();
123 double scale_X = (double)display_size.
x/img_size_pixels.
x;
124 double scale_Y = (
double)display_size.y/img_size_pixels.
y;
126 double display_scale = img_scale * std::min( scale_X, scale_Y );
128 dc.SetUserScale( display_scale, display_scale );
137 msg.ToDouble( &
scale );
This class handle bitmap images in KiCad.
double GetScalingFactor() const
This scaling factor depends on m_pixelSizeIu and m_scale.
VECTOR2I GetSizePixels() const
void ImportData(BITMAP_BASE *aItem)
Copy aItem image to this object and update m_bitmap.
void ConvertToGreyscale()
void DrawBitmap(wxDC *aDC, const VECTOR2I &aPos)
void SetScale(double aScale)
Class PANEL_IMAGE_EDITOR_BASE.
wxStaticText * m_stPPI_Value
wxTextCtrl * m_textCtrlScale
void TransferToImage(BITMAP_BASE *aItem)
Function TransferToImage copy edited image to aItem.
bool TransferDataFromWindow() override
BITMAP_BASE * m_workingImage
PANEL_IMAGE_EDITOR(wxWindow *aParent, BITMAP_BASE *aItem)
void OnRedrawPanel(wxPaintEvent &event) override
void OnGreyScaleConvert(wxCommandEvent &event) override
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
This file is part of the common library.