26 #ifndef _MaskImageCtrl_H
27 #define _MaskImageCtrl_H
30 #include <wx/overlay.h>
47 bool Create(wxWindow* parent, wxWindowID
id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxT(
"panel"));
93 void OnChar(wxKeyEvent& e);
135 virtual void OnDraw(wxDC& dc) wxOVERRIDE;
138 void OnSize(wxSizeEvent & e);
218 return T(
m_realSize.GetHeight()-1 - p.y, p.x);
239 return T(p.y,
m_realSize.GetHeight()-1 - p.x);
349 #endif // _MaskImageCtrl_H
ImageRotation
image rotation.
T applyRotInv(const T &p) const
wxColour m_color_selection
void OnKeyUp(wxKeyEvent &e)
event handler for keyboard
void DrawImageBitmap(wxDC &dc, int offset)
HuginBase::SrcPanoImage::CropMode m_cropMode
const int maskOffset
polygon can exceed the image maximal maskOffset pixels in each direction bigger polygons will be clip...
void setActiveMask(unsigned int newMask, bool doUpdate=true)
mark mask with image as beeing editing
virtual void OnDraw(wxDC &dc) wxOVERRIDE
drawing routine
bool SelectPointsInsideMouseRect(HuginBase::UIntSet &points, const bool considerSelectedOnly)
void SetUserColourPointUnselected(wxColour newColour)
MaskEditorPanel * m_editPanel
std::string m_imageFilename
virtual wxObject * DoCreateResource()
hugin_utils::FDiff2D m_cropCenter
vigra::Rect2D getCrop()
returns the current crop rect
void rescaleImage()
rescale the image
void OnLeftMouseDblClick(wxMouseEvent &mouse)
event handler for left double click
wxColor m_colour_point_selected
void setPreviewOnly()
if called, the mouse handlers are deactivated
HuginBase::MaskPolygonVector m_imageMask
void SetUserColourPolygonNegative(wxColour newColour)
sets the colour for different parts
hugin_utils::FDiff2D invtransform(const wxPoint &p) const
void SetUserColourPointSelected(wxColour newColour)
void OnMouseMove(wxMouseEvent &mouse)
event handler when mouse is moving
std::set< unsigned int > UIntSet
void OnRightMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
double transform(double x) const
xrc handler for mask editor
void setImage(const std::string &filename, HuginBase::MaskPolygonVector newMask, HuginBase::MaskPolygonVector masksToDraw, ImageRotation rot)
set the current image and mask list, this loads also the image from cache
int invtransform(int x) const
translate screen coordinates to image coordinates, considers additional added border ...
double scale(double x) const
HuginBase::MaskPolygonVector getNewMask() const
returns the vector of all mask (including new created mask)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxT("panel"))
void update()
initiate redraw
void OnRightMouseDown(wxMouseEvent &mouse)
event handler when right mouse button is pressed
double calcAutoScaleFactor(wxSize size)
calculate new scale factor for this image
ImageRotation getCurrentRotation()
returns the current rotation of displayed image
double getScale()
return scale factor, 0 for autoscale
void OnSize(wxSizeEvent &e)
handler called when size of control was changed
wxPoint transform(const hugin_utils::FDiff2D &p) const
int scale(int x) const
scale of width/height
void OnCaptureLost(wxMouseCaptureLostEvent &e)
event handler, when mouse capture is lost, e.g.
double getScaleFactor() const
get scale factor (calculates factor when fit to window is active)
std::vector< MaskPolygon > MaskPolygonVector
void OnKillFocus(wxFocusEvent &e)
event handler, when editor lost focus, mainly cancels creating new polygon
void DrawSelectionRectangle()
void selectAllMarkers()
select all points of active mask
void setNewMasks(HuginBase::MaskPolygonVector newMasks, HuginBase::MaskPolygonVector masksToDraw)
updates masks for currently selected image
double invtransform(double x) const
void OnMiddleMouseDown(wxMouseEvent &mouse)
event handler for middle mouse button, start scrolling
ImageRotation m_imgRotation
void OnLeftMouseUp(wxMouseEvent &mouse)
event handler when right mouse button is released
void setScale(double factor)
set the scaling factor for mask editing display.
MaskEditorState m_maskEditState
ClickPos GetClickPos(vigra::Point2D pos)
void Init(MaskEditorPanel *parent)
void SetMaskMode(bool newMaskMode)
sets the control to mask (newMaskMode=true) or crop (newMaskMode=false) mode
void DrawPolygon(wxDC &dc, HuginBase::MaskPolygon poly, bool isSelected, bool drawMarker)
HuginBase::UIntSet m_selectedPoints
ImageCache::EntryPtr m_img
wxColor m_colour_polygon_positive
void SetUserColourPolygonPositive(wxColour newColour)
void OnScroll(wxScrollWinEvent &e)
event handler for remember scroll position
T applyRot(const T &p) const
void startNewPolygon()
starts creating a new polygon
wxBitmap m_disabledBitmap
unsigned int m_activeMask
wxColor m_colour_polygon_negative
wxColor m_colour_point_unselected
wxSize DoGetBestSize() const
returns size of currently scaled image
void FindPolygon(hugin_utils::FDiff2D p)
void setCrop(HuginBase::SrcPanoImage::CropMode newCropMode, vigra::Rect2D newCropRect, bool isCentered, hugin_utils::FDiff2D center, bool isCircleCrop)
updates the crop mode and crop rect
int transform(int x) const
convert image coordinate to screen coordinates, considers additional added border ...
HuginBase::MaskPolygonVector m_masksToDraw
MaskEditorState
different states of the editor
void UpdateCrop(hugin_utils::FDiff2D delta)
MaskImageCtrlXmlHandler()
virtual bool CanHandle(wxXmlNode *node)
void OnMiddleMouseUp(wxMouseEvent &mouse)
event handler for middle mouse button, end scrolling
void OnLeftMouseDown(wxMouseEvent &mouse)
event handler when left mouse button is pressed
base class, which stores one mask polygon
void OnChar(wxKeyEvent &e)
event handler for scrolling with keyboard
void setDrawingActiveMasks(bool newDrawActiveMasks)
set if active masks should be drawn
HuginBase::MaskPolygon m_editingMask