Nana C++ Library An open-source C++ framework project The Programmer's Guide |
||||||||||||||||||||||||||||||||
nana::paint::image_process::selector Description The class selector is used for configuring the algorithms of image processing. Model of None Public base classes None Members
File nana/paint/image_process_selector.hpp Notes 1, If users give a non-existing name for choosing an image processor, the call succeed, but no image processor would be replaced. 2, The image processors that Nana provides are: Stretch algorithms:
Alpha Blend algorith:
Blend algorithm:
Blur algorithm:
Line algorithm:
Examples This is an example which creates a form to display an image, and when the size of form is changed, it makes the image fit the form. In addtion, the example also shows the way to switch the stretch image processing algorithm. #include <nana/gui/wvl.hpp> #include <nana/gui/drawing.hpp> #include <nana/paint/image_process_selector.hpp> using namespace nana::gui; class tsform : public form { public: tsform() { img_.open(STR("image01.bmp")); //Open the image file. //Copy the image to the window nana::size sz = size(); drawing dw(*this); dw.bitblt(0, 0, sz.width, sz.height, img_, 0, 0); dw.update(); //Register events make_event<events::click>(*this, &tsform::_m_click); make_event<events::size>(*this, &tsform::_m_size); } private: //Switchs the algorithm between two algorithms in every click on the form. void _m_click() { static bool interop; nana::paint::image_process::selector sl; sl.stretch(interop ? "bilinear interoplation" : "proximal interoplation"); interop = !interop; } //When the window size is changed, it stretches the image to fit the window. void _m_size() { drawing dw(*this); dw.clear(); //Before stretch, it should clear the operations that are generated before. dw.stretch(size(), img_, img_.size()); dw.update(); } private: nana::paint::image img_; }; int main() { tsform fm; fm.show(); exec(); } Result of application: Stretch the image through bilinear interoplation Stretch the image through proximal interoplation See also None. Move to The Nana Programmer's Guide Main Page |
||||||||||||||||||||||||||||||||