9#include "KChartPalette.h"
11#include "KChartMath_p.h"
20 static Palette makeDefaultPalette() {
39 static Palette makeSubduedPalette() {
42 p.addBrush(
QColor( 0xe0,0x7f,0x70 ) );
43 p.addBrush(
QColor( 0xe2,0xa5,0x6f ) );
44 p.addBrush(
QColor( 0xe0,0xc9,0x70 ) );
45 p.addBrush(
QColor( 0xd1,0xe0,0x70 ) );
46 p.addBrush(
QColor( 0xac,0xe0,0x70 ) );
47 p.addBrush(
QColor( 0x86,0xe0,0x70 ) );
48 p.addBrush(
QColor( 0x70,0xe0,0x7f ) );
49 p.addBrush(
QColor( 0x70,0xe0,0xa4 ) );
50 p.addBrush(
QColor( 0x70,0xe0,0xc9 ) );
51 p.addBrush(
QColor( 0x70,0xd1,0xe0 ) );
52 p.addBrush(
QColor( 0x70,0xac,0xe0 ) );
53 p.addBrush(
QColor( 0x70,0x86,0xe0 ) );
54 p.addBrush(
QColor( 0x7f,0x70,0xe0 ) );
55 p.addBrush(
QColor( 0xa4,0x70,0xe0 ) );
56 p.addBrush(
QColor( 0xc9,0x70,0xe0 ) );
57 p.addBrush(
QColor( 0xe0,0x70,0xd1 ) );
58 p.addBrush(
QColor( 0xe0,0x70,0xac ) );
59 p.addBrush(
QColor( 0xe0,0x70,0x86 ) );
64 static Palette makeRainbowPalette() {
67 p.addBrush(
QColor(255, 0,196) );
68 p.addBrush(
QColor(255, 0, 96) );
69 p.addBrush(
QColor(255, 128,64) );
73 p.addBrush(
QColor( 96, 96,255) );
74 p.addBrush(
QColor(160, 0,255) );
75 for (
int i = 8 ; i < 16 ; ++i ) {
76 p.addBrush( p.getBrush( i - 8 ).color().lighter(), i );
85class Q_DECL_HIDDEN
Palette::Private
96 static const Palette palette = makeDefaultPalette();
100const Palette& Palette::subduedPalette()
102 static const Palette palette = makeSubduedPalette();
106const Palette& Palette::rainbowPalette()
108 static const Palette palette = makeRainbowPalette();
112Palette::Palette(
QObject *parent )
113 :
QObject( parent ), _d( new Private )
120 delete _d; _d =
nullptr;
125Palette::Palette(
const Palette& r )
126 :
QObject(), _d( new Private( *r.d ) )
141 return d->brushes.size() >= 1;
146 return d->brushes.size();
151 if ( position < 0 || position >=
size() ) {
152 d->brushes.append( brush );
154 d->brushes.insert( position, brush );
162 return d->brushes.at( position %
size() );
167 if ( position < 0 || position >=
size() )
return;
168 d->brushes.remove( position );
A Palette is a set of brushes (or colors) to be used for painting data sets.
QBrush getBrush(int position) const
Query the palette for a brush at the specified position.
void removeBrush(int position)
Remove the brush at position position, if there is one.
void addBrush(const QBrush &brush, int position=-1)
Adds brush to the palette.
void changed()
Emitted whenever the palette changes.
const QList< QKeySequence > & copy()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:30 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.