X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fblur.cpp;h=2b481f03d660a82f2b39e3f33fe83c28acdf90d9;hb=7c70b39267a02a92da8293b4ff5759b3f4f738d9;hp=3d22fc8afcbc1ac0a2e50af0c0a90a7b63bf349f;hpb=e3acc0b267b14fda5db3c7bbb2f218b993ef84b3;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/blur.cpp b/synfig-core/trunk/src/synfig/blur.cpp index 3d22fc8..2b481f0 100644 --- a/synfig-core/trunk/src/synfig/blur.cpp +++ b/synfig-core/trunk/src/synfig/blur.cpp @@ -1,20 +1,21 @@ -/* === S I N F G =========================================================== */ +/* === S Y N F I G ========================================================= */ /*! \file blur.cpp ** \brief Blur Implementation File ** ** $Id: blur.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -28,8 +29,8 @@ # include #endif -#include -#include +#include +#include #include "blur.h" @@ -46,7 +47,7 @@ using namespace std; using namespace etl; -using namespace sinfg; +using namespace synfig; /* === M A C R O S ========================================================= */ @@ -113,7 +114,7 @@ Point Blur::operator ()(const Point &pos) const return blurpos; } -Point Blur::operator ()(sinfg::Real x, sinfg::Real y) const +Point Blur::operator ()(synfig::Real x, synfig::Real y) const { return (*this)(Point(x,y)); } @@ -469,7 +470,7 @@ bool Blur::operator ()(const Surface &surface, Surface worksurface(w,h); - //sinfg::info("Blur: check surface = %s", surface_valid(surface)?"true":"false"); + //synfig::info("Blur: check surface = %s", surface_valid(surface)?"true":"false"); // Premultiply the alpha for(y=0;y temp %d", length); + //synfig::info("Blur: hbox blur work -> temp %d", length); etl::hbox_blur(worksurface.begin(),worksurface.end(),length,temp_surface.begin()); } else temp_surface = worksurface; - //sinfg::info("Blur: hbox finished"); + //synfig::info("Blur: hbox finished"); //vertical part //Surface temp_surface2; @@ -580,11 +581,11 @@ bool Blur::operator ()(const Surface &surface, int length = halfsizey; length = std::max(1,length); - //sinfg::info("Blur: vbox blur temp -> work %d",length); + //synfig::info("Blur: vbox blur temp -> work %d",length); etl::vbox_blur(temp_surface.begin(),temp_surface.end(),length,worksurface.begin()); } else worksurface = temp_surface; - //sinfg::info("Blur: vbox finished"); + //synfig::info("Blur: vbox finished"); //blend with the original surface /*int x,y; @@ -616,24 +617,24 @@ bool Blur::operator ()(const Surface &surface, //horizontal part if(size[0]) { - int length=(int)(abs((float)w/(resolution[0]))*size[0]*0.5+1); - length=std::max(1,length); + Real length=abs((float)w/(resolution[0]))*size[0]*0.5+1; + length=std::max(1.0,length); //two box blurs produces: 1 2 1 - etl::hbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin()); - etl::hbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin()); + etl::hbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin()); + etl::hbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin()); } //else temp_surface2=worksurface; //vertical part if(size[1]) { - int length=(int)(abs((float)h/(resolution[1]))*size[1]*0.5+1); - length=std::max(1,length); + Real length=abs((float)h/(resolution[1]))*size[1]*0.5+1; + length=std::max(1.0,length); //two box blurs produces: 1 2 1 on the horizontal 1 2 1 - etl::vbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin()); - etl::vbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin()); + etl::vbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin()); + etl::vbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin()); } //else temp_surface2=temp_surface2; @@ -702,7 +703,7 @@ bool Blur::operator ()(const Surface &surface, Surface temp_surface; Surface *gauss_surface; - //sinfg::warning("Didn't crash yet b1"); + //synfig::warning("Didn't crash yet b1"); //if(get_amount()==1.0 && get_blend_method()==Color::BLEND_STRAIGHT) gauss_surface = &worksurface; @@ -736,7 +737,7 @@ bool Blur::operator ()(const Surface &surface, memset(SC0,0,(w+2)*sizeof(Color)); memset(SC0,0,(w+2)*sizeof(Color)); - //sinfg::warning("Didn't crash yet b2"); + //synfig::warning("Didn't crash yet b2"); //int i = 0; while(bw&&bh) @@ -761,7 +762,7 @@ bool Blur::operator ()(const Surface &surface, bw--,bh--; } - //sinfg::warning("Didn't crash yet bi - %d",i++); + //synfig::warning("Didn't crash yet bi - %d",i++); } while(bw) { @@ -777,7 +778,7 @@ bool Blur::operator ()(const Surface &surface, GuassianBlur_2x1(*gauss_surface); bw--; } - //sinfg::warning("Didn't crash yet bi - %d",i++); + //synfig::warning("Didn't crash yet bi - %d",i++); } while(bh) { @@ -793,7 +794,7 @@ bool Blur::operator ()(const Surface &surface, GuassianBlur_1x2(*gauss_surface); bh--; } - //sinfg::warning("Didn't crash yet bi - %d",i++); + //synfig::warning("Didn't crash yet bi - %d",i++); } delete [] SC0; @@ -808,7 +809,7 @@ bool Blur::operator ()(const Surface &surface, for(x=0;x &surface, //horizontal part if(size[0]) { - int length=(int)(abs((float)w/(resolution[0]))*size[0]*0.5+1); - length=std::max(1,length); + Real length=abs((float)w/(resolution[0]))*size[0]*0.5+1; + length=std::max(1.0,length); //two box blurs produces: 1 2 1 - etl::hbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin()); - etl::hbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin()); + etl::hbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin()); + etl::hbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin()); } //else temp_surface2=worksurface; //vertical part if(size[1]) { - int length=(int)(abs((float)h/(resolution[1]))*size[1]*0.5+1); - length=std::max(1,length); + Real length=abs((float)h/(resolution[1]))*size[1]*0.5+1; + length=std::max(1.0,length); //two box blurs produces: 1 2 1 on the horizontal 1 2 1 - etl::vbox_blur(worksurface.begin(),w,h,length*3/4,temp_surface.begin()); - etl::vbox_blur(temp_surface.begin(),w,h,length*3/4,worksurface.begin()); + etl::vbox_blur(worksurface.begin(),w,h,(int)(length*3/4),temp_surface.begin()); + etl::vbox_blur(temp_surface.begin(),w,h,(int)(length*3/4),worksurface.begin()); } //else temp_surface2=temp_surface2;