18#include <QDialogButtonBox>
20#include <kstandardguiitem.h>
65 setWindowTitle(caption);
67 QVBoxLayout* layout =
new QVBoxLayout();
68 QHBoxLayout* hLayout =
new QHBoxLayout();
72 m_preview->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
74 m_preview->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
79 QLabel* sourceLabel =
new QLabel(i18nc(
"@label:listbox image source",
"Source:"));
80 hLayout->addWidget(sourceLabel);
82 QComboBox* sourceBox =
new QComboBox();
83 sourceBox->addItem(i18nc(
"@item:inlistbox",
"Image"),
Source::Image);
85 hLayout->addWidget(sourceBox);
87 QPushButton* reloadButton =
new QPushButton(i18nc(
"@action:button reload image",
"Reload"));
88 hLayout->addWidget(reloadButton);
90 layout->addLayout(hLayout);
92 const QString mimetype =
"image/x-gimp-brush";
95 m_brushWidget = filter->createConfigurationWidget(0, 0, mimetype.toLatin1());
98 const QString animMimetype =
"image/x-gimp-brush-animated";
101 m_animBrushWidget = animFilter->createConfigurationWidget(0, 0, animMimetype.toLatin1());
109 m_buttonBox =
new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
110 KGuiItem::assign(
m_buttonBox->button(QDialogButtonBox::Save), KStandardGuiItem::save());
111 KGuiItem::assign(
m_buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
113 connect(
m_buttonBox, SIGNAL(accepted()),
this, SLOT(accept()));
114 connect(
m_buttonBox, SIGNAL(rejected()),
this, SLOT(reject()));
119 connect(reloadButton, SIGNAL(clicked()),
this, SLOT(
slotReload()));
165 return QStandardPaths::writableLocation(QStandardPaths::TempLocation) +
"/" + name.split(
" ").join(
"_") + suffix;
171 if (!mainWin) {
return nullptr; }
173 if (!viewManager) {
return nullptr; }
177 return viewManager->
image();
241 static_cast<KisGbrBrush*
>(brush.data())->makeMaskImage(preserveAlpha);
246 brushImage = brush->brushTipImage();
249 if (brushImage.isNull()) {
250 m_preview->setText(i18nc(
"@info empty image",
"Empty"));
253 brushImage = brushImage.scaled(w, w, Qt::KeepAspectRatio);
254 m_preview->setPixmap(QPixmap::fromImage(brushImage));
272 if (!needsUpdate) {
return; }
276 if (QFileInfo(exportFilename).exists()) {
277 m_buttonBox->button(QDialogButtonBox::Save)->setText(i18nc(
"@action:button",
"Overwrite"));
279 m_buttonBox->button(QDialogButtonBox::Save)->setText(i18nc(
"@action:button",
"Save"));
354 for (qint32 y = r.top(); y <= r.bottom(); ++y) {
357 }
while (pixelIt->nextPixel() && maskIt->
nextPixel());
376 KisImageReadOnlyBarrierLock lock(image);
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
QList< QString > QStringList
const QString KEY_BRUSH_STYLE
const QString KEY_PRESERVE_ALPHA
const quint8 OPACITY_OPAQUE_U8
virtual const quint8 * oldRawData() const =0
virtual bool nextPixel()=0
static KisBrushServerProvider * instance()
KoResourceServer< KisBrush > * brushServer()
static KisClipboard * instance()
void setFileBatchMode(const bool batchMode)
bool exportDocumentSync(const QString &path, const QByteArray &mimeType, KisPropertiesConfigurationSP exportConfiguration=0)
void setCurrentImage(KisImageSP image, bool forceInitialUpdate=true, KisNodeSP preActivatedNode=nullptr)
const KoColorSpace * colorSpace() const
void barrierLock(bool readOnly=false)
Wait until all the queued background jobs are completed and lock the image.
KisPaintDeviceSP projection() const
KisSelectionSP globalSelection() const
static KisImportExportFilter * filterForMimeType(const QString &mimetype, Direction direction)
filterForMimeType loads the relevant import/export plugin and returns it. The caller is responsible f...
KisViewManager * viewManager
void crop(qint32 x, qint32 y, qint32 w, qint32 h)
QRect exactBounds() const
KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w)
const KoColorSpace * colorSpace() const
static KisPart * instance()
KisMainWindow * currentMainwindow() const
KisDocument * createTemporaryDocument() const
static KoResourceSP importResourceFileWithUserInput(QWidget *widgetParent, QString storageLocation, QString resourceType, QString resourceFilepath)
KisImageWSP image() const
Return the image this view is displaying.
virtual void applyAlphaU8Mask(quint8 *pixels, const quint8 *alpha, qint32 nPixels) const =0
void setProperty(const QString &name, const QVariant &value)
QString saveLocation()
Returns path where to save user defined and imported resources to.
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
QSharedPointer< KisBrush > KisBrushSP
virtual KisPaintDeviceSP projection() const =0
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
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.