MCPcopy Create free account
hub / github.com/benfry/processing4 / makeGradientRGB

Method makeGradientRGB

app/src/processing/app/ui/Theme.java:213–227  ·  view source on GitHub ↗
(String attribute, int wide, int high)

Source from the content-addressed store, hash-verified

211
212
213 static private Image makeGradientRGB(String attribute, int wide, int high) {
214 int top = getColor(attribute + ".gradient.top").getRGB();
215 int bot = getColor(attribute + ".gradient.bottom").getRGB();
216
217 BufferedImage outgoing =
218 new BufferedImage(wide, high, BufferedImage.TYPE_INT_RGB);
219 int[] row = new int[wide];
220 WritableRaster wr = outgoing.getRaster();
221 for (int i = 0; i < high; i++) {
222 int rgb = PApplet.lerpColor(top, bot, i / (float)(high-1), PConstants.RGB);
223 Arrays.fill(row, rgb);
224 wr.setDataElements(0, i, wide, 1, row);
225 }
226 return outgoing;
227 }
228
229
230 static private Image makeGradientLab(String attribute, int wide, int high) {

Callers 1

makeGradientMethod · 0.95

Calls 4

getColorMethod · 0.95
lerpColorMethod · 0.95
getRasterMethod · 0.45
fillMethod · 0.45

Tested by

no test coverage detected