37#include <kstandardguiitem.h>
43 setWindowTitle(caption);
44 preview->setScaledContents(
false);
45 preview->setFixedSize(preview->size());
46 preview->setStyleSheet(
"border: 2px solid #222; border-radius: 4px; padding: 5px; font: normal 10px;");
59 colorAsMask->setChecked(
true);
60 spacingWidget->setSpacing(
true, 1.0);
63 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Save), KStandardGuiItem::save());
64 KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
92 if (!brushImage.isNull()) {
93 int w = preview->size().width() - 10;
94 brushImage = brushImage.scaled(w, w, Qt::KeepAspectRatio);
97 preview->setPixmap(QPixmap::fromImage(brushImage));
102 if (brushStyle->currentIndex() == 0) {
103 comboBox2->setEnabled(
false);
105 comboBox2->setEnabled(
true);
116 m_brush->setSpacing(spacingWidget->spacing());
117 m_brush->setAutoSpacing(spacingWidget->autoSpacingActive(), spacingWidget->autoSpacingCoeff());
123 preserveAlpha->setEnabled(useColorAsMask);
129 QString suffix =
".gbr";
130 if (brushStyle->currentIndex() != 0) {
134 + suffix).exists()) {
135 buttonBox->button(QDialogButtonBox::Save)->setText(i18n(
"Overwrite"));
137 buttonBox->button(QDialogButtonBox::Save)->setText(i18n(
"Save"));
146 QString name = nameLineEdit->text();
148 if (nameLineEdit->text().isEmpty()) {
149 name = QUuid::createUuid().toByteArray().toHex();
159 resource->setName(name);
160 resource->setFilename(resource->name().split(
" ").join(
"_") + resource->defaultFileExtension());
167 resource->setName(name);
168 resource->setFilename(resource->name().split(
" ").join(
"_") + resource->defaultFileExtension());
183 if (brushStyle->currentIndex() == 0) {
201 for (qint32 y = r.top(); y <= r.bottom(); ++y) {
205 }
while (pixelIt->nextPixel() && maskIt->
nextPixel());
221 KisImageReadOnlyBarrierLock lock(
m_image);
235 switch (comboBox2->currentIndex()) {
246 if (colorAsMask->isChecked()) {
252 m_brush->setSpacing(spacingWidget->spacing());
253 m_brush->setAutoSpacing(spacingWidget->autoSpacingActive(), spacingWidget->autoSpacingCoeff());
QList< QString > QStringList
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
virtual const quint8 * oldRawData() const =0
virtual bool nextPixel()=0
static KisBrushServerProvider * instance()
KoResourceServer< KisBrush > * brushServer()
void barrierLock(bool readOnly=false)
Wait until all the queued background jobs are completed and lock the image.
KisPaintDeviceSP projection() const
KisSelectionSP globalSelection() const
KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w)
const KoColorSpace * colorSpace() const
static bool addResourceWithUserInput(QWidget *widgetParent, KoResourceSP resource, QString storageLocation="")
virtual void applyAlphaU8Mask(quint8 *pixels, const quint8 *alpha, qint32 nPixels) const =0
void setProperty(const QString &name, const QVariant &value)
static QString saveLocation(const QString &type, const QString &suffix=QString(), bool create=true)
QString saveLocation()
Returns path where to save user defined and imported resources to.
QSharedPointer< KisBrush > KisBrushSP
virtual KisPaintDeviceSP projection() const =0
QList< KisNodeSP > childNodes(const QStringList &nodeTypes, const KoProperties &properties) const
KisPixelSelectionSP projection() const
QRect selectedExactRect() const
Slow, but exact way of determining the rectangle that encloses the selection.