public class IltLedImageBaseRendererFactory extends Object implements IltBaseRendererFactory
off
representation) and to make it glow with a
specified color (on
representation). The image
is used as a base for the LED and its colors are computed by applying color
filters over it.
When two images are used, the difference between them is computed and assumed to be the glowing area, which is normalized. All computations described below are applied only to the glowing area. This is useful when defining customized LED shapes.
Note: Image processing is performed only when necessary, which means that no memory or CPU is used when a new image type is defined, but only when that image is drawn.
You can create a new LED element type easily with the following code:
IltLed.Type newType = new IltLed.Type(YOUR_NEW_TYPE_NAME
); try { Image img_1 = null; URL url = new URL("file","",YOUR_IMAGE_FILE_NAME
); img_1 = getImage(url); Image img_2 = null; url = new URL("file","",YOUR_OTHER_IMAGE_FILE_NAME
); img_2 = getImage(url); if ((img_1 != null) && (img_2 != null)) { IltLedImageBaseRendererFactory factory = new IltLedImageBaseRendererFactory(img_1,img_2,YOUR_IMAGE_ATTRIBUTE
); IltSettings.SetValue("Led.Type.YOUR_NEW_TYPE_NAME.Renderer" , factory ); } } catch(Exception e) { e.printStackTrace(); }
Note: YOUR_NEW_TYPE_NAME
should be replaced with any String you want.
Note: YOUR_IMAGE_FILE_NAME
and YOUR_OTHER_IMAGE_FILE_NAME
should be replaced with the appropriate String to create a URL object for your image.
Note: YOUR_IMAGE_ATTRIBUTE
is the brightness attribute from the
imagecolortuner
application (see ilog.tgo.graphic.renderer.IltNEImageBaseRendererFactory
).
IltSettings
,
IltLed.Type
,
IltLedBaseRenderer
Constructor and Description |
---|
IltLedImageBaseRendererFactory()
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(Image sourceImage)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(Image baseImage,
Image activeImage)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(Image baseImage,
Image activeImage,
int bright)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(Image sourceImage,
int bright)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(String sourceImageName)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(String sourceImageName,
int bright)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(String baseImageName,
String activeImageName)
Creates a new
IltLedImageBaseRendererFactory . |
IltLedImageBaseRendererFactory(String baseImageName,
String activeImageName,
int bright)
Creates a new
IltLedImageBaseRendererFactory . |
Modifier and Type | Method and Description |
---|---|
IltBaseRenderer |
createValue()
Creates a new base base renderer for a given LED object.
|
Image |
getBaseImage()
Returns the base image used for comparison.
|
String |
getBaseImageName()
Returns the base image name used for comparison.
|
int |
getBrightThreshold()
Returns the brightness threshold
(0..255) used when
normalizing the image. |
IltBaseRendererFactory |
getImageFactory()
Returns the internal image factory used to create the
Led representation
|
Image |
getSourceImage()
Returns the image to be processed to create the
LED representation.
|
String |
getSourceImageName()
Returns the name of the image to be processed to create
the LED representation.
|
void |
setBaseImage(Image img)
Sets the base image used for comparison.
|
void |
setBaseImageName(String imgName)
Sets the base image name used for comparison.
|
void |
setBrightThreshold(int t)
Defines the brightness threshold
(0..255) used when
normalizing the image. |
void |
setSourceImage(Image img)
Sets the image to be processed to create the
LED representation.
|
void |
setSourceImageName(String imgName)
Sets the name of the image to be processed to create
the LED representation.
|
public IltLedImageBaseRendererFactory(Image sourceImage, int bright)
IltLedImageBaseRendererFactory
.This method creates a new factory based on a single image.
sourceImage
- The image to be processed to create the
LED representation.bright
- Defines the brightness threshold (0..255)
used when
normalizing the image.public IltLedImageBaseRendererFactory(Image sourceImage)
IltLedImageBaseRendererFactory
.
This method creates a new factory based on a single image. The default bright
threshold is set to 64
.
sourceImage
- The image to be processed to create the
LED representation.public IltLedImageBaseRendererFactory(String sourceImageName, int bright)
IltLedImageBaseRendererFactory
.This method creates a new factory based on the specified image file.
sourceImageName
- The image file to be loaded and processed
to create the LED representation.bright
- Defines the brightness threshold (0..255)
used when
normalizing the image.public IltLedImageBaseRendererFactory(String sourceImageName)
IltLedImageBaseRendererFactory
.
This method creates a new factory based on the specified image file. The default
brightness threshold is set to 64
.
sourceImageName
- The image file to be loaded and processed
to create the LED representation.public IltLedImageBaseRendererFactory(Image baseImage, Image activeImage, int bright)
IltLedImageBaseRendererFactory
.This method creates a new factory based on two images, which are combined to build the LED representation. The two images are compared and the difference between them is set to be the glowing portion of the LED.
baseImage
- The base image used for comparison. This image can be null
or entirely transparent (minimum image).activeImage
- The image used for the LED representation. It cannot
be null (maximum image).bright
- Defines the brightness threshold (0..255)
used when
normalizing the image.public IltLedImageBaseRendererFactory(Image baseImage, Image activeImage)
IltLedImageBaseRendererFactory
.
It creates a new factory based on two images. The default brightness
threshold is set to 64
.
baseImage
- The base image used for comparison. This image can be null
or entirely transparent (minimum image).activeImage
- The image used for the LED representation. It cannot
be null (maximum image).public IltLedImageBaseRendererFactory(String baseImageName, String activeImageName, int bright)
IltLedImageBaseRendererFactory
.This method creates a new factory based on the two specified image files.
baseImageName
- The base image file used for comparison. This
image can be null or entirely transparent
(minimum image).activeImageName
- The image file used for the LED representation.
It cannot be null (maximum image).bright
- Defines the brightness threshold (0..255)
used when
normalizing the image.public IltLedImageBaseRendererFactory(String baseImageName, String activeImageName)
IltLedImageBaseRendererFactory
.
This method creates a new factory based on the two specified image files.
The default brightness threshold is set to 64
.
baseImageName
- The base image file used for comparison. This
image can be null or entirely transparent
(minimum image).activeImageName
- The image file used for the LED representation.
It cannot be null (maximum image).public IltLedImageBaseRendererFactory()
IltLedImageBaseRendererFactory
.
This method creates a new factory with a default brightness
threshold set to 64
.
The source image must be specified through method
setSourceImage(Image)
or setSourceImageName(String)
.
The base image can be specified through method
setBaseImage(Image)
or setBaseImageName(String)
.
The source image, base image and brightness can be modified before the renderer factory is used to create a Led renderer. Once the renderer factory is in use, modifying any of these parameters has no effect on the resulting Led representation.
setBaseImage(Image)
,
setSourceImage(Image)
,
setBrightThreshold(int)
public final void setSourceImage(Image img)
The source image must be specified before using this factory for the first time. Once this factory is in use, changing the source image has no effect.
img
- Source imagegetSourceImage()
public final Image getSourceImage()
setSourceImage(Image)
public final void setSourceImageName(String imgName)
The source image must be specified before using this factory for the first time. Once this factory is in use, changing the source image has no effect.
imgName
- Source image namegetSourceImageName()
public final String getSourceImageName()
setSourceImageName(String)
public final void setBaseImage(Image img)
The base image shall be specified before using this factory for the first time. Once this factory is in use, changing the base image has no effect.
img
- Comparison imagegetBaseImage()
public final Image getBaseImage()
setBaseImage(Image)
public final void setBaseImageName(String imgName)
The base image shall be specified before using this factory for the first time. Once this factory is in use, changing the base image has no effect.
imgName
- Comparison image namegetBaseImageName()
public final String getBaseImageName()
setBaseImageName(String)
public final void setBrightThreshold(int t)
(0..255)
used when
normalizing the image.
The brightness threshold shall be specified before using this factory for the first time. Once this factory is in use, changing the threshold has no effect.
t
- Brightness thresholdgetBrightThreshold()
public final int getBrightThreshold()
(0..255)
used when
normalizing the image.setBrightThreshold(int)
public IltBaseRenderer createValue()
createValue
in interface IltBaseRendererFactory
IltBaseRenderer
public IltBaseRendererFactory getImageFactory()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.