From: dooglus Date: Fri, 11 Apr 2008 12:46:43 +0000 (+0000) Subject: Rename all 'pos' parameters to 'origin'. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4a6b5f2e444558761c4e8afccaa61fb2c58ec593;p=synfig.git Rename all 'pos' parameters to 'origin'. git-svn-id: http://svn.voria.com/code@2013 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp b/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp index 3df707e..2da592a 100644 --- a/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp +++ b/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp @@ -93,7 +93,7 @@ Layer_Freetype::Layer_Freetype() 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; @@ -458,7 +458,7 @@ Layer_Freetype::set_param(const String & param, const ValueBase &value) 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; } }); @@ -469,6 +469,8 @@ Layer_Freetype::set_param(const String & param, const ValueBase &value) 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); } @@ -482,7 +484,7 @@ Layer_Freetype::get_param(const String& param)const EXPORT(size); EXPORT(text); EXPORT(color); - EXPORT(pos); + EXPORT(origin); EXPORT(orient); EXPORT(compress); EXPORT(vcompress); @@ -549,7 +551,7 @@ Layer_Freetype::get_param_vocab(void)const .set_local_name(_("Size")) .set_description(_("Size of the text")) .set_hint("size") - .set_origin("pos") + .set_origin("origin") .set_scalar(1) ); @@ -559,8 +561,8 @@ Layer_Freetype::get_param_vocab(void)const .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")) ); @@ -657,8 +659,8 @@ Layer_Freetype::accelerated_render(Context context,Surface *surface,int quality, 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; @@ -852,16 +854,16 @@ Layer_Freetype::accelerated_render(Context context,Surface *surface,int quality, 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::iterator iter2; diff --git a/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.h b/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.h index 968d2ca..81261bc 100644 --- a/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.h +++ b/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.h @@ -119,7 +119,7 @@ private: synfig::Vector size; synfig::Vector orient; synfig::Color color; - synfig::Point pos; + synfig::Point origin; synfig::Real compress; synfig::Real vcompress; diff --git a/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp b/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp index e4e07f8..265d014 100644 --- a/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp @@ -62,7 +62,7 @@ SYNFIG_LAYER_SET_CVS_ID(XORPattern,"$Id$"); XORPattern::XORPattern(): Layer_Composite (1.0,Color::BLEND_STRAIGHT), - pos(0.125,0.125), + origin(0.125,0.125), size(0.25,0.25) { } @@ -70,16 +70,18 @@ XORPattern::XORPattern(): 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(); @@ -94,7 +96,7 @@ XORPattern::get_color(Context context, const Point &point)const 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; @@ -116,12 +118,12 @@ XORPattern::get_param_vocab()const { 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; diff --git a/synfig-core/trunk/src/modules/lyr_std/xorpattern.h b/synfig-core/trunk/src/modules/lyr_std/xorpattern.h index f0471f6..22d5a7d 100644 --- a/synfig-core/trunk/src/modules/lyr_std/xorpattern.h +++ b/synfig-core/trunk/src/modules/lyr_std/xorpattern.h @@ -51,7 +51,7 @@ class XORPattern : public synfig::Layer_Composite, public synfig::Layer_NoDeform private: - Point pos; + Point origin; Point size; public: diff --git a/synfig-core/trunk/src/modules/mod_geometry/checkerboard.cpp b/synfig-core/trunk/src/modules/mod_geometry/checkerboard.cpp index 25edead..29f52e3 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/checkerboard.cpp +++ b/synfig-core/trunk/src/modules/mod_geometry/checkerboard.cpp @@ -66,7 +66,7 @@ SYNFIG_LAYER_SET_CVS_ID(CheckerBoard,"$Id$"); 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)) { @@ -76,10 +76,10 @@ CheckerBoard::CheckerBoard(): 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; } @@ -90,11 +90,13 @@ CheckerBoard::set_param(const String ¶m, const ValueBase &value) 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); } @@ -102,9 +104,7 @@ ValueBase 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(); @@ -121,13 +121,13 @@ CheckerBoard::get_param_vocab()const .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; diff --git a/synfig-core/trunk/src/modules/mod_geometry/checkerboard.h b/synfig-core/trunk/src/modules/mod_geometry/checkerboard.h index 6bf2f2b..4e40538 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/checkerboard.h +++ b/synfig-core/trunk/src/modules/mod_geometry/checkerboard.h @@ -44,7 +44,7 @@ class CheckerBoard : public synfig::Layer_Composite, public synfig::Layer_NoDefo 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; diff --git a/synfig-core/trunk/src/modules/mod_geometry/circle.cpp b/synfig-core/trunk/src/modules/mod_geometry/circle.cpp index db2983d..8df1e78 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/circle.cpp +++ b/synfig-core/trunk/src/modules/mod_geometry/circle.cpp @@ -62,7 +62,7 @@ SYNFIG_LAYER_SET_CVS_ID(Circle,"$Id$"); Circle::Circle(): Layer_Composite (1.0,Color::BLEND_STRAIGHT), color (Color::black()), - pos (0,0), + origin (0,0), radius (1), feather (0), invert (false), @@ -80,9 +80,11 @@ Circle::ImportParameters(const String ¶m, const ValueBase &value) 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); } @@ -105,7 +107,7 @@ Circle::get_param(const String ¶m)const EXPORT(radius); EXPORT(feather); EXPORT(invert); - EXPORT(pos); + EXPORT(origin); EXPORT(falloff); EXPORT_NAME(); @@ -124,15 +126,15 @@ Circle::get_param_vocab()const ); 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")) @@ -156,7 +158,7 @@ Circle::get_param_vocab()const 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); @@ -308,7 +310,7 @@ Circle::get_color(Context context, const Point &point)const 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; @@ -448,10 +450,10 @@ Circle::accelerated_render(Context context,Surface *surface,int quality, const R 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) @@ -524,10 +526,10 @@ Circle::accelerated_render(Context context,Surface *surface,int quality, const R } } - 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) { @@ -569,8 +571,8 @@ Circle::accelerated_render(Context context,Surface *surface,int quality, const R } //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; @@ -681,8 +683,8 @@ Circle::accelerated_render(Context context,Surface *surface,int quality, const R } } - topf -= pos[1]; - leftf-= pos[0]; + topf -= origin[1]; + leftf-= origin[0]; j = top; y = topf; @@ -753,10 +755,10 @@ Circle::get_bounding_rect()const 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; @@ -770,10 +772,10 @@ Circle::get_full_bounding_rect(Context context)const 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(); } diff --git a/synfig-core/trunk/src/modules/mod_geometry/circle.h b/synfig-core/trunk/src/modules/mod_geometry/circle.h index 3eba1ad..32a4ce8 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/circle.h +++ b/synfig-core/trunk/src/modules/mod_geometry/circle.h @@ -46,7 +46,7 @@ class Circle : public synfig::Layer_Composite, public synfig::Layer_NoDeform SYNFIG_LAYER_MODULE_EXT private: synfig::Color color; - synfig::Point pos; + synfig::Point origin; synfig::Real radius; synfig::Real feather; bool invert; diff --git a/synfig-studio/trunk/src/gtkmm/state_circle.cpp b/synfig-studio/trunk/src/gtkmm/state_circle.cpp index 8dde013..b83431b 100644 --- a/synfig-studio/trunk/src/gtkmm/state_circle.cpp +++ b/synfig-studio/trunk/src/gtkmm/state_circle.cpp @@ -594,8 +594,8 @@ StateCircle_Context::make_circle(const Point& _p1, const Point& _p2) 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"); diff --git a/synfig-studio/trunk/src/gtkmm/state_text.cpp b/synfig-studio/trunk/src/gtkmm/state_text.cpp index c0639a4..8eda981 100644 --- a/synfig-studio/trunk/src/gtkmm/state_text.cpp +++ b/synfig-studio/trunk/src/gtkmm/state_text.cpp @@ -401,8 +401,8 @@ StateText_Context::make_text(const Point& _point) 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");