X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_filter%2Fhalftone3.cpp;h=a2a4283d18669a607939c6f1dffaf05489b6d0e9;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=62b76d77c88ed33c6d2f88f60492fe6ee8059f9c;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_filter/halftone3.cpp b/synfig-core/trunk/src/modules/mod_filter/halftone3.cpp index 62b76d7..a2a4283 100644 --- a/synfig-core/trunk/src/modules/mod_filter/halftone3.cpp +++ b/synfig-core/trunk/src/modules/mod_filter/halftone3.cpp @@ -1,20 +1,22 @@ /* === S Y N F I G ========================================================= */ /*! \file halftone3.cpp -** \brief blehh +** \brief Implementation of the "Halftone 3" layer ** -** $Id: halftone3.cpp,v 1.1.1.1 2005/01/04 01:23:10 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 */ /* ========================================================================= */ @@ -52,10 +54,10 @@ using namespace etl; SYNFIG_LAYER_INIT(Halftone3); SYNFIG_LAYER_SET_NAME(Halftone3,"halftone3"); -SYNFIG_LAYER_SET_LOCAL_NAME(Halftone3,_("Halftone3")); -SYNFIG_LAYER_SET_CATEGORY(Halftone3,_("Filters")); +SYNFIG_LAYER_SET_LOCAL_NAME(Halftone3,N_("Halftone 3")); +SYNFIG_LAYER_SET_CATEGORY(Halftone3,N_("Filters")); SYNFIG_LAYER_SET_VERSION(Halftone3,"0.0"); -SYNFIG_LAYER_SET_CVS_ID(Halftone3,"$Id: halftone3.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $"); +SYNFIG_LAYER_SET_CVS_ID(Halftone3,"$Id$"); /* === P R O C E D U R E S ================================================= */ @@ -73,7 +75,7 @@ Halftone3::Halftone3() { tone[i].size=size; tone[i].type=type; - tone[i].offset=(synfig::Point(0,0)); + tone[i].origin=(synfig::Point(0,0)); tone[i].angle=Angle::deg(30.0)*(float)i; } @@ -91,7 +93,7 @@ Halftone3::Halftone3() color[1]=Color::green(); color[2]=Color::blue(); } - + set_blend_method(Color::BLEND_STRAIGHT); for(int i=0;i<3;i++) @@ -109,10 +111,10 @@ Halftone3::sync() tone[i].size=size; tone[i].type=type; } - + #define matrix inverse_matrix //float matrix[3][3]; - + if(subtractive) { for(int i=0;i<3;i++) @@ -153,38 +155,38 @@ Halftone3::sync() } #undef matrix - - + + #if 0 // Insert guass-jordan elimination code here int k=0,i=0,j=0,z_size=3; #define A inverse_matrix - - for (k=0;k(this); } @@ -248,19 +250,23 @@ Halftone3::set_param(const String & param, const ValueBase &value) IMPORT_PLUS(color[0],sync()); IMPORT_PLUS(color[1],sync()); IMPORT_PLUS(color[2],sync()); - + IMPORT_PLUS(subtractive,sync()); - + IMPORT(tone[0].angle); - IMPORT(tone[0].offset); + IMPORT(tone[0].origin); IMPORT(tone[1].angle); - IMPORT(tone[1].offset); + IMPORT(tone[1].origin); IMPORT(tone[2].angle); - IMPORT(tone[2].offset); - - return Layer_Composite::set_param(param,value); + IMPORT(tone[2].origin); + + IMPORT_AS(tone[0].origin,"tone[0].offset"); + IMPORT_AS(tone[1].origin,"tone[1].offset"); + IMPORT_AS(tone[2].origin,"tone[2].offset"); + + return Layer_Composite::set_param(param,value); } ValueBase @@ -274,20 +280,20 @@ Halftone3::get_param(const String & param)const EXPORT(color[2]); EXPORT(subtractive); - + EXPORT(tone[0].angle); - EXPORT(tone[0].offset); + EXPORT(tone[0].origin); EXPORT(tone[1].angle); - EXPORT(tone[1].offset); + EXPORT(tone[1].origin); EXPORT(tone[2].angle); - EXPORT(tone[2].offset); + EXPORT(tone[2].origin); EXPORT_NAME(); EXPORT_VERSION(); - - return Layer_Composite::get_param(param); + + return Layer_Composite::get_param(param); } Layer::Vocab @@ -310,25 +316,25 @@ Halftone3::get_param_vocab()const ret.push_back(ParamDesc("subtractive") .set_local_name(_("Subtractive Flag")) ); - + for(int i=0;i<3;i++) { String chan_name(strprintf("Chan%d",i)); - + ret.push_back(ParamDesc(strprintf("color[%d]",i)) .set_local_name(chan_name+_(" Color")) ); - ret.push_back(ParamDesc(strprintf("tone[%d].offset",i)) - .set_local_name(chan_name+_(" Mask Offset")) + ret.push_back(ParamDesc(strprintf("tone[%d].origin",i)) + .set_local_name(chan_name+_(" Mask Origin")) .set_is_distance() ); ret.push_back(ParamDesc(strprintf("tone[%d].angle",i)) .set_local_name(chan_name+_(" Mask Angle")) - .set_origin(strprintf("tone[%d].offset",i)) + .set_origin(strprintf("tone[%d].origin",i)) ); } - + return ret; } @@ -353,7 +359,7 @@ Halftone3::accelerated_render(Context context,Surface *surface,int quality, cons return false; if(get_amount()==0) return true; - + const Real pw(renddesc.get_pw()),ph(renddesc.get_ph()); const Point tl(renddesc.get_tl()); const int w(surface->get_w()); @@ -363,7 +369,7 @@ Halftone3::accelerated_render(Context context,Surface *surface,int quality, cons Surface::pen pen(surface->begin()); Point pos; int x,y; - + if(is_solid_color()) { for(y=0,pos[1]=tl[1];yamount_complete(10000,10000)) return false;