Eeschema: bitmap editor dialog: some enhancements

This commit is contained in:
jean-pierre charras 2011-09-02 21:43:56 +02:00
parent c42f1446ec
commit 4da0bfc20b
7 changed files with 405 additions and 14 deletions

View File

@ -236,7 +236,7 @@ void BITMAP_BASE::Mirror( bool aVertically )
if( m_image )
{
*m_image = m_image->Mirror( not aVertically );
*m_bitmap = wxBitmap( *m_image );
RebuildBitmap();
}
}
@ -246,7 +246,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
if( m_image )
{
*m_image = m_image->Rotate90( aRotateCCW );
*m_bitmap = wxBitmap( *m_image );
RebuildBitmap();
}
}

View File

@ -40,6 +40,8 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem
: DIALOG_IMAGE_EDITOR_BASE( aParent )
{
m_workingImage = new BITMAP_BASE( * aItem );
m_lastImage = NULL;
m_buttonUndoLast->Enable( false );
wxString msg;
msg.Printf( wxT("%f"), m_workingImage->m_Scale );
m_textCtrlScale->SetValue( msg );;
@ -53,28 +55,106 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem
SetFocus();
}
void DIALOG_IMAGE_EDITOR::OnUndoLastChange( wxCommandEvent& event )
{
BITMAP_BASE * tmp = m_workingImage;
m_workingImage = m_lastImage;
delete tmp;
m_buttonUndoLast->Enable( false );
m_lastImage = NULL;
m_panelDraw->Refresh();
}
void DIALOG_IMAGE_EDITOR::OnMirrorX_click( wxCommandEvent& event )
{
delete m_lastImage;
m_lastImage = new BITMAP_BASE( * m_workingImage );
m_buttonUndoLast->Enable( true );
m_buttonUndoLast->Enable( true );
m_workingImage->Mirror( true );
m_panelDraw->Refresh();
}
void DIALOG_IMAGE_EDITOR::OnMirrorY_click( wxCommandEvent& event )
{
delete m_lastImage;
m_lastImage = new BITMAP_BASE( * m_workingImage );
m_buttonUndoLast->Enable( true );
m_workingImage->Mirror( false );
m_panelDraw->Refresh();
}
void DIALOG_IMAGE_EDITOR::OnRotateClick( wxCommandEvent& event )
{
delete m_lastImage;
m_lastImage = new BITMAP_BASE( * m_workingImage );
m_buttonUndoLast->Enable( true );
m_workingImage->Rotate( false );
m_panelDraw->Refresh();
}
void DIALOG_IMAGE_EDITOR::OnGreyScaleConvert( wxCommandEvent& event )
{
delete m_lastImage;
m_lastImage = new BITMAP_BASE( * m_workingImage );
m_buttonUndoLast->Enable( true );
wxImage& image = *m_workingImage->GetImageData();
image = image.ConvertToGreyscale();
m_workingImage->RebuildBitmap();
m_panelDraw->Refresh();
}
void DIALOG_IMAGE_EDITOR::OnHalfSize( wxCommandEvent& event )
{
delete m_lastImage;
m_lastImage = new BITMAP_BASE( * m_workingImage );
m_buttonUndoLast->Enable( true );
wxSize psize = m_workingImage->GetSizePixels();
wxImage& image = *m_workingImage->GetImageData();
image = image.Scale(psize.x/2, psize.y/2, wxIMAGE_QUALITY_HIGH);
m_workingImage->RebuildBitmap();
m_panelDraw->Refresh();
}
/* Test params values correctness
* Currently scale value must give an actual image
* > MIN_SIZE pixels and < MAX_SIZE pixels
*/
bool DIALOG_IMAGE_EDITOR::CheckValues()
{
#define MIN_SIZE 16
#define MAX_SIZE 6000
double tmp;
wxString msg = m_textCtrlScale->GetValue();
// Test number correctness
if( ! msg.ToDouble( &tmp ) )
{
wxMessageBox( _("Incorrect scale number" ) );
return false;
}
// Test value correctness
wxSize psize = m_workingImage->GetSizePixels();
if ( (psize.x * tmp) < MIN_SIZE || (psize.y * tmp) < MIN_SIZE )
{
wxMessageBox( _("Scale is too small for this image" ) );
return false;
}
if ( (psize.x * tmp) > MAX_SIZE || (psize.y * tmp) > MAX_SIZE )
{
wxMessageBox( _("Scale is too large for this image" ) );
return false;
}
return true;
}
void DIALOG_IMAGE_EDITOR::OnOK_Button( wxCommandEvent& aEvent )
{
EndModal( wxID_OK );
if( CheckValues() )
EndModal( wxID_OK );
return;
}
void DIALOG_IMAGE_EDITOR::OnCancel_Button( wxCommandEvent& aEvent )
@ -97,7 +177,6 @@ void DIALOG_IMAGE_EDITOR::TransfertToImage(BITMAP_BASE* aItem )
{
wxString msg = m_textCtrlScale->GetValue();
msg.ToDouble( &m_workingImage->m_Scale );
m_textCtrlScale->SetValue( msg );
aItem->ImportData( m_workingImage );
}

View File

@ -69,7 +69,7 @@
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">340,256</property>
<property name="size">340,299</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Image Editor</property>
@ -236,7 +236,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -324,7 +324,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -412,7 +412,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@ -498,6 +498,270 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Grey</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonGrey</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnGreyScaleConvert</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Half Size</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonHalfSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnHalfSize</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Undo Last</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonUndoLast</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnUndoLastChange</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>

View File

@ -35,7 +35,9 @@
class DIALOG_IMAGE_EDITOR : public DIALOG_IMAGE_EDITOR_BASE
{
private:
BITMAP_BASE* m_workingImage;
BITMAP_BASE* m_workingImage; // The copy of BITMAP_BASE to be edited
BITMAP_BASE* m_lastImage; // the saved BITMAP_BASE before a new change.
// Used to undo the last change
public:
DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem );
@ -51,12 +53,16 @@ public:
void TransfertToImage( BITMAP_BASE* aItem );
private:
void OnUndoLastChange( wxCommandEvent& event );
void OnGreyScaleConvert( wxCommandEvent& event );
void OnHalfSize( wxCommandEvent& event );
void OnMirrorX_click( wxCommandEvent& event );
void OnMirrorY_click( wxCommandEvent& event );
void OnRotateClick( wxCommandEvent& event );
void OnOK_Button( wxCommandEvent& aEvent );
void OnCancel_Button( wxCommandEvent& aEvent );
void OnRedrawPanel( wxPaintEvent& event );
bool CheckValues();
};

View File

@ -31,13 +31,23 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
bSizerRight = new wxBoxSizer( wxVERTICAL );
m_buttonMirrorX = new wxButton( this, wxID_ANY, _("Mirror X"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonMirrorX, 0, wxEXPAND|wxALL, 5 );
bSizerRight->Add( m_buttonMirrorX, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonMirrorY = new wxButton( this, wxID_ANY, _("Mirror Y"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonMirrorY, 0, wxEXPAND|wxALL, 5 );
bSizerRight->Add( m_buttonMirrorY, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonRotate = new wxButton( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonRotate, 0, wxALL|wxEXPAND, 5 );
bSizerRight->Add( m_buttonRotate, 0, wxEXPAND|wxALL, 5 );
m_buttonGrey = new wxButton( this, wxID_ANY, _("Grey"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonGrey, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonHalfSize = new wxButton( this, wxID_ANY, _("Half Size"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonHalfSize->SetDefault();
bSizerRight->Add( m_buttonHalfSize, 0, wxALL|wxEXPAND, 5 );
m_buttonUndoLast = new wxButton( this, wxID_ANY, _("Undo Last"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRight->Add( m_buttonUndoLast, 0, wxALL|wxEXPAND, 5 );
m_staticTextScale = new wxStaticText( this, wxID_ANY, _("Image Scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextScale->Wrap( -1 );
@ -70,6 +80,9 @@ DIALOG_IMAGE_EDITOR_BASE::DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID
m_buttonMirrorX->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorX_click ), NULL, this );
m_buttonMirrorY->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorY_click ), NULL, this );
m_buttonRotate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRotateClick ), NULL, this );
m_buttonGrey->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnGreyScaleConvert ), NULL, this );
m_buttonHalfSize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnHalfSize ), NULL, this );
m_buttonUndoLast->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnUndoLastChange ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnCancel_Button ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnOK_Button ), NULL, this );
}
@ -81,6 +94,9 @@ DIALOG_IMAGE_EDITOR_BASE::~DIALOG_IMAGE_EDITOR_BASE()
m_buttonMirrorX->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorX_click ), NULL, this );
m_buttonMirrorY->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnMirrorY_click ), NULL, this );
m_buttonRotate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnRotateClick ), NULL, this );
m_buttonGrey->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnGreyScaleConvert ), NULL, this );
m_buttonHalfSize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnHalfSize ), NULL, this );
m_buttonUndoLast->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnUndoLastChange ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnCancel_Button ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMAGE_EDITOR_BASE::OnOK_Button ), NULL, this );

View File

@ -38,6 +38,9 @@ class DIALOG_IMAGE_EDITOR_BASE : public wxDialog
wxButton* m_buttonMirrorX;
wxButton* m_buttonMirrorY;
wxButton* m_buttonRotate;
wxButton* m_buttonGrey;
wxButton* m_buttonHalfSize;
wxButton* m_buttonUndoLast;
wxStaticText* m_staticTextScale;
wxTextCtrl* m_textCtrlScale;
wxStdDialogButtonSizer* m_sdbSizer1;
@ -49,13 +52,16 @@ class DIALOG_IMAGE_EDITOR_BASE : public wxDialog
virtual void OnMirrorX_click( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMirrorY_click( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRotateClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGreyScaleConvert( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHalfSize( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUndoLastChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel_Button( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOK_Button( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Image Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,256 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Image Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,299 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_IMAGE_EDITOR_BASE();
};

View File

@ -72,6 +72,14 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) );
*/
double GetPixelScaleFactor() { return m_pixelScaleFactor; }
void SetPixelScaleFactor( double aSF ) { m_pixelScaleFactor = aSF; }
wxImage* GetImageData() { return m_image; }
/*
* Function RebuildBitmap
* Rebuild the internal bitmap used to draw/plot image
* must be called after a m_image change
*/
void RebuildBitmap() { *m_bitmap = wxBitmap( *m_image ); }
/**
* Function ImportData
@ -102,6 +110,18 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) );
*/
wxSize GetSize() const;
/**
* Function GetSizePixels
* @returns the size in pixels of the image
*/
wxSize GetSizePixels() const
{
if( m_image )
return wxSize( m_image->GetWidth(), m_image->GetHeight() );
else
return wxSize(0,0);
}
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display