Libraryless. Click here for Pure Java version (5431L/30K).
static int blendMultipleColorsToInt(LPair<Color, Double> colors) { double sum = doubleSum(pairsB(colors)); 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 rgbInt( roundedRatio(r, sum), roundedRatio(g, sum), roundedRatio(b, sum)); } static int blendMultipleColorsToInt(Color[] colors, double[] weights) { double sum = doubleSum(weights); double r = 0, g = 0, b = 0; for i over colors: { Color color = colors[i]; double weight = weights[i]; r += color.getRed()*weight; g += color.getGreen()*weight; b += color.getBlue()*weight; } ret rgbInt( roundedRatio(r, sum), roundedRatio(g, sum), roundedRatio(b, sum)); }
Began life as a copy of #1034859
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034866 |
| Snippet name: | blendMultipleColorsToInt |
| Eternal ID of this version: | #1034866/5 |
| Text MD5: | 7d2a0d95dcf7b8bd768ad99373b2ad11 |
| Transpilation MD5: | 61f775f13df16faf753e7beecb48fd23 |
| 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:40:34 |
| Source code size: | 840 bytes / 33 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 368 / 479 |
| Version history: | 4 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |