X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Flyr_std%2Fxorpattern.cpp;h=cbbfe566b3d09faaabd37fd52c582f30d82b8c52;hb=8fb13329e9e9caf813bd814c2a49b098a5623571;hp=8bfaa8ad32cfe6b0fdb8aecfb9293246ac793654;hpb=16b3beced25134bef064705568ecb893a6be4e79;p=synfig.git diff --git a/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp b/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp index 8bfaa8a..cbbfe56 100644 --- a/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/xorpattern.cpp @@ -1,18 +1,22 @@ -/*! ======================================================================== -** Sinfg -** Template File -** $Id: xorpattern.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $ +/* === S Y N F I G ========================================================= */ +/*! \file xorpattern.cpp +** \brief Template Header ** -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** $Id$ ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** 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 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. +** +** 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 ** ** === N O T E S =========================================================== ** @@ -29,14 +33,14 @@ #include "xorpattern.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #endif @@ -44,12 +48,12 @@ /* === G L O B A L S ======================================================= */ -SINFG_LAYER_INIT(XORPattern); -SINFG_LAYER_SET_NAME(XORPattern,"XORPattern"); -SINFG_LAYER_SET_LOCAL_NAME(XORPattern,_("XOR Pattern")); -SINFG_LAYER_SET_CATEGORY(XORPattern,_("Other")); -SINFG_LAYER_SET_VERSION(XORPattern,"0.1"); -SINFG_LAYER_SET_CVS_ID(XORPattern,"$Id: xorpattern.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $"); +SYNFIG_LAYER_INIT(XORPattern); +SYNFIG_LAYER_SET_NAME(XORPattern,"xor_pattern"); +SYNFIG_LAYER_SET_LOCAL_NAME(XORPattern,_("XOR Pattern")); +SYNFIG_LAYER_SET_CATEGORY(XORPattern,_("Other")); +SYNFIG_LAYER_SET_VERSION(XORPattern,"0.1"); +SYNFIG_LAYER_SET_CVS_ID(XORPattern,"$Id$"); /* === P R O C E D U R E S ================================================= */ @@ -60,7 +64,7 @@ XORPattern::XORPattern(): size(0.25,0.25) { } - + bool XORPattern::set_param(const String & param, const ValueBase &value) { @@ -74,29 +78,32 @@ XORPattern::get_param(const String & param)const { EXPORT(pos); EXPORT(size); - + EXPORT_NAME(); EXPORT_VERSION(); - - return ValueBase(); + + return ValueBase(); } Color XORPattern::get_color(Context context, const Point &point)const { - 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]-pos[0])/size[0]), b=(unsigned int)floor((point[1]-pos[1])/size[1]); unsigned char rindex=(a^b); unsigned char gindex=(a^(~b))*4; unsigned char bindex=~(a^b)*2; - return Color((Color::value_type)rindex/(Color::value_type)255.0,(Color::value_type)gindex/(Color::value_type)255.0,(Color::value_type)bindex/(Color::value_type)255.0,1.0); + return Color((Color::value_type)rindex/(Color::value_type)255.0, + (Color::value_type)gindex/(Color::value_type)255.0, + (Color::value_type)bindex/(Color::value_type)255.0, + 1.0); } - + Layer::Vocab XORPattern::get_param_vocab()const { Layer::Vocab ret; - + ret.push_back(ParamDesc("pos") .set_local_name(_("Offset")) ); @@ -104,6 +111,6 @@ XORPattern::get_param_vocab()const .set_local_name(_("Size")) .set_origin("pos") ); - + return ret; }