-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from fastjengine/drawable-improvement
Drawable Improvement 2 - Gradient Improvements
- Loading branch information
Showing
20 changed files
with
2,295 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
src/main/java/tech/fastj/graphics/util/gradients/GradientBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,13 @@ | ||
package tech.fastj.graphics.util.gradients; | ||
|
||
import tech.fastj.engine.CrashMessages; | ||
|
||
import java.awt.MultipleGradientPaint; | ||
|
||
/** The top-level interface for all gradient builders in the package {@link tech.fastj.graphics.util}. */ | ||
public interface GradientBuilder { | ||
|
||
/** Error message defining that a gradient creation error occurred. */ | ||
String GradientCreationError = CrashMessages.theGameCrashed("a gradient creation error."); | ||
|
||
/** | ||
* Builds a {@code MultipleGradientPaint} object based on the data provided by other methods in the builder. | ||
* | ||
* @return The resulting {@code MultipleGradientPaint} object. | ||
*/ | ||
MultipleGradientPaint build(); | ||
|
||
/** | ||
* Generates an array of linear intervals from {@code 0.0f} to {@code 1.0} inclusive, based on the size provided. | ||
* | ||
* @param size The size of the generated array. | ||
* @return The generated array. | ||
*/ | ||
default float[] generateIntervals(int size) { | ||
float[] intervals = new float[size]; | ||
|
||
for (int i = 0; i < intervals.length; i++) { | ||
intervals[i] = (1f / (intervals.length - 1)) * (float) (i); | ||
} | ||
return intervals; | ||
} | ||
} |
Oops, something went wrong.