001/* 002 * Copyright 2010-2015 Institut Pasteur. 003 * 004 * This file is part of Icy. 005 * 006 * Icy is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Icy is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Icy. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package icy.image.colormap; 020 021import java.awt.Color; 022 023/** 024 * @author Stephane 025 */ 026public class FireColorMap extends IcyColorMap 027{ 028 private static final short[] fire_red = {0, 0, 1, 25, 49, 73, 98, 122, 146, 162, 173, 184, 195, 207, 217, 229, 240, 029 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 030 private static final short[] fire_green = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 35, 57, 79, 101, 117, 133, 031 147, 161, 175, 190, 205, 219, 234, 248, 255, 255, 255, 255}; 032 private static final short[] fire_blue = {31, 61, 96, 130, 165, 192, 220, 227, 210, 181, 151, 122, 93, 64, 35, 5, 033 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 98, 160, 223, 255}; 034 035 public FireColorMap() 036 { 037 super("Fire"); 038 039 beginUpdate(); 040 try 041 { 042 final int nColors = fire_red.length; 043 final float scale = (float) IcyColorMap.MAX_INDEX / (nColors - 1); 044 045 for (int i = 0; i < nColors; i++) 046 { 047 final int index = Math.round(i * scale); 048 setRGBControlPoint(index, new Color(fire_red[i], fire_green[i], fire_blue[i])); 049 } 050 } 051 finally 052 { 053 endUpdate(); 054 } 055 } 056}