Basics - Serabe/rinzelight GitHub Wiki
Image struct has four fields.
- :image holds the BufferedImage.
- :format holds a String identifying the current format of the image.
-
:width holds the width of the image. It is taken in first place from
BufferedImage.getWidth()
. -
:height holds the height of the image. It is taken in first place from
BufferedImage.getHeight()
.
The image in any rinzelight image struct is assured to be of BufferedImage/TYPE_INT_ARGB. Take this into account when working with them.
read-image
multimethod in rinzelight.image
namespace accepts both a String and an InputStream.
If a String is provided, it is taken as the path to the image.
write-image
multimethod in rinzelight.image
namespace writes an image img to uri.
Note that it would write the image in jpg format, not png.
display-image
function in rinzelight.image
displays img on a JFrame.
clone-image
method retrieves a new image struct with the :image field set to a cloned BufferedImage.
Moved to constants
You can find get-image-for-effect
in rinzelight.effects.basic-effects
. Given an image returns a new image struct with an empty BufferedImage in :image. Width and height parameters are optional.
If you are only composing effects, don’t bother about get-image-for-effect, since every effect in rinzelight creates a new image. This is so because of two reasons:
- Clojure way is not to modify objects.
- Not all effects can be made in place.