27 #include <wx/dcbuffer.h>
28 #include <wx/dcclient.h>
33 bool PreviewWindow::Create(wxWindow* parent, wxWindowID
id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
35 wxScrolledWindow::Create(parent,
id, pos, size, style, name);
38 SetBackgroundStyle(wxBG_STYLE_PAINT);
48 if(!file.IsEmpty() && wxFileExists(file))
61 SetVirtualSize(100, 100);
71 SetVirtualSize(100,100);
78 wxAutoBufferedPaintDC dc(
this);
80 dc.SetBackground(GetBackgroundColour());
108 wxSize realSize =
m_image.GetSize();
120 wxImageResizeQuality resizeQuality = wxIMAGE_QUALITY_NORMAL;
127 resizeQuality = wxIMAGE_QUALITY_BOX_AVERAGE;
129 img=
m_image.Scale(realSize.GetWidth(), realSize.GetHeight(), resizeQuality);
137 if (!
m_iccProfile.empty() || wxGetApp().GetToolboxFrame()->HasMonitorProfile())
142 SetVirtualSize(realSize);
175 const int w = size.GetWidth();
176 const int h = size.GetHeight();
177 const wxSize csize = GetSize();
178 const double s1 = (double)csize.GetWidth() / w;
179 const double s2 = (double)csize.GetHeight() /
h;
180 return s1 < s2 ? s1 : s2;
void OnPaint(wxPaintEvent &e)
drawing routine
double m_scaleFactor
store current scale factor
double calcAutoScaleFactor(wxSize size)
calculate new scale factor for this image
double getScaleFactor() const
get scale factor (calculates factor when fit to window is active)
int scale(int x) const
helper function to scale of width/height
vigra::ImageImportInfo::ICCProfile m_iccProfile
remember icc profile of currently loaded file
void GetMonitorProfile(wxString &profileName, cmsHPROFILE &profile)
void setImage(const wxString &filename)
set the current image and mask list, this loads also the image from cache
void CorrectImage(wxImage &image, const vigra::ImageImportInfo::ICCProfile &iccProfile, const cmsHPROFILE &monitorProfile)
apply color correction to given image using input iccProfile and monitor profile
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name="panel")
create the control
IMPLEMENT_DYNAMIC_CLASS(wxTreeListHeaderWindow, wxWindow)
void OnSize(wxSizeEvent &e)
handler called when size of control was changed
void setScale(double factor)
set the scaling factor f.
static void info(const char *fmt,...)
void rescaleImage()
rescale the image
double getScale()
return scale factor, 0 for autoscale
declaration of PreviewWindow class