SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Bevel,_("Bevel"));
SYNFIG_LAYER_SET_CATEGORY(Layer_Bevel,_("Stylize"));
SYNFIG_LAYER_SET_VERSION(Layer_Bevel,"0.2");
SYNFIG_LAYER_SET_LOCAL_NAME(Layer_Bevel,_("Bevel"));
SYNFIG_LAYER_SET_CATEGORY(Layer_Bevel,_("Stylize"));
SYNFIG_LAYER_SET_VERSION(Layer_Bevel,"0.2");
Color shade;
Real hi_alpha(1.0f-context.get_color(blurpos+offset).get_a());
Real lo_alpha(1.0f-context.get_color(blurpos-offset).get_a());
Color shade;
Real hi_alpha(1.0f-context.get_color(blurpos+offset).get_a());
Real lo_alpha(1.0f-context.get_color(blurpos-offset).get_a());
Real shade_alpha(hi_alpha-lo_alpha);
if(shade_alpha>0)
shade=color1,shade.set_a(shade_alpha);
Real shade_alpha(hi_alpha-lo_alpha);
if(shade_alpha>0)
shade=color1,shade.set_a(shade_alpha);
return Color::blend(shade,context.get_color(pos),get_amount(),get_blend_method());
}
return Color::blend(shade,context.get_color(pos),get_amount(),get_blend_method());
}
int x,y;
SuperCallback stageone(cb,0,5000,10000);
SuperCallback stagetwo(cb,5000,10000,10000);
int x,y;
SuperCallback stageone(cb,0,5000,10000);
SuperCallback stagetwo(cb,5000,10000,10000);
const int w = renddesc.get_w(),
h = renddesc.get_h();
const Real pw = renddesc.get_pw(),
ph = renddesc.get_ph();
const Vector size(softness,softness);
const int w = renddesc.get_w(),
h = renddesc.get_h();
const Real pw = renddesc.get_pw(),
ph = renddesc.get_ph();
const Vector size(softness,softness);
//callbacks depend on how long the blur takes
if(size[0] || size[1])
{
if(type == Blur::DISC)
{
stageone = SuperCallback(cb,0,5000,10000);
//callbacks depend on how long the blur takes
if(size[0] || size[1])
{
if(type == Blur::DISC)
{
stageone = SuperCallback(cb,0,5000,10000);
- stagetwo = SuperCallback(cb,5000,10000,10000);
+ stagetwo = SuperCallback(cb,5000,10000,10000);
}
else
{
stageone = SuperCallback(cb,0,9000,10000);
}
else
{
stageone = SuperCallback(cb,0,9000,10000);
- stagetwo = SuperCallback(cb,9000,10000,10000);
+ stagetwo = SuperCallback(cb,9000,10000,10000);
}
}
else
{
stageone = SuperCallback(cb,0,9999,10000);
}
}
else
{
stageone = SuperCallback(cb,0,9999,10000);
- stagetwo = SuperCallback(cb,9999,10000,10000);
+ stagetwo = SuperCallback(cb,9999,10000,10000);
//the expanded size = 1/2 the size in each direction rounded up
int halfsizex = (int) (abs(size[0]*.5/pw) + 3),
halfsizey = (int) (abs(size[1]*.5/ph) + 3);
//the expanded size = 1/2 the size in each direction rounded up
int halfsizex = (int) (abs(size[0]*.5/pw) + 3),
halfsizey = (int) (abs(size[1]*.5/ph) + 3);
#define GAUSSIAN_ADJUSTMENT (0.05)
Real pw = (Real)workdesc.get_w()/(workdesc.get_br()[0]-workdesc.get_tl()[0]);
Real ph = (Real)workdesc.get_h()/(workdesc.get_br()[1]-workdesc.get_tl()[1]);
#define GAUSSIAN_ADJUSTMENT (0.05)
Real pw = (Real)workdesc.get_w()/(workdesc.get_br()[0]-workdesc.get_tl()[0]);
Real ph = (Real)workdesc.get_h()/(workdesc.get_br()[1]-workdesc.get_tl()[1]);
halfsizex = (halfsizex + 1)/2;
halfsizey = (halfsizey + 1)/2;
workdesc.set_subwindow( -halfsizex, -halfsizey, offset_w+2*halfsizex, offset_h+2*halfsizey );
halfsizex = (halfsizex + 1)/2;
halfsizey = (halfsizey + 1)/2;
workdesc.set_subwindow( -halfsizex, -halfsizey, offset_w+2*halfsizex, offset_h+2*halfsizey );
//render the background onto the expanded surface
if(!context.accelerated_render(&worksurface,quality,workdesc,&stageone))
return false;
//render the background onto the expanded surface
if(!context.accelerated_render(&worksurface,quality,workdesc,&stageone))
return false;
//be sure the surface is of the correct size
surface->set_wh(renddesc.get_w(),renddesc.get_h());
//be sure the surface is of the correct size
surface->set_wh(renddesc.get_w(),renddesc.get_h());
int u = halfsizex+abs(offset_u), v = halfsizey+abs(offset_v);
for(y=0;y<renddesc.get_h();y++,v++)
{
int u = halfsizex+abs(offset_u), v = halfsizey+abs(offset_v);
for(y=0;y<renddesc.get_h();y++,v++)
{
if(shade.get_a())
{
(*surface)[y][x]=Color::blend(shade,worksurface[v][u],get_amount(),get_blend_method());
if(shade.get_a())
{
(*surface)[y][x]=Color::blend(shade,worksurface[v][u],get_amount(),get_blend_method());
if(cb && !cb->amount_complete(10000,10000))
{
//if(cb)cb->error(strprintf(__FILE__"%d: Accelerated Renderer Failure",__LINE__));
return false;
}
if(cb && !cb->amount_complete(10000,10000))
{
//if(cb)cb->error(strprintf(__FILE__"%d: Accelerated Renderer Failure",__LINE__));
return false;
}
Rect bounds(under.expand(softness));
bounds.expand_x(abs(depth));
bounds.expand_y(abs(depth));
Rect bounds(under.expand(softness));
bounds.expand_x(abs(depth));
bounds.expand_y(abs(depth));