X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Fmotion51%2Fmotion51.C;h=f29ea0bbff57099026887cc722cc84dbb3278c9f;hp=cac4ed3a19f857156a3405482fb75f5f84902e11;hb=1f004d22ca7bd7a98a3bf02b12ec5b1adece92f2;hpb=48c313de28fe6d39d9431dbe2dca6ffb176541ff diff --git a/cinelerra-5.1/plugins/motion51/motion51.C b/cinelerra-5.1/plugins/motion51/motion51.C index cac4ed3a..f29ea0bb 100644 --- a/cinelerra-5.1/plugins/motion51/motion51.C +++ b/cinelerra-5.1/plugins/motion51/motion51.C @@ -120,7 +120,7 @@ Motion51Main::~Motion51Main() delete [] ypts; } -const char* Motion51Main::plugin_title() { return _("Motion51"); } +const char* Motion51Main::plugin_title() { return N_("Motion51"); } int Motion51Main::is_realtime() { return 1; } int Motion51Main::is_multichannel() { return 1; } @@ -565,41 +565,68 @@ void Motion51Main::centroid(double *pix[3], double *ctr_v, double *ctr_x, double } } +Motion51VVFrame::Motion51VVFrame(VFrame *vfrm, int n) + : VFrame(vfrm->get_data(), -1, vfrm->get_y()-vfrm->get_data(), + vfrm->get_u()-vfrm->get_data(), vfrm->get_v()-vfrm->get_data(), + vfrm->get_w(), vfrm->get_h(), vfrm->get_color_model(), + vfrm->get_bytes_per_line()) +{ + this->n = n; +} + +int Motion51VVFrame::draw_pixel(int x, int y) +{ + VFrame::draw_pixel(x+0, y+0); + for( int i=1; idraw_arrow(rx, ry, rx+current_dx, ry+current_dy); + int iw = img->get_w(), ih = img->get_h(); + int mx = iw > ih ? iw : ih; + int n = mx/800 + 1; + Motion51VVFrame vfrm(img, n); + vfrm.set_pixel_color(WHITE); + int m = 2; while( m < n ) m <<= 1; + vfrm.set_stiple(2*m); -// img->draw_smooth(rx-rr,ry, rx-rr,ry+rr, rx,ry+rr); -// img->draw_smooth(rx,ry+rr, rx+rr,ry+rr, rx+rr,ry); -// img->draw_smooth(rx+rr,ry, rx+rr,ry-rr, rx,ry-rr); -// img->draw_smooth(rx,ry-rr, rx-rr,ry-rr, rx-rr,ry); + vfrm.draw_arrow(rx, ry, rx+current_dx, ry+current_dy); +// vfrm.draw_smooth(rx-rr,ry, rx-rr,ry+rr, rx,ry+rr); +// vfrm.draw_smooth(rx,ry+rr, rx+rr,ry+rr, rx+rr,ry); +// vfrm.draw_smooth(rx+rr,ry, rx+rr,ry-rr, rx,ry-rr); +// vfrm.draw_smooth(rx,ry-rr, rx-rr,ry-rr, rx-rr,ry); float rx1 = rx - 0.5*rw; float ry1 = ry - 0.5*rh; float rx2 = rx1 + rw; float ry2 = ry1 + rh; - img->draw_line(rx1, ry1, rx2, ry1); - img->draw_line(rx2, ry1, rx2, ry2); - img->draw_line(rx2, ry2, rx1, ry2); - img->draw_line(rx1, ry2, rx1, ry1); + vfrm.draw_line(rx1, ry1, rx2, ry1); + vfrm.draw_line(rx2, ry1, rx2, ry2); + vfrm.draw_line(rx2, ry2, rx1, ry2); + vfrm.draw_line(rx1, ry2, rx1, ry1); float sx1 = rx1 - rr, sy1 = ry1 - rr; float sx2 = rx2 + rr, sy2 = ry2 + rr; - img->draw_smooth(sx1, ry1, sx1, sy1, rx1, sy1); - img->draw_line(rx1, sy1, rx2, sy1); - img->draw_smooth(rx2, sy1, sx2, sy1, sx2, ry1); - img->draw_line(sx2, ry1, sx2, ry2); - img->draw_smooth(sx2, ry2, sx2, sy2, rx2, sy2); - img->draw_line(rx2, sy2, rx1, sy2); - img->draw_smooth(rx1, sy2, sx1, sy2, sx1, ry2); - img->draw_line(sx1, ry2, sx1, ry1); + vfrm.draw_smooth(sx1, ry1, sx1, sy1, rx1, sy1); + vfrm.draw_line(rx1, sy1, rx2, sy1); + vfrm.draw_smooth(rx2, sy1, sx2, sy1, sx2, ry1); + vfrm.draw_line(sx2, ry1, sx2, ry2); + vfrm.draw_smooth(sx2, ry2, sx2, sy2, rx2, sy2); + vfrm.draw_line(rx2, sy2, rx1, sy2); + vfrm.draw_smooth(rx1, sy2, sx1, sy2, sx1, ry2); + vfrm.draw_line(sx1, ry2, sx1, ry1); double *xp = xpts, *yp = ypts; for( int i=cir_sz; --i>=0; ++xp, ++yp ) - img->draw_pixel(rx+*xp, ry+*yp); + vfrm.draw_pixel(rx+*xp, ry+*yp); } int Motion51Main::open_cache_file()