public class ImageLoader extends DataLoader
| Constructor and Description |
|---|
ImageLoader(processing.core.PApplet parent)
Builds the ImageLoader and registers the KeyEvent to the parent
(PApplet).
|
ImageLoader(processing.core.PApplet parent,
boolean autoResize)
Builds the ImageLoader and registers the KeyEvent to the parent
(PApplet).
|
ImageLoader(processing.core.PApplet parent,
java.lang.String folderName)
Builds the ImageLoader and registers the KeyEvent to the parent
(PApplet).
|
ImageLoader(processing.core.PApplet parent,
java.lang.String folderName,
boolean autoResize)
Builds the ImageLoader and registers the KeyEvent to the parent
(PApplet).
|
ImageLoader(processing.core.PApplet parent,
java.lang.String folderPath,
java.lang.String folderName)
Builds the ImageLoader and registers the KeyEvent to the parent
(PApplet).
|
ImageLoader(processing.core.PApplet parent,
java.lang.String folderPath,
java.lang.String folderName,
boolean autoResize)
Builds the ImageLoader and registers the KeyEvent to the parent
(PApplet).
|
| Modifier and Type | Method and Description |
|---|---|
ImageLoader |
addObserver(ImageUpdateObserver observer)
Add an object that wants to be informed when there is a change of the
current image.
|
ImageLoader |
clearObservers()
Remove all observers from this loader.
|
ImageLoader |
disableAutoResize()
Disable auto resizing of images.
|
ImageLoader |
disableKeys()
Disable the automatic key events of this object.
|
ImageLoader |
enableAutoResize()
Enable auto resizing of images.
|
ImageLoader |
enableKeys()
Enables the automatic key events of this object.
|
processing.core.PImage |
first()
Loads (if necessary) and returns the first file of the given folder.
|
processing.core.PImage |
get(int index)
Loads (if necessary) and returns the file with the given index.
|
processing.core.PImage |
getCurrent()
Loads (if necessary) and returns the current file.
|
processing.core.PImage |
last()
Loads (if necessary) and returns the last file of the given folder.
|
processing.core.PImage[] |
loadAllFiles()
Loads all files (if not loaded yet) and returns them all.
|
processing.core.PImage |
loadFile(int index)
Loads a file with the given index and returns it.
|
processing.core.PImage |
next()
Loads (if necessary) and returns the next file of the given folder.
|
processing.core.PImage |
nextRandom()
Loads (if necessary) and returns the next random file of the given
folder.
|
processing.core.PImage |
previous()
Loads (if necessary) and returns the previous file of the given folder.
|
ImageLoader |
removeObserver(ImageUpdateObserver observer)
Remove an observer from this loader.
|
ImageLoader |
resetKeySettings()
Resets the key settings for the KeyEvents to its default.
|
ImageLoader |
setIndex(int index)
Sets the current element.
|
ImageLoader |
setIndex(java.lang.String filename)
Sets the current element.
|
ImageLoader |
setKey(java.lang.String which,
char key)
Links a certain method call (e.g. next()) with a certain key (e.g.
|
DataLoader |
setKey(java.lang.String which,
int keyCode)
Links a certain method call (e.g. next()) with a certain keyCode (e.g.
|
ImageLoader |
update()
Re-Loads all the absolute paths for all valid files defined by the given
type in the set folder.
|
getFileName, getFileName, getFileName, getFileName, getFolder, getLoadingDirectory, getPath, keyEvent, loadPaths, loadPaths, sizepublic ImageLoader(processing.core.PApplet parent)
parent - A PApplet object.public ImageLoader(processing.core.PApplet parent,
boolean autoResize)
parent - A PApplet object.autoResize - If true, all images will be resized to the parents width and
height directly after they are loaded.public ImageLoader(processing.core.PApplet parent,
java.lang.String folderName)
parent - A PApplet object.folderName - Folder containing files (not null). This folder should at
least contain one image file. The given folder should be a
sub-folder in the current sketch folder or a relative path to
the sketch folder. e.g. "..\\data" is a folder which is
located in the parent directory of the sketch folder. Make
sure to escape the backslashes in the path in the shown way.public ImageLoader(processing.core.PApplet parent,
java.lang.String folderName,
boolean autoResize)
parent - A PApplet object.folderName - Folder containing files (not null). This folder should at
least contain one image file. The given folder should be a
sub-folder in the current sketch folder or a relative path to
the sketch folder. e.g. "..\\data" is a folder which is
located in the parent directory of the sketch folder. Make
sure to escape the backslashes in the path in the shown way.autoResize - If true, all images will be resized to the parents width and
height directly after they are loaded.public ImageLoader(processing.core.PApplet parent,
java.lang.String folderPath,
java.lang.String folderName)
parent - A PApplet object.folderPath - A absolute path to the folder. Example:
"C:\\" is the folderPath and "data
" is the foldername then the files of the folder located at "
C:\\data\\" will be loaded. Make sure to escape the
backslashes in the path in the shown way. If folderPath is
null, the sketch location will be used to set this path.folderName - Folder containing files (not null). This folder should at
least contain one image file. The given folder should be a
sub-folder of folderpath or a relative path to folderPath.
e.g. "C:\\data" is the folderpath and "..\\temp" is the
foldername then "C:\\temp\\" will be the location where the
files will be loaded. Make sure to escape the backslashes in
the path in the shown way.public ImageLoader(processing.core.PApplet parent,
java.lang.String folderPath,
java.lang.String folderName,
boolean autoResize)
parent - A PApplet object.folderPath - A absolute path to the folder. Example:
"C:\\" is the folderPath and "data
" is the foldername then the files of the folder located at "
C:\\data\\" will be loaded. Make sure to escape the
backslashes in the path in the shown way.folderName - Folder containing files (not null). This folder should at
least contain one image file. The given folder should be a
sub-folder of folderpath or a relative path to folderPath.
e.g. "C:\\data" is the folderpath and "..\\temp" is the
foldername then "C:\\temp\\" will be the location where the
files will be loaded. Make sure to escape the backslashes in
the path in the shown way.autoResize - If true, all images will be resized to the parents width and
height directly after they are loaded.public ImageLoader update()
DataLoaderupdate in class DataLoaderpublic ImageLoader resetKeySettings()
DataLoaderresetKeySettings in class DataLoaderpublic ImageLoader disableKeys()
DataLoaderdisableKeys in class DataLoaderpublic ImageLoader enableKeys()
DataLoaderenableKeys in class DataLoaderpublic DataLoader setKey(java.lang.String which, int keyCode)
DataLoadersetKey in class DataLoaderwhich - A String representing the method which should be linked to the
keyCode. Possible values: \ "previous\", \"next\", \"first\",
\"last\", \"random\".keyCode - The keyCode for the key which should be used for the given
function.public ImageLoader setKey(java.lang.String which, char key)
DataLoadersetKey in class DataLoaderwhich - A String representing the method which should be linked to the
keyCode. Possible values: \ "previous\", \"next\", \"first\",
\"last\", \"random\".key - The char containing the key which should be used for the given
function.public ImageLoader enableAutoResize()
public ImageLoader disableAutoResize()
public processing.core.PImage loadFile(int index)
DataLoaderloadFile in class DataLoaderindex - The index of the file which should be loaded.public processing.core.PImage[] loadAllFiles()
DataLoaderloadAllFiles in class DataLoaderpublic processing.core.PImage nextRandom()
DataLoadernextRandom in class DataLoaderpublic processing.core.PImage previous()
DataLoaderprevious in class DataLoaderpublic processing.core.PImage next()
DataLoadernext in class DataLoaderpublic processing.core.PImage first()
DataLoaderfirst in class DataLoaderpublic processing.core.PImage last()
DataLoaderlast in class DataLoaderpublic ImageLoader setIndex(int index)
setIndex in class DataLoaderindex - The index of the element which should be the current element.
Index is in range of [0, size()).public ImageLoader setIndex(java.lang.String filename)
DataLoadersetIndex in class DataLoaderfilename - The name of the file which should be the current element.public processing.core.PImage getCurrent()
DataLoadergetCurrent in class DataLoaderpublic processing.core.PImage get(int index)
DataLoaderget in class DataLoaderpublic ImageLoader addObserver(ImageUpdateObserver observer)
observer - An object that will be informed at a change of the current
color palette.public ImageLoader removeObserver(ImageUpdateObserver observer)
observer - An object that was formerly an observer and which should be
removed.public ImageLoader clearObservers()