Libraryless. Click here for Pure Java version (5403L/30K).
static Color blendMultipleColors(LPair<Color, Double> colors) { double sum = doubleSum(pairsB(colors))*255; double r = 0, g = 0, b = 0; for (color, weight : unpair colors) { r += color.getRed()*weight; g += color.getGreen()*weight; b += color.getBlue()*weight; } ret new Color( (float) clampZeroToOne(doubleRatio(r, sum)), (float) clampZeroToOne(doubleRatio(g, sum)), (float) clampZeroToOne(doubleRatio(b, sum))); }
Began life as a copy of #1007920
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034859 |
Snippet name: | blendMultipleColors |
Eternal ID of this version: | #1034859/3 |
Text MD5: | c0b4af3bc23123db91b673b742aeef9c |
Transpilation MD5: | 46271e52090222bf0e58604bd657e28b |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-12 20:22:37 |
Source code size: | 469 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 121 / 188 |
Version history: | 2 change(s) |
Referenced in: | [show references] |