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 38 of file KisReferenceImage.cpp.

Member Function Documentation

◆ loadFromFile()

bool KisReferenceImage::Private::loadFromFile ( )
inline

Definition at line 54 of file KisReferenceImage.cpp.

54 {
57 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(QFileInfo(externalFilename).isReadable(), false);
58 {
59 QImageReader reader(externalFilename);
60 reader.setDecideFormatFromContent(true);
61 image = reader.read();
62
63 if (image.isNull()) {
64 reader.setAutoDetectImageFormat(true);
65 image = reader.read();
66 }
67
68 }
69
70 if (image.isNull()) {
72 }
73
74 if (image.isNull()) {
77 image = doc->image()->convertToQImage(doc->image()->bounds(), 0);
78 }
80 }
81
82 // See https://bugs.kde.org/show_bug.cgi?id=416515 -- a jpeg image
83 // loaded into a qimage cannot be saved to png unless we explicitly
84 // convert the colorspace of the QImage
85 image.convertToColorSpace(QColorSpace(QColorSpace::SRgb));
86
87 return (!image.isNull());
88 }
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 90 of file KisReferenceImage.cpp.

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

References image.

◆ updateCache()

void KisReferenceImage::Private::updateCache ( )
inline

Definition at line 95 of file KisReferenceImage.cpp.

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

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

Member Data Documentation

◆ cachedImage

QImage KisReferenceImage::Private::cachedImage

Definition at line 47 of file KisReferenceImage.cpp.

◆ embed

bool KisReferenceImage::Private::embed {true}

Definition at line 52 of file KisReferenceImage.cpp.

52{true};

◆ externalFilename

QString KisReferenceImage::Private::externalFilename

Definition at line 44 of file KisReferenceImage.cpp.

◆ id

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

Definition at line 51 of file KisReferenceImage.cpp.

51{-1};

◆ image

QImage KisReferenceImage::Private::image

Definition at line 46 of file KisReferenceImage.cpp.

◆ internalFilename

QString KisReferenceImage::Private::internalFilename

Definition at line 41 of file KisReferenceImage.cpp.

◆ mipmap

KisQImagePyramid KisReferenceImage::Private::mipmap

Definition at line 48 of file KisReferenceImage.cpp.

◆ saturation

qreal KisReferenceImage::Private::saturation {1.0}

Definition at line 50 of file KisReferenceImage.cpp.

50{1.0};

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