X-Git-Url: https://cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Ftracer%2Ftracer.C;h=604a382403ff0e48e91455aada9fee69e57a77f6;hb=9fed7535470aa37781733db836068da3b4c17a0d;hp=be58496d7c29d346acf22e79d42e457eb16de706;hpb=f06e8ed85bd5937d704d57b65e0fb26ed288996d;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/plugins/tracer/tracer.C b/cinelerra-5.1/plugins/tracer/tracer.C index be58496d..604a3824 100644 --- a/cinelerra-5.1/plugins/tracer/tracer.C +++ b/cinelerra-5.1/plugins/tracer/tracer.C @@ -28,6 +28,7 @@ #include "bccmodels.h" #include "bccolors.h" #include "clip.h" +#include "edl.h" #include "edlsession.h" #include "filexml.h" #include "tracer.h" @@ -56,9 +57,9 @@ TracerPoint::~TracerPoint() TracerConfig::TracerConfig() { - drag = draw = fill = 0; - radius = 0; scale = 1; - selected = 0; + drag = draw = 1; fill = 0; + feather = 0; radius = 1; + invert = 0; selected = -1; } TracerConfig::~TracerConfig() { @@ -69,8 +70,9 @@ int TracerConfig::equivalent(TracerConfig &that) if( this->drag != that.drag ) return 0; if( this->draw != that.draw ) return 0; if( this->fill != that.fill ) return 0; + if( this->feather != that.feather ) return 0; + if( this->invert != that.invert ) return 0; if( this->radius != that.radius ) return 0; - if( this->scale != that.scale ) return 0; if( this->points.size() != that.points.size() ) return 0; for( int i=0, n=points.size(); ipoints[i], *bp = that.points[i]; @@ -86,8 +88,9 @@ void TracerConfig::copy_from(TracerConfig &that) this->draw = that.draw; this->fill = that.fill; this->selected = that.selected; + this->feather = that.feather; + this->invert = that.invert; this->radius = that.radius; - this->scale = that.scale; points.remove_all_objects(); for( int i=0,n=that.points.size(); isession; float x = !session ? 0.f : session->output_w / 2.f; float y = !session ? 0.f : session->output_h / 2.f; return config.add_point(x, y); @@ -175,8 +178,9 @@ void Tracer::save_data(KeyFrame *keyframe) output.tag.set_property("DRAG", config.drag); output.tag.set_property("DRAW", config.draw); output.tag.set_property("FILL", config.fill); + output.tag.set_property("FEATHER", config.feather); output.tag.set_property("RADIUS", config.radius); - output.tag.set_property("SCALE", config.scale); + output.tag.set_property("INVERT", config.invert); output.tag.set_property("SELECTED", config.selected); output.append_tag(); output.append_newline(); @@ -210,8 +214,9 @@ void Tracer::read_data(KeyFrame *keyframe) config.drag = input.tag.get_property("DRAG", config.drag); config.draw = input.tag.get_property("DRAW", config.draw); config.fill = input.tag.get_property("FILL", config.fill); + config.feather = input.tag.get_property("FEATHER", config.feather); config.radius = input.tag.get_property("RADIUS", config.radius); - config.scale = input.tag.get_property("SCALE", config.scale); + config.invert = input.tag.get_property("INVERT", config.invert); config.selected = input.tag.get_property("SELECTED", 0); config.limits(); } @@ -221,8 +226,6 @@ void Tracer::read_data(KeyFrame *keyframe) config.add_point(x, y); } } - - if( !config.points.size() ) new_point(); } void Tracer::update_gui() @@ -538,15 +541,18 @@ void FillRegion::run() void Tracer::feather(int r, double s) { - if( !r || !s ) return; - int dir = r<0 ? (r=-r, -1) : 1; - if( dir < 0 ) s = 1./s; + if( !r ) return; + int dir = r < 0 ? (r=-r, -1) : 1; int rr = r * r; int psf[rr]; // pt spot fn - int k = dir>=0 ? 0 : rr-1; - for( int i=0; i 0 ? 0xff : 0; + float p = powf(10.f, s/2); + for( int i=0; i 255 ) vv = 255; + psf[i] = vv; + } for( int i=0,n=points.size(); ix-r, xn=pt->x+r; @@ -557,12 +563,11 @@ void Tracer::feather(int r, double s) bclamp(yn, 0, h); for( int y=ys ; yx, dy = y-pt->y; int dd = dx*dx + dy*dy; if( dd >= rr ) continue; - int pix = msk_rows[y][x], v = psf[dd]; - msk_rows[y][x] = dir >= 0 ? pix+v-(pix*v)/255 : (pix*v)/255; + int v = psf[dd], px = msk_rows[y][x]; + if( dir < 0 ? pxv ) msk_rows[y][x] = v; } } } @@ -576,8 +581,7 @@ void Tracer::draw_mask() uint8_t *mp = msk_rows[y]; uint8_t *rp = frm_rows[y]; for( int x=0; x