Krita
7 #include <kis_file_layer.h>
12 FileLayer::FileLayer(KisImageSP image,
const QString name,
const QString baseName,
const QString fileName,
14 :
Node(image, new KisFileLayer(image,
name, OPACITY_OPAQUE_U8), parent)
16 KisFileLayer *file =
dynamic_cast<KisFileLayer*
>(this->node().data());
18 KisFileLayer::ScalingMethod sm = KisFileLayer::None;
19 if (scalingMethod==
"ToImageSize") {
20 sm= KisFileLayer::ToImageSize;
21 }
else if (scalingMethod==
"ToImagePPI") {
22 sm= KisFileLayer::ToImagePPI;
24 file->setScalingMethod(sm);
25 file->setScalingFilter(scalingFilter);
29 file->setFileName(basePath, getFileNameFromAbsolute(basePath, absoluteFilePath));
32 FileLayer::FileLayer(KisFileLayerSP layer,
QObject *parent)
33 :
Node(layer->image(), layer, parent)
38 FileLayer::~FileLayer()
50 KisFileLayer *file =
dynamic_cast<KisFileLayer*
>(this->node().data());
52 KisFileLayer::ScalingMethod sm = KisFileLayer::None;
54 sm= KisFileLayer::ToImageSize;
56 sm= KisFileLayer::ToImagePPI;
58 file->setScalingMethod(sm);
63 file->setFileName(basePath, getFileNameFromAbsolute(basePath, absoluteFilePath));
68 KisFileLayer *file =
dynamic_cast<KisFileLayer*
>(this->node().data());
69 KIS_ASSERT_RECOVER_RETURN(file);
75 const KisFileLayer *file = qobject_cast<const KisFileLayer*>(this->node());
82 const KisFileLayer *file = qobject_cast<const KisFileLayer*>(this->node());
83 KIS_ASSERT_RECOVER_RETURN_VALUE(file,
"None");
84 KisFileLayer::ScalingMethod sm = file->scalingMethod();
87 if (sm==KisFileLayer::ToImageSize) {
88 method =
"ToImageSize";
89 }
else if (sm==KisFileLayer::ToImagePPI) {
90 method =
"ToImagePPI";
97 const KisFileLayer *file = qobject_cast<const KisFileLayer*>(this->node());
98 KIS_ASSERT_RECOVER_RETURN_VALUE(file,
"Bicubic");
99 return file->scalingFilter();
104 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(
QFileInfo(filePath).isAbsolute(), filePath);
109 if (fi.isSymLink()) {
110 filePath = fi.symLinkTarget();
115 QDir directory(basePath);
116 filePath = directory.relativeFilePath(filePath);
void setProperties(QString fileName, QString scalingMethod=QString("None"), QString scalingFilter=QString("Bicubic"))
setProperties Change the properties of the file layer.
QString scalingMethod() const
scalingMethod returns how the file referenced is scaled.
QString type() const override
type Krita has several types of nodes, split in layers and masks.
QString absoluteFilePath() const const
bool isEmpty() const const
QString absolutePath() const const
QString toLower() const const
Node represents a layer or mask in a Krita image's Node hierarchy.
QString scalingFilter() const
scalingFilter returns the filter with which the file referenced is scaled.
QString name(StandardShortcut id)
void resetCache()
makes the file layer to reload the connected image from disk
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jun 4 2023 04:07:11 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.