Here you can find the source of interpolate(int start, int end, int n, int i)
Parameter | Description |
---|---|
start | The first color component value |
end | The last color component value |
n | Number of steps between the two colors |
i | The index at which the color is to be calculated |
private static int interpolate(int start, int end, int n, int i)
//package com.java2s; /*//w ww .ja v a 2 s . co m * Copyright (C) Stichting Akvo (Akvo Foundation) * * This file is part of Akvo Caddisfly * * Akvo Caddisfly is free software: you can redistribute it and modify it under the terms of * the GNU Affero General Public License (AGPL) as published by the Free Software Foundation, * either version 3 of the License or any later version. * * Akvo Caddisfly is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License included below for more details. * * The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>. */ public class Main { /** * Get the color component that lies between the two color component points * * @param start The first color component value * @param end The last color component value * @param n Number of steps between the two colors * @param i The index at which the color is to be calculated * @return The calculated color component */ private static int interpolate(int start, int end, int n, int i) { return (int) ((float) start + ((((float) end - (float) start) / n) * i)); } }