Пример #1
0
    void operator()(view_t& view)
    {
        using namespace boost::gil;

        int h = v2.height();
        int w = v2.width();
        if(h > view.height() || w > view.width())
            return;

        int n = 0;
        for(int x = 0; x < view.width(); x += w)
        {
            for(int y = 0; y < view.height(); y += h)
            {
                int aw = w;
                if(x + w > view.width())
                {
                    int t = x + w - view.width();
                    aw = w - t;
                }

                int ah = h;
                if(y + h > view.height())
                {
                    int t = y + h - view.height();
                    ah = h - t;
                }

                view_t v3 = subimage_view(view, x, y, aw, ah);
                view_t v4 = subimage_view(v2, 0, 0, aw, ah);
                boost::gil::copy_pixels(v4, v3);
            }
        }
    }
Пример #2
0
	void operator()(view_t& view)
	{
		if (left < 1.0) left *= view.width();
		if (right < 1.0) right *= view.width();
		if (top < 1.0) top *= view.height();
		if (bottom < 1.0) bottom *= view.height();

		double width = view.width()-left-right;
		double height = view.height()-top-bottom;
		view_t view2 = boost::gil::subimage_view(view,(int)left,(int)top,(int)width,(int)height);
		funct(view2);
	}
Пример #3
0
    void operator()(view_t& view)
    {
        typedef typename view_t::value_type value_type_t;

        std::vector<int> dash;
        boost::mpl::for_each<dash_t>(boost::bind(&std::vector<int>::push_back, &dash, _1));

        channels x(view.width(), intervals);

        for(; x; x++)
            for(int y = 0; y < view.width();)
                for(int d = 0; d < dash.size(); ++d, ++y)
                    if(dash[d] && y < view.height())
                        view(*x, y) = color;
    }
Пример #4
0
    void operator()(view_t& view)
    {
        using namespace boost::gil;

        int y = 0;
        std::vector<view_t> views;

        int rows = (int)ceil(layers.size() / (double)cols);
        sections ycurr(view.height() + margin, rows);
        for(; ycurr; ycurr++)
        {
            int yheight = *ycurr - margin;
            int x = 0;

            sections xcurr(view.width() + margin, cols);
            for(; xcurr; xcurr++)
            {
                int xwidth = *xcurr - margin;
                views.push_back(subimage_view(view, x, y, xwidth, yheight));
                x += xwidth + margin;
            }

            y += yheight + margin;
        }

        tbb::parallel_for(tbb::blocked_range<std::size_t>(0, views.size()), parallel_draw<view_t>(layers, views),
                          tbb::auto_partitioner());
    }
Пример #5
0
    void operator()(view_t& view)
    {
        std::vector<int> dash;
        boost::mpl::for_each<dash_t>(boost::bind(&std::vector<int>::push_back, &dash, _1));

        double diff = maxvalue - minvalue;
        if(diff == 0)
            return;

        double rval = 1 - ((value - minvalue) / (diff));
        int y = (int)(rval * (view.height() - 1));

        for(int x = 0; x < view.width();)
            for(int d = 0; d < dash.size(); ++d, ++x)
                if(dash[d] && x < view.width())
                    view(x, y) = color;
    }
Пример #6
0
    void operator()(view_t& view)
    {
        typedef typename view_t::value_type value_type_t;

        BOOST_ASSERT(view.width());

        std::vector<int> dash;
        boost::mpl::for_each<dash_t>(boost::bind(&std::vector<int>::push_back, &dash, _1));

        channels y(view.height(), intervals);

        for(; y; ++y)
            for(int x = 0; x < view.width();)
                for(int d = 0; d < dash.size(); ++d, ++x)
                    if(dash[d] && x < view.width())
                        view(x, *y) = color;
    }
Пример #7
0
    void operator()(view_t& view)
    {
        std::vector<int> dashlst;
        boost::mpl::for_each<dashlst_t>(boost::bind(&std::vector<int>::push_back, &dashlst, _1));

        int intervals = view.width() / width;
        channels i(periods, intervals);
        channels x(view.width(), periods);

        for(int n = 0; i; ++i)
        {
            for(; n < *i; ++n, ++x)
                ;

            for(int y = 0; y < view.height();)
                for(std::size_t d = 0; d < dashlst.size(); ++d, ++y)
                    if(dashlst[d] && y < view.height())
                        view(*x, y) = color;
        }
    }
Пример #8
0
    void operator()(view_t& view)
    {
        using namespace boost::gil;

        double diff = maxvalue - minvalue;
        if(diff == 0)
            return;

        double rval = 1 - ((value1 - minvalue) / (diff));
        int y1 = (int)(rval * (view.height() - 1));

        rval = 1 - ((value2 - minvalue) / (diff));
        int y2 = (int)(rval * (view.height() - 1));

        int yt = (std::min)(y1, y2);
        int yb = (std::max)(y1, y2);

        view_t v2 = subimage_view(view, 0, yt, view.width(), yb - yt);
        funct(v2);
    }