org.j3d.geom.overlay
Class OverlayUtilities
- public class OverlayUtilities
- Utility functionality for creating parts of the overlay system.
Although designed mainly for internal use, this could be useful for end users too.
- Version:
- $Revision: 1.4 $
- Author:
- David Yazel
BITS_3COMP
private static final int[] BITS_3COMP
- bit definitions for 3-component images
BITS_4COMP
private static final int[] BITS_4COMP
- bit definitions for 4-component images
createBufferedImage
public static java.awt.image.BufferedImage createBufferedImage(java.awt.Dimension size,
boolean hasAlpha)
- Create a buffered image that uses a 3 component colour model with the option of adding an alpha component.
- Parameters:
size
- The overall size of the image in pixels
hasAlpha
- true if the image should contain an alpha channel
- Returns:
- A matching image instance
subdivide
public static java.util.List subdivide(java.awt.Dimension dimension,
int threshhold,
int max)
- Subdivides an area into a closest fit set of Rectangle with sides that are powers of 2. All elements will be less than max and greater than the minimum value by threshhold.
- Parameters:
dimension
- The required total size
threshold
- The minimum required size
max
- The maximum required size
- Returns:
- A collection of the rectangles needed to construct the total size
components
public static java.util.List components(int value,
int threshhold,
int max)
- Breaks an integer into powers of 2. The returned list contains a set of Integers that if summed would be a closest fit to to value. Each returned Integer is not greater than a power of 2 by more than threshhold and is not greater than max.
- Parameters:
value
- The target value to achieve
threshold
- The minimum required size of the component total
max
- The maximum required size
- Returns:
- A list, in order of the component values
optimalPower
public static int optimalPower(int value,
int threshhold,
int max)
- Returns an optimal power of two for the value given. return the largest power of 2 which is less than or equal to the value, OR it will return a larger power of two as long as the difference between that and the value is not greater than the threshhold.
smallestPower
public static int smallestPower(int value)
- Return the smallest power of 2 greater than value