Difference between revisions of "Color Image System"

From Slick2D Wiki
Jump to: navigation, search
(Created page with "Note: Note that this system as not been accepted yet. As such all information in here is subject to change or removal. This system consists of four classes: * ColorImageIO -...")
 
Line 18: Line 18:
  
 
ColorTimer contains all the colors to be displayed and controls how they will be displayed. The colors can be set to slowly change between each color with setInterpolate using true. If false is used, the colors will only switch at each timing interval. The starting color is set with setStartColor. Every other color can be added with addColor which takes a slick Color and an 'int' as arguments. The int is the time, in milliseconds, at which to switch to the Color provided.
 
ColorTimer contains all the colors to be displayed and controls how they will be displayed. The colors can be set to slowly change between each color with setInterpolate using true. If false is used, the colors will only switch at each timing interval. The starting color is set with setStartColor. Every other color can be added with addColor which takes a slick Color and an 'int' as arguments. The int is the time, in milliseconds, at which to switch to the Color provided.
 +
 +
[[Category:Miscellaneous]] [[Category:Images]]

Revision as of 16:49, 8 August 2013

Note: Note that this system as not been accepted yet. As such all information in here is subject to change or removal.

This system consists of four classes:

  • ColorImageIO - Allows you to load system that was saved as an XML file.
  • ColorImageSystem - The main class of the system. Each system of colored images is controlled from here
  • ColorImage - Contains an Image and a ColorTimer
  • ColorTimer - Contains all the defined colors and the timing for color switching.

Usage

There are 2 ways to use this system.

Color Image Editor

You can use the Color Image Editor to create a system for you and then save that system to an XML file. You then use ColorImageIO to load that file at game time.

Manual Usage

To create a system manually, you first instantsiate a ColorImageSystem object for each light effect that you want. You can set the 'x' and 'y' display location of each system by calling setSystemX/Y. You can add an image to be displayed beneath the colored images by calling setBaseImage. For each colored image, you create a ColorImage and add it to the ColorImageSystem by calling addImage.

ColorImage contains a single slick Image and a ColorTimer. The slick image is typically a white or grayscale image that you want to dynamically apply color to. The four important methods here are setColorTimer, setImage, setImageX/Y. The 'x' and 'y' coordinates of the ColorImage are used as offsets from the ColorImageSystem 'x' and 'y' coordiantes.

ColorTimer contains all the colors to be displayed and controls how they will be displayed. The colors can be set to slowly change between each color with setInterpolate using true. If false is used, the colors will only switch at each timing interval. The starting color is set with setStartColor. Every other color can be added with addColor which takes a slick Color and an 'int' as arguments. The int is the time, in milliseconds, at which to switch to the Color provided.