size=Vector(0.25,0.25);
text=_("Text Layer");
color=Color::black();
- pos=Vector(0,0);
+ origin=Vector(0,0);
orient=Vector(0.5,0.5);
compress=1.0;
vcompress=1.0;
IMPORT_PLUS(style,new_font(family,style,weight));
IMPORT_PLUS(size, if(old_version){size/=2.0;} needs_sync_=true );
IMPORT_PLUS(text,needs_sync_=true);
- IMPORT_PLUS(pos,needs_sync_=true);
+ IMPORT_PLUS(origin,needs_sync_=true);
IMPORT_PLUS(color, { if (color.get_a() == 0) { if (converted_blend_) {
set_blend_method(Color::BLEND_ALPHA_OVER);
color.set_a(1); } else transparent_color_ = true; } });
IMPORT_PLUS(use_kerning,needs_sync_=true);
IMPORT_PLUS(grid_fit,needs_sync_=true);
+ IMPORT_AS(origin,"pos");
+
return Layer_Composite::set_param(param,value);
}
EXPORT(size);
EXPORT(text);
EXPORT(color);
- EXPORT(pos);
+ EXPORT(origin);
EXPORT(orient);
EXPORT(compress);
EXPORT(vcompress);
.set_local_name(_("Size"))
.set_description(_("Size of the text"))
.set_hint("size")
- .set_origin("pos")
+ .set_origin("origin")
.set_scalar(1)
);
.set_invisible_duck()
);
- ret.push_back(ParamDesc("pos")
- .set_local_name(_("Position"))
+ ret.push_back(ParamDesc("origin")
+ .set_local_name(_("Origin"))
.set_description(_("Text Position"))
);
int w=abs(round_to_int(size[0]*pw));
int h=abs(round_to_int(size[1]*ph));
- //int bx=(int)((pos[0]-renddesc.get_tl()[0])*pw*64+0.5);
- //int by=(int)((pos[1]-renddesc.get_tl()[1])*ph*64+0.5);
+ //int bx=(int)((origin[0]-renddesc.get_tl()[0])*pw*64+0.5);
+ //int by=(int)((origin[1]-renddesc.get_tl()[1])*ph*64+0.5);
int bx=0;
int by=0;
int curr_line;
for(curr_line=0,iter=lines.begin();iter!=lines.end();++iter,curr_line++)
{
- bx=round_to_int((pos[0]-renddesc.get_tl()[0])*pw*CHAR_RESOLUTION-orient[0]*iter->width);
+ bx=round_to_int((origin[0]-renddesc.get_tl()[0])*pw*CHAR_RESOLUTION-orient[0]*iter->width);
// I've no idea why 1.5, but it kind of works. Otherwise,
// rendering to .bmp (which renders from bottom to top, due to
// the .bmp format describing the image from bottom to top,
// renders text in the wrong place.
- by=round_to_int((pos[1]-renddesc.get_tl()[1])*ph*CHAR_RESOLUTION +
+ by=round_to_int((origin[1]-renddesc.get_tl()[1])*ph*CHAR_RESOLUTION +
(1.0-orient[1])*string_height-line_height*curr_line +
((ph>0) ? line_height/1.5 : 0));
- //by=round_to_int(vcompress*((pos[1]-renddesc.get_tl()[1])*ph*64+(1.0-orient[1])*string_height-face->size->metrics.height*curr_line));
+ //by=round_to_int(vcompress*((origin[1]-renddesc.get_tl()[1])*ph*64+(1.0-orient[1])*string_height-face->size->metrics.height*curr_line));
//synfig::info("curr_line=%d, bx=%d, by=%d",curr_line,bx,by);
std::vector<Glyph>::iterator iter2;
synfig::Vector size;
synfig::Vector orient;
synfig::Color color;
- synfig::Point pos;
+ synfig::Point origin;
synfig::Real compress;
synfig::Real vcompress;
XORPattern::XORPattern():
Layer_Composite (1.0,Color::BLEND_STRAIGHT),
- pos(0.125,0.125),
+ origin(0.125,0.125),
size(0.25,0.25)
{
}
bool
XORPattern::set_param(const String & param, const ValueBase &value)
{
- IMPORT(pos);
+ IMPORT(origin);
IMPORT(size);
+ IMPORT_AS(origin,"pos");
+
return Layer_Composite::set_param(param,value);
}
ValueBase
XORPattern::get_param(const String & param)const
{
- EXPORT(pos);
+ EXPORT(origin);
EXPORT(size);
EXPORT_NAME();
if(get_amount()==0.0)
return context.get_color(point);
- unsigned int a=(unsigned int)floor((point[0]-pos[0])/size[0]), b=(unsigned int)floor((point[1]-pos[1])/size[1]);
+ unsigned int a=(unsigned int)floor((point[0]-origin[0])/size[0]), b=(unsigned int)floor((point[1]-origin[1])/size[1]);
unsigned char rindex=(a^b);
unsigned char gindex=(a^(~b))*4;
unsigned char bindex=~(a^b)*2;
{
Layer::Vocab ret(Layer_Composite::get_param_vocab());
- ret.push_back(ParamDesc("pos")
- .set_local_name(_("Offset"))
+ ret.push_back(ParamDesc("origin")
+ .set_local_name(_("Origin"))
);
ret.push_back(ParamDesc("size")
.set_local_name(_("Size"))
- .set_origin("pos")
+ .set_origin("origin")
);
return ret;
private:
- Point pos;
+ Point origin;
Point size;
public:
CheckerBoard::CheckerBoard():
Layer_Composite (1.0,Color::BLEND_STRAIGHT),
color (Color::black()),
- pos (Point(0.125,0.125)),
+ origin (Point(0.125,0.125)),
size (Point(0.25,0.25))
{
inline bool
CheckerBoard::point_test(const synfig::Point& getpos)const
{
- int val=((int)((getpos[0]-pos[0])/size[0])+(int)((getpos[1]-pos[1])/size[1]));
- if(getpos[0]-pos[0] < 0.0)
+ int val=((int)((getpos[0]-origin[0])/size[0])+(int)((getpos[1]-origin[1])/size[1]));
+ if(getpos[0]-origin[0] < 0.0)
val++;
- if(getpos[1]-pos[1] < 0.0)
+ if(getpos[1]-origin[1] < 0.0)
val++;
return val&1;
}
IMPORT_PLUS(color, { if (color.get_a() == 0) { if (converted_blend_) {
set_blend_method(Color::BLEND_ALPHA_OVER);
color.set_a(1); } else transparent_color_ = true; } });
- IMPORT(pos);
- IMPORT(pos[0]);
- IMPORT(pos[1]);
+ IMPORT(origin);
IMPORT(size);
+ IMPORT_AS(origin,"pos");
+ IMPORT_AS(origin[0],"pos[0]");
+ IMPORT_AS(origin[1],"pos[1]");
+
return Layer_Composite::set_param(param,value);
}
CheckerBoard::get_param(const String ¶m)const
{
EXPORT(color);
- EXPORT(pos);
- EXPORT(pos[0]);
- EXPORT(pos[1]);
+ EXPORT(origin);
EXPORT(size);
EXPORT_NAME();
EXPORT_VERSION();
.set_local_name(_("Color"))
.set_description(_("Color of checkers"))
);
- ret.push_back(ParamDesc("pos")
- .set_local_name(_("Offset"))
+ ret.push_back(ParamDesc("origin")
+ .set_local_name(_("Origin"))
);
ret.push_back(ParamDesc("size")
.set_local_name(_("Size"))
.set_description(_("Size of checkers"))
- .set_origin("pos")
+ .set_origin("origin")
);
return ret;
SYNFIG_LAYER_MODULE_EXT
private:
synfig::Color color;
- synfig::Point pos;
+ synfig::Point origin;
synfig::Point size;
bool point_test(const synfig::Point& x)const;
Circle::Circle():
Layer_Composite (1.0,Color::BLEND_STRAIGHT),
color (Color::black()),
- pos (0,0),
+ origin (0,0),
radius (1),
feather (0),
invert (false),
IMPORT(radius);
IMPORT_PLUS(feather, if(feather<0)feather=0;);
IMPORT(invert);
- IMPORT(pos);
+ IMPORT(origin);
IMPORT(falloff);
+ IMPORT_AS(origin,"pos");
+
return Layer_Composite::set_param(param,value);
}
EXPORT(radius);
EXPORT(feather);
EXPORT(invert);
- EXPORT(pos);
+ EXPORT(origin);
EXPORT(falloff);
EXPORT_NAME();
);
ret.push_back(ParamDesc("radius")
.set_local_name(_("Radius"))
- .set_origin("pos")
+ .set_origin("origin")
.set_is_distance()
);
ret.push_back(ParamDesc("feather")
.set_local_name(_("Feather"))
.set_is_distance()
);
- ret.push_back(ParamDesc("pos")
- .set_local_name(_("Center"))
+ ret.push_back(ParamDesc("origin")
+ .set_local_name(_("Origin"))
);
ret.push_back(ParamDesc("invert")
.set_local_name(_("Invert"))
synfig::Layer::Handle
Circle::hit_check(synfig::Context context, const synfig::Point &point)const
{
- Point temp=pos-point;
+ Point temp=origin-point;
if(get_amount()==0)
return context.hit_check(point);
return context.get_color(point);
- Point temp=pos-point;
+ Point temp=origin-point;
/*const Real inner_radius = radius-feather;
const Real outer_radius = radius+feather;
const Real newfeather = (quality == 10) ? 0 : feather + (abs(ph)+abs(pw))/4.0;
//int u,v;
- int left = (int) floor( (pos[0] - x_neg*(radius+newfeather) - tl[0]) / pw );
- int right = (int) ceil( (pos[0] + x_neg*(radius+newfeather) - tl[0]) / pw );
- int top = (int) floor( (pos[1] - y_neg*(radius+newfeather) - tl[1]) / ph );
- int bottom = (int) ceil( (pos[1] + y_neg*(radius+newfeather) - tl[1]) / ph );
+ int left = (int) floor( (origin[0] - x_neg*(radius+newfeather) - tl[0]) / pw );
+ int right = (int) ceil( (origin[0] + x_neg*(radius+newfeather) - tl[0]) / pw );
+ int top = (int) floor( (origin[1] - y_neg*(radius+newfeather) - tl[1]) / ph );
+ int bottom = (int) ceil( (origin[1] + y_neg*(radius+newfeather) - tl[1]) / ph );
//clip the rectangle bounds
if(left < 0)
}
}
- if( (pos[0] - tl[0])*(pos[0] - tl[0]) + (pos[1] - tl[1])*(pos[1] - tl[1]) < inner_radius_sqd
- && (pos[0] - br[0])*(pos[0] - br[0]) + (pos[1] - br[1])*(pos[1] - br[1]) < inner_radius_sqd
- && (pos[0] - tl[0])*(pos[0] - tl[0]) + (pos[1] - br[1])*(pos[1] - br[1]) < inner_radius_sqd
- && (pos[0] - br[0])*(pos[0] - br[0]) + (pos[1] - tl[1])*(pos[1] - tl[1]) < inner_radius_sqd )
+ if( (origin[0] - tl[0])*(origin[0] - tl[0]) + (origin[1] - tl[1])*(origin[1] - tl[1]) < inner_radius_sqd
+ && (origin[0] - br[0])*(origin[0] - br[0]) + (origin[1] - br[1])*(origin[1] - br[1]) < inner_radius_sqd
+ && (origin[0] - tl[0])*(origin[0] - tl[0]) + (origin[1] - br[1])*(origin[1] - br[1]) < inner_radius_sqd
+ && (origin[0] - br[0])*(origin[0] - br[0]) + (origin[1] - tl[1])*(origin[1] - tl[1]) < inner_radius_sqd )
{
if(invert)
{
}
//make topf and leftf relative to the center of the circle
- leftf -= pos[0];
- topf -= pos[1];
+ leftf -= origin[0];
+ topf -= origin[1];
j = top;
y = topf;
}
}
- topf -= pos[1];
- leftf-= pos[0];
+ topf -= origin[1];
+ leftf-= origin[0];
j = top;
y = topf;
return Rect::full_plane();
Rect bounds(
- pos[0]+(radius+feather),
- pos[1]+(radius+feather),
- pos[0]-(radius+feather),
- pos[1]-(radius+feather)
+ origin[0]+(radius+feather),
+ origin[1]+(radius+feather),
+ origin[0]-(radius+feather),
+ origin[1]-(radius+feather)
);
return bounds;
if(is_solid_color() && color.get_a()==0)
{
Rect bounds(
- pos[0]+(radius+feather),
- pos[1]+(radius+feather),
- pos[0]-(radius+feather),
- pos[1]-(radius+feather)
+ origin[0]+(radius+feather),
+ origin[1]+(radius+feather),
+ origin[0]-(radius+feather),
+ origin[1]-(radius+feather)
);
return bounds & context.get_full_bounding_rect();
}
SYNFIG_LAYER_MODULE_EXT
private:
synfig::Color color;
- synfig::Point pos;
+ synfig::Point origin;
synfig::Real radius;
synfig::Real feather;
bool invert;
layer=get_canvas_interface()->add_layer_to("circle",canvas,depth);
layer_selection.push_back(layer);
- layer->set_param("pos",p1);
- get_canvas_interface()->signal_layer_param_changed()(layer,"pos");
+ layer->set_param("origin",p1);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
layer->set_param("radius",(p2-p1).mag());
get_canvas_interface()->signal_layer_param_changed()(layer,"radius");
layer=get_canvas_interface()->add_layer_to("text",canvas,depth);
layer_selection.push_back(layer);
- layer->set_param("pos",point);
- get_canvas_interface()->signal_layer_param_changed()(layer,"pos");
+ layer->set_param("origin",point);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
layer->set_param("text",text);
get_canvas_interface()->signal_layer_param_changed()(layer,"text");