/* * filter_vignette.c -- vignette filter * Copyright (c) 2007 Marco Gittler * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #define MIN(a,b) (adx){ //center, make not darker continue; } else if (radius+smooth<=dx){//max dark after smooth area delta=0.0; }else{ //double sigx=5.0-10.0*(double)(dx-radius+smooth)/(2.0*smooth);//smooth >10 inner area, <-10 in dark area //delta=pow2[((int)((sigx+10.0)*SIGMOD_STEPS/20.0))];//sigmoidal delta = ((double)(radius+smooth-dx)/(2.0*smooth));//linear } delta=MAX(max_opac,delta); *pix=(double)(*pix)*delta; *(pix+1)=((double)(*(pix+1)-127.0)*delta)+127.0; } } // short a, short b, short c, short d // a= gray val pix 1 // b: +=blue, -=yellow // c: =gray pix 2 // d: +=red,-=green } return error; } static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { mlt_frame_push_service( frame, this ); mlt_frame_push_get_image( frame, filter_get_image ); return frame; } mlt_filter filter_vignette_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_filter this = mlt_filter_new( ); //int i=0; if ( this != NULL ) { /* for (i=-SIGMOD_STEPS/2;iprocess = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "start", "80:50,50x50,0" ); //mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "end", "" ); } return this; }