X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Flayer_motionblur.cpp;h=59f90f7a145fbf6240c687572ff07f7a9ec8ba8b;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=0cf853401a5455dc7f11b7729055540711a44c70;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/layer_motionblur.cpp b/synfig-core/trunk/src/synfig/layer_motionblur.cpp index 0cf8534..59f90f7 100644 --- a/synfig-core/trunk/src/synfig/layer_motionblur.cpp +++ b/synfig-core/trunk/src/synfig/layer_motionblur.cpp @@ -1,20 +1,22 @@ /* === S Y N F I G ========================================================= */ -/*! \file layer_motionblur.h -** \brief Template Header +/*! \file layer_motionblur.cpp +** \brief Implementation of the "Motion Blur" layer ** -** $Id: layer_motionblur.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007, 2008 Chris Moore ** -** 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 */ /* ========================================================================= */ @@ -50,11 +52,11 @@ using namespace std; /* === G L O B A L S ======================================================= */ SYNFIG_LAYER_INIT(Layer_MotionBlur); -SYNFIG_LAYER_SET_NAME(Layer_MotionBlur,"MotionBlur"); -SYNFIG_LAYER_SET_LOCAL_NAME(Layer_MotionBlur,_("Motion Blur")); -SYNFIG_LAYER_SET_CATEGORY(Layer_MotionBlur,_("Blurs")); +SYNFIG_LAYER_SET_NAME(Layer_MotionBlur,"MotionBlur"); // todo: use motion_blur +SYNFIG_LAYER_SET_LOCAL_NAME(Layer_MotionBlur,N_("Motion Blur")); +SYNFIG_LAYER_SET_CATEGORY(Layer_MotionBlur,N_("Blurs")); SYNFIG_LAYER_SET_VERSION(Layer_MotionBlur,"0.1"); -SYNFIG_LAYER_SET_CVS_ID(Layer_MotionBlur,"$Id: layer_motionblur.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $"); +SYNFIG_LAYER_SET_CVS_ID(Layer_MotionBlur,"$Id$"); /* === M E M B E R S ======================================================= */ @@ -63,12 +65,12 @@ Layer_MotionBlur::Layer_MotionBlur(): aperture (0) { } - + bool Layer_MotionBlur::set_param(const String ¶m, const ValueBase &value) { - IMPORT(aperture); + IMPORT(aperture); return Layer_Composite::set_param(param,value); } @@ -76,10 +78,10 @@ ValueBase Layer_MotionBlur::get_param(const String ¶m)const { EXPORT(aperture); - + EXPORT_NAME(); EXPORT_VERSION(); - + return Layer_Composite::get_param(param); } @@ -105,7 +107,7 @@ Layer_MotionBlur::get_color(Context context, const Point &pos)const Time time(time_cur); time+=(Vector::value_type)( (signed)(RAND_MAX/2)-(signed)rand() )/(Vector::value_type)(RAND_MAX) *aperture -aperture*0.5; context.set_time(time, pos); - } + } */ return context.get_color(pos); } @@ -115,19 +117,19 @@ Layer_MotionBlur::get_param_vocab()const { Layer::Vocab ret; //ret=Layer_Composite::get_param_vocab(); - + ret.push_back(ParamDesc("aperture") - .set_local_name(_("Aperature")) + .set_local_name(_("Aperture")) .set_description(_("Shutter Time")) ); - + return ret; } bool Layer_MotionBlur::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const { - if(aperture && quality<10) + if(aperture && quality<=10) { //int x, y; SuperCallback subimagecb; @@ -159,37 +161,42 @@ Layer_MotionBlur::accelerated_render(Context context,Surface *surface,int qualit samples=3; break; case 9: - samples=3; + samples=2; break; case 10: // Rough Quality - default: + default: samples=1; break; - + } - + + if (samples == 1) return context.accelerated_render(surface,quality,renddesc,cb); + Surface tmp; int i; + float scale, divisor = 0; surface->set_wh(renddesc.get_w(),renddesc.get_h()); surface->clear(); - + for(i=0;i