File indexing completed on 2024-05-19 04:26:57
0001 0002 /* 0003 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef LIBKIS_PRESET_H 0009 #define LIBKIS_PRESET_H 0010 0011 #include "kritalibkis_export.h" 0012 #include "libkis.h" 0013 #include "Resource.h" 0014 #include <kis_types.h> 0015 #include <kis_paintop_preset.h> 0016 0017 /** 0018 * @brief The Preset class 0019 * Preset is a resource object that stores brush preset data. 0020 * 0021 * An example for printing the current brush preset and all its settings: 0022 * 0023 * @code 0024 from krita import * 0025 0026 view = Krita.instance().activeWindow().activeView() 0027 preset = Preset(view.currentBrushPreset()) 0028 0029 print ( preset.toXML() ) 0030 0031 * @endcode 0032 */ 0033 0034 class KRITALIBKIS_EXPORT Preset : public QObject 0035 { 0036 public: 0037 Preset(Resource *resource); 0038 ~Preset() override; 0039 0040 /** 0041 * @brief toXML 0042 * convert the preset settings into a preset formatted xml. 0043 * @return the xml in a string. 0044 */ 0045 QString toXML() const; 0046 0047 /** 0048 * @brief fromXML 0049 * convert the preset settings into a preset formatted xml. 0050 * @param xml valid xml preset string. 0051 */ 0052 void fromXML(const QString &xml); 0053 0054 private: 0055 struct Private; 0056 Private *const d; 0057 0058 /** 0059 * @brief paintOpPreset 0060 * @return gives a KisPaintOpPreset object back 0061 */ 0062 KisPaintOpPresetSP paintOpPreset(); 0063 0064 }; 0065 0066 #endif // LIBKIS_PRESET_H