1 #include "ZoomImageCanvas.hh"
3 #include <Gui/StringConv.hh>
10 int sbarid, wxWindowID
id,
const wxPoint& pos,
11 const wxSize& size,
long style,
13 : wxPanel(parent, id, pos, size, style, name)
66 register unsigned int xstart, ystart;
67 register unsigned char res[3];
75 for (
int x=(
int)
ZoomX_-(
int)xsize; x<=(int)
ZoomX_+(
int)xsize; x++){
76 for (
int y=(
int)
ZoomY_-(int)ysize; y<=(int)
ZoomY_+(
int)ysize; y++){
77 if (x<0 || y<0 || x>=(
int)width || y>=(int)height){
79 res[0]=res[1]=res[2]=0;
82 res[0]=sida[y][mx]; res[1]=sida[y][mx+1]; res[2]=sida[y][mx+2];
88 my=ystart+i; mx=(xstart+j);
92 ida[my][mx+1] = res[1];
93 ida[my][mx+2] = res[2];
141 os <<
"("<<setw(3)<<ix<<
", "<<setw(3)<<iy<<
") : (";
147 for (
unsigned int channel=0;
176 wxPostEvent(this->GetEventHandler(),pe);
194 wxPostEvent(this->GetEventHandler(),pe);
210 wxPostEvent(this->GetEventHandler(),pe);
229 OnRightMouse(wxMouseEvent &event)
233 wxPoint pos =
event.GetPosition();
234 int x = dc.DeviceToLogicalX( pos.x );
235 int y = dc.DeviceToLogicalY( pos.y );
236 int ix=(x-(int)(wwidth_>>1))/(
int)ZoomFactor_+(int)ZoomX_;
237 int iy=(y-(int)(wheight_>>1))/(
int)ZoomFactor_+(int)ZoomY_;
264 wxPostEvent(this->GetEventHandler(),pe);
274 wxBufferedPaintDC dc(
this);
297 wxPoint pos =
event.GetPosition();
298 mousex_ = dc.DeviceToLogicalX( pos.x );
299 mousey_ = dc.DeviceToLogicalY( pos.y );
308 if (GetParent() && GetParent()->GetParent()){
311 wxPoint pos =
event.GetPosition();
312 unsigned int x = dc.DeviceToLogicalX( pos.x );
313 unsigned int y = dc.DeviceToLogicalY( pos.y );
320 wxMouseEvent ke=event;
323 ke.SetId(GetParent()->GetParent()->GetId());
324 wxPostEvent(GetParent()->GetParent()->GetEventHandler(), ke);
328 BIASERR(
"no ImageCanvas belonging to ZoomImageCanvas\n");
342 wxPoint pos =
event.GetPosition();
343 unsigned int x = dc.DeviceToLogicalX( pos.x );
344 unsigned int y = dc.DeviceToLogicalY( pos.y );
351 wxMouseEvent ke=event;
354 ke.SetId(GetParent()->GetParent()->GetId());
355 wxPostEvent(GetParent()->GetParent()->GetEventHandler(), ke);
359 BIASERR(
"no ImageCanvas belonging to ZoomImageCanvas\n");
373 wxPoint pos =
event.GetPosition();
374 unsigned int x = dc.DeviceToLogicalX( pos.x );
375 unsigned int y = dc.DeviceToLogicalY( pos.y );
385 ke.SetId(GetParent()->GetParent()->GetId());
386 ke.m_keyCode=
event.GetKeyCode();
387 wxPostEvent(GetParent()->GetParent()->GetEventHandler(), ke);
391 BIASERR(
"no ImageCanvas belonging to ZoomImageCanvas\n");
void Release()
reimplemented from ImageBase
void UpdateStatusBar(unsigned x, unsigned y)
wxString AsciiToWx(const char *thestring)
Converts a C string to a wxString.
bool IsEmpty() const
check if ImageData_ points to allocated image buffer or not
void OnLeftMouseDoubleClicked(wxMouseEvent &event)
static void PrintPixelValue(const ImageBase &im, const unsigned int x, const unsigned int y, const unsigned short channel=0, std::ostream &os=std::cout)
print the (typed) pixel value to stream.
void NewCoo(unsigned x, unsigned y)
void OnKey(wxKeyEvent &event)
BIAS::Image< unsigned char > zim_
unsigned int GetWidth() const
bool ClearDrawingContext_
void NewImage(BIAS::ImageBase &im, BIAS::Image< unsigned char > &ucim)
void OnMouseMove(wxMouseEvent &event)
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
void OnResize(wxSizeEvent &event)
void FillImageWithConstValue(StorageType Value)
fill grey images
void OnMouseLeave(wxMouseEvent &event)
void Init(unsigned int Width, unsigned int Height, unsigned int channels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
calls Init from ImageBase storageType is ignored, just dummy argument
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
void OnPaint(wxPaintEvent &event)
ZoomImageCanvas(wxWindow *parent, wxStatusBar *sbar=NULL, int sbarid=0, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(320, 240), long style=wxTAB_TRAVERSAL, const wxString &name=wxT("ZoomImageCanvas"))
BIAS::Image< unsigned char > ucim_
This is the base class for images in BIAS.
void OnLeftMouse(wxMouseEvent &event)
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase