1 /*
2 * mp3plot - Bitrate analysis tool
3 *
4 * Copyright (C) 2007, 2009 Toni Corvera
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 // $Id: image_plotter.cc 1344 2009-06-22 01:11:09Z toni $
22
23 #include "image_plotter.h"
24
25 #ifndef DISABLE_GRAPHICS
26
27 #include <iostream>
28 #include "../mp3/bitrate.h"
29
30 // Colourschemes, they define the colours used in the graphical histogram
31 // and "colourband"
32 #include "old_colourscheme.inc.cc"
33 #include "colourscheme.inc.cc"
34
35 namespace mp3plot {
36
37 const unsigned int image_plotter::IMGW = 1024,
38 image_plotter::IMGH = 768;
39
bitrate_colour(uint8_t bridx,bool old)40 rgb_type image_plotter::bitrate_colour(uint8_t bridx, bool old) {
41 const std::map<uint8_t, rgb_type> * pm = 0;
42 if (!old) {
43 pm =& mp3plot::impl::colourscheme::get_map();
44 }
45 else {
46 pm =& mp3plot::impl::old_colourscheme::get_map();
47 }
48 assert( pm->find(bridx) != pm->end() );
49 return pm->find(bridx)->second;
50 }
51
52 } // namespace mp3plot
53
54 #endif // DISABLE_GRAPHICS
55
56 // vim:set ts=4 et ai: //
57