|
Krita Source Code Documentation
|
#include <KoColorSet.h>
Inheritance diagram for KoColorSet:Classes | |
| class | Private |
Public Types | |
| enum | PaletteType { UNKNOWN = 0 , GPL , RIFF_PAL , ACT , PSP_PAL , ACO , XML , KPL , SBZ , ASE , ACB , CSS } |
Signals | |
| void | entryChanged (int column, int row) |
| void | layoutAboutToChange () |
| void | layoutChanged () |
| void | modified () |
Public Member Functions | |
| void | addGroup (const QString &groupName, int columnCount=KisSwatchGroup::DEFAULT_COLUMN_COUNT, int rowCount=KisSwatchGroup::DEFAULT_ROW_COUNT) |
| addGroup Adds a new group. | |
| void | addSwatch (const KisSwatch &swatch, const QString &groupName=GLOBAL_GROUP_NAME, int column=-1, int row=-1) |
| Add a color to the palette. | |
| void | changeGroupName (const QString &oldGroupName, const QString &newGroupName) |
| changeGroupName | |
| void | clear () |
| clears the complete colorset | |
| KoResourceSP | clone () const override |
| quint32 | colorCount () const |
| int | columnCount () const |
| QString | comment () |
| QString | defaultFileExtension () const override |
| bool | fromByteArray (QByteArray &data, KisResourcesInterfaceSP resourcesInterface) |
| KisSwatchGroup::SwatchInfo | getClosestSwatchInfo (KoColor compare, bool useGivenColorSpace=true) const |
| getIndexClosestColor function that matches the color to all colors in the colorset, and returns the index of the closest match. | |
| KisSwatch | getColorGlobal (quint32 column, quint32 row) const |
| getColorGlobal A function for getting a color based on a global index. Useful for iterating through all color entries. | |
| KisSwatchGroupSP | getGlobalGroup () const |
| getGlobalGroup | |
| KisSwatchGroupSP | getGroup (const QString &name) const |
| getGroup | |
| KisSwatchGroupSP | getGroup (int row) const |
| getGroup get the group that covers this row | |
| KisSwatch | getSwatchFromGroup (quint32 column, quint32 row, QString groupName=KoColorSet::GLOBAL_GROUP_NAME) const |
| getColorGroup A function for getting the color from a specific group. | |
| bool | isGroupTitleRow (int row) const |
| isGroupRow checks whether the current row is a group title | |
| bool | isLocked () const |
| KoColorSet (const KoColorSet &rhs) | |
| Create an copied palette. | |
| KoColorSet (const QString &filename=QString()) | |
| bool | loadFromDevice (QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override |
| void | moveGroup (const QString &groupName, const QString &groupNameInsertBefore=GLOBAL_GROUP_NAME) |
| moveGroup Move a group in the internal stringlist. | |
| KoColorSet & | operator= (const KoColorSet &rhs)=delete |
| PaletteType | paletteType () const |
| void | removeGroup (const QString &groupName, bool keepColors=true) |
| removeGroup Remove a group from the KoColorSet | |
| void | removeSwatch (int column, int row, KisSwatchGroupSP group) |
| remove the swatch from the given group at column and row | |
| QPair< QString, QString > | resourceType () const override |
| int | rowCount () const |
| int | rowCountWithTitles () const |
| int | rowNumberInGroup (int rowNumber) const |
| rowNumberInGroup calculates the row number in the group from the global rownumber | |
| bool | saveToDevice (QIODevice *dev) const override |
| void | setColumnCount (int columns) |
| void | setComment (QString comment) |
| void | setLocked (bool lock) |
| void | setPaletteType (PaletteType paletteType) |
| quint32 | slotCount () const |
| int | startRowForGroup (const QString &groupName) const |
| rowForNamedGroup returns the row the group's title is on | |
| QStringList | swatchGroupNames () const |
| getGroupNames | |
| KUndo2Stack * | undoStack () const |
| void | updateThumbnail () override |
| updateThumbnail updates the thumbnail for this resource. Reimplement if your thumbnail is something else than the image set with setImage. | |
| ~KoColorSet () override | |
Public Member Functions inherited from KoResource | |
| bool | active () const |
| void | addMetaData (QString key, QVariant value) |
| store the given key, value pair in the resource | |
| virtual void | clearSideLoadedResources () |
| virtual QList< KoResourceLoadResult > | embeddedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| QString | filename () const |
| QImage | image () const |
| bool | isDirty () const |
| virtual bool | isEphemeral () const |
| virtual bool | isSerializable () const |
| KoResource () | |
| KoResource (const KoResource &rhs) | |
| KoResource (const QString &filename) | |
| virtual QList< KoResourceLoadResult > | linkedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| bool | load (KisResourcesInterfaceSP resourcesInterface) |
| QString | md5Sum (bool generateIfEmpty=true) const |
| QMap< QString, QVariant > | metadata () const |
| get a map with all the metadata | |
| virtual QString | name () const |
| KoResource & | operator= (const KoResource &rhs)=delete |
| bool | permanent () const |
| virtual QList< int > | requiredCanvasResources () const |
| QList< KoResourceLoadResult > | requiredResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| int | resourceId () const |
| bool | save () |
| void | setActive (bool active) |
| void | setDirty (bool value) |
| Mark the preset as modified but not saved. | |
| void | setFilename (const QString &filename) |
| void | setImage (const QImage &image) |
| void | setMD5Sum (const QString &md5sum) |
| Set the md5sum of this resource. It must be in hex-encoded string format. | |
| void | setName (const QString &name) |
| void | setPermanent (bool permanent) |
| void | setResourceId (int id) |
| void | setStorageLocation (const QString &location) |
| void | setValid (bool valid) |
| void | setVersion (int version) |
| virtual QList< KoResourceLoadResult > | sideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface) const |
| KoResourceSignature | signature () const |
| QString | storageLocation () const |
| QList< KoResourceLoadResult > | takeSideLoadedResources (KisResourcesInterfaceSP globalResourcesInterface) |
| virtual QImage | thumbnail () const |
| thumbnail the thumbnail image to use in resource selectors | |
| virtual QString | thumbnailPath () const |
| thumbnailPath returns the path to a separate thumbnail image, outside the actual resource file itself. If the path is relative, it is supposed start in the same location as the resource itself. If it's absolute, that is, it starts with "/", it is from the root of the storage. | |
| bool | valid () const |
| int | version () const |
| Get the version of the resource. | |
| virtual | ~KoResource () |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Static Public Attributes | |
| static const QString | GLOBAL_GROUP_NAME = QString() |
| static const QString | KPL_COLOR_DEPTH_ID_ATTR = "colorDepthId" |
| static const QString | KPL_COLOR_MODEL_ID_ATTR = "colorModelId" |
| static const QString | KPL_GROUP_NAME_ATTR = "name" |
| static const QString | KPL_GROUP_ROW_COUNT_ATTR = "rows" |
| static const QString | KPL_GROUP_TAG = "Group" |
| static const QString | KPL_PALETTE_COLUMN_COUNT_ATTR = "columns" |
| static const QString | KPL_PALETTE_COMMENT_ATTR = "comment" |
| static const QString | KPL_PALETTE_FILENAME_ATTR = "filename" |
| static const QString | KPL_PALETTE_NAME_ATTR = "name" |
| static const QString | KPL_PALETTE_PROFILE_TAG = "Profile" |
| static const QString | KPL_PALETTE_READONLY_ATTR = "readonly" |
| static const QString | KPL_PALETTE_TAG = "ColorSet" |
| static const QString | KPL_SWATCH_BITDEPTH_ATTR = "bitdepth" |
| static const QString | KPL_SWATCH_COL_ATTR = "column" |
| static const QString | KPL_SWATCH_ID_ATTR = "id" |
| static const QString | KPL_SWATCH_NAME_ATTR = "name" |
| static const QString | KPL_SWATCH_POS_TAG = "Position" |
| static const QString | KPL_SWATCH_ROW_ATTR = "row" |
| static const QString | KPL_SWATCH_SPOT_ATTR = "spot" |
| static const QString | KPL_SWATCH_TAG = "ColorSetEntry" |
| static const QString | KPL_VERSION_ATTR = "version" |
Private Slots | |
| void | canRedoChanged (bool canRedo) |
| void | canUndoChanged (bool canUndo) |
Private Member Functions | |
| void | notifySwatchChanged (const QString &groupName, int column, int row) |
| void | setModified (bool) |
Private Attributes | |
| const QScopedPointer< Private > | d |
Friends | |
| struct | AddGroupCommand |
| struct | AddSwatchCommand |
| struct | ChangeGroupNameCommand |
| struct | ClearCommand |
| struct | MoveGroupCommand |
| struct | RemoveGroupCommand |
| struct | RemoveSwatchCommand |
| struct | SetColumnCountCommand |
| struct | SetCommentCommand |
| struct | SetPaletteTypeCommand |
| class | TestKisPaletteModel |
| class | TestKoColorSet |
Additional Inherited Members | |
Public Attributes inherited from KoResource | |
| bool | active {true} |
| QString | filename |
| QImage | image |
| QString | md5sum |
| QMap< QString, QVariant > | metadata |
| bool | modified {false} |
| QString | name |
| bool | permanent {false} |
| int | resourceId {-1} |
| QString | storageLocation |
| bool | valid {false} |
| int | version {-1} |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Also called palette. Open Gimp, Photoshop or RIFF palette files. This is a straight port from the Gimp.
Definition at line 28 of file KoColorSet.h.
| Enumerator | |
|---|---|
| UNKNOWN | |
| GPL | |
| RIFF_PAL | |
| ACT | |
| PSP_PAL | |
| ACO | |
| XML | |
| KPL | |
| SBZ | |
| ASE | |
| ACB | |
| CSS | |
Definition at line 57 of file KoColorSet.h.
|
explicit |
Load a color set from a file. This can be a Gimp palette, a RIFF palette, a Photoshop palette, a Krita palette, a Scribus palette or a SwatchBooker palette.
Definition at line 561 of file KoColorSet.cpp.
References canRedoChanged(), canUndoChanged(), connect(), and d.
| KoColorSet::KoColorSet | ( | const KoColorSet & | rhs | ) |
Create an copied palette.
Definition at line 571 of file KoColorSet.cpp.
References d.
|
override |
Definition at line 582 of file KoColorSet.cpp.
| void KoColorSet::addGroup | ( | const QString & | groupName, |
| int | columnCount = KisSwatchGroup::DEFAULT_COLUMN_COUNT, | ||
| int | rowCount = KisSwatchGroup::DEFAULT_ROW_COUNT ) |
addGroup Adds a new group.
| groupName | the name of the new group. When not specified, this will fail. |
Definition at line 842 of file KoColorSet.cpp.
References AddGroupCommand, columnCount(), d, rowCount(), and swatchGroupNames().
| void KoColorSet::addSwatch | ( | const KisSwatch & | swatch, |
| const QString & | groupName = GLOBAL_GROUP_NAME, | ||
| int | column = -1, | ||
| int | row = -1 ) |
Add a color to the palette.
| c | the swatch |
| groupName | color to add the group to. If empty, it will be added to the unsorted. |
| column. | The column in the group |
| row. | The row in the group |
Definition at line 643 of file KoColorSet.cpp.
References AddSwatchCommand, and d.
|
privateslot |
Definition at line 794 of file KoColorSet.cpp.
References d, and setModified().
|
privateslot |
Definition at line 784 of file KoColorSet.cpp.
References setModified().
| void KoColorSet::changeGroupName | ( | const QString & | oldGroupName, |
| const QString & | newGroupName ) |
changeGroupName
| oldGroupName | |
| newGroupName |
Definition at line 804 of file KoColorSet.cpp.
References ChangeGroupNameCommand, d, and swatchGroupNames().
| void KoColorSet::clear | ( | ) |
clears the complete colorset
Definition at line 661 of file KoColorSet.cpp.
References ClearCommand, and d.
|
overridevirtual |
Implements KoResource.
Definition at line 586 of file KoColorSet.cpp.
References KoColorSet().
| quint32 KoColorSet::colorCount | ( | ) | const |
Definition at line 908 of file KoColorSet.cpp.
References colorCount(), and d.
| int KoColorSet::columnCount | ( | ) | const |
Definition at line 821 of file KoColorSet.cpp.
References d.
| QString KoColorSet::comment | ( | ) |
|
overridevirtual |
Reimplemented from KoResource.
Definition at line 874 of file KoColorSet.cpp.
|
signal |
| bool KoColorSet::fromByteArray | ( | QByteArray & | data, |
| KisResourcesInterfaceSP | resourcesInterface ) |
Definition at line 621 of file KoColorSet.cpp.
References loadFromDevice().
| KisSwatchGroup::SwatchInfo KoColorSet::getClosestSwatchInfo | ( | KoColor | compare, |
| bool | useGivenColorSpace = true ) const |
getIndexClosestColor function that matches the color to all colors in the colorset, and returns the index of the closest match.
| compare | the color you wish to compare. |
| useGivenColorSpace | whether to use the color space of the color given when the two colors' colorspaces don't match. Else it'll use the entry's colorspace. |
Definition at line 981 of file KoColorSet.cpp.
References KoColor::colorSpace(), KoColor::convertTo(), d, KoColor::data(), and KoColorSpace::difference().
| KisSwatch KoColorSet::getColorGlobal | ( | quint32 | column, |
| quint32 | row ) const |
getColorGlobal A function for getting a color based on a global index. Useful for iterating through all color entries.
| x | the global x index over the whole palette. |
| y | the global y index over the whole palette. |
Definition at line 670 of file KoColorSet.cpp.
References getGroup(), isGroupTitleRow(), rowCount(), and startRowForGroup().
| KisSwatchGroupSP KoColorSet::getGlobalGroup | ( | ) | const |
getGlobalGroup
Definition at line 974 of file KoColorSet.cpp.
References d, and GLOBAL_GROUP_NAME.
| KisSwatchGroupSP KoColorSet::getGroup | ( | const QString & | name | ) | const |
getGroup
| name |
Definition at line 926 of file KoColorSet.cpp.
References d, and KoResource::name.
| KisSwatchGroupSP KoColorSet::getGroup | ( | int | row | ) | const |
getGroup get the group that covers this row
| row |
Definition at line 936 of file KoColorSet.cpp.
References d, GLOBAL_GROUP_NAME, and rowCountWithTitles().
| KisSwatch KoColorSet::getSwatchFromGroup | ( | quint32 | column, |
| quint32 | row, | ||
| QString | groupName = KoColorSet::GLOBAL_GROUP_NAME ) const |
getColorGroup A function for getting the color from a specific group.
| x | the x index over the group. |
| y | the y index over the group. |
| groupName | the name of the group, will give unsorted when not defined. |
Definition at line 692 of file KoColorSet.cpp.
References d.
| bool KoColorSet::isGroupTitleRow | ( | int | row | ) | const |
isGroupRow checks whether the current row is a group title
| row | the row to check |
Definition at line 715 of file KoColorSet.cpp.
References d, and GLOBAL_GROUP_NAME.
| bool KoColorSet::isLocked | ( | ) | const |
|
signal |
|
signal |
|
overridevirtual |
Implements KoResource.
Definition at line 591 of file KoColorSet.cpp.
References d.
|
signal |
| void KoColorSet::moveGroup | ( | const QString & | groupName, |
| const QString & | groupNameInsertBefore = GLOBAL_GROUP_NAME ) |
moveGroup Move a group in the internal stringlist.
| groupName | the groupname to move. |
| groupNameInsertBefore | the groupname to insert before. Empty means it will be added to the end. |
Definition at line 851 of file KoColorSet.cpp.
References d, MoveGroupCommand, and swatchGroupNames().
|
private |
Definition at line 774 of file KoColorSet.cpp.
References entryChanged(), and startRowForGroup().
|
delete |
| KoColorSet::PaletteType KoColorSet::paletteType | ( | ) | const |
| void KoColorSet::removeGroup | ( | const QString & | groupName, |
| bool | keepColors = true ) |
removeGroup Remove a group from the KoColorSet
| groupName | the name of the group you want to remove. |
| keepColors | Whether you wish to keep the colorsetentries. These will be added to the unsorted. |
Definition at line 864 of file KoColorSet.cpp.
References d, GLOBAL_GROUP_NAME, RemoveGroupCommand, and swatchGroupNames().
| void KoColorSet::removeSwatch | ( | int | column, |
| int | row, | ||
| KisSwatchGroupSP | group ) |
remove the swatch from the given group at column and row
Definition at line 653 of file KoColorSet.cpp.
References d, and RemoveSwatchCommand.
|
inlineoverridevirtual |
Implements KoResource.
Definition at line 92 of file KoColorSet.h.
References ResourceType::Palettes.
| int KoColorSet::rowCount | ( | ) | const |
Definition at line 894 of file KoColorSet.cpp.
References d.
| int KoColorSet::rowCountWithTitles | ( | ) | const |
Definition at line 903 of file KoColorSet.cpp.
References d, and rowCount().
| int KoColorSet::rowNumberInGroup | ( | int | rowNumber | ) | const |
rowNumberInGroup calculates the row number in the group from the global rownumber
| rowNumber | this is a row in rowCountWithTitles |
Definition at line 747 of file KoColorSet.cpp.
References isGroupTitleRow().
|
overridevirtual |
Reimplemented from KoResource.
Definition at line 604 of file KoColorSet.cpp.
References KUndo2QStack::clear(), d, GPL, KoResource::setDirty(), and undoStack().
| void KoColorSet::setColumnCount | ( | int | columns | ) |
Definition at line 812 of file KoColorSet.cpp.
References d, and SetColumnCountCommand.
| void KoColorSet::setComment | ( | QString | comment | ) |
Definition at line 833 of file KoColorSet.cpp.
References comment(), d, and SetCommentCommand.
| void KoColorSet::setLocked | ( | bool | lock | ) |
|
private |
Definition at line 766 of file KoColorSet.cpp.
References modified(), and KoResource::setDirty().
| void KoColorSet::setPaletteType | ( | PaletteType | paletteType | ) |
Definition at line 633 of file KoColorSet.cpp.
References d, paletteType(), and SetPaletteTypeCommand.
| quint32 KoColorSet::slotCount | ( | ) | const |
Definition at line 917 of file KoColorSet.cpp.
References d, and slotCount().
| int KoColorSet::startRowForGroup | ( | const QString & | groupName | ) | const |
rowForNamedGroup returns the row the group's title is on
| groupName |
Definition at line 730 of file KoColorSet.cpp.
References d, and GLOBAL_GROUP_NAME.
| QStringList KoColorSet::swatchGroupNames | ( | ) | const |
getGroupNames
Definition at line 706 of file KoColorSet.cpp.
References d.
| KUndo2Stack * KoColorSet::undoStack | ( | ) | const |
|
overridevirtual |
updateThumbnail updates the thumbnail for this resource. Reimplement if your thumbnail is something else than the image set with setImage.
Reimplemented from KoResource.
Definition at line 1008 of file KoColorSet.cpp.
References d, and KoResource::setImage().
|
friend |
Definition at line 276 of file KoColorSet.h.
|
friend |
Definition at line 273 of file KoColorSet.h.
|
friend |
Definition at line 275 of file KoColorSet.h.
|
friend |
Definition at line 278 of file KoColorSet.h.
|
friend |
Definition at line 282 of file KoColorSet.h.
|
friend |
Definition at line 277 of file KoColorSet.h.
|
friend |
Definition at line 274 of file KoColorSet.h.
|
friend |
Definition at line 279 of file KoColorSet.h.
|
friend |
Definition at line 280 of file KoColorSet.h.
|
friend |
Definition at line 281 of file KoColorSet.h.
|
friend |
Definition at line 284 of file KoColorSet.h.
|
friend |
Definition at line 283 of file KoColorSet.h.
|
private |
Definition at line 287 of file KoColorSet.h.
|
static |
Definition at line 33 of file KoColorSet.h.
|
static |
Definition at line 42 of file KoColorSet.h.
|
static |
Definition at line 41 of file KoColorSet.h.
|
static |
Definition at line 43 of file KoColorSet.h.
|
static |
Definition at line 35 of file KoColorSet.h.
|
static |
Definition at line 53 of file KoColorSet.h.
|
static |
Definition at line 36 of file KoColorSet.h.
|
static |
Definition at line 38 of file KoColorSet.h.
|
static |
Definition at line 39 of file KoColorSet.h.
|
static |
Definition at line 37 of file KoColorSet.h.
|
static |
Definition at line 50 of file KoColorSet.h.
|
static |
Definition at line 40 of file KoColorSet.h.
|
static |
Definition at line 54 of file KoColorSet.h.
|
static |
Definition at line 49 of file KoColorSet.h.
|
static |
Definition at line 45 of file KoColorSet.h.
|
static |
Definition at line 48 of file KoColorSet.h.
|
static |
Definition at line 46 of file KoColorSet.h.
|
static |
Definition at line 51 of file KoColorSet.h.
|
static |
Definition at line 44 of file KoColorSet.h.
|
static |
Definition at line 47 of file KoColorSet.h.
|
static |
Definition at line 52 of file KoColorSet.h.
|
static |
Definition at line 34 of file KoColorSet.h.