Nana provides the image processors:
- Stretch algorithms:
- bilinear interoplation It produces a reasonably realistic image.
- proximal interoplation It(also known as nearest-neighbor interoplation) is fast, but produces a not realistic image.
- Alpha Blend algorith:
- alpha_blend Blends two images with alpha channel that is given by source image.
- Blend algorithm:
- Blur algorithm:
- Line algorithm:
- bresenham_line Draws a line.
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.
Result of application:
bilinear interoplation - Stretch the image through bilinear interoplation
proximal interoplation - Stretch the image through proximal interoplation
#include <nana/gui.hpp>
#include <nana/gui/drawing.hpp>
#include <nana/paint/image_process_selector.hpp>
#include <iostream>
using namespace nana;
{
return os <<
"point{" << p.
x <<
"," << p.
y <<
"}";
}
{
return os <<
"size{" << z.
width <<
"," << z.
height <<
"}";
}
{
}
class tsform
{
public:
tsform()
{
if (!img_.open(("../Examples/bground.6states.bmp")))
{
img_.stretch(r, gr_, rw );
std::cout <<
"Pict: " << r <<
", Windows: " << rw <<
"\n";
});
dw.update();
events().click ( [
this](){_m_click();} );
}
private:
void _m_click()
{
static bool interop;
sl.
stretch(interop ?
"bilinear interoplation" :
"proximal interoplation");
interop = !interop;
std::cout << (interop ?
"Click: bilinear interoplation\n"
: "Click: proximal interoplation\n") ;
}
};
int main()
{
tsform fm;
fm.show();
}