Example #1
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());
    }
Example #2
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);
            }
        }
    }
Example #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;
    }
Example #4
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;
    }
Example #5
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;
    }
Example #6
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);
    }
Example #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;
        }
    }
Example #8
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);
	}
int main()
{
  kb_init(&keyboard);
  stb_fake_model_init(&model);

  gl_view_init(&view);

  ctrl_init(&ctrl);
  ctrl_set_view(&view);
  ctrl_set_model(&model);

  kb_set_callback(ctrl.handler);

  view.start();

  ctrl.start();
  keyboard.start();
	model.deinit();
	puts("finish");
}
Example #10
0
void CImageView::Display( view_t handle, int dx, int dy )
{
  Rectangle* r = new Rectangle( 0,0, Width(),Height() );
  Bitmap ^ bmp = gcnew Bitmap( Width(),Height() );

  BitmapData ^ bDat = bmp->LockBits( *r, ImageLockMode::ReadWrite, PixelFormat::Format32bppArgb );

  TBpp32* p = (TBpp32*)(void*)bDat->Scan0;

  int y;
  for (y=0; y<Height(); y++)
  {
    memcpy( p, PixelAddress( 0, y ), sizeof(TBpp32)*Width() );
    p += Width();
  }

  bmp->UnlockBits( bDat );
  delete r;

  handle->DrawImage( bmp, dx,dy, Width(),Height() );
}
Example #11
0
void CImageView::Display( view_t handle, int dx, int dy, int sx, int sy, int sw, int sh )
{
  // 矩形クリップ
  TClipSize blksrc,blkdest;
  blksrc.width = Width(); blksrc.height = Height();
  blkdest.width = Width(); blkdest.height = Height();

  TClipBltInfo info;
  info.sx = sx; info.sy = sy;
  info.sw = sw; info.sh = sh;
  info.dx = dx; info.dy = dy;
  ClipBltInfo( &blksrc, &blkdest, &info );

  if (!ClipBltInfo( &blksrc, &blkdest, &info )) return;

  // 転送サイズだけの作成・ロック
  Bitmap ^ bmp = gcnew Bitmap( info.sw, info.sh );
  Rectangle* r = new Rectangle( 0,0, info.sw, info.sh );
  BitmapData ^ bDat = bmp->LockBits( *r, ImageLockMode::ReadWrite, PixelFormat::Format32bppArgb );

  TBpp32* p = (TBpp32*)(void*)bDat->Scan0;

  int i;
  for (i=info.dy; i<info.dy+info.sh; i++)
  {
    int idx = sizeof(TBpp32)*( (i - info.dy) * info.sw );
    TBpp32* srcadr = (TBpp32*)PixelAddress( 0, info.sy + i-info.dy );
    TBpp32* destadr = (TBpp32*)((BYTE*)p + idx);

    neet::BltCopy( srcadr, info.sx, destadr, 0, info.sw );
  }

  bmp->UnlockBits( bDat );
  delete r;

  Rectangle* dr = new Rectangle( info.dx,info.dy, info.sw,info.sh );

  handle->DrawImage( bmp, *dr, 0,0, info.sw,info.sh, GraphicsUnit::Pixel );
  delete dr;
}