1
# filter.rb : The base class for filters
2
# Copyright (C) 2006 Vincent Fourmond
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
# The base class for filters. Just an interface, in the java meaning of
24
# the term. A filter just provides a function to apply itself.
26
# Import the main description functions into the appropriate
28
extend Descriptions::DescriptionExtend
29
include Descriptions::DescriptionInclude
35
# Creates a description object with the given texts and associates
36
# it with the class. To be used in Filter subclasses, simply this way:
38
# describe "biniou", "Biniou filter", "A filter to take out Binious"
40
# Please remember also that if you don't set a description for
41
# your Filter, it will most likely be of no use to anyone...
43
def Filter.describe(name, longname, desc)
44
d = FilterDescription.new(self,name, longname, desc)
46
register_description(d)
49
# Gets a Function (or assimilate ?) and applies the filter on them.
50
# The functions *should not modify any data in ary*.
51
# By default, the mechanism is to make a copy of the data and apply
54
f = Dobjects::Function.new(a.x.dup, a.y.dup)
59
# This version modifies directly the Function inside the +f+.
65
# Specializes Descriptions for filters
66
class FilterDescription < Descriptions::Description