Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ZoomImageCanvas.hh
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003-2009 (see file CONTACT for details)
4  Multimediale Systeme der Informationsverarbeitung
5  Institut fuer Informatik
6  Christian-Albrechts-Universitaet Kiel
7 
8  BIAS is free software; you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation; either version 2.1 of the License, or
11  (at your option) any later version.
12 
13  BIAS is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with BIAS; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
21 
22 #ifndef __ZoomImageCanvas_hh__
23 #define __ZoomImageCanvas_hh__
24 
25 #include <bias_config.h>
26 
27 #ifndef BIAS_HAVE_WXWIDGETS
28 # error BIAS_HAVE_WXWIDGETS not defined but required by ZoomImageCanvas. Please enable BIAS_HAVE_WXWIDGETS in CMake configure step.
29 #endif
30 
31 #include <Base/Common/BIASpragmaStart.hh>
32 #include <wx/wx.h>
33 #include <wx/dcbuffer.h>
34 #include <Base/Common/BIASpragmaEnd.hh>
35 #include <Base/Image/Image.hh>
36 
37 
38 namespace BIAS{
39 
40  /** @class ZoomImageCanvas
41  @brief
42  @author woelk */
43  class BIASGui_EXPORT ZoomImageCanvas : public wxPanel
44  {
45  public:
46  ZoomImageCanvas(wxWindow* parent, wxStatusBar *sbar=NULL, int sbarid=0,
47  wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
48  const wxSize& size = wxSize(320, 240),
49  long style = wxTAB_TRAVERSAL,
50  const wxString& name = wxT("ZoomImageCanvas"));
51  ~ZoomImageCanvas();
52 
53  void NewImage(BIAS::ImageBase& im, BIAS::Image<unsigned char>& ucim);
54  void NewCoo(unsigned x, unsigned y);
55  void NewZoom(int zoom);
56 
57  /**
58  * Canvas now uses double buffering to avoid flickering, so it should be ok
59  * to always clear the canvas.
60  */
61  inline void SetClearDrawingContext(bool clear)
62  { ClearDrawingContext_=clear; }
63 
64  protected:
65  void UpdateStatusBar(unsigned x, unsigned y);
66  void GetZoomImage();
67 
68  void OnResize(wxSizeEvent & event);
69  void OnPaint(wxPaintEvent & event);
70  void OnMouseMove(wxMouseEvent &event);
71  void OnMouseLeave(wxMouseEvent &event);
72  void OnRightMouse(wxMouseEvent &event);
73  void OnLeftMouse(wxMouseEvent &event);
74  void OnKey(wxKeyEvent &event);
75  void OnLeftMouseDoubleClicked(wxMouseEvent &event);
76 
77  wxBitmap *Bitmap_;
78  wxImage *wximage_;
81  wxStatusBar *SBar_;
82  int SBarID_;
83 
84  // Canvas now uses double buffering to avoid flickering, so it should be ok
85  // to always clear the canvas.
87 
88  unsigned ZoomFactor_, ZoomX_, ZoomY_; // zoom coo, set from NewCoo
89  // upper left corner of ZoomX_, ZoomY_ in Window_
90  unsigned ZoomXPos_, ZoomYPos_;
91  int wwidth_, wheight_; // width & height of Window_
92  int mousex_, mousey_;
93 
94  wxMutex wxbitmap_mutex_, origim_mutex_;
95 
96  DECLARE_EVENT_TABLE()
97  }; // class ZoomImageCanvas
98 
99 } // namesape
100 
101 #endif // __ZoomImageCanvas_hh__
BIAS::ImageBase origim_
BIAS::Image< unsigned char > zim_
void SetClearDrawingContext(bool clear)
Canvas now uses double buffering to avoid flickering, so it should be ok to always clear the canvas...
This is the base class for images in BIAS.
Definition: ImageBase.hh:102