File indexing completed on 2024-05-19 04:36:34
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZUI_COLOR_PALETTE_H 0021 #define TIKZUI_COLOR_PALETTE_H 0022 0023 #include <QColor> 0024 0025 namespace tikz { 0026 namespace ui { 0027 0028 class ColorPalettePrivate; 0029 0030 /** 0031 * Class to manage a color palette. 0032 * 0033 * The ColorPalette represents a color palette. 0034 * The color palette is loaded for a file by calling @p load(). 0035 * Thereafter, the colors can be obtained with @p color() with parameters 0036 * in the range of rows() and columns(). 0037 */ 0038 class ColorPalette 0039 { 0040 public: 0041 /** 0042 * Default constructor. 0043 */ 0044 ColorPalette(); 0045 0046 /** 0047 * Destructor 0048 */ 0049 ~ColorPalette(); 0050 0051 /** 0052 * Load the color palette from @p filename. 0053 */ 0054 void load(const QString & filename); 0055 0056 public: 0057 /** 0058 * Returns the name of the color palette, read in load(). 0059 */ 0060 QString name() const noexcept; 0061 0062 /** 0063 * Returns the color of row @p row and column @p column. 0064 */ 0065 QRgb color(int row, int column) const noexcept; 0066 0067 /** 0068 * Returns the amount of rows this color palette provides. 0069 */ 0070 int rows() const noexcept; 0071 0072 /** 0073 * Returns the amount of columns this color palette provides. 0074 */ 0075 int columns() const noexcept; 0076 0077 /** 0078 * For visual improvement, add a spacing after row. 0079 */ 0080 bool spacingAfterRow(int row) const; 0081 0082 private: 0083 ColorPalettePrivate * const d; 0084 }; 0085 0086 } 0087 } 0088 0089 #endif // TIKZUI_COLOR_PALETTE_H 0090 0091 // kate: indent-width 4; replace-tabs on;