| Class | RS::Graphics::RSImageUnit |
| In: |
rsil/graphics/rsimageunit.rb
|
| Parent: | Object |
| Class: | RSImageUnit |
| File: | rsimageunit.rb |
| Purpose: | RSFilter represents an Image Unit for Filters through wrapping of OSX::CIPlugin |
| Created by: | Mario Pehle, 2006/04/29 |
| Required modules: | - |
| Offers functions: | - |
| file | [R] | saves the path and filename of the Image Unit as a String. |
| Description: | Checks, whether image unit was loaded. If no argument is given, checks the actual image unit if loaded. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | @@loaded_files |
| Returns: | true if loaded, else false |
| Parameters: | Name | i/o/io | default | Meaning |
| : | file | i | - | String, the path and name of the file to check |
# File rsil/graphics/rsimageunit.rb, line 116
116: def self::image_unit_loaded? file
117: @@loaded_files.include?(file)
118: end
| Description: | Loads all filters (executable and nonexecutable) from image units stored in files with extension .plugin. Scans the directories /Library/Graphics/Image Units and ~/Library/Graphics/Image Units. Because of the used method this method can not guarantee, that the Image Unit was loaded successfully. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | OSX::CIPlugIn.oadPlugIns |
| Returns: | nil |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/graphics/rsimageunit.rb, line 52
52: def self::load_all_image_units
53: OSX::CIPlugIn.loadAllPlugIns
54: end
| Description: | Loads all filters from specified image units. Loads executable and nonexecutable filters by default. Set ‘only_nonexecutable’ to true to only load nonexecutable filters from the specified image unit. The return value "true" does not necessarily mean, the filters are loaded, but that the call to load the image unit was done the first time. |
| Precondition: | Loads the file if not already loaded. |
| Postcondition: | @@loaded_files is changed. |
| Exceptions: | - |
| Uses: | OSX::CIPlugIN.loadPlugIn, OSX::NSURL |
| Returns: | true if loaded first, else false |
| Parameters: | Name | i/o/io | default | Meaning |
| : | file | i | - | String, the path and filename of the image unit to load |
| : | only_nonexecutables | i | false | Boolean, only load nonexecutable filters from specified image unit |
# File rsil/graphics/rsimageunit.rb, line 86
86: def self::load_image_unit file, only_nonexecutables=false
87: unless @@loaded_files.include? file and
88: file.respond_to?(:to_s) and
89: !file.nil?
90: nsurl = OSX::NSURL.fileURLWithPath file
91: assert "nsurl not initialized" if nsurl.nil?
92: OSX::CIPlugIn.loadPlugIn(
93: nsurl,
94: :allowNonExecutable,
95: only_nonexecutables
96: )
97: @@loaded_files << file
98: return true
99: end
100: false
101: end
| Description: | Loads all nonexecutable filters from image units stored in files with extension .plugin. Scans the directories /Library/Graphics/Image Units and ~/Library/Graphics/Image Units. Because of the used method this method can not guarantee, that the Image Unit was loaded successfully. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | OSX::CIPlugIn.loadNonExecutablePlugIns |
| Returns: | nil |
| Parameters: | Name | i/o/io | default | Meaning |
# File rsil/graphics/rsimageunit.rb, line 68
68: def self::load_nonexecutable_filters
69: OSX::CIPlugIn.loadNonExecutablePlugIns
70: end
| Description: | Initialize the RSImageList with a String. |
| Precondition: | - |
| Postcondition: | @file is changed. |
| Exceptions: | ArgumentError |
| Uses: | @file |
| Returns: | self |
| Parameters: | Name | i/o/io | default | Meaning |
| : | file | i | - | String, the path and name of the image unit file |
# File rsil/graphics/rsimageunit.rb, line 133
133: def initialize file
134: unless file.nil?
135: if file.respond_to? :to_str
136: @file = file.to_str
137: else
138: raise ArgumentError, "Can not convert argument."
139: end
140: else
141: raise ArgumentError, "Argument 'file' has to be a String."
142: end
143: self
144: end
| Description: | Checks, whether image unit was loaded. If no argument is given, checks the actual image unit if loaded. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | @file, @@loaded_files |
| Returns: | true if loaded, else false |
| Parameters: | Name | i/o/io | default | Meaning |
| : | file | i | nil | String, the path and name of the file to check |
# File rsil/graphics/rsimageunit.rb, line 176
176: def image_unit_loaded? file=nil
177: if file.nil?
178: return @@loaded_files.include?(@file)
179: else
180: return @@loaded_files.include?(file)
181: end
182: end
| Description: | Loads all filters from specified image units. Loads executable and nonexecutable filters by default. Set ‘only_nonexecutable’ to true to only load nonexecutable filters from the specified image unit. The return value "true" does not necessarily mean, the filters are loaded, but that the call to load the image unit was done the first time. |
| Precondition: | - |
| Postcondition: | - |
| Exceptions: | - |
| Uses: | RSImageUnit#load_image_unit |
| Returns: | true if loaded first, else false |
| Parameters: | Name | i/o/io | default | Meaning |
| : | only_nonexecutables | i | false | Boolean, only load nonexecutable filters from specified image unit |
# File rsil/graphics/rsimageunit.rb, line 159
159: def load_image_unit only_nonexecutables=false
160: self.class.load_image_unit @file, only_nonexecutables
161: end