Krita Source Code Documentation
Loading...
Searching...
No Matches
KisReferenceImage::Private Struct Reference
+ Inheritance diagram for KisReferenceImage::Private:

Public Member Functions

bool loadFromFile ()
 
bool loadFromQImage (const QImage &img)
 
void updateCache ()
 

Public Attributes

QImage cachedImage
 
bool embed {true}
 
QString externalFilename
 
int id {-1}
 
QImage image
 
QString internalFilename
 
KisQImagePyramid mipmap
 
qreal saturation {1.0}
 

Detailed Description

Definition at line 37 of file KisReferenceImage.cpp.

Member Function Documentation

◆ loadFromFile()

bool KisReferenceImage::Private::loadFromFile ( )
inline

Definition at line 53 of file KisReferenceImage.cpp.

53 {
56 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(QFileInfo(externalFilename).isReadable(), false);
57 {
58 QImageReader reader(externalFilename);
59 reader.setDecideFormatFromContent(true);
60 image = reader.read();
61
62 if (image.isNull()) {
63 reader.setAutoDetectImageFormat(true);
64 image = reader.read();
65 }
66
67 }
68
69 if (image.isNull()) {
71 }
72
73 if (image.isNull()) {
76 image = doc->image()->convertToQImage(doc->image()->bounds(), 0);
77 }
79 }
80
81 // See https://bugs.kde.org/show_bug.cgi?id=416515 -- a jpeg image
82 // loaded into a qimage cannot be saved to png unless we explicitly
83 // convert the colorspace of the QImage
84 image.convertToColorSpace(QColorSpace(QColorSpace::SRgb));
85
86 return (!image.isNull());
87 }
KisImageSP image
bool openPath(const QString &path, OpenFlags flags=None)
openPath Open a Path
QImage convertToQImage(qint32 x1, qint32 y1, qint32 width, qint32 height, const KoColorProfile *profile)
QRect bounds() const override
static KisPart * instance()
Definition KisPart.cpp:131
void removeDocument(KisDocument *document, bool deleteDocument=true)
Definition KisPart.cpp:248
KisDocument * createTemporaryDocument() const
Definition KisPart.cpp:236
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129

References KisImage::bounds(), KisImage::convertToQImage(), KisPart::createTemporaryDocument(), KisDocument::DontAddToRecent, externalFilename, KisDocument::image, image, KisPart::instance(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, KisDocument::openPath(), and KisPart::removeDocument().

◆ loadFromQImage()

bool KisReferenceImage::Private::loadFromQImage ( const QImage & img)
inline

Definition at line 89 of file KisReferenceImage.cpp.

89 {
90 image = img;
91 return !image.isNull();
92 }

References image.

◆ updateCache()

void KisReferenceImage::Private::updateCache ( )
inline

Definition at line 94 of file KisReferenceImage.cpp.

94 {
95 if (saturation < 1.0) {
97
98 if (saturation > 0.0) {
99 QPainter gc2(&cachedImage);
100 gc2.setOpacity(saturation);
101 gc2.drawImage(QPoint(), image);
102 }
103 } else {
105 }
106
108 }
QImage convertQImageToGrayA(const QImage &image)

References cachedImage, KritaUtils::convertQImageToGrayA(), image, mipmap, and saturation.

Member Data Documentation

◆ cachedImage

QImage KisReferenceImage::Private::cachedImage

Definition at line 46 of file KisReferenceImage.cpp.

◆ embed

bool KisReferenceImage::Private::embed {true}

Definition at line 51 of file KisReferenceImage.cpp.

51{true};

◆ externalFilename

QString KisReferenceImage::Private::externalFilename

Definition at line 43 of file KisReferenceImage.cpp.

◆ id

int KisReferenceImage::Private::id {-1}

Definition at line 50 of file KisReferenceImage.cpp.

50{-1};

◆ image

QImage KisReferenceImage::Private::image

Definition at line 45 of file KisReferenceImage.cpp.

◆ internalFilename

QString KisReferenceImage::Private::internalFilename

Definition at line 40 of file KisReferenceImage.cpp.

◆ mipmap

KisQImagePyramid KisReferenceImage::Private::mipmap

Definition at line 47 of file KisReferenceImage.cpp.

◆ saturation

qreal KisReferenceImage::Private::saturation {1.0}

Definition at line 49 of file KisReferenceImage.cpp.

49{1.0};

The documentation for this struct was generated from the following file: