|
Krita Source Code Documentation
|
The KisFileLayer class loads a particular file as a layer into the layer stack. More...
#include <kis_file_layer.h>
Inheritance diagram for KisFileLayer:Public Types | |
| enum | ScalingMethod { None , ToImageSize , ToImagePPI } |
Public Types inherited from KisNode | |
| enum | PositionToFilthy { N_ABOVE_FILTHY = 0x08 , N_FILTHY_PROJECTION = 0x20 , N_FILTHY = 0x40 , N_BELOW_FILTHY = 0x80 } |
Public Types inherited from KisBaseNode | |
| typedef QList< Property > | PropertyList |
Signals | |
| void | sigRequestOpenFile () |
Signals inherited from KisNode | |
| void | sigNodeChangedInternal () |
Signals inherited from KisBaseNode | |
| void | keyframeChannelAdded (KisKeyframeChannel *channel) |
| void | opacityChanged (quint8 value) |
Private Types | |
| enum | State { FileLoaded , FileNotFound , FileLoadingFailed } |
Private Slots | |
| void | openFile () const |
| void | slotFileExistsStateChanged (bool exists) |
| void | slotImageResolutionChanged () |
| void | slotImageSizeChanged () |
| void | slotLoadingFailed () |
| void | slotLoadingFinished (KisPaintDeviceSP projection, qreal xRes, qreal yRes, const QSize &size) |
Private Member Functions | |
| void | changeState (State newState) |
Private Attributes | |
| QString | m_basePath |
| QString | m_filename |
| QSize | m_generatedForImageSize |
| qreal | m_generatedForXRes = 0.0 |
| qreal | m_generatedForYRes = 0.0 |
| KisSignalAutoConnectionsStore | m_imageConnections |
| KisSafeDocumentLoader | m_loader |
| KisPaintDeviceSP | m_paintDevice |
| QString | m_scalingFilter |
| ScalingMethod | m_scalingMethod {None} |
| State | m_state = FileNotFound |
The KisFileLayer class loads a particular file as a layer into the layer stack.
Definition at line 18 of file kis_file_layer.h.
| Enumerator | |
|---|---|
| None | |
| ToImageSize | |
| ToImagePPI | |
Definition at line 23 of file kis_file_layer.h.
|
private |
| Enumerator | |
|---|---|
| FileLoaded | |
| FileNotFound | |
| FileLoadingFailed | |
Definition at line 92 of file kis_file_layer.h.
| KisFileLayer::KisFileLayer | ( | KisImageWSP | image, |
| const QString & | name, | ||
| quint8 | opacity ) |
Set default paint device for a layer. It will be used in case the file does not exist anymore. Or course, this can happen only in the failing execution path.
Definition at line 25 of file kis_file_layer.cpp.
References KisImage::colorSpace(), connect(), KisBaseNode::image, m_loader, m_paintDevice, openFile(), KisPaintDevice::setDefaultBounds(), sigRequestOpenFile(), slotFileExistsStateChanged(), slotLoadingFailed(), and slotLoadingFinished().
| KisFileLayer::KisFileLayer | ( | KisImageWSP | image, |
| const QString & | basePath, | ||
| const QString & | filename, | ||
| ScalingMethod | scalingMethod, | ||
| QString | scalingFilter, | ||
| const QString & | name, | ||
| quint8 | opacity, | ||
| const KoColorSpace * | fallbackColorSpace = 0 ) |
KisFileLayer create a new file layer with the given file.
| image | the image the file layer will belong to |
| basePath | the path to the image, if it has been saved before. |
| filename | the path to the file, relative to the basePath |
| scalingMethod |
| scalingFilter | the ID of the KisFilterStrategy to be used if scaling |
| name | the name of the layer |
| opacity | the opacity of the layer |
Set default paint device for a layer. It will be used in case the file does not exist anymore. Or course, this can happen only in the failing execution path.
Definition at line 42 of file kis_file_layer.cpp.
References KisImage::colorSpace(), connect(), KisBaseNode::image, m_loader, m_paintDevice, openFile(), path(), KisSafeDocumentLoader::reloadImage(), KisPaintDevice::setDefaultBounds(), KisSafeDocumentLoader::setPath(), sigRequestOpenFile(), slotFileExistsStateChanged(), slotLoadingFailed(), and slotLoadingFinished().
|
override |
Definition at line 69 of file kis_file_layer.cpp.
| KisFileLayer::KisFileLayer | ( | const KisFileLayer & | rhs | ) |
Definition at line 73 of file kis_file_layer.cpp.
References connect(), m_basePath, m_filename, m_generatedForImageSize, m_generatedForXRes, m_generatedForYRes, m_loader, m_paintDevice, m_scalingFilter, m_scalingMethod, m_state, openFile(), path(), KisSafeDocumentLoader::setPath(), sigRequestOpenFile(), and slotLoadingFinished().
|
overridevirtual |
Accept the KisNodeVisitor (for the Visitor design pattern), should call the correct function on the KisNodeVisitor for this node type, so you need to override it for all leaf classes in the node inheritance hierarchy.
return false if the visitor could not successfully act on this node instance.
Reimplemented from KisBaseNode.
Definition at line 335 of file kis_file_layer.cpp.
References KisNodeVisitor::visit().
|
overridevirtual |
Accept the KisNodeVisitor (for the Visitor design pattern), should call the correct function on the KisProcessingVisitor for this node type, so you need to override it for all leaf classes in the node inheritance hierarchy.
The processing visitor differs from node visitor in the way that it accepts undo adapter, that allows the processing to be multithreaded
Reimplemented from KisBaseNode.
Definition at line 340 of file kis_file_layer.cpp.
References KisProcessingVisitor::visit().
|
overridevirtual |
Re-implement this method to add constraints for the subclasses that can be added as children to this node
Implements KisNode.
Definition at line 330 of file kis_file_layer.cpp.
Definition at line 230 of file kis_file_layer.cpp.
References KisNode::baseNodeChangedCallback(), and m_state.
|
overridevirtual |
Implements KisNode.
Definition at line 325 of file kis_file_layer.cpp.
References KisFileLayer().
|
overridevirtual |
Reimplemented from KisExternalLayer.
Definition at line 345 of file kis_file_layer.cpp.
References KisLayer::x(), and KisLayer::y().
| QString KisFileLayer::fileName | ( | ) | const |
Definition at line 165 of file kis_file_layer.cpp.
References m_filename.
|
overridevirtual |
Reimplemented from KisExternalLayer.
Definition at line 93 of file kis_file_layer.cpp.
References KisIconUtils::loadIcon().
|
privateslot |
Definition at line 184 of file kis_file_layer.cpp.
References ENTER_FUNCTION, KisPart::instance(), KIS_ASSERT_RECOVER_NOOP, KIS_SAFE_ASSERT_RECOVER_NOOP, m_filename, KisPart::openExistingFile(), path(), KisDocument::path(), and ppVar.
|
overridevirtual |
Return the layer data before the effect masks have had their go at it.
Implements KisLayer.
Definition at line 104 of file kis_file_layer.cpp.
References m_paintDevice.
|
overridevirtual |
Return the paintdevice you can use to change pixels on. For a paint layer these will be paint pixels, for an adjustment layer or a mask the selection paint device.
Implements KisBaseNode.
Definition at line 109 of file kis_file_layer.cpp.
| QString KisFileLayer::path | ( | ) | const |
Definition at line 170 of file kis_file_layer.cpp.
References m_basePath, and m_filename.
|
overridevirtual |
Reimplemented from KisExternalLayer.
Definition at line 98 of file kis_file_layer.cpp.
References KisLayer::colorSpace(), m_loader, and KisSafeDocumentLoader::reloadImage().
| QString KisFileLayer::scalingFilter | ( | ) | const |
Definition at line 249 of file kis_file_layer.cpp.
References m_scalingFilter.
| KisFileLayer::ScalingMethod KisFileLayer::scalingMethod | ( | ) | const |
Definition at line 239 of file kis_file_layer.cpp.
References m_scalingMethod.
|
overridevirtual |
Return a the properties of this base node (locked, visible etc, with the right icons for their representation and their state.
Subclasses can extend this list with new properties, like opacity for layers or visualized for masks.
The order of properties is, unfortunately, for now, important, so take care which properties superclasses of your class define.
KisBaseNode defines visible = 0, locked = 1 KisLayer defines opacity = 2, compositeOp = 3 KisMask defines active = 2 (KisMask does not inherit kislayer)
Reimplemented from KisBaseNode.
Definition at line 126 of file kis_file_layer.cpp.
References KisImage::colorSpace(), KisPaintDevice::colorSpace(), FileLoadingFailed, FileNotFound, KisLayerPropertiesIcons::getColorSpaceMismatchProperty(), KisLayerPropertiesIcons::getErrorProperty(), KisLayerPropertiesIcons::getProperty(), KisBaseNode::image, m_filename, m_paintDevice, m_state, KisLayerPropertiesIcons::openFileLayerFile, and KisLayer::sectionModelProperties().
| void KisFileLayer::setFileName | ( | const QString & | basePath, |
| const QString & | filename ) |
setFileName replace the existing file with a new one
| basePath | the path to the image, if it has been saved before. |
| filename | the path to the file, relative to the basePath |
Definition at line 154 of file kis_file_layer.cpp.
References m_basePath, m_filename, m_loader, path(), KisSafeDocumentLoader::reloadImage(), and KisSafeDocumentLoader::setPath().
|
overridevirtual |
Reimplemented from KisBaseNode.
Definition at line 382 of file kis_file_layer.cpp.
References KisSignalAutoConnectionsStore::addUniqueConnection(), KisSignalAutoConnectionsStore::clear(), KisBaseNode::image, m_generatedForImageSize, m_generatedForXRes, m_generatedForYRes, m_imageConnections, m_loader, m_paintDevice, m_scalingMethod, None, qFuzzyCompare(), KisSafeDocumentLoader::reloadImage(), KisPaintDevice::setDefaultBounds(), KisBaseNode::setImage(), KisImage::size(), slotImageResolutionChanged(), slotImageSizeChanged(), ToImagePPI, ToImageSize, KisImage::xRes(), and KisImage::yRes().
| void KisFileLayer::setScalingFilter | ( | QString | method | ) |
Definition at line 254 of file kis_file_layer.cpp.
References m_scalingFilter.
| void KisFileLayer::setScalingMethod | ( | ScalingMethod | method | ) |
Definition at line 244 of file kis_file_layer.cpp.
References m_scalingMethod.
|
overridevirtual |
Change the section model properties.
Reimplemented from KisBaseNode.
Definition at line 114 of file kis_file_layer.cpp.
References KoID::id(), KisBaseNode::Property::id, KisLayerPropertiesIcons::openFileLayerFile, KisBaseNode::properties, KisBaseNode::setSectionModelProperties(), sigRequestOpenFile(), and KisBaseNode::Property::state.
|
signal |
|
privateslot |
Definition at line 320 of file kis_file_layer.cpp.
References changeState(), FileLoaded, and FileNotFound.
|
privateslot |
Definition at line 359 of file kis_file_layer.cpp.
References KisBaseNode::image, m_generatedForXRes, m_generatedForYRes, m_loader, m_scalingMethod, qFuzzyCompare(), KisSafeDocumentLoader::reloadImage(), ToImagePPI, KisImage::xRes(), and KisImage::yRes().
|
privateslot |
Definition at line 372 of file kis_file_layer.cpp.
References KisBaseNode::image, m_generatedForImageSize, m_loader, m_scalingMethod, KisSafeDocumentLoader::reloadImage(), KisImage::size(), and ToImageSize.
|
privateslot |
Definition at line 315 of file kis_file_layer.cpp.
References changeState(), and FileLoadingFailed.
|
privateslot |
This method can be transitively called from KisFileLayer::setImage(), which, in turn, can be called from the KisImage's copy-ctor. The shared pointer is, obviously, not initialized during construction, therefore upgrading our constructor to a strong pointer will cause a crash.
Therefore, we use a weak pointer here. It is extremely dangerous, but since this method is usually called from the GUI thread synchronously it should be "somewhat safe".
Definition at line 259 of file kis_file_layer.cpp.
References changeState(), KisPaintDevice::extent(), FileLoaded, get(), KisBaseNode::image, KisFilterStrategyRegistry::instance(), m_generatedForImageSize, m_generatedForXRes, m_generatedForYRes, m_paintDevice, m_scalingFilter, m_scalingMethod, KisPaintDevice::makeCloneFrom(), KisLayer::projection(), qFuzzyCompare(), KisTransformWorker::run(), KisPaintDevice::setDefaultBounds(), KisNode::setDirty(), KisPaintDevice::setX(), KisPaintDevice::setY(), KisImage::size(), ToImagePPI, ToImageSize, KisLayer::x(), KisImage::xRes(), KisLayer::y(), and KisImage::yRes().
|
overridevirtual |
Reimplemented from KisExternalLayer.
Definition at line 353 of file kis_file_layer.cpp.
References KisBaseNode::name(), and warnKrita.
|
private |
Definition at line 101 of file kis_file_layer.h.
|
private |
Definition at line 102 of file kis_file_layer.h.
|
private |
Definition at line 108 of file kis_file_layer.h.
|
private |
Definition at line 109 of file kis_file_layer.h.
|
private |
Definition at line 110 of file kis_file_layer.h.
|
private |
Definition at line 114 of file kis_file_layer.h.
|
private |
Definition at line 107 of file kis_file_layer.h.
|
private |
Definition at line 106 of file kis_file_layer.h.
|
private |
Definition at line 104 of file kis_file_layer.h.
|
private |
Definition at line 103 of file kis_file_layer.h.
|
private |
Definition at line 112 of file kis_file_layer.h.