| Class | RS::Graphics::RSImageList |
| In: |
rsil/graphics/rsimagelist.rb
|
| Parent: | Array |
| Class: | RSImageList |
| File: | rsimagelist.rb |
| Purpose: | RSImageList represents a list of RSImages. If you call methods which are not represented within this class, the message / method call will be delegated to each image in the list. That menas: you can set attributes for each image calling ‘imagelist.gamma = 1.0’. |
| Created by: | Mario Pehle, 2006/04/29 |
| Required modules: | - |
| Offers functions: | - |
| Description: | Initialize the RSCIImageList either with a String, OSX::NSURL, OSX::CIImage, RS::RSCIImage or without a parameter. |
| Precondition: | ‘images’ |
| Postcondition: | @delegate is set, images are added |
| Exceptions: | - |
| Uses: | RSImageList#<< |
| Returns: | self |
| Parameters: | Name | i/o/io | default | Meaning |
| : | images | i | nil | RSImage / Array, the images to initialize with |
# File rsil/graphics/rsimagelist.rb, line 45
45: def initialize images=nil
46: if images.respond_to? :each
47: images.each do |image|
48: if image.kind_of? RS::Graphics::RSImage
49: self << image
50: else
51: self << RS::Graphics::RSImage.new(image.to_s)
52: end
53: end
54: elsif images.kind_of? RS::Graphics::RSImage
55: self << images
56: end
57: @delegate = self
58: self
59: end
| Description: | Processes the images with given filter(s) and returns the result as a new RSImageList. If no filter is given, the filters already added to the single images will process its image. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RSImageList, RSImageList#each, RSImage#apply_filters |
| Returns: | RSImageList |
| Parameters: | Name | i/o/io | default | Meaning |
| : | filters | i | nil | RSFilter / Array, the filters to add to images |
# File rsil/graphics/rsimagelist.rb, line 226
226: def apply_filters filter=nil
227: rl = RS::Graphics::RSImageList.new
228: self.each { |img| rl << img.apply_filters(filter) }
229: rl
230: end
| Description: | Checks an object whether it contains only RSImages. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | [object]each |
| Returns: | true if only contains RSImages, false if not |
| Parameters: | Name | i/o/io | default | Meaning |
| : | object | i | self | Object, should provide method "each" |
# File rsil/graphics/rsimagelist.rb, line 74
74: def contains_only_rsimages? object=self
75: contains = true
76: if object.respond_to? :each
77: object.each do |e|
78: contains = e.kind_of?(RS::Graphics::RSImage) if contains
79: end
80: end
81: contains
82: end
| Description: | Checks an object whether it contains at least one RSImage. Checks self if no object is given. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | [object]each |
| Returns: | true if contains RSImage, false if not |
| Parameters: | Name | i/o/io | default | Meaning |
| : | object | i | self | Object, should provide method "each" |
# File rsil/graphics/rsimagelist.rb, line 97
97: def contains_rsimages? object=self
98: contains = false
99: if object.respond_to? :each
100: object.each do |e|
101: contains = e.kind_of?(RS::Graphics::RSImage) unless contains
102: end
103: end
104: contains
105: end
| Description: | Checks an object whether it is a RSImage. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | - |
| Returns: | true if object is a RSImages, false if not |
| Parameters: | Name | i/o/io | default | Meaning |
| : | object | i | - | Object to check |
# File rsil/graphics/rsimagelist.rb, line 120
120: def is_rsimage? object
121: object.kind_of? RS::Graphics::RSImage
122: end
| Description: | Creates a RSImageList with its components in reverse order. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RSImageList#new, super |
| Returns: | RSImageList |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/graphics/rsimagelist.rb, line 136
136: def reverse
137: self.class.new super
138: end
| Description: | The reverse version of "RSImageList#each_index". |
| Precondition: | - |
| Postcondition: | Depending on the call, self is changed. |
| Exceptions: | - |
| Uses: | RSImageList#length |
| Returns: | self |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/graphics/rsimagelist.rb, line 152
152: def reverse_each_index
153: self.length.times { |i| yield self.length-1-i }
154: self
155: end
| Description: | The reverse version of "RSImageList#each_with_index" |
| Precondition: | - |
| Postcondition: | Depending on the call, self is changed. |
| Exceptions: | - |
| Uses: | RSImageList#length |
| Returns: | true if only contains RSImages, false if not |
| Parameters: | Name | i/o/io | default | Meaning |
| : | object | i | - | Object, should provide method "each" |
# File rsil/graphics/rsimagelist.rb, line 170
170: def reverse_each_with_index
171: self.length.times do |i|
172: ri = self.length-1-i
173: yield self.at(ri), ri
174: end
175: end
| Description: | Creates a simple Array out of members. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | Array, RSImage#each |
| Returns: | Array |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/graphics/rsimagelist.rb, line 189
189: def to_a
190: arr = []
191: self.each { |img| arr << img }
192: arr
193: end
| Description: | Creates a RSImageList, in which no element appears twice. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RSImageList#clone |
| Returns: | RSImageList |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/graphics/rsimagelist.rb, line 207
207: def uniq
208: rl = self.clone
209: rl.uniq!
210: rl
211: end